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 <QColor>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#include <QSet>
|
||||||
#include <QXmlContentHandler>
|
#include <QXmlContentHandler>
|
||||||
#include <QXmlInputSource>
|
#include <QXmlInputSource>
|
||||||
#include <QXmlSimpleReader>
|
#include <QXmlSimpleReader>
|
||||||
@ -193,7 +194,7 @@ class ConfigXmlPrivate
|
|||||||
QList<QSize*> sizes;
|
QList<QSize*> sizes;
|
||||||
QList<quint64*> ulonglongs;
|
QList<quint64*> ulonglongs;
|
||||||
QList<KUrl::List*> urllists;
|
QList<KUrl::List*> urllists;
|
||||||
QMap<QString, QString> keysToNames;
|
QHash<QString, QString> keysToNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigXmlHandler : public QXmlDefaultHandler
|
class ConfigXmlHandler : public QXmlDefaultHandler
|
||||||
@ -257,6 +258,7 @@ bool ConfigXmlHandler::startElement(const QString &namespaceURI, const QString &
|
|||||||
QString name = attrs.localName(i).toLower();
|
QString name = attrs.localName(i).toLower();
|
||||||
if (name == "name") {
|
if (name == "name") {
|
||||||
kDebug() << "set group to " << attrs.value(i);
|
kDebug() << "set group to " << attrs.value(i);
|
||||||
|
d->keysToNames.insert(attrs.value(i), QString());
|
||||||
m_config->setCurrentGroup(attrs.value(i));
|
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]);
|
return KConfigSkeleton::findItem(d->keysToNames[group + key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ConfigXml::hasGroup(const QString &group) const
|
||||||
|
{
|
||||||
|
return d->keysToNames.contains(group);
|
||||||
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
@ -108,6 +108,14 @@ public:
|
|||||||
|
|
||||||
KConfigSkeletonItem* findItem(const QString &group, const QString &key);
|
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:
|
private:
|
||||||
ConfigXmlPrivate * const d;
|
ConfigXmlPrivate * const d;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user