be a lot more careful about what we save, when and how. leaves us still with an annoying problem with save/restore of papers at runtime though .. working on that now

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=857505
This commit is contained in:
Aaron J. Seigo 2008-09-05 15:16:49 +00:00
parent 3b314b6578
commit 90d21e4b31

View File

@ -1176,6 +1176,8 @@ bool Containment::drawWallpaper()
void Containment::setWallpaper(const QString &pluginName, const QString &mode)
{
KConfigGroup cfg = config();
bool newPlugin = true;
bool newMode = true;
if (d->drawWallpaper) {
KConfigGroup paperConfig = KConfigGroup(&cfg, "Wallpaper");
@ -1188,7 +1190,8 @@ void Containment::setWallpaper(const QString &pluginName, const QString &mode)
} 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);
newMode = d->wallpaper->renderingMode().name() != mode;
newPlugin = false;
}
}
@ -1199,14 +1202,28 @@ void Containment::setWallpaper(const QString &pluginName, const QString &mode)
if (d->wallpaper) {
d->wallpaper->setBoundingRect(geometry());
d->wallpaper->restore(paperConfig, mode);
connect(d->wallpaper, SIGNAL(update(const QRectF&)),
this, SLOT(updateRect(const QRectF&)));
if (newPlugin) {
connect(d->wallpaper, SIGNAL(update(const QRectF&)),
this, SLOT(updateRect(const QRectF&)));
cfg.writeEntry("wallpaperplugin", pluginName);
}
if (newMode) {
cfg.writeEntry("wallpaperpluginmode", mode);
}
}
update();
}
cfg.writeEntry("wallpaperplugin", pluginName);
cfg.writeEntry("wallpaperpluginmode", mode);
if (!d->wallpaper) {
cfg.deleteEntry("wallpaperplugin");
cfg.deleteEntry("wallpaperpluginmode");
}
if (newPlugin || newMode) {
emit configNeedsSaving();
}
}
Plasma::Wallpaper* Containment::wallpaper() const