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:
parent
946e0127b8
commit
f7a0308982
@ -599,7 +599,7 @@ QString Applet::category(const QString& appletName)
|
|||||||
|
|
||||||
bool Applet::isImmutable() const
|
bool Applet::isImmutable() const
|
||||||
{
|
{
|
||||||
return d->immutable || d->kioskImmutable;
|
return (containment() && containment()->isImmutable()) || d->immutable || d->kioskImmutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::setImmutable(bool immutable)
|
void Applet::setImmutable(bool immutable)
|
||||||
|
14
applet.h
14
applet.h
@ -401,13 +401,6 @@ class PLASMA_EXPORT Applet : public Widget
|
|||||||
**/
|
**/
|
||||||
bool isImmutable() const;
|
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
|
* @return returns whether or not the applet is using the standard
|
||||||
* background
|
* background
|
||||||
@ -543,6 +536,13 @@ class PLASMA_EXPORT Applet : public Widget
|
|||||||
void geometryChanged();
|
void geometryChanged();
|
||||||
|
|
||||||
public Q_SLOTS:
|
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.
|
* Destroys the applet; it will be deleted and configurations reset.
|
||||||
*/
|
*/
|
||||||
|
@ -163,7 +163,6 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
painter->drawPixmap(point + shiftC, KIcon("configure").pixmap(ICON_SIZE, ICON_SIZE));
|
painter->drawPixmap(point + shiftC, KIcon("configure").pixmap(ICON_SIZE, ICON_SIZE));
|
||||||
point += QPointF(0.0, ICON_SIZE + ICON_MARGIN);
|
point += QPointF(0.0, ICON_SIZE + ICON_MARGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->drawPixmap(point + shiftR, KIcon("transform-rotate").pixmap(ICON_SIZE, ICON_SIZE));
|
painter->drawPixmap(point + shiftR, KIcon("transform-rotate").pixmap(ICON_SIZE, ICON_SIZE));
|
||||||
|
|
||||||
point += QPointF(0.0, ICON_SIZE + ICON_MARGIN * 2);
|
point += QPointF(0.0, ICON_SIZE + ICON_MARGIN * 2);
|
||||||
|
@ -215,7 +215,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
|||||||
KMenu desktopMenu;
|
KMenu desktopMenu;
|
||||||
//kDebug() << "context menu event " << (QObject*)applet;
|
//kDebug() << "context menu event " << (QObject*)applet;
|
||||||
if (!applet) {
|
if (!applet) {
|
||||||
if (!scene() || static_cast<Corona*>(scene())->isImmutable()) {
|
if (!scene() || (static_cast<Corona*>(scene())->isImmutable() && !KAuthorized::authorizeKAction("unlock_desktop"))) {
|
||||||
//kDebug() << "immutability";
|
//kDebug() << "immutability";
|
||||||
QGraphicsItem::contextMenuEvent(event);
|
QGraphicsItem::contextMenuEvent(event);
|
||||||
return;
|
return;
|
||||||
@ -238,6 +238,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
|||||||
bool hasEntries = false;
|
bool hasEntries = false;
|
||||||
if (applet->hasConfigurationInterface()) {
|
if (applet->hasConfigurationInterface()) {
|
||||||
QAction* configureApplet = new QAction(i18n("%1 Settings...", applet->name()), &desktopMenu);
|
QAction* configureApplet = new QAction(i18n("%1 Settings...", applet->name()), &desktopMenu);
|
||||||
|
configureApplet->setIcon(KIcon("configure"));
|
||||||
connect(configureApplet, SIGNAL(triggered(bool)),
|
connect(configureApplet, SIGNAL(triggered(bool)),
|
||||||
applet, SLOT(showConfigurationInterface()));
|
applet, SLOT(showConfigurationInterface()));
|
||||||
desktopMenu.addAction(configureApplet);
|
desktopMenu.addAction(configureApplet);
|
||||||
@ -249,6 +250,7 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
|||||||
QVariant appletV;
|
QVariant appletV;
|
||||||
appletV.setValue((QObject*)applet);
|
appletV.setValue((QObject*)applet);
|
||||||
closeApplet->setData(appletV);
|
closeApplet->setData(appletV);
|
||||||
|
closeApplet->setIcon(KIcon("edit-delete"));
|
||||||
connect(closeApplet, SIGNAL(triggered(bool)),
|
connect(closeApplet, SIGNAL(triggered(bool)),
|
||||||
this, SLOT(destroyApplet()));
|
this, SLOT(destroyApplet()));
|
||||||
desktopMenu.addAction(closeApplet);
|
desktopMenu.addAction(closeApplet);
|
||||||
@ -650,7 +652,7 @@ bool Containment::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::GraphicsSceneHoverEnter:
|
case QEvent::GraphicsSceneHoverEnter:
|
||||||
//kDebug() << "got hoverenterEvent" << d->immutable << " " << applet->isImmutable();
|
//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";
|
//kDebug() << "generated applet handle";
|
||||||
AppletHandle *handle = new AppletHandle(this, applet);
|
AppletHandle *handle = new AppletHandle(this, applet);
|
||||||
d->handles[applet] = handle;
|
d->handles[applet] = handle;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user