From 2ca8a1d2ee9c16ae8c39e9bf80210ce6e7518809 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 5 Mar 2010 00:54:30 +0000 Subject: [PATCH] allow telling the wallpaper that it is in previewing mode BUG:229450 svn path=/trunk/KDE/kdelibs/; revision=1099127 --- private/wallpaper_p.h | 1 + wallpaper.cpp | 13 ++++++++++++- wallpaper.h | 12 ++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) 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.