sieveeditorutil.cpp 10.3 KB
Newer Older
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
  Copyright (c) 2013-2016 Montel Laurent <montel@kde.org>
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License, version 2, as
  published by the Free Software Foundation.

  This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#include "sieveeditorutil.h"

QUrl KSieveUi::SieveEditorUtil::helpUrl(KSieveUi::SieveEditorUtil::HelpVariableName type)
{
    switch (type) {
    case AddressCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5228#page-16"));
    case BodyCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5173"));
    case ConvertCondition:
        return QUrl(); //TODO
    case CurrentdateCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/search/rfc5260#page-6"));
    case DateCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/search/rfc5260#page-4"));
    case EnvelopeCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-24"));
    case EnvironmentCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5183"));
    case ExistsCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-25"));
    case FalseCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-25"));
    case HasflagCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-5"));
    case HeaderCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5228#page-9"));
    case IhaveCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5463"));
    case MailboxexistsCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-2"));
    case MetadataexistsCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-6"));
    case MetadataCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-5"));
    case ServermetadataexistsCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-4"));
    case ServermetadataCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-5"));
    case SizeCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-26"));
    case SpamtestCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3685#page-3"));
    case TrueCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-26"));
Laurent Montel's avatar
Laurent Montel committed
63
64
65
66
67
68
    case NotCondition:
        return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-26"));
    case AnyOf:
        return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-24"));
    case Allof:
        return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-23"));
69
70
71
72
73
74
75
    case VirustestCondition:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3685#page-4"));
    case AbstracteditheaderAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5228#page-9"));
    case AddflagsAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-5"));
    case AddheaderAction:
Laurent Montel's avatar
Laurent Montel committed
76
77
    case DeleteheaderAction:
    case EditHeaderExtension:
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5293"));
    case BreakAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-3"));
    case ConvertAction:
        return QUrl(); //TODO
    case DiscardAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-22"));
    case EncloseAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-10"));
    case ExtracttextAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-11"));
    case FileintoAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/search/rfc3028#page-20"));
    case KeepAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-21"));
    case NotifyAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/search/rfc5435#page-3"));
    case RedirectAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-20"));
    case RejectAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-20"));
    case ERejectAction:
        return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5429#section-2.1"));
    case RemoveflagsAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-5"));
    case ReplaceAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-8"));
    case ReturnAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc6609#page-7"));
    case SetflagsAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-4"));
    case SetvariableAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/search/rfc5229"));
    case StopAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-19"));
    case VacationAction:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5230#page-3"));
    case GlobalVariable:
        return QUrl(QStringLiteral("http://tools.ietf.org/search/rfc5229"));
    case Includes:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc6609#page-4"));
    case ForEveryPart:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-3"));
    case CopyExtension:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3894"));
    case MBoxMetaDataExtension:
        return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-2"));
    case SubAddressExtension:
        return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5233"));
Laurent Montel's avatar
Laurent Montel committed
127
128
    case ImapFlagsExtension:
        return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232"));
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
    case UnknownHelp:
        break;
    }
    return QUrl();
}

KSieveUi::SieveEditorUtil::HelpVariableName KSieveUi::SieveEditorUtil::strToVariableName(const QString &str)
{
    if (str == QLatin1String("address")) {
        return AddressCondition;
    } else if (str == QLatin1String("body")) {
        return BodyCondition;
    } else if (str == QLatin1String("currentdate")) {
        return CurrentdateCondition;
    } else if (str == QLatin1String("date")) {
        return DateCondition;
    } else if (str == QLatin1String("envelope")) {
        return EnvelopeCondition;
    } else if (str == QLatin1String("environment")) {
        return EnvironmentCondition;
    } else if (str == QLatin1String("exists")) {
        return ExistsCondition;
    } else if (str == QLatin1String("false")) {
        return FalseCondition;
    } else if (str == QLatin1String("hasflag")) {
        return HasflagCondition;
    } else if (str == QLatin1String("header")) {
        return HeaderCondition;
    } else if (str == QLatin1String("ihave")) {
        return IhaveCondition;
    } else if (str == QLatin1String("mailboxexists")) {
        return MailboxexistsCondition;
    } else if (str == QLatin1String("metadata")) {
        return MetadataCondition;
    } else if (str == QLatin1String("metadataexists")) {
        return MetadataexistsCondition;
    } else if (str == QLatin1String("servermetadata")) {
        return ServermetadataCondition;
    } else if (str == QLatin1String("servermetadataexists")) {
        return ServermetadataexistsCondition;
    } else if (str == QLatin1String("size")) {
        return SizeCondition;
    } else if (str == QLatin1String("spamtest")) {
        return SpamtestCondition;
    } else if (str == QLatin1String("true")) {
        return TrueCondition;
Laurent Montel's avatar
Laurent Montel committed
175
176
177
178
179
180
    } else if (str == QLatin1String("not")) {
        return NotCondition;
    } else if (str == QLatin1String("anyof")) {
        return AnyOf;
    } else if (str == QLatin1String("allof")) {
        return Allof;
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
    } else if (str == QLatin1String("virustest")) {
        return VirustestCondition;
    } else if (str == QLatin1String("break")) {
        return BreakAction;
    } else if (str == QLatin1String("convert")) {
        return ConvertAction; //TODO
    } else if (str == QLatin1String("discard")) {
        return DiscardAction;
    } else if (str == QLatin1String("enclose")) {
        return EncloseAction;
    } else if (str == QLatin1String("extracttext")) {
        return ExtracttextAction;
    } else if (str == QLatin1String("fileinto")) {
        return FileintoAction;
    } else if (str == QLatin1String("keep")) {
        return KeepAction;
    } else if (str == QLatin1String("notify")) {
        return NotifyAction;
    } else if (str == QLatin1String("redirect")) {
        return RedirectAction;
    } else if (str == QLatin1String("reject")) {
        return RejectAction;
    } else if (str == QLatin1String("ereject")) {
        return ERejectAction;
    } else if (str == QLatin1String("replace")) {
        return ReplaceAction;
    } else if (str == QLatin1String("return")) {
        return ReturnAction;
    } else if (str == QLatin1String("set")) {
        return SetvariableAction;
    } else if (str == QLatin1String("stop")) {
        return StopAction;
    } else if (str == QLatin1String("vacation")) {
        return VacationAction;
    } else if (str == QLatin1String("include")) {
        return Includes;
    } else if (str == QLatin1String("globalvariable")) {
        return GlobalVariable;
    } else if (str == QLatin1String("foreverypart")) {
        return ForEveryPart;
    } else if (str == QLatin1String("copy")) {
        return CopyExtension;
    } else if (str == QLatin1String("mboxmetadata")) {
        return MBoxMetaDataExtension;
    } else if (str == QLatin1String("subaddress")) {
        return SubAddressExtension;
Laurent Montel's avatar
Laurent Montel committed
227
228
    } else if (str == QLatin1String("imapflags")) {
        return ImapFlagsExtension;
Laurent Montel's avatar
Laurent Montel committed
229
230
    } else if (str == QLatin1String("editheader")) {
        return EditHeaderExtension;
231
232
233
234
235
    }

    //TODO
    return UnknownHelp;
}