* delete the wallpaper config group when we change plugins

* save the wallpaper config before moving on if the wallpaper remains the same, so that when we restore the paper later on we're all good and safe

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=857500
This commit is contained in:
Aaron J. Seigo 2008-09-05 15:01:30 +00:00
parent b422757da1
commit 3b314b6578

View File

@ -1178,9 +1178,18 @@ void Containment::setWallpaper(const QString &pluginName, const QString &mode)
KConfigGroup cfg = config();
if (d->drawWallpaper) {
if (d->wallpaper && d->wallpaper->pluginName() != pluginName) {
delete d->wallpaper;
d->wallpaper = 0;
KConfigGroup paperConfig = KConfigGroup(&cfg, "Wallpaper");
if (d->wallpaper) {
// we have a wallpaper, so let's decide whether we need to swap it out
if (d->wallpaper->pluginName() != pluginName) {
delete d->wallpaper;
d->wallpaper = 0;
paperConfig.deleteGroup();
} else {
// it's the same plugin, so let's save its state now so when
// we call restore later on we're safe
d->wallpaper->save(paperConfig);
}
}
if (!pluginName.isEmpty() && !d->wallpaper) {
@ -1189,7 +1198,7 @@ void Containment::setWallpaper(const QString &pluginName, const QString &mode)
if (d->wallpaper) {
d->wallpaper->setBoundingRect(geometry());
d->wallpaper->restore(KConfigGroup(&cfg, "Wallpaper"), mode);
d->wallpaper->restore(paperConfig, mode);
connect(d->wallpaper, SIGNAL(update(const QRectF&)),
this, SLOT(updateRect(const QRectF&)));
}