• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
  • scripting
runnerscript.h
Go to the documentation of this file.
1/*
2 * Copyright 2007 by Aaron Seigo <aseigo@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_RUNNERSCRIPT_H
21#define PLASMA_RUNNERSCRIPT_H
22
23#include <kgenericfactory.h>
24#include <kplugininfo.h>
25
26#include <plasma/plasma_export.h>
27#include <plasma/abstractrunner.h>
28#include <plasma/scripting/scriptengine.h>
29
30namespace Plasma
31{
32
33class RunnerScriptPrivate;
34
40class PLASMA_EXPORT RunnerScript : public ScriptEngine
41{
42 Q_OBJECT
43
44public:
52 explicit RunnerScript(QObject *parent = 0);
53 ~RunnerScript();
54
58 void setRunner(AbstractRunner *runner);
59
63 AbstractRunner *runner() const;
64
70 virtual void match(Plasma::RunnerContext &search);
71
76 virtual void run(const Plasma::RunnerContext &search, const Plasma::QueryMatch &action);
77
78
79Q_SIGNALS:
80 void prepare();
81 void teardown();
82 void createRunOptions(QWidget *widget);
83 void reloadConfiguration();
84 void actionsForMatch(const Plasma::QueryMatch &match, QList<QAction*>* actions);
85
86protected:
90 QString mainScript() const;
91
97 const Package *package() const;
98
102 KPluginInfo description() const;
103
108 DataEngine *dataEngine(const QString &name);
109
110 KConfigGroup config() const;
111 void setIgnoredTypes(RunnerContext::Types types);
112 void setHasRunOptions(bool hasRunOptions);
113 void setSpeed(AbstractRunner::Speed newSpeed);
114 void setPriority(AbstractRunner::Priority newPriority);
115 KService::List serviceQuery(const QString &serviceType,
116 const QString &constraint = QString()) const;
117 QAction* addAction(const QString &id, const QIcon &icon, const QString &text);
118 void addAction(const QString &id, QAction *action);
119 void removeAction(const QString &id);
120 QAction* action(const QString &id) const;
121 QHash<QString, QAction*> actions() const;
122 void clearActions();
123 void addSyntax(const RunnerSyntax &syntax);
124 void setSyntaxes(const QList<RunnerSyntax> &syns);
125
126private:
127 friend class AbstractRunner;
128
129 RunnerScriptPrivate *const d;
130};
131
132#define K_EXPORT_PLASMA_RUNNERSCRIPTENGINE(libname, classname) \
133K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
134K_EXPORT_PLUGIN(factory("plasma_runnerscriptengine_" #libname))
135
136} //Plasma namespace
137
138#endif
abstractrunner.h
Plasma::AbstractRunner::Speed
Speed
Specifies a nominal speed for the runner.
Definition abstractrunner.h:73
Plasma::AbstractRunner::Priority
Priority
Specifies a priority for the runner.
Definition abstractrunner.h:79
Plasma::DataEngine
Data provider for plasmoids (Plasma plugins)
Definition dataengine.h:59
Plasma::Package
object representing an installed Plasmagik package
Definition package.h:43
Plasma::QueryMatch
A match returned by an AbstractRunner in response to a given RunnerContext.
Definition querymatch.h:48
Plasma::RunnerContext
The RunnerContext class provides information related to a search, including the search term,...
Definition runnercontext.h:47
Plasma::RunnerScript::serviceQuery
KService::List serviceQuery(const QString &serviceType, const QString &constraint=QString()) const
Definition runnerscript.cpp:115
Plasma::RunnerScript::actionsForMatch
void actionsForMatch(const Plasma::QueryMatch &match, QList< QAction * > *actions)
Plasma::RunnerScript::description
KPluginInfo description() const
Definition runnerscript.cpp:188
Plasma::RunnerScript::run
virtual void run(const Plasma::RunnerContext &search, const Plasma::QueryMatch &action)
Called whenever an exact or possible match associated with this runner is triggered.
Definition runnerscript.cpp:64
Plasma::RunnerScript::match
virtual void match(Plasma::RunnerContext &search)
Called when the script should create QueryMatch instances through RunnerContext::addInformationalMatc...
Definition runnerscript.cpp:59
Plasma::RunnerScript::addAction
QAction * addAction(const QString &id, const QIcon &icon, const QString &text)
Definition runnerscript.cpp:124
Plasma::RunnerScript::setIgnoredTypes
void setIgnoredTypes(RunnerContext::Types types)
Definition runnerscript.cpp:87
Plasma::RunnerScript::dataEngine
DataEngine * dataEngine(const QString &name)
Definition runnerscript.cpp:70
Plasma::RunnerScript::createRunOptions
void createRunOptions(QWidget *widget)
Plasma::RunnerScript::actions
QHash< QString, QAction * > actions() const
Definition runnerscript.cpp:154
Plasma::RunnerScript::mainScript
QString mainScript() const
Definition runnerscript.cpp:193
Plasma::RunnerScript::setRunner
void setRunner(AbstractRunner *runner)
Sets the Plasma::AbstractRunner associated with this RunnerScript.
Definition runnerscript.cpp:47
Plasma::RunnerScript::teardown
void teardown()
Plasma::RunnerScript::reloadConfiguration
void reloadConfiguration()
Plasma::RunnerScript::runner
AbstractRunner * runner() const
Returns the Plasma::AbstractRunner associated with this script component.
Definition runnerscript.cpp:54
Plasma::RunnerScript::config
KConfigGroup config() const
Definition runnerscript.cpp:79
Plasma::RunnerScript::setHasRunOptions
void setHasRunOptions(bool hasRunOptions)
Definition runnerscript.cpp:94
Plasma::RunnerScript::RunnerScript
RunnerScript(QObject *parent=0)
Default constructor for a RunnerScript.
Definition runnerscript.cpp:36
Plasma::RunnerScript::prepare
void prepare()
Plasma::RunnerScript::removeAction
void removeAction(const QString &id)
Definition runnerscript.cpp:139
Plasma::RunnerScript::clearActions
void clearActions()
Definition runnerscript.cpp:162
Plasma::RunnerScript::addSyntax
void addSyntax(const RunnerSyntax &syntax)
Definition runnerscript.cpp:169
Plasma::RunnerScript::package
const Package * package() const
Definition runnerscript.cpp:183
Plasma::RunnerScript::setPriority
void setPriority(AbstractRunner::Priority newPriority)
Definition runnerscript.cpp:108
Plasma::RunnerScript::AbstractRunner
friend class AbstractRunner
Definition runnerscript.h:127
Plasma::RunnerScript::action
QAction * action(const QString &id) const
Definition runnerscript.cpp:146
Plasma::RunnerScript::setSyntaxes
void setSyntaxes(const QList< RunnerSyntax > &syns)
Definition runnerscript.cpp:176
Plasma::RunnerScript::setSpeed
void setSpeed(AbstractRunner::Speed newSpeed)
Definition runnerscript.cpp:101
Plasma::RunnerSyntax
Definition runnersyntax.h:41
Plasma::ScriptEngine::ScriptEngine
ScriptEngine(QObject *parent=0)
Definition scriptengine.cpp:41
QObject
QWidget
Plasma
Namespace for everything in libplasma.
Definition abstractdialogmanager.cpp:25
plasma_export.h
scriptengine.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal