summaryrefslogtreecommitdiff
path: root/kde-plasma/plasma-desktop/files/plasma-desktop-5.27.3-kicker-hide-separators.patch
blob: 30f95a901839006bf15dc4090be76e38a681deaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From d492a691d44a2878eb3c189219dc04260294bb77 Mon Sep 17 00:00:00 2001
From: Joshua Goins <josh@redstrate.com>
Date: Sat, 18 Mar 2023 10:39:49 -0400
Subject: [PATCH] applets/kicker: Hide separators when sorted alphabetically

Users are able to manually add separator items at custom positions in
their menu structures. When they do so, the location of these
separators are inherently custom, and only make sense when the menu
structure is being displayed in its custom order. When using the option
to display everything alphabetically, the separators' custom position
no longer exists and any automatic placement becomes nonsensical.

Currently, the separators get sorted to the beginning of the list,
which looks quite weird. This commit instead hides the separators when
sorting alphabetically. Only Kicker is affected by this change; the
underlying model providing the items is unchanged.

BUG: 465865
FIXED-IN: 5.27.4
(cherry picked from commit 90ad64ba638649b68cf2ffb7f68e227e86a8b8f1)
---
 applets/kicker/package/contents/ui/ItemListDelegate.qml | 4 +++-
 applets/kicker/package/contents/ui/ItemListDialog.qml   | 2 ++
 applets/kicker/package/contents/ui/ItemListView.qml     | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/applets/kicker/package/contents/ui/ItemListDelegate.qml b/applets/kicker/package/contents/ui/ItemListDelegate.qml
index 0eefe24e9e..ea7a0455c9 100644
--- a/applets/kicker/package/contents/ui/ItemListDelegate.qml
+++ b/applets/kicker/package/contents/ui/ItemListDelegate.qml
@@ -25,6 +25,7 @@ Item {
 
     readonly property real fullTextWidth: Math.ceil(icon.width + label.implicitWidth + arrow.width + row.anchors.leftMargin + row.anchors.rightMargin + row.actualSpacing)
     property bool isSeparator: (model.isSeparator === true)
+    property bool sorted: (model.sorted === true)
     property bool hasChildren: (model.hasChildren === true)
     property bool hasActionList: ((model.favoriteId !== null)
         || (("hasActionList" in model) && (model.hasActionList === true)))
@@ -251,7 +252,8 @@ Item {
         anchors.rightMargin: highlightItemSvg.margins.right
         anchors.verticalCenter: parent.verticalCenter
 
-        active: item.isSeparator
+        // Separator positions don't make sense when sorting everything alphabetically
+        active: item.isSeparator && !item.sorted
 
         asynchronous: false
         sourceComponent: separatorComponent
diff --git a/applets/kicker/package/contents/ui/ItemListDialog.qml b/applets/kicker/package/contents/ui/ItemListDialog.qml
index ffdb2e97c8..d97650cbbe 100644
--- a/applets/kicker/package/contents/ui/ItemListDialog.qml
+++ b/applets/kicker/package/contents/ui/ItemListDialog.qml
@@ -70,6 +70,8 @@ Kicker.SubMenu {
         Kicker.FunnelModel {
             id: funnelModel
 
+            property bool sorted: sourceModel.hasOwnProperty("sorted") ? sourceModel.sorted : false
+
             Component.onCompleted: {
                 kicker.reset.connect(funnelModel.reset);
             }
diff --git a/applets/kicker/package/contents/ui/ItemListView.qml b/applets/kicker/package/contents/ui/ItemListView.qml
index 29ff51da05..d931b9fcff 100644
--- a/applets/kicker/package/contents/ui/ItemListView.qml
+++ b/applets/kicker/package/contents/ui/ItemListView.qml
@@ -30,7 +30,7 @@ FocusScope {
     property int itemHeight: Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, PlasmaCore.Units.iconSizes.small)
         + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom,
         listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2
-    property int separatorHeight: lineSvg.horLineHeight + (2 * PlasmaCore.Units.smallSpacing)
+    property int separatorHeight: model.sorted === true ? 0 : lineSvg.horLineHeight + (2 * PlasmaCore.Units.smallSpacing)
 
     property alias currentIndex: listView.currentIndex
     property alias currentItem: listView.currentItem
-- 
GitLab