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

Plasma

  • plasma
abstractrunner.h
Go to the documentation of this file.
1/*
2 * Copyright 2006-2007 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 Library 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_ABSTRACTRUNNER_H
21#define PLASMA_ABSTRACTRUNNER_H
22
23#include <QtCore/QObject>
24#include <QtCore/QMutex>
25#include <QtCore/QStringList>
26
27#include <kconfiggroup.h>
28#include <kservice.h>
29
30#include <plasma/plasma_export.h>
31#include <plasma/querymatch.h>
32#include <plasma/runnercontext.h>
33#include <plasma/runnersyntax.h>
34#include <plasma/version.h>
35
36class QAction;
37class QMimeData;
38
39class KCompletion;
40
41namespace Plasma
42{
43
44class DataEngine;
45class Package;
46class RunnerScript;
47class QueryMatch;
48class AbstractRunnerPrivate;
49
63class PLASMA_EXPORT AbstractRunner : public QObject
64{
65 Q_OBJECT
66 Q_PROPERTY(bool matchingSuspended READ isMatchingSuspended WRITE suspendMatching NOTIFY matchingSuspended)
67 Q_PROPERTY(QString id READ id)
68 Q_PROPERTY(QString description READ description)
69 Q_PROPERTY(QString name READ name)
70 Q_PROPERTY(QIcon icon READ icon)
71 public:
73 enum Speed {
74 SlowSpeed,
75 NormalSpeed
76 };
77
79 enum Priority {
80 LowestPriority = 0,
81 LowPriority,
82 NormalPriority,
83 HighPriority,
84 HighestPriority
85 };
86
88 typedef QList<AbstractRunner*> List;
89
90 virtual ~AbstractRunner();
91
142 virtual void match(Plasma::RunnerContext &context);
143
149 void performMatch(Plasma::RunnerContext &context);
150
156 bool hasRunOptions();
157
165 virtual void createRunOptions(QWidget *widget);
166
175 virtual void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match);
176
181 Speed speed() const;
182
187 Priority priority() const;
188
194 RunnerContext::Types ignoredTypes() const;
195
200 void setIgnoredTypes(RunnerContext::Types types);
201
205 QString name() const;
206
210 QString id() const;
211
215 QString description() const;
216
220 QIcon icon() const;
221
230 const Package *package() const;
231
235 virtual void reloadConfiguration();
236
241 QList<RunnerSyntax> syntaxes() const;
242
255 static QMutex *bigLock();
256
262 RunnerSyntax *defaultSyntax() const;
263
269 bool isMatchingSuspended() const;
270
271 Q_SIGNALS:
281 void prepare();
282
289 void teardown();
290
296 void matchingSuspended(bool suspended);
297
298 protected:
299 friend class RunnerManager;
300 friend class RunnerManagerPrivate;
301
302 explicit AbstractRunner(QObject *parent = 0, const QString &path = QString());
303 explicit AbstractRunner(const KService::Ptr service, QObject *parent = 0);
304
305 AbstractRunner(QObject *parent, const QVariantList &args);
306
311 void suspendMatching(bool suspend);
312
316 KConfigGroup config() const;
317
321 void setHasRunOptions(bool hasRunOptions);
322
329 void setSpeed(Speed newSpeed);
330
335 void setPriority(Priority newPriority);
336
349 KService::List serviceQuery(const QString &serviceType,
350 const QString &constraint = QString()) const;
351
361 virtual QList<QAction*> actionsForMatch(const Plasma::QueryMatch &match);
362
372 QAction* addAction(const QString &id, const QIcon &icon, const QString &text);
373
383 void addAction(const QString &id, QAction *action);
384
391 void removeAction(const QString &id);
392
396 QAction* action(const QString &id) const;
397
401 QHash<QString, QAction*> actions() const;
402
407 void clearActions();
408
417 void addSyntax(const RunnerSyntax &syntax);
418
433 void setDefaultSyntax(const RunnerSyntax &syntax);
434
442 void setSyntaxes(const QList<RunnerSyntax> &syns);
443
463 Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;
464
465 protected Q_SLOTS:
471 void init();
472
478 QMimeData * mimeDataForMatch(const Plasma::QueryMatch *match);
479
480 private:
481 friend class RunnerScript;
482
483 AbstractRunnerPrivate *const d;
484};
485
486} // Plasma namespace
487
488#define K_EXPORT_PLASMA_RUNNER( libname, classname ) \
489K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
490K_EXPORT_PLUGIN(factory("plasma_runner_" #libname)) \
491K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
492
498#define K_EXPORT_RUNNER_CONFIG( name, classname ) \
499K_PLUGIN_FACTORY(ConfigFactory, registerPlugin<classname>();) \
500K_EXPORT_PLUGIN(ConfigFactory("kcm_krunner_" #name)) \
501K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
502
503#endif
Plasma::AbstractRunner
An abstract base class for Plasma Runner plugins.
Definition: abstractrunner.h:64
Plasma::AbstractRunner::matchingSuspended
void matchingSuspended(bool suspended)
Emitted when the runner enters or exits match suspension.
Plasma::AbstractRunner::prepare
void prepare()
This signal is emitted when matching is about to commence, giving runners an opportunity to prepare t...
Plasma::AbstractRunner::Speed
Speed
Specifies a nominal speed for the runner.
Definition: abstractrunner.h:73
Plasma::AbstractRunner::SlowSpeed
@ SlowSpeed
Definition: abstractrunner.h:74
Plasma::AbstractRunner::teardown
void teardown()
This signal is emitted when a session of matches is complete, giving runners the opportunity to tear ...
Plasma::AbstractRunner::List
QList< AbstractRunner * > List
An ordered list of runners.
Definition: abstractrunner.h:88
Plasma::AbstractRunner::Priority
Priority
Specifies a priority for the runner.
Definition: abstractrunner.h:79
Plasma::AbstractRunner::HighPriority
@ HighPriority
Definition: abstractrunner.h:83
Plasma::AbstractRunner::NormalPriority
@ NormalPriority
Definition: abstractrunner.h:82
Plasma::AbstractRunner::LowPriority
@ LowPriority
Definition: abstractrunner.h:81
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::RunnerManager
The RunnerManager class decides what installed runners are runnable, and their ratings.
Definition: runnermanager.h:50
Plasma::RunnerScript
Provides a restricted interface for scripting a runner.
Definition: runnerscript.h:41
Plasma::RunnerSyntax
Definition: runnersyntax.h:41
QObject
QWidget
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
plasma_export.h
querymatch.h
runnercontext.h
runnersyntax.h
version.h
<Plasma/Version>
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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