• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

libkleo

  • sources
  • kde-4.14
  • kdepim
  • libkleo
  • backends
  • qgpgme
qgpgmenewcryptoconfig.h
Go to the documentation of this file.
1 /*
2  qgpgmenewcryptoconfig.h
3 
4  This file is part of libkleopatra, the KDE keymanagement library
5  Copyright (c) 2010 Klarälvdalens Datakonsult AB
6 
7  Libkleopatra is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of the
10  License, or (at your option) any later version.
11 
12  Libkleopatra is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  In addition, as a special exception, the copyright holders give
22  permission to link the code of this program with any edition of
23  the Qt library by Trolltech AS, Norway (or with modified versions
24  of Qt that use the same license as Qt), and distribute linked
25  combinations including the two. You must obey the GNU General
26  Public License in all respects for all of the code used other than
27  Qt. If you modify this file, you may extend this exception to
28  your version of the file, but you are not obligated to do so. If
29  you do not wish to do so, delete this exception statement from
30  your version.
31 */
32 
33 #ifndef KLEO_QGPGMENEWCRYPTOCONFIG_H
34 #define KLEO_QGPGMENEWCRYPTOCONFIG_H
35 
36 #include "kleo/kleo_export.h"
37 #include "kleo/cryptoconfig.h"
38 
39 #include <QHash>
40 #include <QStringList>
41 #include <QObject>
42 #include <QVariant>
43 #include <QPointer>
44 
45 #include <gpgme++/configuration.h>
46 
47 #ifndef Q_MOC_RUN
48 #include <boost/shared_ptr.hpp>
49 #include <boost/weak_ptr.hpp>
50 #include <boost/enable_shared_from_this.hpp>
51 #endif
52 
53 #include <vector>
54 #include <utility>
55 
56 class QGpgMENewCryptoConfig;
57 class QGpgMENewCryptoConfigComponent;
58 class QGpgMENewCryptoConfigGroup;
59 class QGpgMENewCryptoConfigEntry;
60 
61 class QGpgMENewCryptoConfigEntry : public Kleo::CryptoConfigEntry {
62 public:
63  QGpgMENewCryptoConfigEntry( const boost::shared_ptr<QGpgMENewCryptoConfigGroup> & group, const GpgME::Configuration::Option & option );
64  ~QGpgMENewCryptoConfigEntry();
65 
66  /* reimp */ QString name() const;
67  /* reimp */ QString description() const;
68  /* reimp */ QString path() const;
69  /* reimp */ bool isOptional() const;
70  /* reimp */ bool isReadOnly() const;
71  /* reimp */ bool isList() const;
72  /* reimp */ bool isRuntime() const;
73  /* reimp */ Level level() const;
74  /* reimp */ ArgType argType() const;
75  /* reimp */ bool isSet() const;
76  /* reimp */ bool boolValue() const;
77  /* reimp */ QString stringValue() const;
78  /* reimp */ int intValue() const;
79  /* reimp */ unsigned int uintValue() const;
80  /* reimp */ KUrl urlValue() const;
81  /* reimp */ unsigned int numberOfTimesSet() const;
82  /* reimp */ QStringList stringValueList() const;
83  /* reimp */ std::vector<int> intValueList() const;
84  /* reimp */ std::vector<unsigned int> uintValueList() const;
85  /* reimp */ KUrl::List urlValueList() const;
86  /* reimp */ void resetToDefault();
87  /* reimp */ void setBoolValue( bool );
88  /* reimp */ void setStringValue( const QString& );
89  /* reimp */ void setIntValue( int );
90  /* reimp */ void setUIntValue( unsigned int );
91  /* reimp */ void setURLValue( const KUrl& );
92  /* reimp */ void setNumberOfTimesSet( unsigned int );
93  /* reimp */ void setStringValueList( const QStringList& );
94  /* reimp */ void setIntValueList( const std::vector<int>& );
95  /* reimp */ void setUIntValueList( const std::vector<unsigned int>& );
96  /* reimp */ void setURLValueList( const KUrl::List& );
97  /* reimp */ bool isDirty() const;
98 
99 #if 0
100  void setDirty( bool b );
101  QString outputString() const;
102 
103 protected:
104  bool isStringType() const;
105  QVariant stringToValue( const QString& value, bool unescape ) const;
106  QString toString( bool escape ) const;
107 #endif
108 private:
109  boost::weak_ptr<QGpgMENewCryptoConfigGroup> m_group;
110  GpgME::Configuration::Option m_option;
111 };
112 
113 class QGpgMENewCryptoConfigGroup : public Kleo::CryptoConfigGroup {
114 public:
115  QGpgMENewCryptoConfigGroup( const boost::shared_ptr<QGpgMENewCryptoConfigComponent> & parent, const GpgME::Configuration::Option & option );
116  ~QGpgMENewCryptoConfigGroup();
117 
118  /* reimp */ QString name() const;
119  /* reimp */ QString iconName() const { return QString(); }
120  /* reimp */ QString description() const;
121  /* reimp */ QString path() const;
122  /* reimp */ Kleo::CryptoConfigEntry::Level level() const;
123  /* reimp */ QStringList entryList() const;
124  /* reimp */ QGpgMENewCryptoConfigEntry * entry( const QString & name ) const;
125 
126 private:
127  friend class QGpgMENewCryptoConfigComponent; // it adds the entries
128  boost::weak_ptr<QGpgMENewCryptoConfigComponent> m_component;
129  GpgME::Configuration::Option m_option;
130  QStringList m_entryNames;
131  QHash< QString, boost::shared_ptr<QGpgMENewCryptoConfigEntry> > m_entriesByName;
132 };
133 
135 class QGpgMENewCryptoConfigComponent : public Kleo::CryptoConfigComponent, public boost::enable_shared_from_this<QGpgMENewCryptoConfigComponent> {
136 public:
137  QGpgMENewCryptoConfigComponent();
138  ~QGpgMENewCryptoConfigComponent();
139 
140  void setComponent( const GpgME::Configuration::Component & component );
141 
142  /* reimp */ QString name() const;
143  /* reimp */ QString iconName() const { return name(); }
144  /* reimp */ QString description() const;
145  /* reimp */ QStringList groupList() const;
146  /* reimp */ QGpgMENewCryptoConfigGroup * group( const QString & name ) const;
147 
148  /* reimp */ void sync( bool runtime );
149 
150 private:
151  GpgME::Configuration::Component m_component;
152  QHash< QString, boost::shared_ptr<QGpgMENewCryptoConfigGroup> > m_groupsByName;
153 };
154 
159 class KLEO_EXPORT QGpgMENewCryptoConfig : public Kleo::CryptoConfig {
160 public:
164  QGpgMENewCryptoConfig();
165  ~QGpgMENewCryptoConfig();
166 
167  /* reimp */ QStringList componentList() const;
168 
169  /* reimp */ QGpgMENewCryptoConfigComponent* component( const QString & name ) const;
170 
171  /* reimp */ void clear();
172  /* reimp */ void sync( bool runtime );
173 
174 private:
176  void reloadConfiguration( bool showErrors );
177 
178 private:
179  QHash< QString, boost::shared_ptr<QGpgMENewCryptoConfigComponent> > m_componentsByName;
180  bool m_parsed;
181 };
182 
183 #endif /* KLEO_QGPGMENEWCRYPTOCONFIG_H */
QGpgMENewCryptoConfigEntry::isReadOnly
bool isReadOnly() const
Definition: qgpgmenewcryptoconfig.cpp:402
QGpgMENewCryptoConfigEntry::setNumberOfTimesSet
void setNumberOfTimesSet(unsigned int)
Definition: qgpgmenewcryptoconfig.cpp:639
QGpgMENewCryptoConfigEntry::setURLValue
void setURLValue(const KUrl &)
Definition: qgpgmenewcryptoconfig.cpp:624
QGpgMENewCryptoConfigEntry::setUIntValue
void setUIntValue(unsigned int)
Definition: qgpgmenewcryptoconfig.cpp:617
name
const char * name
Definition: kconfigbasedkeyfilter.cpp:126
QGpgMENewCryptoConfigComponent::groupList
QStringList groupList() const
Definition: qgpgmenewcryptoconfig.cpp:190
QGpgMENewCryptoConfigGroup::QGpgMENewCryptoConfigGroup
QGpgMENewCryptoConfigGroup(const boost::shared_ptr< QGpgMENewCryptoConfigComponent > &parent, const GpgME::Configuration::Option &option)
Definition: qgpgmenewcryptoconfig.cpp:219
QGpgMENewCryptoConfigGroup::~QGpgMENewCryptoConfigGroup
~QGpgMENewCryptoConfigGroup()
Definition: qgpgmenewcryptoconfig.cpp:226
QGpgMENewCryptoConfigEntry::setBoolValue
void setBoolValue(bool)
Definition: qgpgmenewcryptoconfig.cpp:585
QGpgMENewCryptoConfig
CryptoConfig implementation around the gpgconf command-line tool For method docu, see kleo/cryptoconf...
Definition: qgpgmenewcryptoconfig.h:159
QGpgMENewCryptoConfigEntry::QGpgMENewCryptoConfigEntry
QGpgMENewCryptoConfigEntry(const boost::shared_ptr< QGpgMENewCryptoConfigGroup > &group, const GpgME::Configuration::Option &option)
Definition: qgpgmenewcryptoconfig.cpp:318
QGpgMENewCryptoConfigGroup::path
QString path() const
Definition: qgpgmenewcryptoconfig.cpp:238
QGpgMENewCryptoConfigComponent::setComponent
void setComponent(const GpgME::Configuration::Component &component)
Definition: qgpgmenewcryptoconfig.cpp:152
QGpgMENewCryptoConfigEntry::description
QString description() const
Definition: qgpgmenewcryptoconfig.cpp:384
QGpgMENewCryptoConfigEntry::urlValue
KUrl urlValue() const
Definition: qgpgmenewcryptoconfig.cpp:514
QGpgMENewCryptoConfigEntry::~QGpgMENewCryptoConfigEntry
~QGpgMENewCryptoConfigEntry()
Definition: qgpgmenewcryptoconfig.cpp:370
QGpgMENewCryptoConfigGroup::level
Kleo::CryptoConfigEntry::Level level() const
Definition: qgpgmenewcryptoconfig.cpp:246
QGpgMENewCryptoConfigEntry::stringValue
QString stringValue() const
Definition: qgpgmenewcryptoconfig.cpp:445
QGpgMENewCryptoConfigEntry::isRuntime
bool isRuntime() const
Definition: qgpgmenewcryptoconfig.cpp:412
QGpgMENewCryptoConfigGroup::entryList
QStringList entryList() const
Definition: qgpgmenewcryptoconfig.cpp:252
QGpgMENewCryptoConfigEntry::isSet
bool isSet() const
Definition: qgpgmenewcryptoconfig.cpp:433
QGpgMENewCryptoConfigGroup::name
QString name() const
Definition: qgpgmenewcryptoconfig.cpp:228
QGpgMENewCryptoConfigComponent::name
QString name() const
Definition: qgpgmenewcryptoconfig.cpp:180
QGpgMENewCryptoConfigGroup::iconName
QString iconName() const
Definition: qgpgmenewcryptoconfig.h:119
QGpgMENewCryptoConfigComponent::description
QString description() const
Definition: qgpgmenewcryptoconfig.cpp:185
boost::shared_ptr
Definition: checksumdefinition.h:46
QGpgMENewCryptoConfigComponent::sync
void sync(bool runtime)
Definition: qgpgmenewcryptoconfig.cpp:205
QGpgMENewCryptoConfigEntry::setIntValueList
void setIntValueList(const std::vector< int > &)
Definition: qgpgmenewcryptoconfig.cpp:661
QHash
QGpgMENewCryptoConfigEntry::isDirty
bool isDirty() const
Definition: qgpgmenewcryptoconfig.cpp:690
QGpgMENewCryptoConfigGroup::entry
QGpgMENewCryptoConfigEntry * entry(const QString &name) const
Definition: qgpgmenewcryptoconfig.cpp:257
QGpgMENewCryptoConfigEntry::intValue
int intValue() const
Definition: qgpgmenewcryptoconfig.cpp:453
QGpgMENewCryptoConfigEntry::setURLValueList
void setURLValueList(const KUrl::List &)
Definition: qgpgmenewcryptoconfig.cpp:675
QGpgMENewCryptoConfigGroup
Definition: qgpgmenewcryptoconfig.h:113
Level
Level
Definition: cryptoconfig.h:60
QGpgMENewCryptoConfigEntry::argType
ArgType argType() const
Definition: qgpgmenewcryptoconfig.cpp:423
QGpgMENewCryptoConfigComponent::group
QGpgMENewCryptoConfigGroup * group(const QString &name) const
Definition: qgpgmenewcryptoconfig.cpp:200
QGpgMENewCryptoConfigEntry::stringValueList
QStringList stringValueList() const
Definition: qgpgmenewcryptoconfig.cpp:535
QString
KLEO_EXPORT
#define KLEO_EXPORT
Definition: kleo_export.h:41
QGpgMENewCryptoConfigEntry::setIntValue
void setIntValue(int)
Definition: qgpgmenewcryptoconfig.cpp:610
QGpgMENewCryptoConfigComponent::iconName
QString iconName() const
Definition: qgpgmenewcryptoconfig.h:143
QGpgMENewCryptoConfigGroup::description
QString description() const
Definition: qgpgmenewcryptoconfig.cpp:233
QStringList
cryptoconfig.h
QGpgMENewCryptoConfigComponent::~QGpgMENewCryptoConfigComponent
~QGpgMENewCryptoConfigComponent()
Definition: qgpgmenewcryptoconfig.cpp:178
ArgType
ArgType
Type of the argument.
Definition: cryptoconfig.h:81
QGpgMENewCryptoConfigEntry::boolValue
bool boolValue() const
Definition: qgpgmenewcryptoconfig.cpp:438
QGpgMENewCryptoConfigEntry::setStringValueList
void setStringValueList(const QStringList &)
Definition: qgpgmenewcryptoconfig.cpp:646
QGpgMENewCryptoConfigComponent
For docu, see kleo/cryptoconfig.h.
Definition: qgpgmenewcryptoconfig.h:135
QGpgMENewCryptoConfigEntry::setStringValue
void setStringValue(const QString &)
Definition: qgpgmenewcryptoconfig.cpp:594
QGpgMENewCryptoConfigEntry::urlValueList
KUrl::List urlValueList() const
Definition: qgpgmenewcryptoconfig.cpp:561
QGpgMENewCryptoConfigEntry::name
QString name() const
Definition: qgpgmenewcryptoconfig.cpp:379
QGpgMENewCryptoConfigEntry::uintValue
unsigned int uintValue() const
Definition: qgpgmenewcryptoconfig.cpp:460
QGpgMENewCryptoConfigEntry::level
Level level() const
Definition: qgpgmenewcryptoconfig.cpp:417
QGpgMENewCryptoConfigEntry::isOptional
bool isOptional() const
Definition: qgpgmenewcryptoconfig.cpp:397
QGpgMENewCryptoConfigEntry::setUIntValueList
void setUIntValueList(const std::vector< unsigned int > &)
Definition: qgpgmenewcryptoconfig.cpp:668
QGpgMENewCryptoConfigEntry::isList
bool isList() const
Definition: qgpgmenewcryptoconfig.cpp:407
QGpgMENewCryptoConfigEntry::resetToDefault
void resetToDefault()
Definition: qgpgmenewcryptoconfig.cpp:580
QGpgMENewCryptoConfigEntry::path
QString path() const
Definition: qgpgmenewcryptoconfig.cpp:389
kleo_export.h
QGpgMENewCryptoConfigEntry::numberOfTimesSet
unsigned int numberOfTimesSet() const
Definition: qgpgmenewcryptoconfig.cpp:528
QGpgMENewCryptoConfigComponent::QGpgMENewCryptoConfigComponent
QGpgMENewCryptoConfigComponent()
Definition: qgpgmenewcryptoconfig.cpp:145
QGpgMENewCryptoConfigEntry::intValueList
std::vector< int > intValueList() const
Definition: qgpgmenewcryptoconfig.cpp:547
QGpgMENewCryptoConfigEntry
Definition: qgpgmenewcryptoconfig.h:61
QGpgMENewCryptoConfigEntry::uintValueList
std::vector< unsigned int > uintValueList() const
Definition: qgpgmenewcryptoconfig.cpp:554
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkleo

Skip menu "libkleo"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal