From 54202fc885abc3d256de6858d5e494328ab4789a Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sun, 11 Oct 2009 17:06:26 +0000 Subject: [PATCH] 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 --- corona.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/corona.cpp b/corona.cpp index 2d50440c5..02c01c178 100644 --- a/corona.cpp +++ b/corona.cpp @@ -353,6 +353,14 @@ void Corona::loadLayout(const QString &configName) mergeConfig = true; } + QList 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); }