diff --git a/private/wallpaper_p.h b/private/wallpaper_p.h index dab3e83c3..b9639263d 100644 --- a/private/wallpaper_p.h +++ b/private/wallpaper_p.h @@ -76,6 +76,7 @@ public: bool initialized : 1; bool needsConfig : 1; bool scriptInitialized : 1; + bool previewing : 1; }; class LoadImageThread : public QObject, public QRunnable diff --git a/wallpaper.cpp b/wallpaper.cpp index 17e2b5bc9..8f0bb3b5b 100644 --- a/wallpaper.cpp +++ b/wallpaper.cpp @@ -459,7 +459,8 @@ WallpaperPrivate::WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) cacheRendering(false), initialized(false), needsConfig(false), - scriptInitialized(false) + scriptInitialized(false), + previewing(false) { if (wallpaperDescription.isValid()) { QString api = wallpaperDescription.property("X-Plasma-API").toString(); @@ -638,6 +639,16 @@ void Wallpaper::setContextualActions(const QList &actions) contextActions = actions; } +bool Wallpaper::isPreviewing() const +{ + return d->previewing; +} + +void Wallpaper::setPreviewing(bool previewing) +{ + d->previewing = previewing; +} + const Package *Wallpaper::package() const { return d->package; diff --git a/wallpaper.h b/wallpaper.h index 0df34ab0e..146ac6d5a 100644 --- a/wallpaper.h +++ b/wallpaper.h @@ -62,6 +62,7 @@ class PLASMA_EXPORT Wallpaper : public QObject Q_PROPERTY(KServiceAction renderingMode READ renderingMode) Q_PROPERTY(QList listRenderingModes READ listRenderingModes) Q_PROPERTY(bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache) + Q_PROPERTY(bool previewing READ isPreviewing WRITE setPreviewing) public: /** @@ -330,6 +331,17 @@ class PLASMA_EXPORT Wallpaper : public QObject */ QList contextualActions() const; + /** + * @return true if in preview mode, such as in a configuation dialog + * @since 4.5 + */ + bool isPreviewing() const; + + /** + * Puts the wallpaper into preview mode + */ + void setPreviewing(bool previewing); + Q_SIGNALS: /** * This signal indicates that wallpaper needs to be repainted.