[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: kconfiggroup and unhandled types
From:       "Thomas Braxton" <kde.braxton () gmail ! com>
Date:       2007-10-29 8:59:32
Message-ID: 928c3f1b0710290159y197dad00yb9c2f0a0a1e645c2 () mail ! gmail ! com
[Download RAW message or body]

On 10/29/07, Thiago Macieira <thiago@kde.org> wrote:
>
> Em Monday 29 October 2007 05:20:34 Aaron J. Seigo escreveu:
> > were there specific reasons for using kFatal that warrant keeping it
> that
> > way?
>
> I agree that kWarning is probably better.
>
> If you're debugging your code and you want to fix your warnings, do this:
>
>         export QT_FATAL_WARNINGS=1
>
> This will generate core dumps when a warning is triggered. The same
> behaviour
> as a kFatal, that is.


I didn't know about that. So, how about this patch?

Index: kconfiggroup.cpp
===================================================================
--- kconfiggroup.cpp (revision 730534)
+++ kconfiggroup.cpp (working copy)
@@ -346,7 +346,7 @@
         }
         case QVariant::Color:
         case QVariant::Font:
-            kFatal() << "KConfigGroup::readEntry was passed GUI type '"
+            kWarning() << "KConfigGroup::readEntry was passed GUI type '"
                     << aDefault.typeName()
                     << "' but kdeui isn't linked! If it is linked to your
program, "
                     "this is a platform bug. Please inform the KDE
developers" << endl;
@@ -362,7 +362,7 @@
             break;
     }

-    kFatal() << "unhandled type " << aDefault.typeName();
+    kWarning() << "unhandled type " << aDefault.typeName();
     return QVariant();
 }

@@ -1103,7 +1103,7 @@

         case QVariant::Color:
         case QVariant::Font:
-            kFatal() << "KConfigGroup::writeEntry was passed GUI type '"
+            kWarning() << "KConfigGroup::writeEntry was passed GUI type '"
                      << value.typeName()
                      << "' but kdeui isn't linked! If it is linked to your
program, this is a platform bug. "
                         "Please inform the KDE developers" << endl;
@@ -1116,7 +1116,7 @@
                 data = qvariant_cast<KUrl>(value).url().toUtf8();
                 break;
             }
-            kFatal() << "KConfigGroup::writeEntry - unhandled type" <<
value.typeName() << "in group" << name();
+            kWarning() << "KConfigGroup::writeEntry - unhandled type" <<
value.typeName() << "in group" << name();
         }

     writeEntry(key, data, flags);

[Attachment #3 (text/html)]

<br><br><div><span class="gmail_quote">On 10/29/07, <b \
class="gmail_sendername">Thiago Macieira</b> &lt;<a \
href="mailto:thiago@kde.org">thiago@kde.org</a>&gt; wrote:</span><blockquote \
class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Em Monday 29 October 2007 05:20:34 Aaron J. Seigo \
escreveu:<br>&gt; were there specific reasons for using kFatal that warrant keeping \
it that<br>&gt; way?<br><br>I agree that kWarning is probably better.<br><br>If \
you&#39;re debugging your code and you want to fix your warnings, do this: \
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;export \
QT_FATAL_WARNINGS=1<br><br>This will generate core dumps when a warning is triggered. \
The same behaviour<br>as a kFatal, that is.</blockquote><div><br \
class="webkit-block-placeholder"></div><div>I didn&#39;t know about that. So, how \
about this patch? </div><div><br \
class="webkit-block-placeholder"></div><div><div>Index: \
kconfiggroup.cpp</div><div>===================================================================</div><div>--- \
kconfiggroup.cpp<span class="Apple-tab-span" style="white-space:pre">  \
</span>(revision 730534)</div><div>+++ kconfiggroup.cpp<span class="Apple-tab-span" \
style="white-space:pre">	</span>(working copy)</div><div>@@ -346,7 +346,7 \
@@</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp;&nbsp; &nbsp; &nbsp; \
&nbsp; case QVariant::Color: </div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case \
QVariant::Font:</div><div>- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kFatal() \
&lt;&lt; &quot;KConfigGroup::readEntry was passed GUI type &#39;&quot;</div><div>+ \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kWarning() &lt;&lt; \
&quot;KConfigGroup::readEntry was passed GUI type &#39;&quot; </div><div>&nbsp;&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; \
aDefault.typeName()</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &lt;&lt; &quot;&#39; but kdeui isn&#39;t linked! If it is linked \
to your program, &quot;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &quot;this is a platform bug. Please inform the KDE \
developers&quot; &lt;&lt; endl; </div><div>@@ -362,7 +362,7 @@</div><div>&nbsp;&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</div><div>&nbsp;&nbsp; &nbsp; \
}</div><div>&nbsp;</div><div>- &nbsp; &nbsp;kFatal() &lt;&lt; &quot;unhandled type \
&quot; &lt;&lt; aDefault.typeName();</div><div>+ &nbsp; &nbsp;kWarning() &lt;&lt; \
&quot;unhandled type &quot; &lt;&lt;  aDefault.typeName();</div><div>&nbsp;&nbsp; \
&nbsp; return QVariant();</div><div>&nbsp;}</div><div>&nbsp;</div><div>@@ -1103,7 \
+1103,7 @@</div><div>&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case \
QVariant::Color:</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case \
QVariant::Font:</div><div>- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kFatal() \
&lt;&lt; &quot;KConfigGroup::writeEntry was passed GUI type &#39;&quot; </div><div>+ \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kWarning() &lt;&lt; \
&quot;KConfigGroup::writeEntry was passed GUI type &#39;&quot;</div><div>&nbsp;&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; \
value.typeName()</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; &quot;&#39; but kdeui isn&#39;t linked! If it is \
linked to your program, this is a platform bug. &quot; </div><div>&nbsp;&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Please \
inform the KDE developers&quot; &lt;&lt; endl;</div><div>@@ -1116,7 +1116,7 \
@@</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data = \
qvariant_cast&lt;KUrl&gt;(value).url().toUtf8();</div><div> &nbsp;&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; }</div><div>- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kFatal() \
&lt;&lt; &quot;KConfigGroup::writeEntry - unhandled type&quot; &lt;&lt; \
value.typeName() &lt;&lt; &quot;in group&quot; &lt;&lt; name();</div> <div>+ &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kWarning() &lt;&lt; &quot;KConfigGroup::writeEntry \
- unhandled type&quot; &lt;&lt; value.typeName() &lt;&lt; &quot;in group&quot; \
&lt;&lt; name();</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; \
}</div><div>&nbsp;</div><div>&nbsp;&nbsp; &nbsp; writeEntry(key, data, flags); \
</div><br>&nbsp;</div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic