9#ifndef PLASMA_RUNNERMANAGER_H
10#define PLASMA_RUNNERMANAGER_H
15#include "krunner_export.h"
17#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 91)
20#include <KPluginMetaData>
24#include "abstractrunner.h"
30class AbstractRunnerTest;
38class RunnerManagerPrivate;
49 Q_PROPERTY(
bool retainPriorSearch READ retainPriorSearch)
50 Q_PROPERTY(QString priorSearch READ priorSearch WRITE setPriorSearch)
51 Q_PROPERTY(QStringList history READ history)
52 Q_PROPERTY(
bool historyEnabled READ historyEnabled NOTIFY historyEnabledChanged)
56 explicit RunnerManager(
const QString &configFile, QObject *parent =
nullptr);
57#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 76)
61 KRUNNER_DEPRECATED_VERSION(5, 76,
"use RunnerManager(const QString &configFile, QObject *parent) instead")
62 explicit RunnerManager(KConfigGroup &config, QObject *parent =
nullptr);
73#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 82)
79 KRUNNER_DEPRECATED_VERSION(5,
81 "The dedicated singleRunnerMode methods are deprecated, use runner(const QString &pluginName) with the singleRunnerId instead")
93 KRUNNER_DEPRECATED_VERSION(5,
95 "The dedicated singleRunnerMode methods are deprecated, pass in the singleModeRunnerId into the launchQuery overload instead")
96 void setSingleModeRunnerId(const QString &
id);
103 KRUNNER_DEPRECATED_VERSION(5, 82, "The dedicated singleRunnerMode methods are deprecated, save the variable before using it in launchQuery() instead")
104 QString singleModeRunnerId() const;
111 KRUNNER_DEPRECATED_VERSION(
114 "The dedicated singleRunnerMode methods are deprecated, call the
RunnerContext::singleRunnerQueryMode on the searchContext instead")
115 bool singleMode() const;
125 KRUNNER_DEPRECATED_VERSION(5,
127 "The dedicated singleRunnerMode methods are deprecated, the single mode is set to true when launchQuery is called with a non "
128 "empty and existing runnerId")
129 void setSingleMode(
bool singleMode);
136 KRUNNER_DEPRECATED_VERSION(5, 81, "filter the runners manually using the X-Plasma-AdvertiseSingleRunnerQueryMode of the metadata")
137 QStringList singleModeAdvertisedRunnerIds() const;
146 KRUNNER_DEPRECATED_VERSION(5, 81, "call runner(const QString &
id) and fetch the name from the returned
object instead")
147 QString runnerName(const QString &
id) const;
173#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 79)
179 KRUNNER_DEPRECATED_VERSION(5, 79,
"Use run(const QueryMatch &match) instead")
180 void run(const QString &
id);
263#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 76)
270 KRUNNER_DEPRECATED_VERSION(5, 76,
"feature is unused and not supported by most runners")
271 void setEnabledCategories(const QStringList &categories);
274#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 72)
275#if KSERVICE_BUILD_DEPRECATED_SINCE(5, 0)
287 KRUNNER_DEPRECATED_VERSION(5, 72,
"use loadRunner(const KPluginMetaData &)")
288 void loadRunner(const KService::Ptr service);
304#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 77)
315 KRUNNER_DEPRECATED_VERSION_BELATED(5, 77, 5, 0,
"the KPackage support was removed in Plasma 5.0")
316 void loadRunner(const QString &path);
319#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 88)
325 KRUNNER_DEPRECATED_VERSION(5, 88,
"reading allowed runners from the config is deprecated, use runners() and get their ids instead")
326 QStringList allowedRunners() const;
329#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 76)
334 KRUNNER_DEPRECATED_VERSION(5, 76,
"feature is unused and not supported by most runners")
335 QStringList enabledCategories() const;
344#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 79)
350 KRUNNER_DEPRECATED_VERSION(5, 79,
"Use mimeDataForMatch(const QueryMatch &match) instead")
351 QMimeData *mimeDataForMatch(const QString &matchId) const;
354#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 85)
367 KRUNNER_DEPRECATED_VERSION(5, 85,
"The concept of parent apps for runners is deprecated, use no-arg overload instead")
368 static QVector<KPluginMetaData> runnerMetaDataList(const QString &parentApp);
377#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 72)
390 KRUNNER_DEPRECATED_VERSION(5, 72,
"Use runnerMetaDataList() instead")
391 static KPluginInfo::List listRunnerInfo(const QString &parentApp = QString());
468 Q_PRIVATE_SLOT(d,
void jobDone(ThreadWeaver::JobPointer))
469 KPluginMetaData convertDBusRunnerToJson(
const QString &filename)
const;
472 std::unique_ptr<RunnerManagerPrivate>
const d;
474 friend class RunnerManagerPrivate;
475 friend AbstractRunnerTest;
479#if !KRUNNER_ENABLE_DEPRECATED_SINCE(5, 91)
An abstract base class for Plasma Runner plugins.
Definition abstractrunner.h:69
A match returned by an AbstractRunner in response to a given RunnerContext.
Definition querymatch.h:35
The RunnerContext class provides information related to a search, including the search term,...
Definition runnercontext.h:32
The RunnerManager class decides what installed runners are runnable, and their ratings.
Definition runnermanager.h:47
void historyEnabledChanged()
QList< QAction * > actionsForMatch(const QueryMatch &match)
Retrieves the list of actions, if any, for a match.
void setAllowedRunners(const QStringList &runners)
Sets a whitelist for the plugins that can be loaded by this manager.
void setPriorSearch(const QString &search)
Set the prior search for this runner.
void matchesChanged(const QList< Plasma::QueryMatch > &matches)
Emitted each time a new match is added to the list.
bool retainPriorSearch()
If the prior search should be restored when KRunner is reopened.
void run(const QueryMatch &match)
Runs a given match.
static QVector< KPluginMetaData > runnerMetaDataList()
QList< AbstractRunner * > runners() const
AbstractRunner * runner(const QString &pluginName) const
Finds and returns a loaded runner or NULL.
void matchSessionComplete()
Call this method when the query session is finished for the time being.
void queryFinished()
Emitted when the launchQuery finish.
void enableKNotifyPluginWatcher()
If you call this method the manager will create a KConfigWatcher which reload its runners or the runn...
QList< QueryMatch > matches() const
Retrieves all available matches found so far for the previously launched query.
QString getHistorySuggestion(const QString &typedQuery) const
Get the suggested history entry for the typed query.
void reset()
Reset the current data and stops the query.
void removeFromHistory(int index)
Delete the given index from the history.
bool historyEnabled()
If history completion is enabled, the default value is true.
void setSearchTerm(const QString &term, int cursorPosition)
Put the given search term in the KRunner search field.
void reloadConfiguration()
Causes a reload of the current configuration.
QStringList history() const
QMimeData * mimeDataForMatch(const QueryMatch &match) const
bool runMatch(const QueryMatch &match)
Runs a given match.
void loadRunner(const KPluginMetaData &pluginMetaData)
Attempts to add the AbstractRunner plugin represented by the plugin info passed in.
RunnerContext * searchContext() const
Retrieves the current context.
void setupMatchSession()
Call this method when the runners should be prepared for a query session.
QString priorSearch() const
Get the suggested prior search for this runner.
void launchQuery(const QString &term, const QString &runnerId)
Launch a query, this will create threads and return immediately.
void launchQuery(const QString &term)
Convenience version of above.