File indexing completed on 2024-05-19 13:25:27
0001 /* 0002 SPDX-FileCopyrightText: 2006 Aaron Seigo <aseigo@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #pragma once 0008 0009 #include <KRunner/AbstractRunner> 0010 #include <QIcon> 0011 #include <optional> 0012 0013 /** 0014 * This class runs programs using the literal name of the binary, much as one 0015 * would use at a shell prompt. 0016 */ 0017 class ShellRunner : public Plasma::AbstractRunner 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 ShellRunner(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args); 0023 ~ShellRunner() override; 0024 0025 void match(Plasma::RunnerContext &context) override; 0026 void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action) override; 0027 0028 private: 0029 std::optional<QString> parseShellCommand(const QString &query, QStringList &envs); 0030 QList<QAction *> m_actionList; 0031 QIcon m_matchIcon; 0032 };