--- a/src/contents/ui/pages/PowerfulWhenNeeded.qml +++ b/src/contents/ui/pages/PowerfulWhenNeeded.qml @@ -103,6 +103,7 @@ GenericPage { subtitle: i18nc("@info Caption for Get Hot New Stuff button", "Extend the system with add-ons") buttonIcon: "get-hot-new-stuff" onClicked: pageStack.layers.push(ghnsView); + visible: Controller.isAuthorized("ghns"); } } --- a/src/contents/ui/main.qml +++ b/src/contents/ui/main.qml @@ -141,7 +141,9 @@ Kirigami.ApplicationWindow { } pageStack.push(contribute); - pageStack.push(donate); + if (Controller.isAuthorized("action/help_donate")) { + pageStack.push(donate); + } pageStack.currentIndex = 0; } } --- a/src/controller.h +++ b/src/controller.h @@ -11,6 +11,7 @@ class Controller : public QObject { Q_OBJECT public: + Q_INVOKABLE bool isAuthorized(const QString &test_action); Q_INVOKABLE static void launchApp(const QString &program); Q_INVOKABLE static void runCommand(const QString &command); Q_INVOKABLE static void runCommand(const QString &command, const QString &desktopFilename); --- a/src/controller.cpp +++ b/src/controller.cpp @@ -19,6 +19,7 @@ #include #include #include +#include void Controller::launchApp(const QString &program) { @@ -27,6 +28,11 @@ void Controller::launchApp(const QString job->start(); } +bool Controller::isAuthorized(const QString &test_action) +{ + return KAuthorized::authorize(test_action); +} + void Controller::runCommand(const QString &command) { runCommand(command, QString());