From d492a691d44a2878eb3c189219dc04260294bb77 Mon Sep 17 00:00:00 2001 From: Joshua Goins 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