KRunner::RunnerContext

Search for usage in LXR

KRunner::RunnerContext Class Referencefinal

#include <KRunner/RunnerContext>

Public Member Functions

 RunnerContext (const RunnerContext &other)
 
 RunnerContext (RunnerManager *manager=nullptr)
 
bool addMatch (const QueryMatch &match)
 
bool addMatches (const QList< QueryMatch > &matches)
 
void ignoreCurrentMatchForHistory () const
 
bool isValid () const
 
QList< QueryMatchmatches () const
 
RunnerContextoperator= (const RunnerContext &other)
 
QString query () const
 
void requestQueryStringUpdate (const QString &text, int cursorPosition) const
 
void setQuery (const QString &term)
 
bool singleRunnerQueryMode () const
 

Detailed Description

The RunnerContext class provides information related to a search, including the search term and collected matches.

Definition at line 31 of file runnercontext.h.

Constructor & Destructor Documentation

◆ RunnerContext() [1/2]

KRunner::RunnerContext::RunnerContext ( RunnerManager * manager = nullptr)
explicit

Definition at line 98 of file runnercontext.cpp.

◆ RunnerContext() [2/2]

KRunner::RunnerContext::RunnerContext ( const RunnerContext & other)

Copy constructor.

Definition at line 104 of file runnercontext.cpp.

◆ ~RunnerContext()

KRunner::RunnerContext::~RunnerContext ( )

Definition at line 110 of file runnercontext.cpp.

Member Function Documentation

◆ addMatch()

bool KRunner::RunnerContext::addMatch ( const QueryMatch & match)

Appends a match to the existing list of matches.

If you are going to be adding multiple matches, it is more performant to use

See also
addMatches instead.
Parameters
matchthe match to add
Returns
true if the match was added, false otherwise.

Definition at line 214 of file runnercontext.cpp.

◆ addMatches()

bool KRunner::RunnerContext::addMatches ( const QList< QueryMatch > & matches)

Appends lists of matches to the list of matches.

Parameters
matchesthe matches to add
Returns
true if matches were added, false if matches were e.g. outdated

Definition at line 191 of file runnercontext.cpp.

◆ ignoreCurrentMatchForHistory()

void KRunner::RunnerContext::ignoreCurrentMatchForHistory ( ) const

Set this to true in the AbstractRunner::run method to prevent the entry from being saved to the history.

Since
5.90

Definition at line 242 of file runnercontext.cpp.

◆ isValid()

bool KRunner::RunnerContext::isValid ( ) const
Returns
true if this context is no longer valid and therefore matching using it should abort. While not required to be used within runners, it provides a nice way to avoid unnecessary processing in runners that may run for an extended period (as measured in 10s of ms) and therefore improve the user experience.

Definition at line 185 of file runnercontext.cpp.

◆ matches()

QList< QueryMatch > KRunner::RunnerContext::matches ( ) const

Retrieves all available matches for the current search term.

Returns
a list of matches

Definition at line 219 of file runnercontext.cpp.

◆ operator=()

RunnerContext & KRunner::RunnerContext::operator= ( const RunnerContext & other)

Assignment operator.

Definition at line 114 of file runnercontext.cpp.

◆ query()

QString KRunner::RunnerContext::query ( ) const
Returns
the current search query term.

Definition at line 177 of file runnercontext.cpp.

◆ requestQueryStringUpdate()

void KRunner::RunnerContext::requestQueryStringUpdate ( const QString & text,
int cursorPosition ) const

Request that KRunner updates the query string and stasy open, even after running a match.

This method is const so it can be called in a const context.

Parameters
textText that will be displayed in the search field
cursorPositionPosition of the cursor, if this is different than the length of the text, the characters between the position and text will be selected
Since
5.90

Definition at line 226 of file runnercontext.cpp.

◆ setQuery()

void KRunner::RunnerContext::setQuery ( const QString & term)

Sets the query term for this object and attempts to determine the type of the search.

Definition at line 163 of file runnercontext.cpp.

◆ singleRunnerQueryMode()

bool KRunner::RunnerContext::singleRunnerQueryMode ( ) const
Returns
true if the current query is a single runner query

Definition at line 237 of file runnercontext.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 1 2024 18:52:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.