libplasma
abstractrunner.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef RUNNER_H
00021 #define RUNNER_H
00022
00023 #include <QtCore/QObject>
00024 #include <QtCore/QStringList>
00025
00026 #include <KDE/KConfigGroup>
00027
00028 #include <plasma/plasma_export.h>
00029 #include <plasma/searchmatch.h>
00030 #include <plasma/searchcontext.h>
00031
00032 class KCompletion;
00033
00034 namespace Plasma
00035 {
00036
00040 class PLASMA_EXPORT AbstractRunner : public QObject
00041 {
00042 Q_OBJECT
00043
00044 public:
00045 enum Speed { NormalSpeed,
00046 SlowSpeed };
00047
00048 typedef QList<AbstractRunner*> List;
00049
00055 static List loadRunners(QObject* parent, const QStringList& whitelist = QStringList() );
00056
00062 explicit AbstractRunner(QObject* parent = 0);
00063 virtual ~AbstractRunner();
00064
00068 KConfigGroup config() const;
00069
00085 virtual void match(Plasma::SearchContext *search) = 0;
00086
00087 void performMatch(Plasma::SearchContext &globalContext);
00088
00094 bool hasMatchOptions();
00095
00103 virtual void createMatchOptions(QWidget *widget);
00104
00108 bool isConfigurable();
00109
00117 virtual void createConfigurationInterface(QWidget *widget);
00118
00123 virtual void exec(Plasma::SearchMatch *action);
00124
00128 Speed speed() const;
00129
00130 protected:
00134 void setHasMatchOptions(bool hasMatchOptions);
00135
00139 void setIsConfigurable(bool canBeConfigured);
00140
00147 void setSpeed(Speed newSpeed);
00148
00149 private:
00150 class Private;
00151 Private* const d;
00152 };
00153
00154 }
00155
00156 #define K_EXPORT_PLASMA_RUNNER( libname, classname ) \
00157 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00158 K_EXPORT_PLUGIN(factory("plasma_runner_" #libname))
00159
00160 #endif