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
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
#ifndef __KLEO_UI_KEYREQUESTER_H__
00050
#define __KLEO_UI_KEYREQUESTER_H__
00051
00052
#include <qwidget.h>
00053
#include <kleo/cryptobackend.h>
00054
00055
#include <vector>
00056
00057
namespace Kleo {
00058
class KeyListView;
00059
class KeyListViewItem;
00060 }
00061
00062
namespace GpgME {
00063
class Key;
00064
class KeyListResult;
00065 }
00066
00067
class QStringList;
00068
class QString;
00069
class QPushButton;
00070
class QLabel;
00071
00072
namespace Kleo {
00073
00075 class KeyRequester :
public QWidget {
00076 Q_OBJECT
00077
public:
00078
KeyRequester(
unsigned int allowedKeys,
bool multipleKeys=
false,
00079
QWidget * parent=0,
const char * name=0 );
00080
00081
KeyRequester(
QWidget * parent=0,
const char * name=0 );
00082 ~
KeyRequester();
00083
00084
const GpgME::Key & key()
const;
00089
void setKey(
const GpgME::Key & key );
00090
00091
const std::vector<GpgME::Key> & keys()
const;
00095
void setKeys(
const std::vector<GpgME::Key> & keys );
00096
00097
QString fingerprint()
const;
00101
void setFingerprint(
const QString & fingerprint );
00102
00103
QStringList fingerprints()
const;
00107
void setFingerprints(
const QStringList & fingerprints );
00108
00109
00110
QPushButton * eraseButton();
00111
QPushButton * dialogButton();
00112
00113
void setDialogCaption(
const QString & caption );
00114
void setDialogMessage(
const QString & message );
00115
00116
bool isMultipleKeysEnabled()
const;
00117
void setMultipleKeysEnabled(
bool enable );
00118
00119
unsigned int allowedKeys()
const;
00120
void setAllowedKeys(
unsigned int allowed );
00121
00122
void setInitialQuery(
const QString & s ) { mInitialQuery = s; }
00123
const QString & initialQuery()
const {
return mInitialQuery; }
00124
00125 signals:
00126
void changed();
00127
00128
private:
00129
void init();
00130
void startKeyListJob(
const QStringList & fingerprints );
00131
void updateKeys();
00132
00133
private slots:
00134
void slotNextKey(
const GpgME::Key & key );
00135
void slotKeyListResult(
const GpgME::KeyListResult & result );
00136
void slotDialogButtonClicked();
00137
void slotEraseButtonClicked();
00138
00139
private:
00140
const CryptoBackend::Protocol * mOpenPGPBackend;
00141
const CryptoBackend::Protocol * mSMIMEBackend;
00142
QLabel * mLabel;
00143
QPushButton * mEraseButton;
00144
QPushButton * mDialogButton;
00145
QString mDialogCaption, mDialogMessage, mInitialQuery;
00146
bool mMulti;
00147
unsigned int mKeyUsage;
00148
int mJobs;
00149 std::vector<GpgME::Key> mKeys;
00150 std::vector<GpgME::Key> mTmpKeys;
00151
00152
private:
00153
class Private;
00154 Private * d;
00155
protected:
00156
virtual void virtual_hook(
int,
void* );
00157 };
00158
00159
00160
class EncryptionKeyRequester :
public KeyRequester {
00161 Q_OBJECT
00162
public:
00163
enum { OpenPGP = 1, SMIME = 2, AllProtocols = OpenPGP|SMIME };
00164
00168 EncryptionKeyRequester(
bool multipleKeys=
false,
unsigned int proto=AllProtocols,
00169
QWidget * parent=0,
const char * name=0,
00170
bool onlyTrusted=
true,
bool onlyValid=
true );
00174 EncryptionKeyRequester(
QWidget * parent=0,
const char * name=0 );
00175 ~EncryptionKeyRequester();
00176
00177
void setAllowedKeys(
unsigned int proto,
bool onlyTrusted=
true,
bool onlyValid=
true );
00178
00179
private:
00180
class Private;
00181 Private * d;
00182
protected:
00183
virtual void virtual_hook(
int,
void* );
00184 };
00185
00186
00187
class SigningKeyRequester :
public KeyRequester {
00188 Q_OBJECT
00189
public:
00190
enum { OpenPGP = 1, SMIME = 2, AllProtocols = OpenPGP|SMIME };
00191
00200 SigningKeyRequester(
bool multipleKeys=
false,
unsigned int proto=AllProtocols,
00201
QWidget * parent=0,
const char * name=0,
00202
bool onlyTrusted=
true,
bool onlyValid=
true );
00206 SigningKeyRequester(
QWidget * parent=0,
const char * name=0 );
00207 ~SigningKeyRequester();
00208
00209
00210
00211
00212
00213
00214
00215
void setAllowedKeys(
unsigned int proto,
bool onlyTrusted=
true,
bool onlyValid=
true );
00216
00217
private:
00218
class Private;
00219 Private * d;
00220
protected:
00221
virtual void virtual_hook(
int,
void* );
00222 };
00223
00224 }
00225
00226
#endif // __KLEO_UI_KEYREQUESTER_H__