From 6bbc8cb420b27ad1ca9e82082112dda0f8108b9c Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 10 Sep 2013 12:38:41 +0200 Subject: [PATCH] propagate drawWallpaperChanged --- src/plasma/containment.cpp | 5 +++++ src/plasma/containment.h | 5 +++++ src/plasma/scripting/appletscript.cpp | 4 ++++ src/plasma/scripting/appletscript.h | 5 +++++ src/scriptengines/qml/plasmoid/containmentinterface.cpp | 2 ++ src/scriptengines/qml/plasmoid/containmentinterface.h | 8 +++++--- 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index 2cf741205..a40023e77 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -453,7 +453,12 @@ int Containment::screen() const void Containment::setDrawWallpaper(bool drawWallpaper) { + if (d->drawWallpaper == drawWallpaper) { + return; + } + d->drawWallpaper = drawWallpaper; + emit drawWallpaperChanged(); } bool Containment::drawWallpaper() diff --git a/src/plasma/containment.h b/src/plasma/containment.h index 5ddc33272..61d277638 100644 --- a/src/plasma/containment.h +++ b/src/plasma/containment.h @@ -273,6 +273,11 @@ Q_SIGNALS: */ void uiReadyChanged(bool uiReady); + /** + * Emitted when the value of drawWallpaper() has changed + */ + void drawWallpaperChanged(); + public Q_SLOTS: /** * Informs the Corona as to what position it is in. This is informational diff --git a/src/plasma/scripting/appletscript.cpp b/src/plasma/scripting/appletscript.cpp index f621a6ac3..cb9df7d92 100644 --- a/src/plasma/scripting/appletscript.cpp +++ b/src/plasma/scripting/appletscript.cpp @@ -39,6 +39,10 @@ AppletScript::AppletScript(QObject *parent) d(new AppletScriptPrivate) { d->applet = 0; + Plasma::Containment *cont = qobject_cast(d->applet); + if (cont) { + connect(cont, &Plasma::Containment::drawWallpaperChanged, this, &AppletScript::drawWallpaperChanged); + } } AppletScript::~AppletScript() diff --git a/src/plasma/scripting/appletscript.h b/src/plasma/scripting/appletscript.h index 857aa8f81..d786e1cf2 100644 --- a/src/plasma/scripting/appletscript.h +++ b/src/plasma/scripting/appletscript.h @@ -150,6 +150,11 @@ Q_SIGNALS: */ void uiReadyChanged(bool uiReady); + /** + * Emitted when the value of drawWallpaper() has changed + */ + void drawWallpaperChanged(); + public Q_SLOTS: /** diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index df2d02165..b520b3a95 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -67,6 +67,8 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent) this, &ContainmentInterface::activityChanged); connect(containment(), &Plasma::Containment::wallpaperChanged, this, &ContainmentInterface::loadWallpaper); + connect(containment(), &Plasma::Containment::drawWallpaperChanged, + this, &ContainmentInterface::drawWallpaperChanged); if (containment()->corona()) { connect(containment()->corona(), &Plasma::Corona::availableScreenRegionChanged, diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.h b/src/scriptengines/qml/plasmoid/containmentinterface.h index f67e8ca99..fd8953321 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.h +++ b/src/scriptengines/qml/plasmoid/containmentinterface.h @@ -44,14 +44,14 @@ class ContainmentInterface : public AppletInterface Q_PROPERTY(QList applets READ applets NOTIFY appletsChanged) /** - * True if the containment should draw a wallpaper TODO: notify + * True if the containment should draw a wallpaper */ - Q_PROPERTY(bool drawWallpaper READ drawWallpaper WRITE setDrawWallpaper) + Q_PROPERTY(bool drawWallpaper READ drawWallpaper WRITE setDrawWallpaper NOTIFY drawWallpaperChanged) /** * Type of this containment TODO: notify */ - Q_PROPERTY(Plasma::Types::ContainmentType containmentType READ containmentType WRITE setContainmentType) + Q_PROPERTY(Plasma::Types::ContainmentType containmentType READ containmentType WRITE setContainmentType NOTIFY containmentTypeChanged) /** * Activity name of this containment @@ -124,6 +124,8 @@ Q_SIGNALS: void activityChanged(); void availableScreenRegionChanged(); void appletsChanged(); + void drawWallpaperChanged(); + void containmentTypeChanged(); ///void immutableChanged(); protected Q_SLOTS: