diff --git a/configxml.cpp b/configxml.cpp index eb302dd68..5e2d2700e 100644 --- a/configxml.cpp +++ b/configxml.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -193,7 +194,7 @@ class ConfigXmlPrivate QList sizes; QList ulonglongs; QList urllists; - QMap keysToNames; + QHash keysToNames; }; class ConfigXmlHandler : public QXmlDefaultHandler @@ -257,6 +258,7 @@ bool ConfigXmlHandler::startElement(const QString &namespaceURI, const QString & QString name = attrs.localName(i).toLower(); if (name == "name") { kDebug() << "set group to " << attrs.value(i); + d->keysToNames.insert(attrs.value(i), QString()); m_config->setCurrentGroup(attrs.value(i)); } } @@ -535,4 +537,9 @@ KConfigSkeletonItem* ConfigXml::findItem(const QString &group, const QString &ke return KConfigSkeleton::findItem(d->keysToNames[group + key]); } +bool ConfigXml::hasGroup(const QString &group) const +{ + return d->keysToNames.contains(group); +} + } // Plasma namespace diff --git a/configxml.h b/configxml.h index 077395f88..97d2078d4 100644 --- a/configxml.h +++ b/configxml.h @@ -108,6 +108,14 @@ public: KConfigSkeletonItem* findItem(const QString &group, const QString &key); + /** + * Check to see if a group exists + * + * @param group the name of the group to check for + * @return true if the group exists, or false if it does not + */ + bool hasGroup(const QString &group) const; + private: ConfigXmlPrivate * const d; };