Get group from config group and use that as a parent.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=863901
This commit is contained in:
Petri Damstén 2008-09-23 12:21:19 +00:00
parent 56e353da9b
commit 8eef2c7764
2 changed files with 18 additions and 4 deletions

View File

@ -194,6 +194,7 @@ class ConfigXmlPrivate
QList<QSize*> sizes;
QList<quint64*> ulonglongs;
QList<KUrl::List*> urllists;
QString baseGroup;
QStringList groups;
QHash<QString, QString> keysToNames;
};
@ -255,14 +256,23 @@ bool ConfigXmlHandler::startElement(const QString &namespaceURI, const QString &
int numAttrs = attrs.count();
QString tag = localName.toLower();
if (tag == "group") {
QString group;
for (int i = 0; i < numAttrs; ++i) {
QString name = attrs.localName(i).toLower();
if (name == "name") {
//kDebug() << "set group to" << attrs.value(i);
d->groups.append(attrs.value(i));
m_config->setCurrentGroup(attrs.value(i));
group = attrs.value(i);
}
}
if (group.isEmpty()) {
group = d->baseGroup;
} else {
d->groups.append(group);
if (!d->baseGroup.isEmpty()) {
group = d->baseGroup + '\x1d' + group;
}
}
m_config->setCurrentGroup(group);
} else if (tag == "entry") {
for (int i = 0; i < numAttrs; ++i) {
QString name = attrs.localName(i).toLower();
@ -522,6 +532,12 @@ ConfigXml::ConfigXml(const KConfigGroup *config, QIODevice *xml, QObject *parent
: KConfigSkeleton(KSharedConfig::openConfig(config->config()->name()), parent),
d(new ConfigXmlPrivate)
{
KConfigGroup group = config->parent();
d->baseGroup = config->name();
while (group.isValid() && group.name() != "<default>") {
d->baseGroup = group.name() + '\x1d' + d->baseGroup;
group = group.parent();
}
d->parse(this, xml);
}

View File

@ -88,7 +88,6 @@ public:
/**
* Creates a KConfigSkeleton populated using the definition found in
* the XML data passed in.
* FIXME/WARNING: DOES NOT WORK IN KDE 4.1 - FIX KCONFIGSKELETON
*
* @param config the configuration object to use
* @param xml the xml data; must be valid KConfigXT data
@ -99,7 +98,6 @@ public:
/**
* Creates a KConfigSkeleton populated using the definition found in
* the XML data passed in.
* FIXME/WARNING: DOES NOT WORK IN KDE 4.1 - FIX KCONFIGSKELETON
*
* @param config the group to use as the root for configuration items
* @param xml the xml data; must be valid KConfigXT data