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

libkleo

  • sources
  • kde-4.12
  • 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 #include <boost/shared_ptr.hpp>
48 #include <boost/weak_ptr.hpp>
49 #include <boost/enable_shared_from_this.hpp>
50 
51 #include <vector>
52 #include <utility>
53 
54 class QGpgMENewCryptoConfig;
55 class QGpgMENewCryptoConfigComponent;
56 class QGpgMENewCryptoConfigGroup;
57 class QGpgMENewCryptoConfigEntry;
58 
59 class QGpgMENewCryptoConfigEntry : public Kleo::CryptoConfigEntry {
60 public:
61  QGpgMENewCryptoConfigEntry( const boost::shared_ptr<QGpgMENewCryptoConfigGroup> & group, const GpgME::Configuration::Option & option );
62  ~QGpgMENewCryptoConfigEntry();
63 
64  /* reimp */ QString name() const;
65  /* reimp */ QString description() const;
66  /* reimp */ QString path() const;
67  /* reimp */ bool isOptional() const;
68  /* reimp */ bool isReadOnly() const;
69  /* reimp */ bool isList() const;
70  /* reimp */ bool isRuntime() const;
71  /* reimp */ Level level() const;
72  /* reimp */ ArgType argType() const;
73  /* reimp */ bool isSet() const;
74  /* reimp */ bool boolValue() const;
75  /* reimp */ QString stringValue() const;
76  /* reimp */ int intValue() const;
77  /* reimp */ unsigned int uintValue() const;
78  /* reimp */ KUrl urlValue() const;
79  /* reimp */ unsigned int numberOfTimesSet() const;
80  /* reimp */ QStringList stringValueList() const;
81  /* reimp */ std::vector<int> intValueList() const;
82  /* reimp */ std::vector<unsigned int> uintValueList() const;
83  /* reimp */ KUrl::List urlValueList() const;
84  /* reimp */ void resetToDefault();
85  /* reimp */ void setBoolValue( bool );
86  /* reimp */ void setStringValue( const QString& );
87  /* reimp */ void setIntValue( int );
88  /* reimp */ void setUIntValue( unsigned int );
89  /* reimp */ void setURLValue( const KUrl& );
90  /* reimp */ void setNumberOfTimesSet( unsigned int );
91  /* reimp */ void setStringValueList( const QStringList& );
92  /* reimp */ void setIntValueList( const std::vector<int>& );
93  /* reimp */ void setUIntValueList( const std::vector<unsigned int>& );
94  /* reimp */ void setURLValueList( const KUrl::List& );
95  /* reimp */ bool isDirty() const;
96 
97 #if 0
98  void setDirty( bool b );
99  QString outputString() const;
100 
101 protected:
102  bool isStringType() const;
103  QVariant stringToValue( const QString& value, bool unescape ) const;
104  QString toString( bool escape ) const;
105 #endif
106 private:
107  boost::weak_ptr<QGpgMENewCryptoConfigGroup> m_group;
108  GpgME::Configuration::Option m_option;
109 };
110 
111 class QGpgMENewCryptoConfigGroup : public Kleo::CryptoConfigGroup {
112 public:
113  QGpgMENewCryptoConfigGroup( const boost::shared_ptr<QGpgMENewCryptoConfigComponent> & parent, const GpgME::Configuration::Option & option );
114  ~QGpgMENewCryptoConfigGroup();
115 
116  /* reimp */ QString name() const;
117  /* reimp */ QString iconName() const { return QString(); }
118  /* reimp */ QString description() const;
119  /* reimp */ QString path() const;
120  /* reimp */ Kleo::CryptoConfigEntry::Level level() const;
121  /* reimp */ QStringList entryList() const;
122  /* reimp */ QGpgMENewCryptoConfigEntry * entry( const QString & name ) const;
123 
124 private:
125  friend class QGpgMENewCryptoConfigComponent; // it adds the entries
126  boost::weak_ptr<QGpgMENewCryptoConfigComponent> m_component;
127  GpgME::Configuration::Option m_option;
128  QStringList m_entryNames;
129  QHash< QString, boost::shared_ptr<QGpgMENewCryptoConfigEntry> > m_entriesByName;
130 };
131 
133 class QGpgMENewCryptoConfigComponent : public Kleo::CryptoConfigComponent, public boost::enable_shared_from_this<QGpgMENewCryptoConfigComponent> {
134 public:
135  QGpgMENewCryptoConfigComponent();
136  ~QGpgMENewCryptoConfigComponent();
137 
138  void setComponent( const GpgME::Configuration::Component & component );
139 
140  /* reimp */ QString name() const;
141  /* reimp */ QString iconName() const { return name(); }
142  /* reimp */ QString description() const;
143  /* reimp */ QStringList groupList() const;
144  /* reimp */ QGpgMENewCryptoConfigGroup * group( const QString & name ) const;
145 
146  /* reimp */ void sync( bool runtime );
147 
148 private:
149  GpgME::Configuration::Component m_component;
150  QHash< QString, boost::shared_ptr<QGpgMENewCryptoConfigGroup> > m_groupsByName;
151 };
152 
157 class KLEO_EXPORT QGpgMENewCryptoConfig : public Kleo::CryptoConfig {
158 public:
162  QGpgMENewCryptoConfig();
163  ~QGpgMENewCryptoConfig();
164 
165  /* reimp */ QStringList componentList() const;
166 
167  /* reimp */ QGpgMENewCryptoConfigComponent* component( const QString & name ) const;
168 
169  /* reimp */ void clear();
170  /* reimp */ void sync( bool runtime );
171 
172 private:
174  void reloadConfiguration( bool showErrors );
175 
176 private:
177  QHash< QString, boost::shared_ptr<QGpgMENewCryptoConfigComponent> > m_componentsByName;
178  bool m_parsed;
179 };
180 
181 #endif /* KLEO_QGPGMENEWCRYPTOCONFIG_H */
QGpgMENewCryptoConfigEntry::isReadOnly
bool isReadOnly() const
Definition: qgpgmenewcryptoconfig.cpp:400
QGpgMENewCryptoConfigEntry::setNumberOfTimesSet
void setNumberOfTimesSet(unsigned int)
Definition: qgpgmenewcryptoconfig.cpp:637
QGpgMENewCryptoConfigEntry::setURLValue
void setURLValue(const KUrl &)
Definition: qgpgmenewcryptoconfig.cpp:622
QGpgMENewCryptoConfigEntry::setUIntValue
void setUIntValue(unsigned int)
Definition: qgpgmenewcryptoconfig.cpp:615
name
const char * name
Definition: kconfigbasedkeyfilter.cpp:124
QGpgMENewCryptoConfigComponent::groupList
QStringList groupList() const
Definition: qgpgmenewcryptoconfig.cpp:188
QGpgMENewCryptoConfigGroup::QGpgMENewCryptoConfigGroup
QGpgMENewCryptoConfigGroup(const boost::shared_ptr< QGpgMENewCryptoConfigComponent > &parent, const GpgME::Configuration::Option &option)
Definition: qgpgmenewcryptoconfig.cpp:217
QGpgMENewCryptoConfigGroup::~QGpgMENewCryptoConfigGroup
~QGpgMENewCryptoConfigGroup()
Definition: qgpgmenewcryptoconfig.cpp:224
QGpgMENewCryptoConfigEntry::setBoolValue
void setBoolValue(bool)
Definition: qgpgmenewcryptoconfig.cpp:583
QGpgMENewCryptoConfig
CryptoConfig implementation around the gpgconf command-line tool For method docu, see kleo/cryptoconf...
Definition: qgpgmenewcryptoconfig.h:157
QGpgMENewCryptoConfigEntry::QGpgMENewCryptoConfigEntry
QGpgMENewCryptoConfigEntry(const boost::shared_ptr< QGpgMENewCryptoConfigGroup > &group, const GpgME::Configuration::Option &option)
Definition: qgpgmenewcryptoconfig.cpp:316
QGpgMENewCryptoConfigGroup::path
QString path() const
Definition: qgpgmenewcryptoconfig.cpp:236
QGpgMENewCryptoConfigComponent::setComponent
void setComponent(const GpgME::Configuration::Component &component)
Definition: qgpgmenewcryptoconfig.cpp:150
QGpgMENewCryptoConfigEntry::description
QString description() const
Definition: qgpgmenewcryptoconfig.cpp:382
QGpgMENewCryptoConfigEntry::urlValue
KUrl urlValue() const
Definition: qgpgmenewcryptoconfig.cpp:512
QGpgMENewCryptoConfigEntry::~QGpgMENewCryptoConfigEntry
~QGpgMENewCryptoConfigEntry()
Definition: qgpgmenewcryptoconfig.cpp:368
QGpgMENewCryptoConfigGroup::level
Kleo::CryptoConfigEntry::Level level() const
Definition: qgpgmenewcryptoconfig.cpp:244
QString
QGpgMENewCryptoConfigEntry::stringValue
QString stringValue() const
Definition: qgpgmenewcryptoconfig.cpp:443
QGpgMENewCryptoConfigEntry::isRuntime
bool isRuntime() const
Definition: qgpgmenewcryptoconfig.cpp:410
QGpgMENewCryptoConfigGroup::entryList
QStringList entryList() const
Definition: qgpgmenewcryptoconfig.cpp:250
QGpgMENewCryptoConfigEntry::isSet
bool isSet() const
Definition: qgpgmenewcryptoconfig.cpp:431
QGpgMENewCryptoConfigGroup::name
QString name() const
Definition: qgpgmenewcryptoconfig.cpp:226
QGpgMENewCryptoConfigComponent::name
QString name() const
Definition: qgpgmenewcryptoconfig.cpp:178
QGpgMENewCryptoConfigGroup::iconName
QString iconName() const
Definition: qgpgmenewcryptoconfig.h:117
QGpgMENewCryptoConfigComponent::description
QString description() const
Definition: qgpgmenewcryptoconfig.cpp:183
boost::shared_ptr
Definition: checksumdefinition.h:46
QGpgMENewCryptoConfigComponent::sync
void sync(bool runtime)
Definition: qgpgmenewcryptoconfig.cpp:203
QGpgMENewCryptoConfigEntry::setIntValueList
void setIntValueList(const std::vector< int > &)
Definition: qgpgmenewcryptoconfig.cpp:659
QGpgMENewCryptoConfigEntry::isDirty
bool isDirty() const
Definition: qgpgmenewcryptoconfig.cpp:688
QGpgMENewCryptoConfigGroup::entry
QGpgMENewCryptoConfigEntry * entry(const QString &name) const
Definition: qgpgmenewcryptoconfig.cpp:255
QGpgMENewCryptoConfigEntry::intValue
int intValue() const
Definition: qgpgmenewcryptoconfig.cpp:451
QGpgMENewCryptoConfigEntry::setURLValueList
void setURLValueList(const KUrl::List &)
Definition: qgpgmenewcryptoconfig.cpp:673
QGpgMENewCryptoConfigGroup
Definition: qgpgmenewcryptoconfig.h:111
Level
Level
Definition: cryptoconfig.h:60
QGpgMENewCryptoConfigEntry::argType
ArgType argType() const
Definition: qgpgmenewcryptoconfig.cpp:421
QGpgMENewCryptoConfigComponent::group
QGpgMENewCryptoConfigGroup * group(const QString &name) const
Definition: qgpgmenewcryptoconfig.cpp:198
QGpgMENewCryptoConfigEntry::stringValueList
QStringList stringValueList() const
Definition: qgpgmenewcryptoconfig.cpp:533
KLEO_EXPORT
#define KLEO_EXPORT
Definition: kleo_export.h:41
QGpgMENewCryptoConfigEntry::setIntValue
void setIntValue(int)
Definition: qgpgmenewcryptoconfig.cpp:608
QGpgMENewCryptoConfigComponent::iconName
QString iconName() const
Definition: qgpgmenewcryptoconfig.h:141
QGpgMENewCryptoConfigGroup::description
QString description() const
Definition: qgpgmenewcryptoconfig.cpp:231
cryptoconfig.h
QGpgMENewCryptoConfigComponent::~QGpgMENewCryptoConfigComponent
~QGpgMENewCryptoConfigComponent()
Definition: qgpgmenewcryptoconfig.cpp:176
ArgType
ArgType
Type of the argument.
Definition: cryptoconfig.h:81
QGpgMENewCryptoConfigEntry::boolValue
bool boolValue() const
Definition: qgpgmenewcryptoconfig.cpp:436
QGpgMENewCryptoConfigEntry::setStringValueList
void setStringValueList(const QStringList &)
Definition: qgpgmenewcryptoconfig.cpp:644
QGpgMENewCryptoConfigComponent
For docu, see kleo/cryptoconfig.h.
Definition: qgpgmenewcryptoconfig.h:133
QGpgMENewCryptoConfigEntry::setStringValue
void setStringValue(const QString &)
Definition: qgpgmenewcryptoconfig.cpp:592
QGpgMENewCryptoConfigEntry::urlValueList
KUrl::List urlValueList() const
Definition: qgpgmenewcryptoconfig.cpp:559
QGpgMENewCryptoConfigEntry::name
QString name() const
Definition: qgpgmenewcryptoconfig.cpp:377
QGpgMENewCryptoConfigEntry::uintValue
unsigned int uintValue() const
Definition: qgpgmenewcryptoconfig.cpp:458
QGpgMENewCryptoConfigEntry::level
Level level() const
Definition: qgpgmenewcryptoconfig.cpp:415
QGpgMENewCryptoConfigEntry::isOptional
bool isOptional() const
Definition: qgpgmenewcryptoconfig.cpp:395
QGpgMENewCryptoConfigEntry::setUIntValueList
void setUIntValueList(const std::vector< unsigned int > &)
Definition: qgpgmenewcryptoconfig.cpp:666
QGpgMENewCryptoConfigEntry::isList
bool isList() const
Definition: qgpgmenewcryptoconfig.cpp:405
QGpgMENewCryptoConfigEntry::resetToDefault
void resetToDefault()
Definition: qgpgmenewcryptoconfig.cpp:578
QGpgMENewCryptoConfigEntry::path
QString path() const
Definition: qgpgmenewcryptoconfig.cpp:387
kleo_export.h
QGpgMENewCryptoConfigEntry::numberOfTimesSet
unsigned int numberOfTimesSet() const
Definition: qgpgmenewcryptoconfig.cpp:526
QGpgMENewCryptoConfigComponent::QGpgMENewCryptoConfigComponent
QGpgMENewCryptoConfigComponent()
Definition: qgpgmenewcryptoconfig.cpp:143
QGpgMENewCryptoConfigEntry::intValueList
std::vector< int > intValueList() const
Definition: qgpgmenewcryptoconfig.cpp:545
QGpgMENewCryptoConfigEntry
Definition: qgpgmenewcryptoconfig.h:59
QGpgMENewCryptoConfigEntry::uintValueList
std::vector< unsigned int > uintValueList() const
Definition: qgpgmenewcryptoconfig.cpp:552
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:57:49 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

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