Plasma
runnermanager.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2006 Aaron Seigo <aseigo@kde.org> 00003 * Copyright (C) 2007 Ryan P. Bitanga <ryan.bitanga@gmail.com> 00004 * Copyright (C) 2008 Jordi Polo <mumismo@gmail.com> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Library General Public License as 00008 * published by the Free Software Foundation; either version 2, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this program; if not, write to the 00018 * Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef PLASMA_RUNNERMANAGER_H 00023 #define PLASMA_RUNNERMANAGER_H 00024 00025 #include <QtCore/QList> 00026 #include <QtCore/QObject> 00027 00028 #include <kplugininfo.h> 00029 00030 #include <plasma/plasma_export.h> 00031 #include "abstractrunner.h" 00032 00033 class QAction; 00034 class KConfigGroup; 00035 00036 namespace Plasma 00037 { 00038 class QueryMatch; 00039 class AbstractRunner; 00040 class RunnerContext; 00041 class RunnerManagerPrivate; 00042 00049 class PLASMA_EXPORT RunnerManager : public QObject 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 explicit RunnerManager(QObject *parent=0); 00055 explicit RunnerManager(KConfigGroup &config, QObject *parent=0); 00056 ~RunnerManager(); 00057 00063 AbstractRunner *runner(const QString &name) const; 00064 00069 AbstractRunner *singleModeRunner() const; 00070 00079 void setSingleModeRunnerId(const QString &id); 00080 00085 QString singleModeRunnerId() const; 00086 00091 bool singleMode() const; 00092 00099 void setSingleMode(bool singleMode); 00100 00107 QString runnerName(const QString &id) const; 00108 00112 QList<AbstractRunner *> runners() const; 00113 00118 QStringList singleModeAdvertisedRunnerIds() const; 00119 00124 RunnerContext *searchContext() const; 00125 00130 QList<QueryMatch> matches() const; 00131 00136 void run(const QueryMatch &match); 00137 00142 void run(const QString &id); 00143 00147 QList<QAction*> actionsForMatch(const QueryMatch &match); 00148 00152 QString query() const; 00153 00157 void reloadConfiguration(); 00158 00165 void setAllowedRunners(const QStringList &runners); 00166 00177 void loadRunner(const KService::Ptr service); 00178 00188 void loadRunner(const QString &path); 00189 00194 QStringList allowedRunners() const; 00195 00200 QMimeData * mimeDataForMatch(const QueryMatch &match) const; 00201 00206 QMimeData * mimeDataForMatch(const QString &id) const; 00207 00219 static KPluginInfo::List listRunnerInfo(const QString &parentApp = QString()); 00220 00221 public Q_SLOTS: 00229 void setupMatchSession(); 00230 00237 void matchSessionComplete(); 00238 00248 void launchQuery(const QString &term, const QString &runnerId); 00249 00253 void launchQuery(const QString &term); 00254 00264 bool execQuery(const QString &term, const QString &runnerName); 00265 00269 bool execQuery(const QString &term); 00270 00274 void reset(); 00275 00276 Q_SIGNALS: 00280 void matchesChanged(const QList<Plasma::QueryMatch> &matches); 00281 00286 void queryFinished(); 00287 00288 private: 00289 Q_PRIVATE_SLOT(d, void scheduleMatchesChanged()) 00290 Q_PRIVATE_SLOT(d, void matchesChanged()) 00291 Q_PRIVATE_SLOT(d, void jobDone(ThreadWeaver::Job*)) 00292 Q_PRIVATE_SLOT(d, void unblockJobs()) 00293 Q_PRIVATE_SLOT(d, void runnerMatchingSuspended(bool)) 00294 00295 RunnerManagerPrivate * const d; 00296 00297 friend class RunnerManagerPrivate; 00298 }; 00299 00300 } 00301 00302 #endif
KDE 4.6 API Reference