QGpgME  9.2.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  // Design change from here on we are closely bound to one implementation
253  // of cryptoconfig. To avoid ABI breaks with every new function we
254  // add real functions from now on.
255 
259  QStringList stringValueList() const;
260 };
261 
265 class QGPGME_EXPORT CryptoConfigGroup
266 {
267 
268 public:
269  virtual ~CryptoConfigGroup() {}
270 
274  virtual QString name() const = 0;
275 
279  virtual QString iconName() const = 0;
280 
284  virtual QString description() const = 0;
285 
289  virtual QString path() const = 0;
290 
294  virtual CryptoConfigEntry::Level level() const = 0;
295 
301  virtual QStringList entryList() const = 0;
302 
308  virtual CryptoConfigEntry *entry(const QString &name) const = 0;
309 };
310 
314 class QGPGME_EXPORT CryptoConfigComponent
315 {
316 
317 public:
318  virtual ~CryptoConfigComponent() {}
319 
323  virtual QString name() const = 0;
324 
328  virtual QString iconName() const = 0;
329 
333  virtual QString description() const = 0;
334 
341  virtual QStringList groupList() const = 0;
342 
347  virtual CryptoConfigGroup *group(const QString &name) const = 0;
348 
349 };
350 
354 class QGPGME_EXPORT CryptoConfig
355 {
356 
357 public:
358  virtual ~CryptoConfig() {}
359 
365  virtual QStringList componentList() const = 0;
366 
371  virtual CryptoConfigComponent *component(const QString &name) const = 0;
372 
381  CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const
382  {
383  const QGpgME::CryptoConfigComponent *comp = component(componentName);
384  const QGpgME::CryptoConfigGroup *group = comp ? comp->group(groupName) : 0;
385  return group ? group->entry(entryName) : 0;
386  }
387 
394  virtual void sync(bool runtime) = 0;
395 
403  virtual void clear() = 0;
404 };
405 
406 }
407 #endif /* __cplusplus */
408 #endif /* CRYPTOCONFIG_H */
Definition: abstractimportjob.h:47