From ac3058c77785c29ed1efd0e7ebf5385e8e39cd0e Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 2 Aug 2017 11:42:09 +0300 Subject: [PATCH] delay window removal when closing from context menu --- plasmoid/package/contents/ui/ContextMenu.qml | 9 ++++++++- plasmoid/package/contents/ui/main.qml | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/plasmoid/package/contents/ui/ContextMenu.qml b/plasmoid/package/contents/ui/ContextMenu.qml index 3fd317eed..24e9f7a0a 100644 --- a/plasmoid/package/contents/ui/ContextMenu.qml +++ b/plasmoid/package/contents/ui/ContextMenu.qml @@ -782,7 +782,14 @@ PlasmaComponents.ContextMenu { text: i18n("Close") icon: "window-close" - onClicked: tasksModel.requestClose(menu.modelIndex) + onClicked: { + if (root.zoomFactor>1) { + delayWindowRemovalTimer.modelIndex = menu.modelIndex; + delayWindowRemovalTimer.start(); + } else { + tasksModel.requestClose(menu.modelIndex); + } + } } PlasmaComponents.MenuItem { diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 9a25d491b..765d6f3d2 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -445,6 +445,21 @@ Item { } } + //! Timer to delay the removal of the window through the context menu in case the + //! the window is zoomed + Timer{ + id: delayWindowRemovalTimer + //this is the animation time needed in order for tasks to restore their zoom first + interval: 7 * (root.durationTime * units.shortDuration) + + property var modelIndex + + onTriggered: { + tasksModel.requestClose(delayWindowRemovalTimer.modelIndex) + } + } + + /////Window Previews/////////