config().deleteGroup() doesn't removethe applet, just the configuration for the applet. we need to remove the applet's main group to properly delete an apple from the config.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=741916
This commit is contained in:
Aaron J. Seigo 2007-11-26 18:26:32 +00:00
parent 852d3253cc
commit f339cb9dcb

View File

@ -332,6 +332,21 @@ public:
pendingConstraints |= c; pendingConstraints |= c;
} }
KConfigGroup mainConfigGroup(const Applet* q)
{
KConfigGroup appletConfig;
if (q->containment()) {
appletConfig = q->containment()->config();
appletConfig = KConfigGroup(&appletConfig, "Applets");
} else {
kWarning() << "requesting config for" << q->name() << "without a containment!";
appletConfig = KConfigGroup(KGlobal::config(), "Applets");
}
return KConfigGroup(&appletConfig, QString::number(appletId));
}
//TODO: examine the usage of memory here; there's a pretty large //TODO: examine the usage of memory here; there's a pretty large
// number of members at this point. // number of members at this point.
uint appletId; uint appletId;
@ -441,16 +456,7 @@ KConfigGroup Applet::config() const
return containmentConfig; return containmentConfig;
} }
KConfigGroup appletConfig; KConfigGroup appletConfig = d->mainConfigGroup(this);
if (containment()) {
appletConfig = containment()->config();
appletConfig = KConfigGroup(&appletConfig, "Applets");
} else {
kWarning() << "requesting config for" << name() << "without a containment!";
appletConfig = KConfigGroup(KGlobal::config(), "Applets");
}
appletConfig = KConfigGroup(&appletConfig, QString::number(d->appletId));
return KConfigGroup(&appletConfig, "Configuration"); return KConfigGroup(&appletConfig, "Configuration");
} }
@ -469,11 +475,12 @@ KConfigGroup Applet::globalConfig() const
void Applet::destroy() void Applet::destroy()
{ {
//kDebug() << "???????????????? DESTROYING APPLET" << name() << " ???????????????????????????";
if (d->configXml) { if (d->configXml) {
d->configXml->setDefaults(); d->configXml->setDefaults();
} }
config().deleteGroup(); d->mainConfigGroup(this).deleteGroup();
deleteLater(); deleteLater();
} }