certmanager/lib
cryptobackendfactory.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_CRYPTOBACKENDFACTORY_H__
00034 #define __KLEO_CRYPTOBACKENDFACTORY_H__
00035
00036 #include <tqobject.h>
00037
00038 #include "cryptobackend.h"
00039 #include <tdepimmacros.h>
00040
00041 #include <vector>
00042 #include <map>
00043
00044 namespace Kleo {
00045 class BackendConfigWidget;
00046 }
00047
00048 class TQString;
00049 class TDEConfig;
00050
00051 namespace Kleo {
00052
00053 struct lt_i_str {
00054 bool operator()( const char * one, const char * two ) const {
00055 return tqstricmp( one, two ) < 0;
00056 }
00057 };
00058
00059 class KDE_EXPORT CryptoBackendFactory : public TQObject {
00060 Q_OBJECT
00061
00062 protected:
00063 CryptoBackendFactory();
00064 ~CryptoBackendFactory();
00065 public:
00066 static CryptoBackendFactory * instance();
00067
00068 const CryptoBackend::Protocol * smime() const;
00069 const CryptoBackend::Protocol * openpgp() const;
00070 const CryptoBackend::Protocol * protocol( const char * name ) const;
00071 CryptoConfig * config() const;
00072
00073 const CryptoBackend * backend( unsigned int idx ) const;
00074
00075 bool hasBackends() const;
00076
00077 Kleo::BackendConfigWidget * configWidget( TQWidget * parent=0, const char * name=0 ) const;
00078
00079 TDEConfig* configObject() const;
00080
00081
00082
00083
00084
00085
00086
00087
00088 void setSMIMEBackend( const CryptoBackend* backend );
00089 void setOpenPGPBackend( const CryptoBackend* backend );
00090 void setProtocolBackend( const char * name, const CryptoBackend * backend );
00091
00092 void scanForBackends( TQStringList * reasons=0 );
00093
00094 const char * enumerateProtocols( int i ) const;
00095
00096 bool knowsAboutProtocol( const char * name ) const;
00097
00098 protected:
00099 std::vector<CryptoBackend*> mBackendList;
00100 mutable TDEConfig* mConfigObject;
00101 typedef std::map<const char *, const CryptoBackend*, lt_i_str> BackendMap;
00102 BackendMap mBackends;
00103 typedef std::vector<const char *> ProtocolSet;
00104 ProtocolSet mAvailableProtocols;
00105
00106 private:
00107 const CryptoBackend * backendByName( const TQString& name ) const;
00108 void readConfig();
00109 CryptoBackendFactory( const CryptoBackendFactory & );
00110 void operator=( const CryptoBackendFactory & );
00111
00112 static CryptoBackendFactory * mSelf;
00113 };
00114
00115
00116 }
00117
00118 #endif // __KLEO_CRYPTOBACKENDFACTORY_H__
|