From 17324b5da997df49845ea070ecebbff13715ad8f Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 12 Aug 2017 14:09:00 +0300 Subject: [PATCH] move Close window button to the end of ContextMenu -- try to not disturb the user workflow by providing him the Close option which is used very often as near as possible from the click event --- plasmoid/package/contents/ui/ContextMenu.qml | 120 +++++-------------- 1 file changed, 29 insertions(+), 91 deletions(-) diff --git a/plasmoid/package/contents/ui/ContextMenu.qml b/plasmoid/package/contents/ui/ContextMenu.qml index 24e9f7a0a..f72394a4b 100644 --- a/plasmoid/package/contents/ui/ContextMenu.qml +++ b/plasmoid/package/contents/ui/ContextMenu.qml @@ -753,55 +753,6 @@ PlasmaComponents.ContextMenu { //////END OF NEW ARCHITECTURE - - PlasmaComponents.MenuItem { - property QtObject configureAction: null - - visible: !latteDock - enabled: configureAction && configureAction.enabled - - text: configureAction ? configureAction.text : "" - icon: configureAction ? configureAction.icon : "" - - onClicked: configureAction.trigger() - - 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: { - if (root.zoomFactor>1) { - delayWindowRemovalTimer.modelIndex = menu.modelIndex; - delayWindowRemovalTimer.start(); - } else { - tasksModel.requestClose(menu.modelIndex); - } - } - } - - PlasmaComponents.MenuItem { - id: removePlasmoid - visible: !latteDock && !plasmoid.immutable - - text: plasmoid.action("remove").text - icon: plasmoid.action("remove").icon - - onClicked: plasmoid.action("remove").trigger(); - } - PlasmaComponents.MenuItem { separator: true } @@ -884,13 +835,12 @@ PlasmaComponents.ContextMenu { } PlasmaComponents.MenuItem { - id: altenativesMenuItem + id: alternativesMenuItem visible: root.editMode text: plasmoid.action("alternatives").text icon: plasmoid.action("alternatives").icon onClicked: plasmoid.action("alternatives").trigger(); - } PlasmaComponents.MenuItem { @@ -904,56 +854,44 @@ PlasmaComponents.ContextMenu { } PlasmaComponents.MenuItem { - id: containmentMenuItem - - visible: latteDock - enabled: visible + id: configureItem - icon: "latte-dock" - text: "Latte" + action: latteDock ? latteDock.containmentActions()[1] : plasmoid.action("configure") + } - PlasmaComponents.ContextMenu { - id: containmentSubMenu + PlasmaComponents.MenuItem { + id: removePlasmoid + visible: !latteDock && !plasmoid.immutable - visualParent: containmentMenuItem.action + text: plasmoid.action("remove").text + icon: plasmoid.action("remove").icon - function refresh() { - clearMenuItems(); + onClicked: plasmoid.action("remove").trigger(); + } - var actionList = latteDock.containmentActions(); + PlasmaComponents.MenuItem { + separator: true + visible: closeWindowItem.visible + } - var visibleActions=0; + //!move window Close button at the very bottom in order to not alter users workflow + //!comparing with the design decisions of other taskmanagers + PlasmaComponents.MenuItem { + id: closeWindowItem + visible: (visualParent && visualParent.m.IsLauncher !== true && visualParent.m.IsStartup !== true) - for (var i=0; i 1) { - for (var i=0; i1) { + delayWindowRemovalTimer.modelIndex = menu.modelIndex; + delayWindowRemovalTimer.start(); + } else { + tasksModel.requestClose(menu.modelIndex); } - - Component.onCompleted: refresh(); } } - }