certmanager/lib
qgpgmecryptoconfig.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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 ~QGpgMECryptoConfigComponent();
00086
00087 QString name() const { return mName; }
00088 QString iconName() const { return mName; }
00089 QString description() const { return mDescription; }
00090 QStringList groupList() const;
00091 Kleo::CryptoConfigGroup* group( const QString& name ) const;
00092
00093 void sync( bool runtime );
00094
00095 private slots:
00096 void slotCollectStdOut( KProcIO* proc );
00097 private:
00098 void runGpgConf();
00099
00100 private:
00101 QDict<QGpgMECryptoConfigGroup> mGroups;
00102 QString mName;
00103 QString mDescription;
00104 QGpgMECryptoConfigGroup* mCurrentGroup;
00105 QString mCurrentGroupName;
00106 };
00107
00108 class QGpgMECryptoConfigGroup : public Kleo::CryptoConfigGroup {
00109
00110 public:
00111 QGpgMECryptoConfigGroup( const QString & name, const QString& description, int level );
00112 ~QGpgMECryptoConfigGroup() {}
00113
00114 QString name() const { return mName; }
00115 QString iconName() const { return QString::null; }
00116 QString description() const { return mDescription; }
00117 Kleo::CryptoConfigEntry::Level level() const { return mLevel; }
00118 QStringList entryList() const;
00119 Kleo::CryptoConfigEntry* entry( const QString& name ) const;
00120
00121 private:
00122 friend class QGpgMECryptoConfigComponent;
00123 QDict<QGpgMECryptoConfigEntry> mEntries;
00124 QString mName;
00125 QString mDescription;
00126 Kleo::CryptoConfigEntry::Level mLevel;
00127 };
00128
00129 class QGpgMECryptoConfigEntry : public Kleo::CryptoConfigEntry {
00130 public:
00131 QGpgMECryptoConfigEntry( const QStringList& parsedLine );
00132 ~QGpgMECryptoConfigEntry();
00133
00134 QString name() const { return mName; }
00135 QString description() const { return mDescription; }
00136 bool isOptional() const;
00137 bool isReadOnly() const;
00138 bool isList() const;
00139 bool isRuntime() const;
00140 Level level() const { return static_cast<Level>( mLevel ); }
00141 ArgType argType() const { return static_cast<ArgType>( mArgType ); }
00142 bool isSet() const;
00143 bool boolValue() const;
00144 QString stringValue() const;
00145 int intValue() const;
00146 unsigned int uintValue() const;
00147 KURL urlValue() const;
00148 unsigned int numberOfTimesSet() const;
00149 QStringList stringValueList() const;
00150 QValueList<int> intValueList() const;
00151 QValueList<unsigned int> uintValueList() const;
00152 KURL::List urlValueList() const;
00153 void resetToDefault();
00154 void setBoolValue( bool );
00155 void setStringValue( const QString& );
00156 void setIntValue( int );
00157 void setUIntValue( unsigned int );
00158 void setURLValue( const KURL& );
00159 void setNumberOfTimesSet( unsigned int );
00160 void setStringValueList( const QStringList& );
00161 void setIntValueList( const QValueList<int>& );
00162 void setUIntValueList( const QValueList<unsigned int>& );
00163 void setURLValueList( const KURL::List& );
00164 bool isDirty() const { return mDirty; }
00165
00166 void setDirty( bool b );
00167 QString outputString() const;
00168
00169 protected:
00170 bool isStringType() const;
00171 QVariant stringToValue( const QString& value, bool unescape ) const;
00172 QString toString( bool escape ) const;
00173 private:
00174 QString mName;
00175 QString mDescription;
00176 QVariant mDefaultValue;
00177 QVariant mValue;
00178 uint mFlags : 8;
00179 uint mLevel : 3;
00180 uint mRealArgType : 6;
00181 uint mArgType : 3;
00182 uint mDirty : 1;
00183 uint mSet : 1;
00184 };
00185
00186 #endif
|