From ce6088868b028ca5bee9aaca5fa370197a0b3d71 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Mon, 18 Oct 2021 11:33:02 +0200 Subject: [PATCH] Port to enum values for KAuthorized::authorize Task: https://phabricator.kde.org/T11948 --- applets/icon/iconapplet.cpp | 4 ++-- components/shellprivate/widgetexplorer/widgetexplorer.cpp | 2 +- runners/shell/shellrunner.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applets/icon/iconapplet.cpp b/applets/icon/iconapplet.cpp index 1a9cc05f1..fc7b7247d 100644 --- a/applets/icon/iconapplet.cpp +++ b/applets/icon/iconapplet.cpp @@ -128,7 +128,7 @@ void IconApplet::populate() // if this restriction is set, KIO won't allow running desktop files from outside // registered services, applications, and so on, in this case we'll use the original // .desktop file and lose the ability to customize it - if (!KAuthorized::authorize(QStringLiteral("run_desktop_files"))) { + if (!KAuthorized::authorize(KAuthorized::RUN_DESKTOP_FILES)) { populateFromDesktopFile(localUrlString); // we don't call setLocalPath here as we don't want to store localPath to be a system-location // so that the fact that we cannot edit is re-evaluated every time @@ -491,7 +491,7 @@ bool IconApplet::isAcceptableDrag(QObject *dropEvent) QMimeDatabase db; const QMimeType mimeType = db.mimeTypeForUrl(m_url); - if (KAuthorized::authorize(QStringLiteral("shell_access")) && isExecutable(mimeType)) { + if (KAuthorized::authorize(KAuthorized::SHELL_ACCESS) && isExecutable(mimeType)) { return true; } diff --git a/components/shellprivate/widgetexplorer/widgetexplorer.cpp b/components/shellprivate/widgetexplorer/widgetexplorer.cpp index aed4275d4..5937de6f0 100644 --- a/components/shellprivate/widgetexplorer/widgetexplorer.cpp +++ b/components/shellprivate/widgetexplorer/widgetexplorer.cpp @@ -195,7 +195,7 @@ QList WidgetExplorer::widgetsMenuActions() WidgetAction *action = nullptr; - if (KAuthorized::authorize(QStringLiteral("ghns"))) { + if (KAuthorized::authorize(KAuthorized::GHNS)) { action = new WidgetAction(QIcon::fromTheme(QStringLiteral("internet-services")), i18n("Download New Plasma Widgets"), this); connect(action, &QAction::triggered, this, &WidgetExplorer::downloadWidgets); actionList << action; diff --git a/runners/shell/shellrunner.cpp b/runners/shell/shellrunner.cpp index 31bfa471c..03b54e1f1 100644 --- a/runners/shell/shellrunner.cpp +++ b/runners/shell/shellrunner.cpp @@ -28,7 +28,7 @@ ShellRunner::ShellRunner(QObject *parent, const KPluginMetaData &metaData, const // The results from the services runner are preferred, consequently we set a low priority setPriority(AbstractRunner::LowestPriority); // If the runner is not authorized we can suspend it - bool enabled = KAuthorized::authorize(QStringLiteral("run_command")) && KAuthorized::authorize(QStringLiteral("shell_access")); + bool enabled = KAuthorized::authorize(QStringLiteral("run_command")) && KAuthorized::authorize(KAuthorized::SHELL_ACCESS); suspendMatching(!enabled); addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Finds commands that match :q:, using common shell syntax")));