track group names as well
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=841830
This commit is contained in:
parent
cc7db99997
commit
2e070a1307
@ -21,6 +21,7 @@
|
||||
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QSet>
|
||||
#include <QXmlContentHandler>
|
||||
#include <QXmlInputSource>
|
||||
#include <QXmlSimpleReader>
|
||||
@ -193,7 +194,7 @@ class ConfigXmlPrivate
|
||||
QList<QSize*> sizes;
|
||||
QList<quint64*> ulonglongs;
|
||||
QList<KUrl::List*> urllists;
|
||||
QMap<QString, QString> keysToNames;
|
||||
QHash<QString, QString> 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
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user