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 isList() const;
00138 bool isRuntime() const;
00139 Level level() const { return static_cast<Level>( mLevel ); }
00140 ArgType argType() const { return static_cast<ArgType>( mArgType ); }
00141 bool isSet() const;
00142 bool boolValue() const;
00143 QString stringValue() const;
00144 int intValue() const;
00145 unsigned int uintValue() const;
00146 KURL urlValue() const;
00147 unsigned int numberOfTimesSet() const;
00148 QStringList stringValueList() const;
00149 QValueList<int> intValueList() const;
00150 QValueList<unsigned int> uintValueList() const;
00151 KURL::List urlValueList() const;
00152 void resetToDefault();
00153 void setBoolValue( bool );
00154 void setStringValue( const QString& );
00155 void setIntValue( int );
00156 void setUIntValue( unsigned int );
00157 void setURLValue( const KURL& );
00158 void setNumberOfTimesSet( unsigned int );
00159 void setStringValueList( const QStringList& );
00160 void setIntValueList( const QValueList<int>& );
00161 void setUIntValueList( const QValueList<unsigned int>& );
00162 void setURLValueList( const KURL::List& );
00163 bool isDirty() const { return mDirty; }
00164
00165 void setDirty( bool b );
00166 QString outputString() const;
00167
00168 protected:
00169 bool isStringType() const;
00170 QVariant stringToValue( const QString& value, bool unescape ) const;
00171 QString toString( bool escape ) const;
00172 private:
00173 QString mName;
00174 QString mDescription;
00175 QVariant mDefaultValue;
00176 QVariant mValue;
00177 uint mFlags : 7;
00178 uint mLevel : 3;
00179 uint mRealArgType : 6;
00180 uint mArgType : 3;
00181 uint mDirty : 1;
00182 uint mSet : 1;
00183 };
00184
00185 #endif
|