put containment options last, make accidental removal of widgets a bit harder

BUG:188880

svn path=/trunk/KDE/kdelibs/; revision=960594
This commit is contained in:
Aaron J. Seigo 2009-04-28 17:30:46 +00:00
parent 614954756b
commit 7d8a4272cd

View File

@ -513,6 +513,21 @@ void ContainmentPrivate::appletActions(KMenu &desktopMenu, Applet *applet, bool
} }
} }
if (static_cast<Corona*>(q->scene())->immutability() == Mutable) {
if (!desktopMenu.isEmpty()) {
desktopMenu.addSeparator();
}
QAction *closeApplet = applet->d->actions.action("remove");
if (!closeApplet) { //unlikely but not impossible
closeApplet = new QAction(i18nc("%1 is the name of the applet", "Remove this %1", applet->name()), &desktopMenu);
closeApplet->setIcon(KIcon("edit-delete"));
QObject::connect(closeApplet, SIGNAL(triggered(bool)), applet, SLOT(destroy()));
}
desktopMenu.addAction(closeApplet);
}
KMenu *containmentMenu = new KMenu(i18nc("%1 is the name of the containment", "%1 Options", q->name()), &desktopMenu); KMenu *containmentMenu = new KMenu(i18nc("%1 is the name of the containment", "%1 Options", q->name()), &desktopMenu);
containmentActions(*containmentMenu); containmentActions(*containmentMenu);
if (!containmentMenu->isEmpty()) { if (!containmentMenu->isEmpty()) {
@ -537,24 +552,9 @@ void ContainmentPrivate::appletActions(KMenu &desktopMenu, Applet *applet, bool
desktopMenu.addMenu(containmentMenu); desktopMenu.addMenu(containmentMenu);
} }
} }
if (static_cast<Corona*>(q->scene())->immutability() == Mutable) {
if (!desktopMenu.isEmpty()) {
desktopMenu.addSeparator();
} }
QAction *closeApplet = applet->d->actions.action("remove"); bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet)
if (!closeApplet) { //unlikely but not impossible
closeApplet = new QAction(i18nc("%1 is the name of the applet", "Remove this %1", applet->name()), &desktopMenu);
closeApplet->setIcon(KIcon("edit-delete"));
QObject::connect(closeApplet, SIGNAL(triggered(bool)), applet, SLOT(destroy()));
}
desktopMenu.addAction(closeApplet);
}
}
bool ContainmentPrivate::showContextMenu(const QPointF &point,
const QPoint &screenPos, bool includeApplet)
{ {
Applet *applet = 0; Applet *applet = 0;