allow telling the wallpaper that it is in previewing mode

BUG:229450

svn path=/trunk/KDE/kdelibs/; revision=1099127
This commit is contained in:
Aaron J. Seigo 2010-03-05 00:54:30 +00:00
parent 3c262b40ea
commit 2ca8a1d2ee
3 changed files with 25 additions and 1 deletions

View File

@ -76,6 +76,7 @@ public:
bool initialized : 1;
bool needsConfig : 1;
bool scriptInitialized : 1;
bool previewing : 1;
};
class LoadImageThread : public QObject, public QRunnable

View File

@ -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<QAction*> &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;

View File

@ -62,6 +62,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
Q_PROPERTY(KServiceAction renderingMode READ renderingMode)
Q_PROPERTY(QList<KServiceAction> 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<QAction*> 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.