00001
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 <qobject.h>
00037
#include <qvaluevector.h>
00038
00039
#include "cryptobackend.h"
00040
00041
namespace Kleo {
00042
class BackendConfigWidget;
00043 }
00044
00045
class QString;
00046
class KConfig;
00047
00048
namespace Kleo {
00049
00050
class CryptoBackendFactory :
public QObject {
00051 Q_OBJECT
00052
protected:
00053 CryptoBackendFactory();
00054 ~CryptoBackendFactory();
00055
public:
00056
static CryptoBackendFactory * instance();
00057
00058
const CryptoBackend::Protocol * smime() const;
00059 const CryptoBackend::Protocol * openpgp() const;
00060 CryptoConfig * config() const;
00061
00062 const CryptoBackend * backend(
unsigned int idx ) const;
00063
00064
bool hasBackends() const;
00065
00066 Kleo::BackendConfigWidget * configWidget(
QWidget * parent=0, const
char * name=0 ) const;
00067
00068 KConfig* configObject() const;
00069
00070
00071
00072
00073
00074
00075
00076
00077
void setSMIMEBackend( const CryptoBackend* backend );
00078
void setOpenPGPBackend( const CryptoBackend* backend );
00079
00080
void scanForBackends(
QStringList * reasons=0 );
00081
00082 protected:
00083
QValueVector<CryptoBackend*> mBackendList;
00084 mutable KConfig* mConfigObject;
00085 const CryptoBackend* mSMIMEBackend;
00086 const CryptoBackend* mOpenPGPBackend;
00087
00088 private:
00089 const CryptoBackend * backendByName( const
QString& name ) const;
00090
void readConfig();
00091 CryptoBackendFactory( const CryptoBackendFactory & );
00092
void operator=( const CryptoBackendFactory & );
00093
00094 static CryptoBackendFactory * mSelf;
00095 };
00096
00097
00098 }
00099
00100 #endif