From kde-commits Sat Feb 28 20:33:19 2009 From: Michael Jansen Date: Sat, 28 Feb 2009 20:33:19 +0000 To: kde-commits Subject: KDE/kdelibs/kdecore/config Message-Id: <1235853199.504866.18830.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123585320726469 SVN commit 933397 by mjansen: Implement a improvement for group.exists() returning false for groups without content (see kconfigtest). This change only solves my current problem. The real solution is much more complicated. M +12 -1 kconfig.cpp --- trunk/KDE/kdelibs/kdecore/config/kconfig.cpp #933396:933397 @@ -684,7 +684,18 @@ bool KConfig::hasGroupImpl(const QByteArray& aGroup) const { Q_D(const KConfig); - return d->entryMap.hasEntry(aGroup); + + if (d->entryMap.hasEntry(aGroup)) return true; + + QByteArray subGroupMarker = aGroup + '\x1d'; + // Because this group could have only subgroups but no entries we have to + // search for group markers + for (KEntryMap::ConstIterator entryMapIt( d->entryMap.constBegin() ); entryMapIt != d->entryMap.constEnd(); ++entryMapIt) { + if (entryMapIt.key().mGroup.startsWith(subGroupMarker)) { + return true; + } + } + return false; } bool KConfigPrivate::canWriteEntry(const QByteArray& group, const char* key, bool isDefault) const