don't rely on KConfigSkeleton actually creating groups in the config or even being useful in telling us what groups it knows about. KConfigSkeleton is far too tightly coupled with the idea of KConfigDialog to be useful for half the things it should be useful for. =(
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=856847
This commit is contained in:
parent
b53e688306
commit
d89e799c96
@ -194,6 +194,7 @@ class ConfigXmlPrivate
|
||||
QList<QSize*> sizes;
|
||||
QList<quint64*> ulonglongs;
|
||||
QList<KUrl::List*> urllists;
|
||||
QStringList groups;
|
||||
QHash<QString, QString> keysToNames;
|
||||
};
|
||||
|
||||
@ -258,7 +259,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());
|
||||
d->groups.append(attrs.value(i));
|
||||
m_config->setCurrentGroup(attrs.value(i));
|
||||
}
|
||||
}
|
||||
@ -539,7 +540,12 @@ KConfigSkeletonItem* ConfigXml::findItem(const QString &group, const QString &ke
|
||||
|
||||
bool ConfigXml::hasGroup(const QString &group) const
|
||||
{
|
||||
return d->keysToNames.contains(group);
|
||||
return d->groups.contains(group);
|
||||
}
|
||||
|
||||
QStringList ConfigXml::groupList() const
|
||||
{
|
||||
return d->groups;
|
||||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
@ -118,6 +118,10 @@ public:
|
||||
*/
|
||||
bool hasGroup(const QString &group) const;
|
||||
|
||||
/**
|
||||
* @return the list of groups defined by the XML
|
||||
*/
|
||||
QStringList groupList() const;
|
||||
private:
|
||||
ConfigXmlPrivate * const d;
|
||||
};
|
||||
|
@ -115,7 +115,7 @@ QStringList Service::operationNames() const
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
return d->config->config()->groupList();
|
||||
return d->config->groupList();
|
||||
}
|
||||
|
||||
KConfigGroup Service::operationDescription(const QString &operationName)
|
||||
@ -253,7 +253,7 @@ void Service::setOperationsScheme(QIODevice *xml)
|
||||
//FIXME: make KSharedConfig and KConfigSkeleton not braindamaged in 4.2 and then get rid of the
|
||||
// temp file object here
|
||||
d->tempFile = new KTemporaryFile;
|
||||
KSharedConfigPtr c = KSharedConfig::openConfig(d->tempFile->fileName());
|
||||
KSharedConfigPtr c = KSharedConfig::openConfig(d->tempFile->fileName(), KConfig::NoGlobals);
|
||||
d->config = new ConfigXml(c, xml, this);
|
||||
emit operationsChanged();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user