From f4201a8a71f10b02e1cfa761f8a2b588083b1421 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 3 Jan 2017 16:17:28 +0200 Subject: [PATCH] improve menu behavior and appearance --- app/dockview.cpp | 6 ++- plasmoid/contents/ui/ContextMenu.qml | 60 +++++++++++++++++++--------- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/app/dockview.cpp b/app/dockview.cpp index 2127c2a0c..995e7de94 100644 --- a/app/dockview.cpp +++ b/app/dockview.cpp @@ -81,8 +81,12 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen) QAction *lockWidgetsAction = containment()->actions()->action("lock widgets"); containment()->actions()->removeAction(lockWidgetsAction); + //FIX: hide and not delete in order to disable a nasty behavior from + //ContainmentInterface. If only one action exists for containment the + //this action is triggered directly QAction *addWidgetsAction = containment()->actions()->action("add widgets"); - containment()->actions()->removeAction(addWidgetsAction); + addWidgetsAction->setVisible(false); + //containment()->actions()->removeAction(addWidgetsAction); }, Qt::DirectConnection); } diff --git a/plasmoid/contents/ui/ContextMenu.qml b/plasmoid/contents/ui/ContextMenu.qml index dccd1e798..1a229ef29 100644 --- a/plasmoid/contents/ui/ContextMenu.qml +++ b/plasmoid/contents/ui/ContextMenu.qml @@ -607,6 +607,27 @@ PlasmaComponents.ContextMenu { Component.onCompleted: configureAction = plasmoid.action("configure") } + + PlasmaComponents.MenuItem { + separator: true + } + + PlasmaComponents.MenuItem { + id: closeWindowItem + visible: (visualParent && visualParent.m.IsLauncher !== true && visualParent.m.IsStartup !== true) + + enabled: visualParent && visualParent.m.IsClosable === true + + text: i18n("Close") + icon: "window-close" + + onClicked: tasksModel.requestClose(visualParent.modelIndex()) + } + + PlasmaComponents.MenuItem { + separator: true + } + PlasmaComponents.MenuItem { id: containmentMenuItem @@ -626,16 +647,32 @@ PlasmaComponents.ContextMenu { var actionList = nowDockPanel.containmentActions(); - if (actionList.length > 1) { + var visibleActions=0; + + for (var i=0; i 1) { for (var i=0; i