certmanager/lib Library API Documentation

qgpgmecryptoconfig.h

00001 /* 00002 qgpgmecryptoconfig.h 00003 00004 This file is part of libkleopatra, the KDE keymanagement library 00005 Copyright (c) 2004 Klarälvdalens Datakonsult AB 00006 00007 Libkleopatra is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License as 00009 published by the Free Software Foundation; either version 2 of the 00010 License, or (at your option) any later version. 00011 00012 Libkleopatra is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 In addition, as a special exception, the copyright holders give 00022 permission to link the code of this program with any edition of 00023 the Qt library by Trolltech AS, Norway (or with modified versions 00024 of Qt that use the same license as Qt), and distribute linked 00025 combinations including the two. You must obey the GNU General 00026 Public License in all respects for all of the code used other than 00027 Qt. If you modify this file, you may extend this exception to 00028 your version of the file, but you are not obligated to do so. If 00029 you do not wish to do so, delete this exception statement from 00030 your version. 00031 */ 00032 00033 #ifndef KLEO_QGPGMECRYPTOCONFIG_H 00034 #define KLEO_QGPGMECRYPTOCONFIG_H 00035 00036 #include <kleo/cryptoconfig.h> 00037 #include <qdict.h> 00038 #include <qstringlist.h> 00039 #include <qobject.h> 00040 #include <qvariant.h> 00041 class KProcIO; 00042 00043 class QGpgMECryptoConfigComponent; 00044 class QGpgMECryptoConfigEntry; 00049 class QGpgMECryptoConfig : public QObject, public Kleo::CryptoConfig { 00050 00051 Q_OBJECT 00052 public: 00056 QGpgMECryptoConfig(); 00057 virtual ~QGpgMECryptoConfig(); 00058 00059 virtual QStringList componentList() const; 00060 00061 virtual Kleo::CryptoConfigComponent* component( const QString& name ) const; 00062 00063 virtual void clear(); 00064 virtual void sync( bool runtime ); 00065 00066 private slots: 00067 void slotCollectStdOut( KProcIO* proc ); 00068 private: 00070 void runGpgConf( bool showErrors ); 00071 00072 private: 00073 QDict<QGpgMECryptoConfigComponent> mComponents; 00074 bool mParsed; 00075 }; 00076 00077 class QGpgMECryptoConfigGroup; 00078 00080 class QGpgMECryptoConfigComponent : public QObject, public Kleo::CryptoConfigComponent { 00081 00082 Q_OBJECT 00083 public: 00084 QGpgMECryptoConfigComponent( QGpgMECryptoConfig*, const QString& name, const QString& description ); 00085 virtual ~QGpgMECryptoConfigComponent(); 00086 00087 virtual QString description() const { return mDescription; } 00088 virtual QStringList groupList() const; 00089 virtual Kleo::CryptoConfigGroup* group( const QString& name ) const; 00090 00091 void sync( bool runtime ); 00092 00093 private slots: 00094 void slotCollectStdOut( KProcIO* proc ); 00095 private: 00096 void runGpgConf(); 00097 00098 private: 00099 QDict<QGpgMECryptoConfigGroup> mGroups; 00100 QString mName; 00101 QString mDescription; 00102 QGpgMECryptoConfigGroup* mCurrentGroup; // during parsing 00103 QString mCurrentGroupName; // during parsing 00104 }; 00105 00106 class QGpgMECryptoConfigGroup : public Kleo::CryptoConfigGroup { 00107 00108 public: 00109 QGpgMECryptoConfigGroup( const QString& description, int level ); 00110 virtual ~QGpgMECryptoConfigGroup() {} 00111 00112 virtual QString description() const { return mDescription; } 00113 virtual Kleo::CryptoConfigEntry::Level level() const { return mLevel; } 00114 virtual QStringList entryList() const; 00115 virtual Kleo::CryptoConfigEntry* entry( const QString& name ) const; 00116 00117 private: 00118 friend class QGpgMECryptoConfigComponent; // it adds the entries 00119 QDict<QGpgMECryptoConfigEntry> mEntries; 00120 QString mDescription; 00121 Kleo::CryptoConfigEntry::Level mLevel; 00122 }; 00123 00124 class QGpgMECryptoConfigEntry : public Kleo::CryptoConfigEntry { 00125 public: 00126 QGpgMECryptoConfigEntry( const QStringList& parsedLine ); 00127 virtual ~QGpgMECryptoConfigEntry(); 00128 00129 virtual QString description() const { return mDescription; } 00130 virtual bool isOptional() const; 00131 virtual bool isList() const; 00132 virtual bool isRuntime() const; 00133 virtual Level level() const { return static_cast<Level>( mLevel ); } 00134 virtual ArgType argType() const { return static_cast<ArgType>( mArgType ); } 00135 virtual bool isSet() const; 00136 virtual bool boolValue() const; 00137 virtual QString stringValue() const; 00138 virtual int intValue() const; 00139 virtual unsigned int uintValue() const; 00140 virtual KURL urlValue() const; 00141 virtual unsigned int numberOfTimesSet() const; 00142 virtual QStringList stringValueList() const; 00143 virtual QValueList<int> intValueList() const; 00144 virtual QValueList<unsigned int> uintValueList() const; 00145 virtual KURL::List urlValueList() const; 00146 virtual void resetToDefault(); 00147 virtual void setBoolValue( bool ); 00148 virtual void setStringValue( const QString& ); 00149 virtual void setIntValue( int ); 00150 virtual void setUIntValue( unsigned int ); 00151 virtual void setURLValue( const KURL& ); 00152 virtual void setNumberOfTimesSet( unsigned int ); 00153 virtual void setStringValueList( const QStringList& ); 00154 virtual void setIntValueList( const QValueList<int>& ); 00155 virtual void setUIntValueList( const QValueList<unsigned int>& ); 00156 virtual void setURLValueList( const KURL::List& ); 00157 virtual bool isDirty() const { return mDirty; } 00158 void setDirty( bool b ); 00159 QString outputString() const; 00160 00161 protected: 00162 bool isStringType() const; 00163 QVariant stringToValue( const QString& value, bool unescape ) const; 00164 QString toString( bool escape ) const; 00165 private: 00166 QString mDescription; 00167 QVariant mDefaultValue; 00168 QVariant mValue; 00169 uint mFlags : 7; // bitfield with 7 bits 00170 uint mLevel : 3; // max is 4 (2, in fact) -> 3 bits 00171 uint mRealArgType : 6; // max is 33 -> 6 bits 00172 uint mArgType : 3; // max is 6 (ArgType enum) -> 3 bits; 00173 uint mDirty : 1; 00174 uint mSet : 1; 00175 }; 00176 00177 #endif /* KLEO_QGPGMECRYPTOCONFIG_H */
KDE Logo
This file is part of the documentation for certmanager/lib Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:50:06 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003