Allow to lock applet position

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=693020
This commit is contained in:
Laurent Montel 2007-07-26 20:22:04 +00:00
parent 60f199c791
commit 1553ae4492
2 changed files with 28 additions and 0 deletions

View File

@ -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"

View File

@ -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.