Added the ability to lock desktop widgets and assigned icons to all the desktop context menu actions.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=744659
This commit is contained in:
Aaron Eisenberg 2007-12-04 02:17:21 +00:00
parent 946e0127b8
commit f7a0308982
4 changed files with 12 additions and 11 deletions

View File

@ -599,7 +599,7 @@ QString Applet::category(const QString& appletName)
bool Applet::isImmutable() const
{
return d->immutable || d->kioskImmutable;
return (containment() && containment()->isImmutable()) || d->immutable || d->kioskImmutable;
}
void Applet::setImmutable(bool immutable)

View File

@ -401,13 +401,6 @@ class PLASMA_EXPORT Applet : public Widget
**/
bool isImmutable() const;
/**
* Sets whether or not this applet is immutable or not.
*
* @arg immutable true if this applet should not be changeable
**/
void setImmutable(bool immutable);
/**
* @return returns whether or not the applet is using the standard
* background
@ -543,6 +536,13 @@ class PLASMA_EXPORT Applet : public Widget
void geometryChanged();
public Q_SLOTS:
/**
* Sets whether or not this applet is immutable or not.
*
* @arg immutable true if this applet should not be changeable
**/
void setImmutable(bool immutable);
/**
* Destroys the applet; it will be deleted and configurations reset.
*/

View File

@ -163,7 +163,6 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
painter->drawPixmap(point + shiftC, KIcon("configure").pixmap(ICON_SIZE, ICON_SIZE));
point += QPointF(0.0, ICON_SIZE + ICON_MARGIN);
}
painter->drawPixmap(point + shiftR, KIcon("transform-rotate").pixmap(ICON_SIZE, ICON_SIZE));
point += QPointF(0.0, ICON_SIZE + ICON_MARGIN * 2);

View File

@ -215,7 +215,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
KMenu desktopMenu;
//kDebug() << "context menu event " << (QObject*)applet;
if (!applet) {
if (!scene() || static_cast<Corona*>(scene())->isImmutable()) {
if (!scene() || (static_cast<Corona*>(scene())->isImmutable() && !KAuthorized::authorizeKAction("unlock_desktop"))) {
//kDebug() << "immutability";
QGraphicsItem::contextMenuEvent(event);
return;
@ -238,6 +238,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
bool hasEntries = false;
if (applet->hasConfigurationInterface()) {
QAction* configureApplet = new QAction(i18n("%1 Settings...", applet->name()), &desktopMenu);
configureApplet->setIcon(KIcon("configure"));
connect(configureApplet, SIGNAL(triggered(bool)),
applet, SLOT(showConfigurationInterface()));
desktopMenu.addAction(configureApplet);
@ -249,6 +250,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
QVariant appletV;
appletV.setValue((QObject*)applet);
closeApplet->setData(appletV);
closeApplet->setIcon(KIcon("edit-delete"));
connect(closeApplet, SIGNAL(triggered(bool)),
this, SLOT(destroyApplet()));
desktopMenu.addAction(closeApplet);
@ -650,7 +652,7 @@ bool Containment::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
switch (event->type()) {
case QEvent::GraphicsSceneHoverEnter:
//kDebug() << "got hoverenterEvent" << d->immutable << " " << applet->isImmutable();
if (!d->immutable && !applet->isImmutable() && !d->handles.contains(applet)) {
if (!d->immutable && !applet->isImmutable() && !corona()->isImmutable() && !d->handles.contains(applet)) {
//kDebug() << "generated applet handle";
AppletHandle *handle = new AppletHandle(this, applet);
d->handles[applet] = handle;