BUG:180272

svn path=/branches/KDE/4.2/kdelibs/; revision=910419
This commit is contained in:
Beat Wolf 2009-01-13 11:28:56 +00:00
parent e4171154f9
commit 5f71a0228b

View File

@ -539,11 +539,26 @@ void ContainmentPrivate::appletActions(KMenu &desktopMenu, Applet *applet, bool
KMenu *containmentMenu = new KMenu(i18nc("%1 is the name of the containment", "%1 Options", q->name()), &desktopMenu);
containmentActions(*containmentMenu);
if (!containmentMenu->isEmpty()) {
if (!desktopMenu.isEmpty()) {
int enabled = 0;
//count number of real actions
foreach(QAction *action, containmentMenu->actions()) {
if(action->isEnabled() && !action->isSeparator()) {
enabled++;
}
}
if (enabled > 0) {
desktopMenu.addSeparator();
}
desktopMenu.addMenu(containmentMenu);
//if there is only one, don't create a submenu
if(enabled < 2) {
foreach(QAction *action, containmentMenu->actions()) {
desktopMenu.addAction(action);
}
} else {
desktopMenu.addMenu(containmentMenu);
}
}
if (static_cast<Corona*>(q->scene())->immutability() == Mutable) {