KConfigSkeleton and writing defaults..

Aaron J. Seigo aseigo at kde.org
Thu Sep 18 05:38:41 BST 2008


in the KConfigSkeletonItem class's writeConfig methods, there is this code:

    if ((mDefault == mReference) && !cg.hasDefault( mKey))
       cg.revertToDefault( mKey );

this doesn't seem to make much sense to me because KConfigGroup::hasDefault 
returns false only if there is no default ... so revertToDefault when 
!hasDefault is the same as setting the item to nothing.

this causes problems when using KConfigSkeleton to cary information about 
configuration objects as when mDefault == mReference and there is no default 
(usually the case) you end up with nothing, even if !mDefault.isNull() ...

does anybody know the reason for the strange construct above?
or does anybody know if it is safe to change it to the following?

    if ((mDefault == mReference) && cg.hasDefault( mKey))
       cg.revertToDefault( mKey );

this fixes a bug in Plasma::Service, so it's not theoretical .. i don't 
understand what this change might break, however, so i'm asking =)

Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080917/3338123e/attachment.sig>

More information about the kde-core-devel mailing list