2 Copyright (c) 2011-2014 Montel Laurent <montel@kde.org>
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.
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.
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
18 #include "templatesutil.h"
20 #include <KConfigGroup>
21 #include <KSharedConfig>
22 #include <QStringList>
23 using namespace TemplateParser
;
25 void TemplateParser::Util::deleteTemplate( const QString
&id
)
27 KSharedConfig::Ptr config
=
28 KSharedConfig::openConfig( QLatin1String("templatesconfigurationrc"), KConfig::NoGlobals
);
30 const QString key
= QString::fromLatin1( "Templates #%1" ).arg( id
);
31 if ( config
->hasGroup( key
) ) {
32 KConfigGroup group
= config
->group( key
);
38 QStringList
TemplateParser::Util::keywordsWithArgs()
40 QStringList keywordsWithArgs
;
42 << QLatin1String( "%REM=\".*\"%-" )
43 << QLatin1String( "%INSERT=\".*\"" )
44 << QLatin1String( "%SYSTEM=\".*\"" )
45 << QLatin1String( "%PUT=\".*\"" )
46 << QLatin1String( "%QUOTEPIPE=\".*\"" )
47 << QLatin1String( "%MSGPIPE=\".*\"" )
48 << QLatin1String( "%BODYPIPE=\".*\"" )
49 << QLatin1String( "%CLEARPIPE=\".*\"" )
50 << QLatin1String( "%TEXTPIPE=\".*\"" )
51 << QLatin1String( "%OHEADER=\".*\"" )
52 << QLatin1String( "%HEADER=\".*\"" );
54 return keywordsWithArgs
;
57 QStringList
TemplateParser::Util::keywords()
61 << QLatin1String( "%QUOTE" )
62 << QLatin1String( "%FORCEDPLAIN" )
63 << QLatin1String( "%FORCEDHTML" )
64 << QLatin1String( "%QHEADERS" )
65 << QLatin1String( "%HEADERS" )
66 << QLatin1String( "%TEXT" )
67 << QLatin1String( "%OTEXTSIZE" )
68 << QLatin1String( "%OTEXT" )
69 << QLatin1String( "%OADDRESSEESADDR" )
70 << QLatin1String( "%CCADDR" )
71 << QLatin1String( "%CCNAME" )
72 << QLatin1String( "%CCFNAME" )
73 << QLatin1String( "%CCLNAME" )
74 << QLatin1String( "%TOADDR" )
75 << QLatin1String( "%TONAME" )
76 << QLatin1String( "%TOFNAME" )
77 << QLatin1String( "%TOLNAME" )
78 << QLatin1String( "%TOLIST" )
79 << QLatin1String( "%FROMADDR" )
80 << QLatin1String( "%FROMNAME" )
81 << QLatin1String( "%FROMFNAME" )
82 << QLatin1String( "%FROMLNAME" )
83 << QLatin1String( "%FULLSUBJECT" )
84 << QLatin1String( "%FULLSUBJ" )
85 << QLatin1String( "%MSGID" )
86 << QLatin1String( "%HEADER( " )
87 << QLatin1String( "%OCCADDR" )
88 << QLatin1String( "%OCCNAME" )
89 << QLatin1String( "%OCCFNAME" )
90 << QLatin1String( "%OCCLNAME" )
91 << QLatin1String( "%OTOADDR" )
92 << QLatin1String( "%OTONAME" )
93 << QLatin1String( "%OTOFNAME" )
94 << QLatin1String( "%OTOLNAME" )
95 << QLatin1String( "%OTOLIST" )
96 << QLatin1String( "%OTO" )
97 << QLatin1String( "%OFROMADDR" )
98 << QLatin1String( "%OFROMNAME" )
99 << QLatin1String( "%OFROMFNAME" )
100 << QLatin1String( "%OFROMLNAME" )
101 << QLatin1String( "%OFULLSUBJECT" )
102 << QLatin1String( "%OFULLSUBJ" )
103 << QLatin1String( "%OMSGID" )
104 << QLatin1String( "%DATEEN" )
105 << QLatin1String( "%DATESHORT" )
106 << QLatin1String( "%DATE" )
107 << QLatin1String( "%DOW" )
108 << QLatin1String( "%TIMELONGEN" )
109 << QLatin1String( "%TIMELONG" )
110 << QLatin1String( "%TIME" )
111 << QLatin1String( "%ODATEEN" )
112 << QLatin1String( "%ODATESHORT" )
113 << QLatin1String( "%ODATE" )
114 << QLatin1String( "%ODOW" )
115 << QLatin1String( "%OTIMELONGEN" )
116 << QLatin1String( "%OTIMELONG" )
117 << QLatin1String( "%OTIME" )
118 << QLatin1String( "%BLANK" )
119 << QLatin1String( "%NOP" )
120 << QLatin1String( "%CLEAR" )
121 << QLatin1String( "%DEBUGOFF" )
122 << QLatin1String( "%DEBUG" )
123 << QLatin1String( "%CURSOR" )
124 << QLatin1String( "%SIGNATURE" );