37 #include "cryptplugfactory.h"
38 #include "cryptplugwrapperlist.h"
40 #include <tdeconfig.h>
41 #include <tdelocale.h>
43 #include <tdemessagebox.h>
44 #include <tdeapplication.h>
48 KMail::CryptPlugFactory * KMail::CryptPlugFactory::mSelf = 0;
57 KMail::CryptPlugFactory::CryptPlugFactory()
58 : Kleo::CryptoBackendFactory(),
59 mCryptPlugWrapperList( 0 )
63 mCryptPlugWrapperList =
new CryptPlugWrapperList();
64 mCryptPlugWrapperList->setAutoDelete(
false );
65 updateCryptPlugWrapperList();
68 KMail::CryptPlugFactory::~CryptPlugFactory() {
70 delete mCryptPlugWrapperList; mCryptPlugWrapperList = 0;
73 KMail::CryptPlugFactory * KMail::CryptPlugFactory::instance() {
75 mSelf =
new CryptPlugFactory();
80 if ( smime() && smime()->active() )
82 if ( openpgp() && openpgp()->active() )
87 CryptPlugWrapper * KMail::CryptPlugFactory::createForProtocol(
const TQString & proto )
const {
88 TQString p = proto.lower();
89 if ( p ==
"application/pkcs7-signature" || p ==
"application/x-pkcs7-signature" )
91 if ( p ==
"application/pgp-signature" || p ==
"application/x-pgp-signature" )
97 return mCryptPlugWrapperList->findForLibName(
"smime" );
101 return mCryptPlugWrapperList->findForLibName(
"openpgp" );
104 void KMail::CryptPlugFactory::scanForBackends( TQStringList * reason ) {
105 Kleo::CryptoBackendFactory::scanForBackends( reason );
106 updateCryptPlugWrapperList();
109 void KMail::CryptPlugFactory::updateCryptPlugWrapperList() {
110 mCryptPlugWrapperList->clear();
111 for ( std::vector<Kleo::CryptoBackend*>::const_iterator it = mBackendList.begin() ; it != mBackendList.end() ; ++it ) {
113 mCryptPlugWrapperList->append( w );
115 mCryptPlugWrapperList->append( w );
119 #include "cryptplugfactory.moc"
This class provides C++ access to the CRYPTPLUG API.