[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-workspace] /: [KRunner] Show configure button only if not forbidden by KIOSK restriction
From:       Kai Uwe Broulik <null () kde ! org>
Date:       2017-11-29 13:14:47
Message-ID: E1eK2CN-000281-7I () code ! kde ! org
[Download RAW message or body]

Git commit 853333c2ef3bcfa65c3f5cbc291ae2c7719e9512 by Kai Uwe Broulik.
Committed on 29/11/2017 at 13:14.
Pushed by broulik into branch 'master'.

[KRunner] Show configure button only if not forbidden by KIOSK restriction

Differential Revision: https://phabricator.kde.org/D9050

M  +6    -0    krunner/view.cpp
M  +2    -0    krunner/view.h
M  +1    -0    lookandfeel/contents/runcommand/RunCommand.qml

https://commits.kde.org/plasma-workspace/853333c2ef3bcfa65c3f5cbc291ae2c771=
9e9512

diff --git a/krunner/view.cpp b/krunner/view.cpp
index 0b221561..a2ee843b 100644
--- a/krunner/view.cpp
+++ b/krunner/view.cpp
@@ -28,6 +28,7 @@
 #include <QClipboard>
 #include <QPlatformSurfaceEvent>
 =

+#include <KAuthorized>
 #include <KWindowSystem>
 #include <KWindowEffects>
 #include <KAuthorized>
@@ -400,6 +401,11 @@ void View::displayConfiguration()
     QProcess::startDetached(QStringLiteral("kcmshell5"), QStringList() << =
QStringLiteral("plasmasearch"));
 }
 =

+bool View::canConfigure() const
+{
+    return KAuthorized::authorizeControlModule(QStringLiteral("kcm_plasmas=
earch.desktop"));
+}
+
 QStringList View::history() const
 {
     return m_history;
diff --git a/krunner/view.h b/krunner/view.h
index 86c0c3c8..e23f4c22 100644
--- a/krunner/view.h
+++ b/krunner/view.h
@@ -46,6 +46,7 @@ class View : public PlasmaQuick::Dialog
     Q_OBJECT
     Q_CLASSINFO("D-Bus Interface", "org.kde.krunner.App")
 =

+    Q_PROPERTY(bool canConfigure READ canConfigure CONSTANT)
     Q_PROPERTY(QStringList history READ history NOTIFY historyChanged)
 =

 public:
@@ -57,6 +58,7 @@ public:
     bool freeFloating() const;
     void setFreeFloating(bool floating);
 =

+    bool canConfigure() const;
     QStringList history() const;
 =

     Q_INVOKABLE void addToHistory(const QString &item);
diff --git a/lookandfeel/contents/runcommand/RunCommand.qml b/lookandfeel/c=
ontents/runcommand/RunCommand.qml
index e2133e4f..bcdb08ac 100644
--- a/lookandfeel/contents/runcommand/RunCommand.qml
+++ b/lookandfeel/contents/runcommand/RunCommand.qml
@@ -60,6 +60,7 @@ ColumnLayout {
             }
             Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel=
", "Configure")
             Accessible.description: i18nd("plasma_lookandfeel_org.kde.look=
andfeel", "Configure Search Plugins")
+            visible: runnerWindow.canConfigure
         }
         PlasmaComponents.TextField {
             id: queryField
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic