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
#ifdef HAVE_CONFIG_H
00034
#include <config.h>
00035
#endif
00036
00037
#include "kpgpbackendbase.h"
00038
00039
#include "pgp2backend.h"
00040
#include "pgp5backend.h"
00041
#include "pgp6backend.h"
00042
#include "gpg1backend.h"
00043
00044
#include <klocale.h>
00045
00046
#include <qstring.h>
00047
00048
#include "kpgpwrapper.h"
00049
00050 Kleo::KpgpBackendBase::KpgpBackendBase()
00051 : Kleo::CryptoBackend(),
00052 mOpenPGPProtocol( 0 )
00053 {
00054 }
00055
00056 Kleo::KpgpBackendBase::~KpgpBackendBase()
00057 {
00058
delete mOpenPGPProtocol; mOpenPGPProtocol = 0;
00059 }
00060
00061
QString Kleo::GPG1Backend::name()
const {
00062
return GPG1_BACKEND_NAME;
00063 }
00064
00065
QString Kleo::GPG1Backend::displayName()
const {
00066
return i18n(
"Kpgp/gpg");
00067 }
00068
00069
QString Kleo::PGP2Backend::name()
const {
00070
return PGP2_BACKEND_NAME;
00071 }
00072
00073
QString Kleo::PGP2Backend::displayName()
const {
00074
return i18n(
"Kpgp/pgp v2");
00075 }
00076
00077
QString Kleo::PGP5Backend::name()
const {
00078
return PGP5_BACKEND_NAME;
00079 }
00080
00081
QString Kleo::PGP5Backend::displayName()
const {
00082
return i18n(
"Kpgp/pgp v5");
00083 }
00084
00085
QString Kleo::PGP6Backend::name()
const {
00086
return PGP6_BACKEND_NAME;
00087 }
00088
00089
QString Kleo::PGP6Backend::displayName()
const {
00090
return i18n(
"Kpgp/pgp v6");
00091 }
00092
00093
static const QString notSupported() {
00094
return i18n(
"This backend does not support S/MIME");
00095 }
00096
00097
bool Kleo::KpgpBackendBase::checkForOpenPGP(
QString * )
const {
00098
return true;
00099 }
00100
00101
bool Kleo::KpgpBackendBase::checkForSMIME(
QString * reason )
const {
00102
if ( reason ) *reason = notSupported();
00103
return false;
00104 }
00105
00106 Kleo::CryptoBackend::Protocol * Kleo::KpgpBackendBase::openpgp()
const {
00107
if ( !mOpenPGPProtocol )
00108
if ( checkForOpenPGP() )
00109 mOpenPGPProtocol =
new KpgpWrapper( name() );
00110
return mOpenPGPProtocol;
00111 }