catch wallpaper changes
svn path=/trunk/KDE/kdebase/workspace/; revision=1122770
This commit is contained in:
parent
2b42e85991
commit
6216e0ae72
19
applet.cpp
19
applet.cpp
@ -33,7 +33,9 @@ class Applet::Private
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: configDirty(false)
|
||||
: configDirty(false),
|
||||
inWallpaperConfig(false),
|
||||
wallpaperConfigDirty(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -41,7 +43,9 @@ public:
|
||||
QStringList configGroupPath;
|
||||
KConfigGroup globalConfigGroup;
|
||||
QStringList globalConfigGroupPath;
|
||||
bool configDirty;
|
||||
bool configDirty : 1;
|
||||
bool inWallpaperConfig : 1;
|
||||
bool wallpaperConfigDirty : 1;
|
||||
};
|
||||
|
||||
Applet::Applet(QObject *parent)
|
||||
@ -74,6 +78,8 @@ void Applet::setCurrentConfigGroup(const QStringList &groupNames)
|
||||
foreach (const QString &groupName, groupNames) {
|
||||
d->configGroup = KConfigGroup(&d->configGroup, groupName);
|
||||
}
|
||||
|
||||
d->inWallpaperConfig = !groupNames.isEmpty() && groupNames.first() == "Wallpaper";
|
||||
}
|
||||
|
||||
QStringList Applet::currentConfigGroup() const
|
||||
@ -111,6 +117,10 @@ QVariant Applet::readConfig(const QString &key, const QVariant &def) const
|
||||
void Applet::writeConfig(const QString &key, const QVariant &value)
|
||||
{
|
||||
if (d->configGroup.isValid()) {
|
||||
if (d->inWallpaperConfig) {
|
||||
d->wallpaperConfigDirty = true;
|
||||
}
|
||||
|
||||
d->configGroup.writeEntry(key, value);
|
||||
d->configDirty = true;
|
||||
}
|
||||
@ -230,6 +240,11 @@ bool Applet::locked() const
|
||||
return app->immutability() != Plasma::Mutable;
|
||||
}
|
||||
|
||||
bool Applet::wallpaperConfigDirty() const
|
||||
{
|
||||
return d->wallpaperConfigDirty;
|
||||
}
|
||||
|
||||
Plasma::Applet *Applet::applet() const
|
||||
{
|
||||
return 0;
|
||||
|
2
applet.h
2
applet.h
@ -58,6 +58,8 @@ public:
|
||||
void setLocked(bool locked);
|
||||
bool locked() const;
|
||||
|
||||
bool wallpaperConfigDirty() const;
|
||||
|
||||
virtual Plasma::Applet *applet() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
|
@ -53,10 +53,15 @@ Containment::Containment(Plasma::Containment *containment, QObject *parent)
|
||||
|
||||
Containment::~Containment()
|
||||
{
|
||||
if (d->containment && (d->oldWallpaperPlugin != d->wallpaperPlugin ||
|
||||
d->oldWallpaperMode != d->wallpaperMode)) {
|
||||
if (d->containment) {
|
||||
Plasma::Containment *containment = d->containment.data();
|
||||
containment->setWallpaper(d->wallpaperPlugin, d->wallpaperMode);
|
||||
if (d->oldWallpaperPlugin != d->wallpaperPlugin ||
|
||||
d->oldWallpaperMode != d->wallpaperMode) {
|
||||
containment->setWallpaper(d->wallpaperPlugin, d->wallpaperMode);
|
||||
} else if (wallpaperConfigDirty() && containment->wallpaper()) {
|
||||
KConfigGroup cg(&containment->config(), "Wallpaper");
|
||||
containment->wallpaper()->restore(cg);
|
||||
}
|
||||
}
|
||||
|
||||
delete d;
|
||||
|
Loading…
Reference in New Issue
Block a user