• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libplasma

Plasma::AbstractRunner

Plasma::AbstractRunner Class Reference

#include <abstractrunner.h>

Inheritance diagram for Plasma::AbstractRunner:

Inheritance graph
[legend]

List of all members.


Detailed Description

An abstract base class for Plasma Runner plugins.

Be aware that runners have to be thread-safe. This is due to the fact that each runner is executed in its own thread for each new term. Thus, a runner may be executed more than once at the same time.

Definition at line 53 of file abstractrunner.h.


Public Types

typedef QList< AbstractRunner * > List
enum  Priority {
  LowestPriority = 0, LowPriority, NormalPriority, HighPriority,
  HighestPriority
}
enum  Speed { SlowSpeed, NormalSpeed }

Public Member Functions

virtual void createRunOptions (QWidget *widget)
QString description () const
bool hasRunOptions ()
QString id () const
RunnerContext::Types ignoredTypes () const
virtual void match (Plasma::RunnerContext &context)
QString name () const
const Package * package () const
void performMatch (Plasma::RunnerContext &context)
Priority priority () const
virtual void reloadConfiguration ()
virtual void run (const Plasma::RunnerContext &context, const Plasma::QueryMatch &action)
void setIgnoredTypes (RunnerContext::Types types)
Speed speed () const
virtual ~AbstractRunner ()

Protected Slots

void init ()

Protected Member Functions

 AbstractRunner (QObject *parent, const QVariantList &args)
 AbstractRunner (QObject *parent=0, const QString &serviceId=QString())
QMutex * bigLock () const
KConfigGroup config () const
KService::List serviceQuery (const QString &serviceType, const QString &constraint=QString()) const
void setHasRunOptions (bool hasRunOptions)
void setPriority (Priority newPriority)
void setSpeed (Speed newSpeed)

Member Typedef Documentation

typedef QList<AbstractRunner*> Plasma::AbstractRunner::List

Definition at line 69 of file abstractrunner.h.


Member Enumeration Documentation

enum Plasma::AbstractRunner::Priority

Enumerator:
LowestPriority 
LowPriority 
NormalPriority 
HighPriority 
HighestPriority 

Definition at line 62 of file abstractrunner.h.

enum Plasma::AbstractRunner::Speed

Enumerator:
SlowSpeed 
NormalSpeed 

Definition at line 58 of file abstractrunner.h.


Constructor & Destructor Documentation

Plasma::AbstractRunner::~AbstractRunner (  )  [virtual]

Definition at line 103 of file abstractrunner.cpp.

Plasma::AbstractRunner::AbstractRunner ( QObject *  parent = 0,
const QString &  serviceId = QString() 
) [explicit, protected]

Constructs a Runner object.

Since AbstractRunner has pure virtuals, this constructor can not be called directly. Rather a subclass must be created

Definition at line 91 of file abstractrunner.cpp.

Plasma::AbstractRunner::AbstractRunner ( QObject *  parent,
const QVariantList &  args 
) [protected]

Definition at line 97 of file abstractrunner.cpp.


Member Function Documentation

QMutex * Plasma::AbstractRunner::bigLock (  )  const [protected]

Definition at line 208 of file abstractrunner.cpp.

KConfigGroup Plasma::AbstractRunner::config (  )  const [protected]

Provides access to the runner's configuration object.

Definition at line 108 of file abstractrunner.cpp.

void Plasma::AbstractRunner::createRunOptions ( QWidget *  widget  )  [virtual]

If hasRunOptions() returns true, this method may be called to get a widget displaying the options the user can interact with to modify the behaviour of what happens when a given match is selected.

Parameters:
widget the parent of the options widgets.

Definition at line 167 of file abstractrunner.cpp.

QString Plasma::AbstractRunner::description (  )  const

Returns the description of this Runner.

Definition at line 243 of file abstractrunner.cpp.

bool Plasma::AbstractRunner::hasRunOptions (  ) 

If the runner has options that the user can interact with to modify what happens when run or one of the actions created in fillMatches is called, the runner should return true.

Definition at line 157 of file abstractrunner.cpp.

QString Plasma::AbstractRunner::id (  )  const

Returns an id string for the Runner.

Definition at line 235 of file abstractrunner.cpp.

RunnerContext::Types Plasma::AbstractRunner::ignoredTypes (  )  const

Returns the OR'ed value of all the Information types (as defined in RunnerContext::Type) this runner is not interested in.

Returns:
OR'ed value of black listed types

Definition at line 192 of file abstractrunner.cpp.

void Plasma::AbstractRunner::init (  )  [protected, slot]

Definition at line 256 of file abstractrunner.cpp.

void Plasma::AbstractRunner::match ( Plasma::RunnerContext &  context  )  [virtual]

This is the main query method.

It should trigger creation of QueryMatch instances through RunnerContext::addInformationalMatch, RunnerContext::addExactMatch, and RunnerContext::addPossibleMatch.

If the runner can run precisely the requested term (RunnerContext::query()), it should create an exact match (RunnerContext::addExactMatch). The first runner that creates a QueryMatch will be the default runner. Other runner's matches will be suggested in the interface. Non-exact matches should be offered via RunnerContext::addPossibleMatch.

The match will be activated if the user selects it.

If this runner's exact match is selected, it will be passed into the run method.

See also:
run
Since each runner is executed in its own thread there is no need to return from this method right away, nor to create all matches here.

Definition at line 220 of file abstractrunner.cpp.

QString Plasma::AbstractRunner::name (  )  const

Returns the user visible engine name for the Runner.

Definition at line 227 of file abstractrunner.cpp.

const Package * Plasma::AbstractRunner::package (  )  const

Accessor for the associated Package object if any.

Returns:
the Package object, or 0 if none

Definition at line 251 of file abstractrunner.cpp.

void Plasma::AbstractRunner::performMatch ( Plasma::RunnerContext &  context  ) 

Triggers a call to match.

  • globalContext the search context used in executing this match.

Definition at line 123 of file abstractrunner.cpp.

AbstractRunner::Priority Plasma::AbstractRunner::priority (  )  const

The priority of the runner.

See also:
setPriority

Definition at line 182 of file abstractrunner.cpp.

void Plasma::AbstractRunner::reloadConfiguration (  )  [virtual]

Signal runner to reload its configuration.

Definition at line 119 of file abstractrunner.cpp.

void Plasma::AbstractRunner::run ( const Plasma::RunnerContext &  context,
const Plasma::QueryMatch &  action 
) [virtual]

Called whenever an exact or possible match associated with this runner is triggered.

Definition at line 213 of file abstractrunner.cpp.

KService::List Plasma::AbstractRunner::serviceQuery ( const QString &  serviceType,
const QString &  constraint = QString() 
) const [protected]

A blocking method to do queries of installed Services which can provide a measure of safety for runners running their own threads.

This should be used instead of calling KServiceTypeTrader::query(..) directly.

  • serviceType a service type like "Plasma/Applet" or "KFilePlugin"
  • constraint a constraint to limit the the choices returned.
    See also:
    KServiceTypeTrader::query(const QString&, const QString&)
    Returns:
    a list of services that satisfy the query.

Definition at line 202 of file abstractrunner.cpp.

void Plasma::AbstractRunner::setHasRunOptions ( bool  hasRunOptions  )  [protected]

Sets whether or not the the runner has options for matches.

Definition at line 162 of file abstractrunner.cpp.

void Plasma::AbstractRunner::setIgnoredTypes ( RunnerContext::Types  types  ) 

Sets the types this runner will ignore.

Parameters:
types OR'ed listed of ignored types

Definition at line 197 of file abstractrunner.cpp.

void Plasma::AbstractRunner::setPriority ( Priority  newPriority  )  [protected]

Sets the priority of the runner.

Lower priority runners are executed only after higher priority runners.

Definition at line 187 of file abstractrunner.cpp.

void Plasma::AbstractRunner::setSpeed ( Speed  newSpeed  )  [protected]

Sets the nominal speed of the runner.

Only slow runners need to call this within their constructor because the default speed is NormalSpeed. Runners that use DBUS should call this within their constructors.

Definition at line 177 of file abstractrunner.cpp.

AbstractRunner::Speed Plasma::AbstractRunner::speed (  )  const

The nominal speed of the runner.

See also:
setSpeed

Definition at line 172 of file abstractrunner.cpp.


The documentation for this class was generated from the following files:
  • abstractrunner.h
  • abstractrunner.cpp

libplasma

Skip menu "libplasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal