KRunner 5.109.0
runnersyntax.h
1/*
2 SPDX-FileCopyrightText: 2009 Aaron Seigo <aseigo@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef PLASMA_RUNNERSYNTAX_H
8#define PLASMA_RUNNERSYNTAX_H
9
10#include <QStringList>
11#include <memory>
12
13#include "krunner_export.h"
14
15namespace Plasma
16{
17class RunnerSyntaxPrivate;
41class KRUNNER_EXPORT RunnerSyntax
42{
43public:
51 RunnerSyntax(const QString &exampleQuery, const QString &description);
52
61 explicit RunnerSyntax(const QStringList &exampleQueries, const QString &description);
62
67
69
74
75#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 106)
85 KRUNNER_DEPRECATED_VERSION(5, 106, "Use constructor taking example query QStringList")
86 void addExampleQuery(const QString &exampleQuery);
87#endif
88
92 QStringList exampleQueries() const;
93
94#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 76)
102 KRUNNER_DEPRECATED_VERSION(5, 76, "The descriptions should be directly set when creating the example query. Use exampleQueries() instead.")
103 QStringList exampleQueriesWithTermDescription() const;
104#endif
105
106#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 106)
112 KRUNNER_DEPRECATED_VERSION(5, 106, "This should only be set when constructing the syntax")
113 void setDescription(const QString &description);
114#endif
115
120 QString description() const;
121
122#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 76)
131 KRUNNER_DEPRECATED_VERSION(
132 5,
133 76,
134 "Set the description directly when creating the example query. Use <my query description> instead of :q: when creating the string")
135 void setSearchTermDescription(const QString &description);
136#endif
137
138#if KRUNNER_ENABLE_DEPRECATED_SINCE(5, 76)
143 KRUNNER_DEPRECATED_VERSION(5, 76, "Feature is obsolete, the search term description should be set inside of the example query directly")
144 QString searchTermDescription() const;
145#endif
146
147private:
148 std::unique_ptr<RunnerSyntaxPrivate> const d;
149};
150
151} // namespace Plasma
152
153#if !KRUNNER_ENABLE_DEPRECATED_SINCE(5, 91)
154namespace KRunner
155{
156using RunnerSyntax = Plasma::RunnerSyntax;
157}
158#endif
159
160#endif // multiple inclusion guard
Definition runnersyntax.h:42
RunnerSyntax(const QStringList &exampleQueries, const QString &description)
Constructs a syntax object.
QStringList exampleQueries() const
QString description() const
RunnerSyntax(const QString &exampleQuery, const QString &description)
Constructs a simple syntax object.
RunnerSyntax & operator=(const RunnerSyntax &rhs)
Assignment operator.
RunnerSyntax(const RunnerSyntax &other)
Copy constructor.