Albert
Loading...
Searching...
No Matches
albert::QueryHandler Class Referenceabstract

#include <albert/queryhandler.h>

Description

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.

Inheritance diagram for albert::QueryHandler:
[legend]

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< QueryExecutionexecution (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.
 

Constructor & Destructor Documentation

◆ ~QueryHandler()

albert::QueryHandler::~QueryHandler ( )
overrideprotected

Destructs the handler.

Member Function Documentation

◆ allowTriggerRemap()

virtual bool albert::QueryHandler::allowTriggerRemap ( ) const
virtual

Returns true if the user is allowed to set a custom trigger, otherwise returns false.

The base class implementation returns true.

◆ defaultTrigger()

virtual QString albert::QueryHandler::defaultTrigger ( ) const
virtual

Returns the default trigger.

The base class implementation returns Extension::id() with a space appended.

◆ execution()

virtual std::unique_ptr< QueryExecution > albert::QueryHandler::execution ( QueryContext context)
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.

◆ setFuzzyMatching()

virtual void albert::QueryHandler::setFuzzyMatching ( bool  enabled)
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.

◆ setTrigger()

virtual void albert::QueryHandler::setTrigger ( const QString &  trigger)
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.

◆ supportsFuzzyMatching()

virtual bool albert::QueryHandler::supportsFuzzyMatching ( ) const
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.

◆ synopsis()

virtual QString albert::QueryHandler::synopsis ( const QString &  query) const
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.


The documentation for this class was generated from the following file: