|
Albert
|
#include <albert/queryhandler.h>
Base query handler interface for triggered queries.
This class defines the fundamental contract between the core and a query handler. It is used for triggered queries and is selected exclusively when its trigger matches the user input.
Implementations are responsible for executing the query asynchronously and providing results via a QueryExecution created by execution.
This interface is low-level and intentionally flexible. Implement it only if your use case is not covered by the convenience subclasses.
Public Member Functions | |
| virtual QString | synopsis (const QString &query) const |
| Returns the input hint for the given query. | |
| virtual bool | allowTriggerRemap () const |
Returns true if the user is allowed to set a custom trigger, otherwise returns false. | |
| virtual QString | defaultTrigger () const |
| Returns the default trigger. | |
| virtual bool | supportsFuzzyMatching () const |
Returns true if the handler supports fuzzy matching, otherwise returns false. | |
| virtual std::unique_ptr< QueryExecution > | execution (QueryContext &context)=0 |
| Creates a query execution for the given context. | |
Public Member Functions inherited from albert::Extension | |
| virtual QString | id () const =0 |
| Returns the extension identifier. | |
| virtual QString | name () const =0 |
| Returns the pretty, human readable extension name. | |
| virtual QString | description () const =0 |
| Returns the brief extension description. | |
Protected Member Functions | |
| ~QueryHandler () override | |
| Destructs the handler. | |
| virtual void | setFuzzyMatching (bool enabled) |
| Sets the fuzzy matching mode to enabled. | |
| virtual void | setTrigger (const QString &trigger) |
| Notifies that the user-defined trigger has changed to trigger. | |
Protected Member Functions inherited from albert::Extension | |
| virtual | ~Extension () |
| Destructs the extension. | |
|
overrideprotected |
Destructs the handler.
|
virtual |
Returns true if the user is allowed to set a custom trigger, otherwise returns false.
The base class implementation returns true.
|
virtual |
Returns the default trigger.
The base class implementation returns Extension::id() with a space appended.
|
pure virtual |
Creates a query execution for the given context.
The results are added to results as they become available.
Implemented in albert::AsyncGeneratorQueryHandler, and albert::GeneratorQueryHandler.
|
protectedvirtual |
Sets the fuzzy matching mode to enabled.
This function is called when the user toggles fuzzy matching for this handler.
The base class implementation does nothing.
Reimplemented in albert::IndexQueryHandler.
|
protectedvirtual |
Notifies that the user-defined trigger has changed to trigger.
This function is called when the user changes the trigger for this handler.
The base class implementation does nothing.
|
virtual |
Returns true if the handler supports fuzzy matching, otherwise returns false.
If true, the user can enable fuzzy matching for this handler and setFuzzyMatching(bool) should be implemented accordingly.
The base class implementation returns false.
Reimplemented in albert::IndexQueryHandler.
|
virtual |
Returns the input hint for the given query.
The returned string will be displayed in the input line if space permits.
The base class implementation returns an empty string.