diff options
-rw-r--r-- | autotests/kconfigtest.cpp | 8 | ||||
-rw-r--r-- | src/core/kconfig.cpp | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp index 95a87584..77d0ddde 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp @@ -806,19 +806,25 @@ void KConfigTest::testDelete() KConfigGroup delgr(&ct, "Nested Group 3"); QVERIFY(delgr.exists()); QVERIFY(ct.hasGroup("Nested Group 3")); + QVERIFY(ct.groupList().contains(QStringLiteral("Nested Group 3"))); delgr.deleteGroup(); QVERIFY(!delgr.exists()); QVERIFY(!ct.hasGroup("Nested Group 3")); - QVERIFY(ct.groupList().contains(QStringLiteral("Nested Group 3"))); + QVERIFY(!ct.groupList().contains(QStringLiteral("Nested Group 3"))); KConfigGroup ng(&ct, "Nested Group 2"); QVERIFY(sc.hasGroup("Complex Types")); + QVERIFY(sc.groupList().contains(QStringLiteral("Complex Types"))); QVERIFY(!sc.hasGroup("Does not exist")); + QVERIFY(ct.hasGroup("Nested Group 1")); + QVERIFY(ct.groupList().contains(QStringLiteral("Nested Group 1"))); sc.deleteGroup("Complex Types"); QCOMPARE(sc.group("Complex Types").keyList().count(), 0); QVERIFY(!sc.hasGroup("Complex Types")); // #192266 QVERIFY(!sc.group("Complex Types").exists()); + QVERIFY(!sc.groupList().contains(QStringLiteral("Complex Types"))); QVERIFY(!ct.hasGroup("Nested Group 1")); + QVERIFY(!ct.groupList().contains(QStringLiteral("Nested Group 1"))); QCOMPARE(ct.group("Nested Group 1").keyList().count(), 0); QCOMPARE(ct.group("Nested Group 2").keyList().count(), 0); diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index ed45d1dd..0b890132 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -281,7 +281,7 @@ QStringList KConfig::groupList() const for (auto entryMapIt = d->entryMap.cbegin(); entryMapIt != d->entryMap.cend(); ++entryMapIt) { const KEntryKey &key = entryMapIt.key(); const QByteArray &group = key.mGroup; - if (key.mKey.isNull() && !group.isEmpty() && group != "<default>" && group != "$Version") { + if (!key.mKey.isNull() && !entryMapIt->bDeleted && !group.isEmpty() && group != "<default>" && group != "$Version") { const QString groupname = QString::fromUtf8(group); groups << groupname.left(groupname.indexOf(QLatin1Char('\x1d'))); } @@ -297,7 +297,7 @@ QStringList KConfigPrivate::groupList(const QByteArray &group) const for (auto entryMapIt = entryMap.cbegin(); entryMapIt != entryMap.cend(); ++entryMapIt) { const KEntryKey &key = entryMapIt.key(); - if (key.mKey.isNull() && key.mGroup.startsWith(theGroup)) { + if (!key.mKey.isNull() && !entryMapIt->bDeleted && key.mGroup.startsWith(theGroup)) { const QString groupname = QString::fromUtf8(key.mGroup.mid(theGroup.length())); groups << groupname.left(groupname.indexOf(QLatin1Char('\x1d'))); } |