diff --git a/applet.cpp b/applet.cpp index 8a8b636c0..56c3c3693 100644 --- a/applet.cpp +++ b/applet.cpp @@ -727,6 +727,25 @@ Applet* Applet::loadApplet(const KPluginInfo& info, uint appletId, const QString return loadApplet(info.pluginName(), appletId, args); } +void Applet::slotLockApplet(bool lock) +{ + if(lock) + setFlags( flags()^QGraphicsItem::ItemIsMovable); + else + setFlags( flags() | QGraphicsItem::ItemIsMovable); +} + +bool Applet::lockApplet() const +{ + return !(flags() & QGraphicsItem::ItemIsMovable); +} + +void Applet::setLockApplet(bool lock) +{ + slotLockApplet(lock); +} + + } // Plasma namespace #include "applet.moc" diff --git a/applet.h b/applet.h index d2e866f54..b1246b298 100644 --- a/applet.h +++ b/applet.h @@ -50,6 +50,7 @@ class PLASMA_EXPORT Applet : public QObject, public Widget Q_PROPERTY( bool immutable READ isImmutable WRITE setImmutable ) Q_PROPERTY( bool drawStandardBackground READ drawStandardBackground WRITE setDrawStandardBackground ) Q_PROPERTY( bool failedToLaunch READ failedToLaunch WRITE setFailedToLaunch ) + Q_PROPERTY( bool lockApplet READ lockApplet WRITE setLockApplet ) Q_PROPERTY( QRectF boundingRect READ boundingRect ) public: @@ -379,6 +380,11 @@ class PLASMA_EXPORT Applet : public QObject, public Widget **/ QRectF boundingRect () const; + bool lockApplet() const; + + void setLockApplet(bool lock); + + Q_SIGNALS: /** * Emitted when the applet needs to take (or lose) keyboard focus. @@ -395,6 +401,9 @@ class PLASMA_EXPORT Applet : public QObject, public Widget **/ void requestFocus( bool focus ); + protected Q_SLOTS: + void slotLockApplet(bool); + protected: /** * Returns the name of the applet.