Libksieve

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

KDE's Doxygen guidelines are available online.