QGpgME  17.2.1.0000000
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 by Bundesamt für Sicherheit in der Informationstechnik
7  Software engineering by Intevation GmbH
8 
9  QGpgME is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version.
13 
14  QGpgME is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 
23  In addition, as a special exception, the copyright holders give
24  permission to link the code of this program with any edition of
25  the Qt library by Trolltech AS, Norway (or with modified versions
26  of Qt that use the same license as Qt), and distribute linked
27  combinations including the two. You must obey the GNU General
28  Public License in all respects for all of the code used other than
29  Qt. If you modify this file, you may extend this exception to
30  your version of the file, but you are not obligated to do so. If
31  you do not wish to do so, delete this exception statement from
32  your version.
33 */
34 
35 #ifndef CRYPTOCONFIG_H
36 #define CRYPTOCONFIG_H
37 
38 #include "qgpgme_export.h"
39 #ifdef __cplusplus
40 /* we read this file from a C compiler, and are only interested in the
41  * enums... */
42 
43 #include <QUrl>
44 
45 #include <vector>
46 
47 class QVariant;
48 
49 /* Start reading this file from the bottom up :) */
50 
51 namespace QGpgME
52 {
53 
57 class QGPGME_EXPORT CryptoConfigEntry
58 {
59 
60 public:
61 #endif /* __cplusplus */
67  enum Level { Level_Basic = 0,
68  Level_Advanced = 1,
69  Level_Expert = 2
70  };
71 
88  enum ArgType { ArgType_None = 0,
89  ArgType_String = 1,
90  ArgType_Int = 2,
91  ArgType_UInt = 3,
92  ArgType_Path = 4,
93  /* Nr. 5 was URL historically. */
94  ArgType_LDAPURL = 6,
95  ArgType_DirPath = 7,
96 
97  NumArgType
98  };
99 
100 #ifdef __cplusplus
101  virtual ~CryptoConfigEntry() {}
102 
106  virtual QString name() const = 0;
107 
111  virtual QString description() const = 0;
112 
116  virtual QString path() const = 0;
117 
121  virtual bool isOptional() const = 0;
122 
126  virtual bool isReadOnly() const = 0;
127 
131  virtual bool isList() const = 0;
132 
136  virtual bool isRuntime() const = 0;
137 
141  virtual Level level() const = 0;
142 
146  virtual ArgType argType() const = 0;
147 
151  virtual bool isSet() const = 0;
152 
156  virtual bool boolValue() const = 0;
157 
162  virtual QString stringValue() const = 0;
163 
167  virtual int intValue() const = 0;
168 
172  virtual unsigned int uintValue() const = 0;
173 
177  virtual QUrl urlValue() const = 0;
178 
182  virtual unsigned int numberOfTimesSet() const = 0;
183 
187  virtual std::vector<int> intValueList() const = 0;
188 
192  virtual std::vector<unsigned int> uintValueList() const = 0;
193 
197  virtual QList<QUrl> urlValueList() const = 0;
198 
202  virtual void resetToDefault() = 0;
203 
208  virtual void setBoolValue(bool) = 0;
209 
213  virtual void setStringValue(const QString &) = 0;
214 
218  virtual void setIntValue(int) = 0;
219 
223  virtual void setUIntValue(unsigned int) = 0;
224 
228  virtual void setURLValue(const QUrl &) = 0;
229 
233  virtual void setNumberOfTimesSet(unsigned int) = 0;
234 
238  virtual void setIntValueList(const std::vector<int> &) = 0;
239 
243  virtual void setUIntValueList(const std::vector<unsigned int> &) = 0;
244 
248  virtual void setURLValueList(const QList<QUrl> &) = 0;
249 
253  virtual bool isDirty() const = 0;
254 
255  // Design change from here on we are closely bound to one implementation
256  // of cryptoconfig. To avoid ABI breaks with every new function we
257  // add real functions from now on.
258 
262  QStringList stringValueList() const;
263 
267  QVariant defaultValue() const;
268 };
269 
273 class QGPGME_EXPORT CryptoConfigGroup
274 {
275 
276 public:
277  virtual ~CryptoConfigGroup() {}
278 
282  virtual QString name() const = 0;
283 
287  virtual QString iconName() const = 0;
288 
292  virtual QString description() const = 0;
293 
297  virtual QString path() const = 0;
298 
302  virtual CryptoConfigEntry::Level level() const = 0;
303 
309  virtual QStringList entryList() const = 0;
310 
316  virtual CryptoConfigEntry *entry(const QString &name) const = 0;
317 };
318 
322 class QGPGME_EXPORT CryptoConfigComponent
323 {
324 
325 public:
326  virtual ~CryptoConfigComponent() {}
327 
331  virtual QString name() const = 0;
332 
336  virtual QString iconName() const = 0;
337 
341  virtual QString description() const = 0;
342 
349  virtual QStringList groupList() const = 0;
350 
355  virtual CryptoConfigGroup *group(const QString &name) const = 0;
356 
357 };
358 
362 class QGPGME_EXPORT CryptoConfig
363 {
364 
365 public:
366  virtual ~CryptoConfig() {}
367 
373  virtual QStringList componentList() const = 0;
374 
379  virtual CryptoConfigComponent *component(const QString &name) const = 0;
380 
389  CryptoConfigEntry *entry(const QString &componentName, const QString &entryName) const;
390 
402  QGPGME_DEPRECATED CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const;
403 
410  virtual void sync(bool runtime) = 0;
411 
419  virtual void clear() = 0;
420 };
421 
422 }
423 #endif /* __cplusplus */
424 #endif /* CRYPTOCONFIG_H */