File 0018-Take-into-account-kiosk-restrictions-for-when-appmen.patch of Package plasma5-workspace

From 692a3db4f2ac9975f27a291716f3b5c900a6a73f Mon Sep 17 00:00:00 2001
From: Kai Uwe Broulik <kde@privat.broulik.de>
Date: Wed, 11 Jan 2017 16:48:23 +0100
Subject: [PATCH 18/44] Take into account kiosk restrictions for when appmenu
 is disabled

There's no point in telling the user to go to a settings module that is restricted.
Also disallow going there in this case.
---
 applets/appmenu/package/contents/ui/main.qml | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/applets/appmenu/package/contents/ui/main.qml b/applets/appmenu/package/contents/ui/main.qml
index 3a47eee4..a4f6ec66 100644
--- a/applets/appmenu/package/contents/ui/main.qml
+++ b/applets/appmenu/package/contents/ui/main.qml
@@ -34,6 +34,8 @@ Item {
     readonly property bool view: plasmoid.configuration.compactView
     readonly property bool menuAvailable: appMenuModel.menuAvailable
 
+    readonly property bool kcmAuthorized: KCMShell.authorize(["style.desktop"]).length > 0
+
     onViewChanged: {
         plasmoid.nativeInterface.view = view
     }
@@ -49,7 +51,7 @@ Item {
         Layout.fillHeight: false
         Layout.minimumWidth: implicitWidth
         Layout.maximumWidth: implicitWidth
-        enabled: appletEnabled ? menuAvailable : true
+        enabled: appletEnabled ? menuAvailable : kcmAuthorized
         checkable: appletEnabled && menuAvailable && plasmoid.nativeInterface.currentIndex === fakeIndex
         checked: checkable
         iconSource: appletEnabled ? i18n("application-menu") : i18n("emblem-warning")
@@ -59,8 +61,6 @@ Item {
             } else {
                 KCMShell.open("style")
             }
-
-
         }
     }
 
@@ -108,7 +108,9 @@ Item {
         }
     }
 
-    Plasmoid.toolTipSubText: !appletEnabled ? i18n("Application Menu Widget is disabled in settings.\n\nGo to System Settings > Application Style > Fine Tuning (tab) to enable it.") : ""
+    Plasmoid.toolTipMainText: appletEnabled ? "" : i18n("Application Menu Widget is disabled")
+    Plasmoid.toolTipSubText: appletEnabled || !root.kcmAuthorized ? ""
+                            : i18nc("it being the 'Application Menu Widget'", "Go to System Settings > Application Style > Fine Tuning (tab) to enable it.");
 
     AppMenuPrivate.AppMenuModel {
         id: appMenuModel
-- 
2.12.0

openSUSE Build Service is sponsored by