KRunner::RunnerManager Class
class KRunner::RunnerManagerThe RunnerManager class decides what installed runners are runnable, and their ratings. It is the main proxy to the runners. More...
Header: | #include <KRunner/RunnerManager> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Runner) target_link_libraries(mytarget PRIVATE KF6::Runner) |
Inherits: | QObject |
Properties
- history : const QStringList
- historyEnabled : bool
- querying : const bool
Public Functions
RunnerManager(QObject *parent = nullptr) | |
(since 6.0) | RunnerManager(const KConfigGroup &pluginConfigGroup, const KConfigGroup &stateGroup, QObject *parent) |
(since 5.78) QString | getHistorySuggestion(const QString &typedQuery) const |
(since 5.78) QStringList | history() const |
(since 5.78) bool | historyEnabled() |
KRunner::AbstractRunner * | loadRunner(const KPluginMetaData &pluginMetaData) |
QList<KRunner::QueryMatch> | matches() const |
QMimeData * | mimeDataForMatch(const KRunner::QueryMatch &match) const |
QString | query() const |
(since 6.7) bool | querying() const |
void | reloadConfiguration() |
(since 5.78) void | removeFromHistory(int index) |
(since 6.0) bool | run(const KRunner::QueryMatch &match, const KRunner::Action &action = {}) |
KRunner::AbstractRunner * | runner(const QString &pluginId) const |
QList<KRunner::AbstractRunner *> | runners() const |
KRunner::RunnerContext * | searchContext() const |
void | setAllowedRunners(const QStringList &runners) |
(since 6.0) void | setHistoryEnabled(bool enabled) |
Public Slots
void | launchQuery(const QString &term, const QString &runnerId = QString()) |
void | matchSessionComplete() |
void | reset() |
void | setupMatchSession() |
Signals
(since 5.78) void | historyEnabledChanged() |
void | matchesChanged(const QList<KRunner::QueryMatch> &matches) |
void | queryFinished() |
(since 6.7) void | queryingChanged() |
(since 6.0) void | requestUpdateQueryString(const QString &term, int cursorPosition) |
Static Public Members
(since 5.72) QList<KPluginMetaData> | runnerMetaDataList() |
Detailed Description
Property Documentation
[read-only]
history : const QStringList
Access functions:
QStringList | history() const |
historyEnabled : bool
Access functions:
bool | historyEnabled() |
void | setHistoryEnabled(bool enabled) |
Notifier signal:
void | historyEnabledChanged() |
[read-only]
querying : const bool
Access functions:
bool | querying() const |
Notifier signal:
void | queryingChanged() |
Member Function Documentation
[explicit]
RunnerManager::RunnerManager(QObject *parent = nullptr)
Constructs a RunnerManager using the default locations for state/plugin config
[explicit, since 6.0]
RunnerManager::RunnerManager(const KConfigGroup &pluginConfigGroup, const KConfigGroup &stateGroup, QObject *parent)
Constructs a RunnerManager with the given parameters
configurationGroup Config group used for reading enabled plugins
stateGroup Config group used for storing history
This function was introduced in 6.0.
[invokable, since 5.78]
QString RunnerManager::getHistorySuggestion(const QString &typedQuery) const
Get the suggested history entry for the typed query. If no entry is found an empty string is returned.
typedQuery
Returns completion for typedQuery
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
This function was introduced in 5.78.
[since 5.78]
QStringList RunnerManager::history() const
Returns History of this runner for the current activity. If the RunnerManager is not history aware the global entries will be returned.
Note: Getter function for property history.
This function was introduced in 5.78.
[since 5.78]
bool RunnerManager::historyEnabled()
If history completion is enabled, the default value is true.
Note: Getter function for property historyEnabled.
This function was introduced in 5.78.
See also setHistoryEnabled().
[signal, since 5.78]
void RunnerManager::historyEnabledChanged()
Note: Notifier signal for property historyEnabled.
This function was introduced in 5.78.
See also historyEnabled.
[slot]
void RunnerManager::launchQuery(const QString &term, const QString &runnerId = QString())
Launch a query, this will create threads and return immediately. When the information will be available can be known using the matchesChanged signal.
term the term we want to find matches for
runnerId optional, if only one specific runner is to be used; providing an id will put the manager into single runner mode
KRunner::AbstractRunner *RunnerManager::loadRunner(const KPluginMetaData &pluginMetaData)
Attempts to add the AbstractRunner plugin represented by the plugin info passed in. Usually one can simply let the configuration of plugins handle loading Runner plugins, but in cases where specific runners should be loaded this allows for that to take place
Note: Consider using setAllowedRunners in case you want to only allow specific runners
pluginMetaData the metaData to use to load the plugin
Returns the loaded runner or nullptr
[slot]
void RunnerManager::matchSessionComplete()
Call this method when the query session is finished for the time being.
See also prepareForMatchSession.
QList<KRunner::QueryMatch> RunnerManager::matches() const
Retrieves all available matches found so far for the previously launched query
[signal]
void RunnerManager::matchesChanged(const QList<KRunner::QueryMatch> &matches)
Emitted each time a new match is added to the list
QMimeData *RunnerManager::mimeDataForMatch(const KRunner::QueryMatch &match) const
Returns mime data of the specified match
QString RunnerManager::query() const
Returns the current query term set in launchQuery
[signal]
void RunnerManager::queryFinished()
Emitted when the launchQuery finish
[since 6.7]
bool RunnerManager::querying() const
If the RunnerManager is currently querying
Note: Getter function for property querying.
This function was introduced in 6.7.
[signal, since 6.7]
void RunnerManager::queryingChanged()
Emitted when the querying status has changed
Note: Notifier signal for property querying.
This function was introduced in 6.7.
void RunnerManager::reloadConfiguration()
Causes a reload of the current configuration
This gets called automatically when the config in the KCM is saved
[invokable, since 5.78]
void RunnerManager::removeFromHistory(int index)
Delete the given index from the history.
historyEntry
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
This function was introduced in 5.78.
[signal, since 6.0]
void RunnerManager::requestUpdateQueryString(const QString &term, int cursorPosition)
Put the given search term in the KRunner search field
term The term that should be displayed
cursorPosition Where the cursor should be positioned
This function was introduced in 6.0.
[slot]
void RunnerManager::reset()
Reset the current data and stops the query
[since 6.0]
bool RunnerManager::run(const KRunner::QueryMatch &match, const KRunner::Action &action = {})
Runs a given match. This also respects the extra handling for the InformationalMatch.
This also handles the history automatically
match the match to be executed
selectedAction the action returned by QueryMatch::actions that has been selected by the user, nullptr if none
Returns if the RunnerWindow should close
This function was introduced in 6.0.
KRunner::AbstractRunner *RunnerManager::runner(const QString &pluginId) const
Finds and returns a loaded runner or a nullptr
pluginId the name of the runner plugin
Returns Pointer to the runner
[static, since 5.72]
QList<KPluginMetaData> RunnerManager::runnerMetaDataList()
Returns metadata list of all known Runner plugins
This function was introduced in 5.72.
QList<KRunner::AbstractRunner *> RunnerManager::runners() const
Returns the list of all currently loaded runners
KRunner::RunnerContext *RunnerManager::searchContext() const
Retrieves the current context
Returns pointer to the current context
void RunnerManager::setAllowedRunners(const QStringList &runners)
Sets a whitelist for the plugins that can be loaded by this manager.
Runners that are disabled through the config will not be loaded.
plugins the plugin names of allowed runners
[since 6.0]
void RunnerManager::setHistoryEnabled(bool enabled)
Enables/disabled the history feature for the RunnerManager instance. The value will not be persisted and is only kept during the object's lifetime.
Note: Setter function for property historyEnabled.
This function was introduced in 6.0.
See also historyEnabled().
[slot]
void RunnerManager::setupMatchSession()
Call this method when the runners should be prepared for a query session. Call matchSessionComplete when the query session is finished for the time being.
See also matchSessionComplete.