From f771100e870ade6cd23fe449da1c76b3fa8c7a18 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 14 Jan 2021 19:28:30 +0200 Subject: [PATCH] plasmoid:show separator actions only for launchers --- plasmoid/package/contents/ui/ContextMenu.qml | 1 + plasmoid/package/contents/ui/abilities/Launchers.qml | 2 +- plasmoid/package/contents/ui/task/TaskItem.qml | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plasmoid/package/contents/ui/ContextMenu.qml b/plasmoid/package/contents/ui/ContextMenu.qml index 9b6e96936..96893ec76 100644 --- a/plasmoid/package/contents/ui/ContextMenu.qml +++ b/plasmoid/package/contents/ui/ContextMenu.qml @@ -827,6 +827,7 @@ PlasmaComponents.ContextMenu { PlasmaComponents.MenuItem { id: addInternalSeparatorItem enabled: !visualParent.tailItemIsSeparator || !visualParent.headItemIsSeparator + visible: visualParent.hasShownLauncher icon: "add" text: !visualParent.tailItemIsSeparator ? i18n("Add Tail Separator") : i18n("Add Head Separator") diff --git a/plasmoid/package/contents/ui/abilities/Launchers.qml b/plasmoid/package/contents/ui/abilities/Launchers.qml index 8644fa857..5f28780a3 100644 --- a/plasmoid/package/contents/ui/abilities/Launchers.qml +++ b/plasmoid/package/contents/ui/abilities/Launchers.qml @@ -203,7 +203,7 @@ Item { function inCurrentActivity(launcherUrl) { var activities = _launchers.tasksModel.launcherActivities(launcherUrl); - if (activities.length === 0 || activities.indexOf(_NULLACTIVITYID_) !== -1 || activities.indexOf(activityInfo.currentActivity) !== -1) { + if (activities.indexOf(_NULLACTIVITYID_) !== -1 || activities.indexOf(activityInfo.currentActivity) !== -1) { return true; } diff --git a/plasmoid/package/contents/ui/task/TaskItem.qml b/plasmoid/package/contents/ui/task/TaskItem.qml index b352498e9..fbb456dd9 100644 --- a/plasmoid/package/contents/ui/task/TaskItem.qml +++ b/plasmoid/package/contents/ui/task/TaskItem.qml @@ -136,6 +136,9 @@ Item { readonly property bool isHidden: !visible || isForcedHidden property bool isForcedHidden: false property bool isLauncher: (IsLauncher === true) ? true : false + property bool hasShownLauncher: (launchers.inCurrentActivity(taskItem.launcherUrl) + || launchers.inCurrentActivity(taskItem.launcherUrlWithIcon)) + && !root.inActivityChange /*update trigger when changing current activity*/ property bool isMinimized: (IsMinimized === true) ? true : false property bool isSeparator: false property bool isStartup: (IsStartup === true) ? true : false @@ -1234,9 +1237,6 @@ Item { launchers.launcherRemoved.connect(onLauncherChanged); parabolic.sglClearZoom.connect(sltClearZoom); - var hasShownLauncher = ((tasksModel.launcherPosition(taskItem.launcherUrl) !== -1) - || (tasksModel.launcherPosition(taskItem.launcherUrlWithIcon) !== -1) ); - //startup without launcher var hideStartup = ((!hasShownLauncher || !taskItem.launchers.inCurrentActivity(taskItem.launcherUrl)) && taskItem.isStartup);