try to respect the ids in the extra config file, if it's taken, use the

autogenerated one. this way we have a more faitful reproduction of the
default config file

svn path=/trunk/KDE/kdelibs/; revision=1033961
This commit is contained in:
Marco Martin 2009-10-11 17:06:26 +00:00
parent 14dd33ec4a
commit 54202fc885

View File

@ -353,6 +353,14 @@ void Corona::loadLayout(const QString &configName)
mergeConfig = true;
}
QList<int> containmentsIds;
if (mergeConfig) {
foreach (Plasma::Containment *cont, d->containments) {
containmentsIds.append(cont->id());
}
}
KConfigGroup containments(c, "Containments");
foreach (const QString &group, containments.groupList()) {
@ -362,7 +370,15 @@ void Corona::loadLayout(const QString &configName)
continue;
}
int cid = mergeConfig ? 0 : group.toUInt();
int cid = group.toUInt();
if (mergeConfig) {
if (containmentsIds.contains(cid)) {
cid = 0;
} else if (cid > AppletPrivate::s_maxAppletId) {
AppletPrivate::s_maxAppletId = cid;
}
}
//kDebug() << "got a containment in the config, trying to make a" << containmentConfig.readEntry("plugin", QString()) << "from" << group;
Containment *c = d->addContainment(containmentConfig.readEntry("plugin", QString()), QVariantList(),
cid, true);
@ -370,6 +386,10 @@ void Corona::loadLayout(const QString &configName)
continue;
}
if (mergeConfig) {
containmentsIds.append(c->id());
}
c->init();
c->restore(containmentConfig);
}