KRunner 5.109.0
Properties | Signals | Public Slots | Public Member Functions | Static Public Member Functions | List of all members
Plasma::RunnerManager

The RunnerManager class decides what installed runners are runnable, and their ratings. More...

#include <KRunner/RunnerManager>

Properties

QStringList history
 
bool historyEnabled
 
QString priorSearch
 
bool retainPriorSearch
 

Signals

void historyEnabledChanged ()
 
void matchesChanged (const QList< Plasma::QueryMatch > &matches)
 Emitted each time a new match is added to the list.
 
void queryFinished ()
 Emitted when the launchQuery finish.
 
void setSearchTerm (const QString &term, int cursorPosition)
 Put the given search term in the KRunner search field.
 

Public Slots

void launchQuery (const QString &term)
 Convenience version of above.
 
void launchQuery (const QString &term, const QString &runnerId)
 Launch a query, this will create threads and return immediately.
 
void matchSessionComplete ()
 Call this method when the query session is finished for the time being.
 
void reset ()
 Reset the current data and stops the query.
 
void setupMatchSession ()
 Call this method when the runners should be prepared for a query session.
 

Public Member Functions

 RunnerManager (const QString &configFile, QObject *parent=nullptr)
 
 RunnerManager (QObject *parent=nullptr)
 
QList< QAction * > actionsForMatch (const QueryMatch &match)
 Retrieves the list of actions, if any, for a match.
 
void enableKNotifyPluginWatcher ()
 If you call this method the manager will create a KConfigWatcher which reload its runners or the runner configuration when the settings in the KCM are edited.
 
QString getHistorySuggestion (const QString &typedQuery) const
 Get the suggested history entry for the typed query.
 
QStringList history () const
 
bool historyEnabled ()
 If history completion is enabled, the default value is true.
 
void loadRunner (const KPluginMetaData &pluginMetaData)
 Attempts to add the AbstractRunner plugin represented by the plugin info passed in.
 
QList< QueryMatchmatches () const
 Retrieves all available matches found so far for the previously launched query.
 
QMimeData * mimeDataForMatch (const QueryMatch &match) const
 
QString priorSearch () const
 Get the suggested prior search for this runner.
 
QString query () const
 
void reloadConfiguration ()
 Causes a reload of the current configuration.
 
void removeFromHistory (int index)
 Delete the given index from the history.
 
bool retainPriorSearch ()
 If the prior search should be restored when KRunner is reopened.
 
void run (const QueryMatch &match)
 Runs a given match.
 
bool runMatch (const QueryMatch &match)
 Runs a given match.
 
AbstractRunnerrunner (const QString &pluginName) const
 Finds and returns a loaded runner or NULL.
 
QList< AbstractRunner * > runners () const
 
RunnerContextsearchContext () const
 Retrieves the current context.
 
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.
 

Static Public Member Functions

static QVector< KPluginMetaData > runnerMetaDataList ()
 

Detailed Description

The RunnerManager class decides what installed runners are runnable, and their ratings.

It is the main proxy to the runners.

Member Function Documentation

◆ actionsForMatch()

QList< QAction * > Plasma::RunnerManager::actionsForMatch ( const QueryMatch match)

Retrieves the list of actions, if any, for a match.

◆ enableKNotifyPluginWatcher()

void Plasma::RunnerManager::enableKNotifyPluginWatcher ( )

If you call this method the manager will create a KConfigWatcher which reload its runners or the runner configuration when the settings in the KCM are edited.

Since
5.73
See also
reloadConfiguration

◆ getHistorySuggestion()

QString Plasma::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.

Parameters
typedQuery
Returns
completion for typedQuery
Since
5.78

◆ history()

QStringList Plasma::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.
Since
5.78

◆ historyEnabled()

bool Plasma::RunnerManager::historyEnabled ( )

If history completion is enabled, the default value is true.

Since
5.78

◆ historyEnabledChanged

void Plasma::RunnerManager::historyEnabledChanged ( )
signal
See also
historyEnabled
Since
5.78

◆ launchQuery [1/2]

void Plasma::RunnerManager::launchQuery ( const QString &  term)
slot

Convenience version of above.

◆ launchQuery [2/2]

void Plasma::RunnerManager::launchQuery ( const QString &  term,
const QString &  runnerId 
)
slot

Launch a query, this will create threads and return immediately.

When the information will be available can be known using the matchesChanged signal.

Parameters
termthe term we want to find matches for
runnerIdoptional, if only one specific runner is to be used; providing an id will put the manager into single runner mode

◆ loadRunner()

void Plasma::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

Parameters
pluginMetaDatathe metaData to use to load the plugin
Since
5.72

◆ matches()

QList< QueryMatch > Plasma::RunnerManager::matches ( ) const

Retrieves all available matches found so far for the previously launched query.

Returns
List of matches

◆ matchesChanged

void Plasma::RunnerManager::matchesChanged ( const QList< Plasma::QueryMatch > &  matches)
signal

Emitted each time a new match is added to the list.

◆ matchSessionComplete

void Plasma::RunnerManager::matchSessionComplete ( )
slot

Call this method when the query session is finished for the time being.

Since
4.4
See also
prepareForMatchSession

◆ mimeDataForMatch()

QMimeData * Plasma::RunnerManager::mimeDataForMatch ( const QueryMatch match) const
Returns
mime data of the specified match
Since
4.5

◆ priorSearch()

QString Plasma::RunnerManager::priorSearch ( ) const

Get the suggested prior search for this runner.

Just like the history this value can be activity specific, depending on the build/config.

Returns
priorSearch
Since
5.78

◆ query()

QString Plasma::RunnerManager::query ( ) const
Returns
the current query term

◆ queryFinished

void Plasma::RunnerManager::queryFinished ( )
signal

Emitted when the launchQuery finish.

Since
4.5

◆ reloadConfiguration()

void Plasma::RunnerManager::reloadConfiguration ( )

Causes a reload of the current configuration.

◆ removeFromHistory()

void Plasma::RunnerManager::removeFromHistory ( int  index)

Delete the given index from the history.

Parameters
historyEntry
Since
5.78

◆ reset

void Plasma::RunnerManager::reset ( )
slot

Reset the current data and stops the query.

◆ retainPriorSearch()

bool Plasma::RunnerManager::retainPriorSearch ( )

If the prior search should be restored when KRunner is reopened.

Since
5.78

◆ run()

void Plasma::RunnerManager::run ( const QueryMatch match)

Runs a given match.

Parameters
matchthe match to be executed

◆ runMatch()

bool Plasma::RunnerManager::runMatch ( const QueryMatch match)

Runs a given match.

This also respects the extra handling for the InformationalMatch. This also handles the history automatically

Parameters
matchthe match to be executed
Returns
if the RunnerWindow should close
Since
5.78

◆ runner()

AbstractRunner * Plasma::RunnerManager::runner ( const QString &  pluginName) const

Finds and returns a loaded runner or NULL.

Parameters
pluginNamethe name of the runner plugin
Returns
Pointer to the runner

◆ runnerMetaDataList()

static QVector< KPluginMetaData > Plasma::RunnerManager::runnerMetaDataList ( )
static
Returns
metadata list of all known Runner implementations
Since
5.72

◆ runners()

QList< AbstractRunner * > Plasma::RunnerManager::runners ( ) const
Returns
the list of all currently loaded runners

◆ searchContext()

RunnerContext * Plasma::RunnerManager::searchContext ( ) const

Retrieves the current context.

Returns
pointer to the current context

◆ setAllowedRunners()

void Plasma::RunnerManager::setAllowedRunners ( const QStringList &  runners)

Sets a whitelist for the plugins that can be loaded by this manager.

Parameters
pluginsthe plugin names of allowed runners
Since
4.4

◆ setPriorSearch()

void Plasma::RunnerManager::setPriorSearch ( const QString &  search)

Set the prior search for this runner.

Setting an empty string will clear this value.

Since
5.78

◆ setSearchTerm

void Plasma::RunnerManager::setSearchTerm ( const QString &  term,
int  cursorPosition 
)
signal

Put the given search term in the KRunner search field.

Parameters
termThe term that should be displayed
cursorPositionWhere the cursor should be positioned
Since
5.78

◆ setupMatchSession

void Plasma::RunnerManager::setupMatchSession ( )
slot

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.

Since
4.4
See also
matchSessionComplete