QGpgME  8.1.0.0
Qt API for GpgME
cryptoconfig.h
1 /*
2  cryptoconfig.h
3 
4  This file is part of qgpgme, the Qt API binding for gpgme
5  Copyright (c) 2004 Klarälvdalens Datakonsult AB
6  Copyright (c) 2016 Intevation GmbH
7 
8  QGpgME is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12 
13  QGpgME is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the Qt library by Trolltech AS, Norway (or with modified versions
25  of Qt that use the same license as Qt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  Qt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 */
33 
34 #ifndef CRYPTOCONFIG_H
35 #define CRYPTOCONFIG_H
36 
37 #include "qgpgme_export.h"
38 #ifdef __cplusplus
39 /* we read this file from a C compiler, and are only interested in the
40  * enums... */
41 
42 #include <QUrl>
43 
44 #include <vector>
45 
46 /* Start reading this file from the bottom up :) */
47 
48 namespace QGpgME
49 {
50 
54 class QGPGME_EXPORT CryptoConfigEntry
55 {
56 
57 public:
58 #endif /* __cplusplus */
59 
64  enum Level { Level_Basic = 0,
65  Level_Advanced = 1,
66  Level_Expert = 2
67  };
68 
85  enum ArgType { ArgType_None = 0,
86  ArgType_String = 1,
87  ArgType_Int = 2,
88  ArgType_UInt = 3,
89  ArgType_Path = 4,
90  /* Nr. 5 was URL historically. */
91  ArgType_LDAPURL = 6,
92  ArgType_DirPath = 7,
93 
94  NumArgType
95  };
96 
97 #ifdef __cplusplus
98  virtual ~CryptoConfigEntry() {}
99 
103  virtual QString name() const = 0;
104 
108  virtual QString description() const = 0;
109 
113  virtual QString path() const = 0;
114 
118  virtual bool isOptional() const = 0;
119 
123  virtual bool isReadOnly() const = 0;
124 
128  virtual bool isList() const = 0;
129 
133  virtual bool isRuntime() const = 0;
134 
138  virtual Level level() const = 0;
139 
143  virtual ArgType argType() const = 0;
144 
148  virtual bool isSet() const = 0;
149 
153  virtual bool boolValue() const = 0;
154 
159  virtual QString stringValue() const = 0;
160 
164  virtual int intValue() const = 0;
165 
169  virtual unsigned int uintValue() const = 0;
170 
174  virtual QUrl urlValue() const = 0;
175 
179  virtual unsigned int numberOfTimesSet() const = 0;
180 
184  virtual std::vector<int> intValueList() const = 0;
185 
189  virtual std::vector<unsigned int> uintValueList() const = 0;
190 
194  virtual QList<QUrl> urlValueList() const = 0;
195 
199  virtual void resetToDefault() = 0;
200 
205  virtual void setBoolValue(bool) = 0;
206 
210  virtual void setStringValue(const QString &) = 0;
211 
215  virtual void setIntValue(int) = 0;
216 
220  virtual void setUIntValue(unsigned int) = 0;
221 
225  virtual void setURLValue(const QUrl &) = 0;
226 
230  virtual void setNumberOfTimesSet(unsigned int) = 0;
231 
235  virtual void setIntValueList(const std::vector<int> &) = 0;
236 
240  virtual void setUIntValueList(const std::vector<unsigned int> &) = 0;
241 
245  virtual void setURLValueList(const QList<QUrl> &) = 0;
246 
250  virtual bool isDirty() const = 0;
251 };
252 
256 class QGPGME_EXPORT CryptoConfigGroup
257 {
258 
259 public:
260  virtual ~CryptoConfigGroup() {}
261 
265  virtual QString name() const = 0;
266 
270  virtual QString iconName() const = 0;
271 
275  virtual QString description() const = 0;
276 
280  virtual QString path() const = 0;
281 
285  virtual CryptoConfigEntry::Level level() const = 0;
286 
292  virtual QStringList entryList() const = 0;
293 
299  virtual CryptoConfigEntry *entry(const QString &name) const = 0;
300 };
301 
305 class QGPGME_EXPORT CryptoConfigComponent
306 {
307 
308 public:
309  virtual ~CryptoConfigComponent() {}
310 
314  virtual QString name() const = 0;
315 
319  virtual QString iconName() const = 0;
320 
324  virtual QString description() const = 0;
325 
332  virtual QStringList groupList() const = 0;
333 
338  virtual CryptoConfigGroup *group(const QString &name) const = 0;
339 
340 };
341 
345 class QGPGME_EXPORT CryptoConfig
346 {
347 
348 public:
349  virtual ~CryptoConfig() {}
350 
356  virtual QStringList componentList() const = 0;
357 
362  virtual CryptoConfigComponent *component(const QString &name) const = 0;
363 
372  CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const
373  {
374  const QGpgME::CryptoConfigComponent *comp = component(componentName);
375  const QGpgME::CryptoConfigGroup *group = comp ? comp->group(groupName) : 0;
376  return group ? group->entry(entryName) : 0;
377  }
378 
386  virtual void sync(bool runtime) = 0;
387 
395  virtual void clear() = 0;
396 };
397 
398 }
399 #endif /* __cplusplus */
400 #endif /* CRYPTOCONFIG_H */
Definition: abstractimportjob.h:47