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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/config
From:       Michael Jansen <kde () michael-jansen ! biz>
Date:       2009-02-28 20:33:19
Message-ID: 1235853199.504866.18830.nullmailer () svn ! kde ! org
[Download RAW message or body]

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


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

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