From f430123d8dc44f6b5a5d0e2c233e36bb0c0270ee Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Thu, 17 Jun 2021 23:18:59 +0400 Subject: [PATCH] Use introduced writable active in MnemonicData AppMenu is using it's own way to remove mnemonics but then they still are being processed by Kirigami's MnemonicAttached. This commit adapts AppMenu for use with writable active property to show mnemonics underlines based on own logic. --- applets/appmenu/package/contents/ui/main.qml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/applets/appmenu/package/contents/ui/main.qml b/applets/appmenu/package/contents/ui/main.qml index 8792e1169..2b079c75f 100644 --- a/applets/appmenu/package/contents/ui/main.qml +++ b/applets/appmenu/package/contents/ui/main.qml @@ -25,6 +25,7 @@ import org.kde.kquickcontrolsaddons 2.0 // For KCMShell import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.private.appmenu 1.0 as AppMenuPrivate +import org.kde.kirigami 2.5 as Kirigami Item { id: root @@ -118,19 +119,8 @@ Item { Layout.fillWidth: root.vertical Layout.fillHeight: !root.vertical - text: { - var text = activeMenu; - - var alt = keystateSource.data.Alt; - if (!alt || !alt.Pressed) { - // StyleHelpers.removeMnemonics - text = text.replace(/([^&]*)&(.)([^&]*)/g, function (match, p1, p2, p3) { - return p1.concat(p2, p3); - }); - } - - return text; - } + text: activeMenu + Kirigami.MnemonicData.active: keystateSource.data.Alt && keystateSource.data.Alt.Pressed // fake highlighted checkable: plasmoid.nativeInterface.currentIndex === index checked: checkable