Changeset View
Changeset View
Standalone View
Standalone View
runners/baloo/baloosearchrunner.h
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * This file is part of the KDE Baloo Project | 2 | * This file is part of the KDE Baloo Project | ||
3 | * Copyright (C) 2014 Vishesh Handa <me@vhanda.in> | 3 | * Copyright (C) 2014 Vishesh Handa <me@vhanda.in> | ||
4 | * Copyright (C) 2017 David Edmundson <davidedmundson@kde.org> | ||||
4 | * | 5 | * | ||
5 | * This library is free software; you can redistribute it and/or | 6 | * This library is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU Lesser General Public | 7 | * modify it under the terms of the GNU Lesser General Public | ||
7 | * License as published by the Free Software Foundation; either | 8 | * License as published by the Free Software Foundation; either | ||
8 | * version 2.1 of the License, or (at your option) any later version. | 9 | * version 2.1 of the License, or (at your option) any later version. | ||
9 | * | 10 | * | ||
10 | * This library is distributed in the hope that it will be useful, | 11 | * This library is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * Lesser General Public License for more details. | 14 | * Lesser General Public License for more details. | ||
14 | * | 15 | * | ||
15 | * You should have received a copy of the GNU Lesser General Public | 16 | * You should have received a copy of the GNU Lesser General Public | ||
16 | * License along with this library; if not, write to the Free Software | 17 | * License along with this library; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | * | 19 | * | ||
19 | */ | 20 | */ | ||
20 | 21 | | |||
21 | #ifndef _BALOO_SEARCH_RUNNER_H_ | 22 | #ifndef _BALOO_SEARCH_RUNNER_H_ | ||
22 | #define _BALOO_SEARCH_RUNNER_H_ | 23 | #define _BALOO_SEARCH_RUNNER_H_ | ||
23 | 24 | | |||
24 | #include <KRunner/AbstractRunner> | 25 | #include <QObject> | ||
26 | #include <QDBusContext> | ||||
27 | #include <QDBusMessage> | ||||
28 | | ||||
25 | #include <KRunner/QueryMatch> | 29 | #include <KRunner/QueryMatch> | ||
30 | #include "dbusutils_p.h" | ||||
26 | 31 | | |||
27 | class QMimeData; | 32 | class QTimer; | ||
28 | 33 | | |||
29 | class SearchRunner : public Plasma::AbstractRunner | 34 | class SearchRunner : public QObject, protected QDBusContext | ||
30 | { | 35 | { | ||
31 | Q_OBJECT | 36 | Q_OBJECT | ||
32 | 37 | | |||
33 | public: | 38 | public: | ||
34 | SearchRunner(QObject* parent, const QVariantList& args); | 39 | SearchRunner(QObject* parent=0); | ||
35 | SearchRunner(QObject* parent, const QString& serviceId = QString()); | | |||
36 | ~SearchRunner() override; | 40 | ~SearchRunner() override; | ||
37 | 41 | | |||
38 | void match(Plasma::RunnerContext& context) override; | 42 | RemoteActions Actions(); | ||
39 | void run(const Plasma::RunnerContext& context, const Plasma::QueryMatch& action) override; | 43 | RemoteMatches Match(const QString &searchTerm); | ||
40 | 44 | void Run(const QString &id, const QString &actionId); | |||
41 | QStringList categories() const override; | | |||
42 | QIcon categoryIcon(const QString& category) const override; | | |||
43 | | ||||
44 | QList<QAction *> actionsForMatch(const Plasma::QueryMatch &match) override; | | |||
45 | QMimeData *mimeDataForMatch(const Plasma::QueryMatch &match) override; | | |||
46 | | ||||
47 | protected Q_SLOTS: | | |||
48 | void init() override; | | |||
49 | 45 | | |||
50 | private: | 46 | private: | ||
51 | QList<Plasma::QueryMatch> match(Plasma::RunnerContext& context, const QString& type, | 47 | void performMatch(); | ||
48 | RemoteMatches matchInternal(const QString &searchTerm, const QString& type, | ||||
52 | const QString& category); | 49 | const QString& category); | ||
50 | | ||||
51 | QDBusMessage m_lastRequest; | ||||
52 | QString m_searchTerm; | ||||
53 | QTimer *m_timer; | ||||
53 | }; | 54 | }; | ||
54 | 55 | | |||
55 | #endif // _BALOO_SEARCH_RUNNER_H_ | 56 | #endif // _BALOO_SEARCH_RUNNER_H_ |