Port to KAction

master^2
Björn Bidar 2 years ago
parent 18a018f7ed
commit e058f61640
  1. 3
      pass.cpp
  2. 7
      pass.h

@ -19,6 +19,7 @@
#include <KLocalizedString>
#include <KNotification>
#include <QIcon>
#include <QAction>
#include <QDirIterator>
#include <QProcess>
@ -84,11 +85,9 @@ void Pass::reloadConfiguration()
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
auto icon = QIcon::fromTheme(passAction.icon, QIcon::fromTheme("object-unlocked"));
//KRunner::Action(actionId, QStringLiteral("process-stop"), i18n("Send SIGKILL")),
auto *act = new QAction(icon, passAction.name, this);
act->setData(passAction.regex);
#else
actionIdCounter++;
auto *act = new KRunner::Action(passAction.regex, QIcon::hasThemeIcon(passAction.icon) ?
passAction.icon : QStringLiteral("object-unlocked"), passAction.name);
#endif

@ -50,7 +50,10 @@ public:
void clip(const QString &msg);
void match(KRunner::RunnerContext &) override;
void run(const KRunner::RunnerContext &, const KRunner::QueryMatch &) override;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QList<QAction *> actionsForMatch(const KRunner::QueryMatch &) override;
#endif
void reloadConfiguration() override;
@ -71,7 +74,11 @@ private:
QFileSystemWatcher watcher;
bool showActions;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QList<QAction *> orderedActions;
#else
QList<KRunner::Action *> orderedActions;
#endif
const QRegularExpression queryPrefix = QRegularExpression("^pass( .+)?$");
};

Loading…
Cancel
Save