KRunner::RunnerSyntax

Search for usage in LXR

KRunner::RunnerSyntax Class Reference

#include <KRunner/RunnerSyntax>

Public Member Functions

 RunnerSyntax (const QString &exampleQuery, const QString &description)
 
 RunnerSyntax (const QStringList &exampleQueries, const QString &description)
 
 RunnerSyntax (const RunnerSyntax &other)
 
QString description () const
 
QStringList exampleQueries () const
 
RunnerSyntaxoperator= (const RunnerSyntax &rhs)
 

Detailed Description

Represents a query prototype that the runner accepts.

These can be created and registered with AbstractRunner::addSyntax to allow applications to show to the user what the runner is currently capable of doing.

Lets say the runner has a trigger word and then the user can type anything after that. In that case you could use ":q:" as a placeholder, which will get expanded to i18n("search term") and be put in brackets.

KRunner::RunnerSyntax syntax(QStringLiteral("sometriggerword :q:"), i18n("Description for this syntax"));
addSyntax(syntax);
Represents a query prototype that the runner accepts.
QString i18n(const char *text, const TYPE &arg...)

But if the query the user has to enter is sth. specific like a program, url or file you should use a custom placeholder to make it easier to understand.

KRunner::RunnerSyntax syntax(QStringLiteral("sometriggereword <%1>").arg(i18n("program name"))), i18n("Description for this syntax"));
addSyntax(syntax);

Definition at line 40 of file runnersyntax.h.

Constructor & Destructor Documentation

◆ RunnerSyntax() [1/3]

KRunner::RunnerSyntax::RunnerSyntax ( const QString & exampleQuery,
const QString & description )
inlineexplicit

Constructs a RunnerSyntax with one example query.

Parameters
exampleQuerySee the class description for examples and placeholder conventions.
descriptionA description of what the described syntax does from the user's point of view.

Definition at line 49 of file runnersyntax.h.

◆ RunnerSyntax() [2/3]

KRunner::RunnerSyntax::RunnerSyntax ( const QStringList & exampleQueries,
const QString & description )
explicit

Constructs a RunnerSyntax with multiple example queries.

Parameters
exampleQueriesSee the class description for examples and placeholder conventions.
descriptionA description of what the described syntax does from the user's point of view. This description should be true for all example queries. In case they differ, consider using multiple syntaxes.
Since
5.106

Definition at line 40 of file runnersyntax.cpp.

◆ RunnerSyntax() [3/3]

KRunner::RunnerSyntax::RunnerSyntax ( const RunnerSyntax & other)
explicit

Definition at line 46 of file runnersyntax.cpp.

Member Function Documentation

◆ description()

QString KRunner::RunnerSyntax::description ( ) const
Returns
the user visible description of what the syntax does

Definition at line 64 of file runnersyntax.cpp.

◆ exampleQueries()

QStringList KRunner::RunnerSyntax::exampleQueries ( ) const
Returns
the example queries associated with this Syntax object

Definition at line 59 of file runnersyntax.cpp.

◆ operator=()

RunnerSyntax & KRunner::RunnerSyntax::operator= ( const RunnerSyntax & rhs)

Definition at line 53 of file runnersyntax.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 Mon Nov 18 2024 12:14:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.