[PATCH] KConfig code cleanups

Oswald Buddenhagen ossi at kde.org
Sun Oct 28 08:53:43 GMT 2007


please teach your mailer to attach patches as text not binary.

On Sat, Oct 27, 2007 at 05:07:10PM -0500, Thomas Braxton wrote:
> 1) do we want to support an empty group name? We've never supported it
> before, and I really don't see a use for it, but it shouldn't be too hard to
> add support for.
> 1a) If we do, do we want to support empty sub-group names?
> 2) this one depends on #1, should the name of the default group be exposed?
> It's really just an implementation detail that I think should never be
> returned to the user, unless we decide to support empty group names.
>
the concept of giving the root group a virtual name is bogus. it should
be a null string. we planned to eliminate this <default> madness - a
list of all(?) occurrences can be found here:
http://web.davidfaure.fr/kde/default.list - wanna go ahead with it?
this, btw, does not mean that the name of the root group is "" - the
root group simply has no name, but we need to address it somehow through
our tree-wise inferior api. consequently, subgroups cannot have empty
names, either.

> 3) should the translated entries from other locales be removed from the
> entryMap?
>
yes

> Index: kconfig.cpp
> ===================================================================
> --- kconfig.cpp	(revision 730036)
> +++ kconfig.cpp	(working copy)
> @@ -520,7 +520,9 @@
>  bool KConfig::isGroupImmutableImpl(const QByteArray& aGroup) const
>  {
>      Q_D(const KConfig);
> -    return isImmutable()|d->entryMap.getEntryOption(aGroup, 0, 0, KEntryMap::EntryImmutable);
> +    if (aGroup.isEmpty())
> +        return d->bFileImmutable;
> +    return d->bFileImmutable|d->entryMap.getEntryOption(aGroup, 0, 0, KEntryMap::EntryImmutable);
>  }
>  
this looks bogus. it should be possible to have an empty group with
an immutability marker. fix the entry map if it doesn't work.

> Index: kconfiggroup.cpp
> ===================================================================
> --- kconfiggroup.cpp	(revision 730036)
> +++ kconfiggroup.cpp	(working copy)
> @@ -1096,7 +1129,6 @@
>  {
>      writePathEntry(pKey.toUtf8(), path, pFlags);
>  }
> -
>  void KConfigGroup::writePathEntry(const char *pKey, const QString & path, WriteConfigFlags pFlags)
>  {
>      writePathEntry(QByteArray(pKey), path, pFlags);
>
not good. ;)

the rest seems ok to me.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.




More information about the kde-core-devel mailing list