KConfig:copyTo + Sync doesn't write to disk (test case)

Aaron J. Seigo aseigo at kde.org
Wed Apr 9 08:38:18 BST 2008


On Tuesday 08 April 2008, Oswald Buddenhagen wrote:
> On Tue, Apr 08, 2008 at 03:56:44AM -0600, Aaron J. Seigo wrote:
> > --- kconfig.cpp	(revision 792053)
> > +++ kconfig.cpp	(working copy)
> > @@ -114,11 +114,12 @@
> >  }
> >
> >  void KConfigPrivate::copyGroup(const QByteArray& source, const
> > QByteArray& destination, -                                KConfigGroup
> > *otherGroup) const +                                KConfigGroup
> > *otherGroup, KConfigBase::WriteConfigFlags flags) const {
> >      KEntryMap& otherMap = otherGroup->config()->d_ptr->entryMap;
> >      const int len = source.length();
> >      const bool sameName = (destination == source);
> > +    bool dirtied = false;
> >
> >      foreach (const KEntryKey& key, entryMap.keys()) {
> >          const QByteArray& group = key.mGroup;
> > @@ -138,7 +139,12 @@
> >          KEntry entry = entryMap[key];
> >          entry.bDirty = true;
> >          otherMap[newKey] = entry;
> > +        dirtied = true;
> >      }
> > +
> > +    if (dirtied && flags & KConfigBase::Persistent) {
> > +        otherGroup->config()->d_ptr->bDirty = true;
> > +    }
> >  }
>
> this logic makes no sense.

if we've actually added something to the other config and this write operation 
is supposed to be persistent, then we mark the config as dirty. there's no 
point in changing it otherwise.

i do see one issue i didn't catch in there though: entr.bDirty = true; should 
be conditional on KConfigBase::Persistent as well, as you noted in your 
email. will fix that.

> anyway, when you add the WriteConfigFlags param, you kinda promise to
> implement the other two flags as well ...

true.. i've added that as well now.. 

will commit the api fixes on monday.

-- 
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: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080409/344dabbd/attachment.sig>


More information about the kde-core-devel mailing list