Plasma
runnercontext.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 PLASMA_RUNNERCONTEXT_H
00021 #define PLASMA_RUNNERCONTEXT_H
00022
00023 #include <QtCore/QList>
00024 #include <QtCore/QObject>
00025 #include <QtCore/QSharedDataPointer>
00026
00027 #include <plasma/plasma_export.h>
00028
00029 class KCompletion;
00030 class KConfigGroup;
00031
00032 namespace Plasma
00033 {
00034
00035 class QueryMatch;
00036 class AbstractRunner;
00037 class RunnerContextPrivate;
00038
00046 class PLASMA_EXPORT RunnerContext : public QObject
00047 {
00048 Q_OBJECT
00049
00050 public:
00051 enum Type {
00052 None = 0,
00053 UnknownType = 1,
00054 Directory = 2,
00055 File = 4,
00056 NetworkLocation = 8,
00057 Executable = 16,
00058 ShellCommand = 32,
00059 Help = 64,
00060 FileSystem = Directory | File | Executable | ShellCommand
00061 };
00062
00063 Q_DECLARE_FLAGS(Types, Type)
00064
00065 explicit RunnerContext(QObject *parent = 0);
00066
00070 explicit RunnerContext(RunnerContext &other, QObject *parent = 0);
00071
00072 ~RunnerContext();
00073
00078 void reset();
00079
00084 void setQuery(const QString &term);
00085
00089 QString query() const;
00090
00095 Type type() const;
00096
00104 QString mimeType() const;
00105
00124 bool isValid() const;
00125
00133
00134
00135 bool addMatches(const QString &term, const QList<QueryMatch> &matches);
00136
00147
00148
00149 bool addMatch(const QString &term, const QueryMatch &match);
00150
00156 QList<QueryMatch> matches() const;
00157
00165 QueryMatch match(const QString &id) const;
00166
00177 void restore(const KConfigGroup &config);
00178
00182 void save(KConfigGroup &config);
00183
00192 void run(const QueryMatch &match);
00193
00194 Q_SIGNALS:
00195 void matchesChanged();
00196
00197 private:
00198 QExplicitlySharedDataPointer<RunnerContextPrivate> d;
00199 };
00200
00201 }
00202
00203 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::RunnerContext::Types)
00204
00205 #endif