QGpgME
16.1.0.00005e9
Qt API for GpgME
Loading...
Searching...
No Matches
lang
qt
src
qgpgmenewcryptoconfig.h
1
/*
2
qgpgmenewcryptoconfig.h
3
4
This file is part of qgpgme, the Qt API binding for gpgme
5
Copyright (c) 2010 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 QGPGME_QGPGMENEWCRYPTOCONFIG_H
36
#define QGPGME_QGPGMENEWCRYPTOCONFIG_H
37
38
#include "qgpgme_export.h"
39
#include "cryptoconfig.h"
40
41
#include <QHash>
42
#include <QStringList>
43
#include <QVariant>
44
45
#ifdef BUILDING_QGPGME
46
# include "configuration.h"
47
#else
48
# include <gpgme++/configuration.h>
49
#endif
50
51
52
#include <vector>
53
#include <utility>
54
55
class
QGpgMENewCryptoConfig
;
56
class
QGpgMENewCryptoConfigComponent
;
57
class
QGpgMENewCryptoConfigGroup
;
58
class
QGpgMENewCryptoConfigEntry
;
59
60
class
QGpgMENewCryptoConfigEntry
:
public
QGpgME::CryptoConfigEntry
61
{
62
public
:
63
QGpgMENewCryptoConfigEntry
(
const
std::shared_ptr<QGpgMENewCryptoConfigGroup> &group,
const
GpgME::Configuration::Option &
option
);
64
~QGpgMENewCryptoConfigEntry
();
65
66
QString
name()
const
Q_DECL_OVERRIDE
;
67
QString
description()
const
Q_DECL_OVERRIDE
;
68
QString
path()
const
Q_DECL_OVERRIDE
;
69
bool
isOptional()
const
Q_DECL_OVERRIDE
;
70
bool
isReadOnly()
const
Q_DECL_OVERRIDE
;
71
bool
isList()
const
Q_DECL_OVERRIDE
;
72
bool
isRuntime()
const
Q_DECL_OVERRIDE
;
73
Level level()
const
Q_DECL_OVERRIDE
;
74
ArgType argType()
const
Q_DECL_OVERRIDE
;
75
bool
isSet()
const
Q_DECL_OVERRIDE
;
76
bool
boolValue()
const
Q_DECL_OVERRIDE
;
77
QString
stringValue()
const
Q_DECL_OVERRIDE
;
78
int
intValue()
const
Q_DECL_OVERRIDE
;
79
unsigned
int
uintValue()
const
Q_DECL_OVERRIDE
;
80
QUrl
urlValue()
const
Q_DECL_OVERRIDE
;
81
unsigned
int
numberOfTimesSet()
const
Q_DECL_OVERRIDE
;
82
std::vector<int> intValueList()
const
Q_DECL_OVERRIDE
;
83
std::vector<unsigned int> uintValueList()
const
Q_DECL_OVERRIDE
;
84
QList<QUrl>
urlValueList()
const
Q_DECL_OVERRIDE
;
85
void
resetToDefault()
Q_DECL_OVERRIDE
;
86
void
setBoolValue(
bool
)
Q_DECL_OVERRIDE
;
87
void
setStringValue(
const
QString
&)
Q_DECL_OVERRIDE
;
88
void
setIntValue(
int
)
Q_DECL_OVERRIDE
;
89
void
setUIntValue(
unsigned
int
)
Q_DECL_OVERRIDE
;
90
void
setURLValue(
const
QUrl
&)
Q_DECL_OVERRIDE
;
91
void
setNumberOfTimesSet(
unsigned
int
)
Q_DECL_OVERRIDE
;
92
void
setIntValueList(
const
std::vector<int> &)
Q_DECL_OVERRIDE
;
93
void
setUIntValueList(
const
std::vector<unsigned int> &)
Q_DECL_OVERRIDE
;
94
void
setURLValueList(
const
QList<QUrl>
&)
Q_DECL_OVERRIDE
;
95
bool
isDirty()
const
Q_DECL_OVERRIDE
;
96
97
QStringList
stringValueList()
const
;
98
QVariant
defaultValue()
const
;
99
100
#if 0
101
void
setDirty
(
bool
b
);
102
QString
outputString
()
const
;
103
104
protected
:
105
bool
isStringType
()
const
;
106
QVariant
stringToValue
(
const
QString
&value,
bool
unescape
)
const
;
107
QString
toString
(
bool
escape)
const
;
108
#endif
109
private
:
110
std::weak_ptr<QGpgMENewCryptoConfigGroup> m_group;
111
GpgME::Configuration::Option m_option;
112
};
113
114
class
QGpgMENewCryptoConfigGroup
:
public
QGpgME::CryptoConfigGroup
115
{
116
public
:
117
QGpgMENewCryptoConfigGroup
(
const
std::shared_ptr<QGpgMENewCryptoConfigComponent> &
parent
,
const
GpgME::Configuration::Option &
option
);
118
~QGpgMENewCryptoConfigGroup
();
119
120
QString
name()
const
Q_DECL_OVERRIDE
;
121
QString
iconName()
const
Q_DECL_OVERRIDE
122
{
123
return
QString
();
124
}
125
QString
description()
const
Q_DECL_OVERRIDE
;
126
QString
path()
const
Q_DECL_OVERRIDE
;
127
QGpgME::CryptoConfigEntry::Level level()
const
Q_DECL_OVERRIDE
;
128
QStringList
entryList()
const
Q_DECL_OVERRIDE
;
129
QGpgMENewCryptoConfigEntry
*entry(
const
QString
&name)
const
Q_DECL_OVERRIDE
;
130
131
private
:
132
friend
class
QGpgMENewCryptoConfigComponent
;
// it adds the entries
133
std::weak_ptr<QGpgMENewCryptoConfigComponent> m_component;
134
GpgME::Configuration::Option m_option;
135
QStringList
m_entryNames;
136
QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigEntry>
> m_entriesByName;
137
};
138
140
class
QGpgMENewCryptoConfigComponent
:
public
QGpgME::CryptoConfigComponent,
public
std::enable_shared_from_this<QGpgMENewCryptoConfigComponent>
141
{
142
public
:
143
QGpgMENewCryptoConfigComponent
();
144
~QGpgMENewCryptoConfigComponent
();
145
146
void
setComponent(
const
GpgME::Configuration::Component &component);
147
148
QString
name()
const
Q_DECL_OVERRIDE
;
149
QString
iconName()
const
Q_DECL_OVERRIDE
150
{
151
return
name();
152
}
153
QString
description()
const
Q_DECL_OVERRIDE
;
154
QStringList
groupList()
const
Q_DECL_OVERRIDE
;
155
QGpgMENewCryptoConfigGroup
*group(
const
QString
&name)
const
Q_DECL_OVERRIDE
;
156
157
void
sync(
bool
runtime
);
158
159
private
:
160
GpgME::Configuration::Component m_component;
161
QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigGroup>
> m_groupsByName;
162
};
163
168
class
QGPGME_EXPORT
QGpgMENewCryptoConfig
:
public
QGpgME::CryptoConfig
169
{
170
public
:
174
QGpgMENewCryptoConfig
();
175
~QGpgMENewCryptoConfig
();
176
177
QStringList
componentList()
const
Q_DECL_OVERRIDE
;
178
179
QGpgMENewCryptoConfigComponent
*component(
const
QString
&name)
const
Q_DECL_OVERRIDE
;
180
181
void
clear()
Q_DECL_OVERRIDE
;
182
void
sync(
bool
runtime
)
Q_DECL_OVERRIDE
;
183
184
private
:
186
void
reloadConfiguration(
bool
showErrors
);
187
188
private
:
189
QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigComponent>
> m_componentsByName;
190
bool
m_parsed;
191
};
192
193
#endif
/* QGPGME_QGPGMENEWCRYPTOCONFIG_H */
QGpgMENewCryptoConfigComponent
For docu, see kleo/cryptoconfig.h.
Definition
qgpgmenewcryptoconfig.h:141
QGpgMENewCryptoConfigEntry
Definition
qgpgmenewcryptoconfig.h:61
QGpgMENewCryptoConfigGroup
Definition
qgpgmenewcryptoconfig.h:115
QGpgMENewCryptoConfig
Definition
qgpgmenewcryptoconfig.h:169
QMap
Definition
qgpgmebackend.h:43
Generated on Tue Mar 12 2024 16:00:23 for QGpgME by
1.9.8