Libksieve

sieveeditorutil.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-only
5*/
6
7#include "sieveeditorutil.h"
8
9QUrl KSieveUi::SieveEditorUtil::helpUrl(KSieveUi::SieveEditorUtil::HelpVariableName type)
10{
11 switch (type) {
12 case AddressCondition:
13 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5228#page-16"));
14 case BodyCondition:
15 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5173"));
16 case ConvertCondition:
17 return {}; // TODO
18 case CurrentdateCondition:
19 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5260#page-6"));
20 case DateCondition:
21 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5260#page-4"));
22 case EnvelopeCondition:
23 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-24"));
24 case EnvironmentCondition:
25 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5183"));
26 case ExistsCondition:
27 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-25"));
28 case FalseCondition:
29 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-25"));
30 case HasflagCondition:
31 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-5"));
32 case HeaderCondition:
33 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5228#page-9"));
34 case IhaveCondition:
35 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5463"));
36 case MailboxexistsCondition:
37 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-2"));
38 case MetadataexistsCondition:
39 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-6"));
40 case MetadataCondition:
41 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-5"));
42 case ServermetadataexistsCondition:
43 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-4"));
44 case ServermetadataCondition:
45 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-5"));
46 case SizeCondition:
47 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-26"));
48 case SpamtestCondition:
49 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3685#page-3"));
50 case TrueCondition:
51 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-26"));
52 case NotCondition:
53 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-26"));
54 case AnyOf:
55 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-24"));
56 case Allof:
57 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-23"));
58 case VirustestCondition:
59 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3685#page-4"));
60 case AbstracteditheaderAction:
61 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5228#page-9"));
62 case AddflagsAction:
63 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-5"));
64 case AddheaderAction:
65 case DeleteheaderAction:
66 case EditHeaderExtension:
67 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5293"));
68 case BreakAction:
69 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-3"));
70 case ConvertAction:
71 return {}; // TODO
72 case DiscardAction:
73 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-22"));
74 case EncloseAction:
75 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-10"));
76 case ExtracttextAction:
77 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-11"));
78 case FileintoAction:
79 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-20"));
80 case KeepAction:
81 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-21"));
82 case NotifyAction:
83 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5435#page-3"));
84 case RedirectAction:
85 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-20"));
86 case RejectAction:
87 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-20"));
88 case ERejectAction:
89 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5429#section-2.1"));
90 case RemoveflagsAction:
91 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-5"));
92 case ReplaceAction:
93 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-8"));
94 case ReturnAction:
95 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc6609#page-7"));
96 case SetflagsAction:
97 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-4"));
98 case SetvariableAction:
99 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5229"));
100 case StopAction:
101 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-19"));
102 case VacationAction:
103 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5230#page-3"));
104 case GlobalVariable:
105 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5229"));
106 case Includes:
107 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc6609#page-4"));
108 case ForEveryPart:
109 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-3"));
110 case CopyExtension:
111 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3894"));
112 case MBoxMetaDataExtension:
113 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-2"));
114 case SubAddressExtension:
115 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5233"));
116 case ImapFlagsExtension:
117 return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232"));
118 case UnknownHelp:
119 break;
120 }
121 return {};
122}
123
124KSieveUi::SieveEditorUtil::HelpVariableName KSieveUi::SieveEditorUtil::strToVariableName(const QString &str)
125{
126 if (str == QLatin1StringView("address")) {
127 return AddressCondition;
128 } else if (str == QLatin1StringView("body")) {
129 return BodyCondition;
130 } else if (str == QLatin1StringView("currentdate")) {
131 return CurrentdateCondition;
132 } else if (str == QLatin1StringView("date")) {
133 return DateCondition;
134 } else if (str == QLatin1StringView("envelope")) {
135 return EnvelopeCondition;
136 } else if (str == QLatin1StringView("environment")) {
137 return EnvironmentCondition;
138 } else if (str == QLatin1StringView("exists")) {
139 return ExistsCondition;
140 } else if (str == QLatin1StringView("false")) {
141 return FalseCondition;
142 } else if (str == QLatin1StringView("hasflag")) {
143 return HasflagCondition;
144 } else if (str == QLatin1StringView("header")) {
145 return HeaderCondition;
146 } else if (str == QLatin1StringView("ihave")) {
147 return IhaveCondition;
148 } else if (str == QLatin1StringView("mailboxexists")) {
149 return MailboxexistsCondition;
150 } else if (str == QLatin1StringView("metadata")) {
151 return MetadataCondition;
152 } else if (str == QLatin1StringView("metadataexists")) {
153 return MetadataexistsCondition;
154 } else if (str == QLatin1StringView("servermetadata")) {
155 return ServermetadataCondition;
156 } else if (str == QLatin1StringView("servermetadataexists")) {
157 return ServermetadataexistsCondition;
158 } else if (str == QLatin1StringView("size")) {
159 return SizeCondition;
160 } else if (str == QLatin1StringView("spamtest")) {
161 return SpamtestCondition;
162 } else if (str == QLatin1StringView("true")) {
163 return TrueCondition;
164 } else if (str == QLatin1StringView("not")) {
165 return NotCondition;
166 } else if (str == QLatin1StringView("anyof")) {
167 return AnyOf;
168 } else if (str == QLatin1StringView("allof")) {
169 return Allof;
170 } else if (str == QLatin1StringView("virustest")) {
171 return VirustestCondition;
172 } else if (str == QLatin1StringView("break")) {
173 return BreakAction;
174 } else if (str == QLatin1StringView("convert")) {
175 return ConvertAction; // TODO
176 } else if (str == QLatin1StringView("discard")) {
177 return DiscardAction;
178 } else if (str == QLatin1StringView("enclose")) {
179 return EncloseAction;
180 } else if (str == QLatin1StringView("extracttext")) {
181 return ExtracttextAction;
182 } else if (str == QLatin1StringView("fileinto")) {
183 return FileintoAction;
184 } else if (str == QLatin1StringView("keep")) {
185 return KeepAction;
186 } else if (str == QLatin1StringView("notify")) {
187 return NotifyAction;
188 } else if (str == QLatin1StringView("redirect")) {
189 return RedirectAction;
190 } else if (str == QLatin1StringView("reject")) {
191 return RejectAction;
192 } else if (str == QLatin1StringView("ereject")) {
193 return ERejectAction;
194 } else if (str == QLatin1StringView("replace")) {
195 return ReplaceAction;
196 } else if (str == QLatin1StringView("return")) {
197 return ReturnAction;
198 } else if (str == QLatin1StringView("set")) {
199 return SetvariableAction;
200 } else if (str == QLatin1StringView("stop")) {
201 return StopAction;
202 } else if (str == QLatin1StringView("vacation")) {
203 return VacationAction;
204 } else if (str == QLatin1StringView("include")) {
205 return Includes;
206 } else if (str == QLatin1StringView("globalvariable")) {
207 return GlobalVariable;
208 } else if (str == QLatin1StringView("foreverypart")) {
209 return ForEveryPart;
210 } else if (str == QLatin1StringView("copy")) {
211 return CopyExtension;
212 } else if (str == QLatin1StringView("mboxmetadata")) {
213 return MBoxMetaDataExtension;
214 } else if (str == QLatin1StringView("subaddress")) {
215 return SubAddressExtension;
216 } else if (str == QLatin1StringView("imapflags")) {
217 return ImapFlagsExtension;
218 } else if (str == QLatin1StringView("editheader")) {
219 return EditHeaderExtension;
220 }
221
222 // TODO
223 return UnknownHelp;
224}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.