1/*
2 SPDX-FileCopyrightText: 2017 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <KRunner/AbstractRunner>
10
11#include "dbusutils_p.h"
12#include <QHash>
13#include <QImage>
14#include <QList>
15#include <QSet>
16
17namespace KRunner
18{
19class DBusRunner : public KRunner::AbstractRunner
20{
21 Q_OBJECT
22
23public:
24 explicit DBusRunner(QObject *parent, const KPluginMetaData &data);
25
26 // matchInternal is overwritten. Meaning we do not need the original match
27 void match(KRunner::RunnerContext &) override
28 {
29 }
30 void reloadConfiguration() override;
31 void run(const KRunner::RunnerContext &context, const KRunner::QueryMatch &match) override;
32
33 Q_INVOKABLE void matchInternal(KRunner::RunnerContext context);
34
35private:
36 void teardown();
37
38 // Returns RemoteActions with service name as key
39 void requestActions();
40 void requestActionsForService(const QString &service, const std::function<void()> &finishedCallback);
41 QList<QueryMatch> convertMatches(const QString &service, const RemoteMatches &remoteMatches);
42 void requestConfig();
43 static QImage decodeImage(const RemoteImage &remoteImage);
44 QSet<QString> m_matchingServices;
45 QHash<QString, QList<KRunner::Action>> m_actions;
46 const QString m_path;
47 const bool m_hasUniqueResults;
48 const bool m_requestActionsOnce;
49 bool m_actionsForSessionRequested = false;
50 bool m_matchWasCalled = false;
51 bool m_callLifecycleMethods = false;
52 const QString m_ifaceName;
53 QSet<QString> m_requestedActionServices;
54};
55}
56

source code of krunner/src/dbusrunner_p.h