QGpgME  10.3.4.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 /* Start reading this file from the bottom up :) */
48 
49 namespace QGpgME
50 {
51 
55 class QGPGME_EXPORT CryptoConfigEntry
56 {
57 
58 public:
59 #endif /* __cplusplus */
60 
65  enum Level { Level_Basic = 0,
66  Level_Advanced = 1,
67  Level_Expert = 2
68  };
69 
86  enum ArgType { ArgType_None = 0,
87  ArgType_String = 1,
88  ArgType_Int = 2,
89  ArgType_UInt = 3,
90  ArgType_Path = 4,
91  /* Nr. 5 was URL historically. */
92  ArgType_LDAPURL = 6,
93  ArgType_DirPath = 7,
94 
95  NumArgType
96  };
97 
98 #ifdef __cplusplus
99  virtual ~CryptoConfigEntry() {}
100 
104  virtual QString name() const = 0;
105 
109  virtual QString description() const = 0;
110 
114  virtual QString path() const = 0;
115 
119  virtual bool isOptional() const = 0;
120 
124  virtual bool isReadOnly() const = 0;
125 
129  virtual bool isList() const = 0;
130 
134  virtual bool isRuntime() const = 0;
135 
139  virtual Level level() const = 0;
140 
144  virtual ArgType argType() const = 0;
145 
149  virtual bool isSet() const = 0;
150 
154  virtual bool boolValue() const = 0;
155 
160  virtual QString stringValue() const = 0;
161 
165  virtual int intValue() const = 0;
166 
170  virtual unsigned int uintValue() const = 0;
171 
175  virtual QUrl urlValue() const = 0;
176 
180  virtual unsigned int numberOfTimesSet() const = 0;
181 
185  virtual std::vector<int> intValueList() const = 0;
186 
190  virtual std::vector<unsigned int> uintValueList() const = 0;
191 
195  virtual QList<QUrl> urlValueList() const = 0;
196 
200  virtual void resetToDefault() = 0;
201 
206  virtual void setBoolValue(bool) = 0;
207 
211  virtual void setStringValue(const QString &) = 0;
212 
216  virtual void setIntValue(int) = 0;
217 
221  virtual void setUIntValue(unsigned int) = 0;
222 
226  virtual void setURLValue(const QUrl &) = 0;
227 
231  virtual void setNumberOfTimesSet(unsigned int) = 0;
232 
236  virtual void setIntValueList(const std::vector<int> &) = 0;
237 
241  virtual void setUIntValueList(const std::vector<unsigned int> &) = 0;
242 
246  virtual void setURLValueList(const QList<QUrl> &) = 0;
247 
251  virtual bool isDirty() const = 0;
252 
253  // Design change from here on we are closely bound to one implementation
254  // of cryptoconfig. To avoid ABI breaks with every new function we
255  // add real functions from now on.
256 
260  QStringList stringValueList() const;
261 };
262 
266 class QGPGME_EXPORT CryptoConfigGroup
267 {
268 
269 public:
270  virtual ~CryptoConfigGroup() {}
271 
275  virtual QString name() const = 0;
276 
280  virtual QString iconName() const = 0;
281 
285  virtual QString description() const = 0;
286 
290  virtual QString path() const = 0;
291 
295  virtual CryptoConfigEntry::Level level() const = 0;
296 
302  virtual QStringList entryList() const = 0;
303 
309  virtual CryptoConfigEntry *entry(const QString &name) const = 0;
310 };
311 
315 class QGPGME_EXPORT CryptoConfigComponent
316 {
317 
318 public:
319  virtual ~CryptoConfigComponent() {}
320 
324  virtual QString name() const = 0;
325 
329  virtual QString iconName() const = 0;
330 
334  virtual QString description() const = 0;
335 
342  virtual QStringList groupList() const = 0;
343 
348  virtual CryptoConfigGroup *group(const QString &name) const = 0;
349 
350 };
351 
355 class QGPGME_EXPORT CryptoConfig
356 {
357 
358 public:
359  virtual ~CryptoConfig() {}
360 
366  virtual QStringList componentList() const = 0;
367 
372  virtual CryptoConfigComponent *component(const QString &name) const = 0;
373 
382  CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const
383  {
384  const QGpgME::CryptoConfigComponent *comp = component(componentName);
385  const QGpgME::CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr;
386  return group ? group->entry(entryName) : nullptr;
387  }
388 
395  virtual void sync(bool runtime) = 0;
396 
404  virtual void clear() = 0;
405 };
406 
407 }
408 #endif /* __cplusplus */
409 #endif /* CRYPTOCONFIG_H */