remove any stale config data to avoid accidentally merging old and existing containment configs

svn path=/trunk/KDE/kdelibs/; revision=1167946
This commit is contained in:
Aaron J. Seigo 2010-08-25 18:54:22 +00:00
parent 57bbfe755c
commit d071b6e301

View File

@ -230,6 +230,14 @@ public:
containment->setFormFactor(Plasma::Planar); containment->setFormFactor(Plasma::Planar);
} }
// if this is a new containment, we need to ensure that there are no stale
// configuration data around
if (id == 0) {
KConfigGroup conf(q->config(), "Containments");
conf = KConfigGroup(&conf, QString::number(containment->id()));
conf.deleteGroup();
}
applet->d->isContainment = true; applet->d->isContainment = true;
containment->setPos(containment->d->preferredPos(q)); containment->setPos(containment->d->preferredPos(q));
q->addItem(containment); q->addItem(containment);
@ -448,7 +456,7 @@ void Corona::loadLayout(const QString &configName)
} }
KSharedConfigPtr conf = config(); KSharedConfigPtr conf = config();
d->importLayout(*conf, conf != config()); d->importLayout(*conf, false);
} }
QList<Plasma::Containment *> Corona::importLayout(const KConfigBase &conf) QList<Plasma::Containment *> Corona::importLayout(const KConfigBase &conf)
@ -490,6 +498,8 @@ QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigBase &conf
if (mergeConfig) { if (mergeConfig) {
KConfigGroup realConf(q->config(), "Containments"); KConfigGroup realConf(q->config(), "Containments");
realConf = KConfigGroup(&realConf, QString::number(cid)); realConf = KConfigGroup(&realConf, QString::number(cid));
// in case something was there before us
realConf.deleteGroup();
containmentConfig.copyTo(&realConf); containmentConfig.copyTo(&realConf);
} }