KRunner

querymatch.h
1 /*
2  * Copyright 2006-2007 Aaron Seigo <[email protected]>
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 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_QUERYMATCH_H
21 #define PLASMA_QUERYMATCH_H
22 
23 #include <QList>
24 #include <QUrl>
25 #include <QSharedDataPointer>
26 
27 #include "krunner_export.h"
28 
29 class QAction;
30 class QIcon;
31 class QString;
32 class QVariant;
33 class QWidget;
34 
35 namespace Plasma
36 {
37 
38 class RunnerContext;
39 class AbstractRunner;
40 class QueryMatchPrivate;
41 
48 class KRUNNER_EXPORT QueryMatch
49 {
50  public:
54  enum Type {
55  NoMatch = 0,
56  CompletionMatch = 10,
57  PossibleMatch = 30,
58  InformationalMatch = 50,
62  HelperMatch = 70,
70  ExactMatch = 100
71  };
72 
79  explicit QueryMatch(AbstractRunner *runner = nullptr);
80 
84  QueryMatch(const QueryMatch &other);
85 
86  ~QueryMatch();
87  QueryMatch &operator=(const QueryMatch &other);
88  bool operator==(const QueryMatch &other) const;
89  bool operator!=(const QueryMatch &other) const;
90  bool operator<(const QueryMatch &other) const;
91 
92 
96  AbstractRunner *runner() const;
97 
105  void run(const RunnerContext &context) const;
106 
111  bool isValid() const;
112 
116  void setType(Type type);
117 
121  Type type() const;
122 
130  void setMatchCategory(const QString& category);
131 
139  QString matchCategory() const;
140 
147  void setRelevance(qreal relevance);
148 
155  qreal relevance() const;
156 
166  void setData(const QVariant &data);
167 
171  QVariant data() const;
172 
182  void setId(const QString &id);
183 
192  QString id() const;
193 
200  void setText(const QString &text);
201 
205  QString text() const;
206 
213  void setSubtext(const QString &text);
214 
218  QString subtext() const;
219 
227  void setIcon(const QIcon &icon);
228 
232  QIcon icon() const;
233 
240  void setIconName(const QString &iconName);
241 
246  QString iconName() const;
247 
253  void setMimeType(const QString &mimeType);
254 
258  QString mimeType() const;
259 
263  void setUrls(const QList<QUrl> &urls);
264 
268  QList<QUrl> urls() const;
269 
275  void setEnabled(bool enable);
276 
280  bool isEnabled() const;
281 
285  QAction* selectedAction() const;
286 
290  void setSelectedAction(QAction *action);
291 
292 #if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 71)
293 
298  KRUNNER_DEPRECATED_VERSION_BELATED(5, 71, 5, 0, "No longer use, feature removed")
299  bool hasConfigurationInterface() const;
300 #endif
301 
302 #if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 71)
303 
312  KRUNNER_DEPRECATED_VERSION_BELATED(5, 71, 5, 0, "No longer use, feature removed")
313  void createConfigurationInterface(QWidget *parent);
314 #endif
315 
316  private:
318 };
319 
320 }
321 
322 #endif
An abstract base class for Plasma Runner plugins.
Type
The type of match.
Definition: querymatch.h:54
The RunnerContext class provides information related to a search, including the search term...
Definition: runnercontext.h:45
A match returned by an AbstractRunner in response to a given RunnerContext.
Definition: querymatch.h:48
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 22:38:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.