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

Plasma

abstractrunner.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #ifndef PLASMA_ABSTRACTRUNNER_H
00021 #define PLASMA_ABSTRACTRUNNER_H
00022 
00023 #include <QtCore/QObject>
00024 #include <QtCore/QMutex>
00025 #include <QtCore/QStringList>
00026 
00027 #include <kconfiggroup.h>
00028 #include <kservice.h>
00029 
00030 #include <plasma/plasma_export.h>
00031 #include <plasma/runnercontext.h>
00032 #include <plasma/querymatch.h>
00033 #include <plasma/version.h>
00034 
00035 class QAction;
00036 
00037 class KCompletion;
00038 
00039 namespace Plasma
00040 {
00041 
00042 class Package;
00043 class RunnerScript;
00044 class QueryMatch;
00045 class AbstractRunnerPrivate;
00046 
00056 class PLASMA_EXPORT AbstractRunner : public QObject
00057 {
00058     Q_OBJECT
00059 
00060     public:
00062         enum Speed {
00063             SlowSpeed,
00064             NormalSpeed
00065         };
00066 
00068         enum Priority {
00069             LowestPriority = 0,
00070             LowPriority,
00071             NormalPriority,
00072             HighPriority,
00073             HighestPriority
00074         };
00075 
00077         typedef QList<AbstractRunner*> List;
00078 
00079         virtual ~AbstractRunner();
00080 
00131         virtual void match(Plasma::RunnerContext &context);
00132 
00138         void performMatch(Plasma::RunnerContext &context);
00139 
00145         bool hasRunOptions();
00146 
00154         virtual void createRunOptions(QWidget *widget);
00155 
00164         virtual void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match);
00165 
00170         Speed speed() const;
00171 
00176         Priority priority() const;
00177 
00183         RunnerContext::Types ignoredTypes() const;
00184 
00189         void setIgnoredTypes(RunnerContext::Types types);
00190 
00194         QString name() const;
00195 
00199         QString id() const;
00200 
00204         QString description() const;
00205 
00214         const Package *package() const;
00215 
00219         virtual void reloadConfiguration();
00220 
00233         static QMutex *bigLock();
00234 
00235     protected:
00236         friend class RunnerManager;
00237         friend class RunnerManagerPrivate;
00238 
00244         explicit AbstractRunner(QObject *parent = 0, const QString &serviceId = QString());
00245         AbstractRunner(QObject *parent, const QVariantList &args);
00246 
00250         KConfigGroup config() const;
00251 
00255         void setHasRunOptions(bool hasRunOptions);
00256 
00263         void setSpeed(Speed newSpeed);
00264 
00269         void setPriority(Priority newPriority);
00270 
00282         KService::List serviceQuery(const QString &serviceType,
00283                                     const QString &constraint = QString()) const;
00284 
00294         virtual QList<QAction*> actionsForMatch(const Plasma::QueryMatch &match);
00295 
00305         QAction* addAction(const QString &id, const QIcon &icon, const QString &text);
00306 
00316         void addAction(const QString &id, QAction *action);
00317 
00324         void removeAction(const QString &id);
00325 
00329         QAction* action(const QString &id) const;
00330 
00334         QHash<QString, QAction*> actions() const;
00339         void clearActions();
00340 
00341     protected Q_SLOTS:
00342         void init();
00343 
00344     private:
00345         AbstractRunnerPrivate *const d;
00346 };
00347 
00348 } // Plasma namespace
00349 
00350 #define K_EXPORT_PLASMA_RUNNER( libname, classname )     \
00351 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00352 K_EXPORT_PLUGIN(factory("plasma_runner_" #libname)) \
00353 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
00354 
00355 #define K_EXPORT_RUNNER_CONFIG( name, classname )     \
00356 K_PLUGIN_FACTORY(ConfigFactory, registerPlugin<classname>();) \
00357 K_EXPORT_PLUGIN(ConfigFactory("kcm_krunner_" #name)) \
00358 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
00359 
00360 #endif

Plasma

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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