Commit 20c5edd9 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Suspend matching if plugin is not auhorized

parent abcffd85
......@@ -33,7 +33,9 @@ ShellRunner::ShellRunner(QObject *parent, const QVariantList &args)
{
setObjectName(QStringLiteral("Command"));
setPriority(AbstractRunner::HighestPriority);
m_enabled = KAuthorized::authorize(QStringLiteral("run_command")) && KAuthorized::authorize(QStringLiteral("shell_access"));
// If the runner is not authorized we can suspend it
bool enabled = KAuthorized::authorize(QStringLiteral("run_command")) && KAuthorized::authorize(QStringLiteral("shell_access"));
suspendMatching(!enabled);
setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File |
Plasma::RunnerContext::NetworkLocation | Plasma::RunnerContext::UnknownType |
Plasma::RunnerContext::Help);
......@@ -51,10 +53,6 @@ ShellRunner::~ShellRunner()
void ShellRunner::match(Plasma::RunnerContext &context)
{
if (!context.isValid() || !m_enabled) {
return;
}
const QString term = context.query();
Plasma::QueryMatch match(this);
match.setId(term);
......
......@@ -38,7 +38,6 @@ class ShellRunner : public Plasma::AbstractRunner
QList<QAction *> actionsForMatch(const Plasma::QueryMatch &match) override;
private:
bool m_enabled;
QList<QAction *> m_actionList;
QIcon m_matchIcon;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment