keyselectiondialog.h
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 #ifndef __KLEO_UI_KEYSELECTIONDIALOG_H__
00038 #define __KLEO_UI_KEYSELECTIONDIALOG_H__
00039
00040 #include <kdialogbase.h>
00041
00042 #include <kleo/cryptobackend.h>
00043 #include <gpgmepp/key.h>
00044
00045 #include <vector>
00046
00047 class QVBoxLayout;
00048 class QCheckBox;
00049 class QPixmap;
00050 class QTimer;
00051 class QListViewItem;
00052 class QRegExp;
00053 class QPoint;
00054
00055 namespace Kleo {
00056 class KeyListView;
00057 class KeyListViewItem;
00058 }
00059
00060 namespace GpgME {
00061 class KeyListResult;
00062 }
00063
00064 namespace Kleo {
00065
00066 class KeySelectionDialog : public KDialogBase {
00067 Q_OBJECT
00068 public:
00069
00070 enum KeyUsage {
00071 PublicKeys = 1,
00072 SecretKeys = 2,
00073 EncryptionKeys = 4,
00074 SigningKeys = 8,
00075 ValidKeys = 16,
00076 TrustedKeys = 32,
00077 CertificationKeys = 64,
00078 AuthenticationKeys = 128,
00079 OpenPGPKeys = 256,
00080 SMIMEKeys = 512,
00081 AllKeys = PublicKeys | SecretKeys | OpenPGPKeys | SMIMEKeys,
00082 ValidTrustedEncryptionKeys = AllKeys | EncryptionKeys | ValidKeys | TrustedKeys
00083 };
00084
00085 KeySelectionDialog( const QString & title,
00086 const QString & text,
00087 const std::vector<GpgME::Key> & selectedKeys=std::vector<GpgME::Key>(),
00088 unsigned int keyUsage=AllKeys,
00089 bool extendedSelection=false,
00090 bool rememberChoice=false,
00091 QWidget * parent=0, const char * name=0,
00092 bool modal=true );
00093 KeySelectionDialog( const QString & title,
00094 const QString & text,
00095 const QString & initialPattern,
00096 unsigned int keyUsage=AllKeys,
00097 bool extendedSelection=false,
00098 bool rememberChoice=false,
00099 QWidget * parent=0, const char * name=0,
00100 bool modal=true );
00101 ~KeySelectionDialog();
00102
00105 const GpgME::Key & selectedKey() const;
00106
00107 QString fingerprint() const;
00108
00110 const std::vector<GpgME::Key> & selectedKeys() const { return mSelectedKeys; }
00111
00113 QStringList fingerprints() const;
00114
00116 QStringList pgpKeyFingerprints() const;
00118 QStringList smimeFingerprints() const;
00119
00120 bool rememberSelection() const;
00121 protected slots:
00122
00123
00124 void slotHelp();
00125
00126
00127 QVBoxLayout* topLayout() const { return mTopLayout; }
00128
00129 private slots:
00130 void slotRereadKeys();
00131 void slotStartCertificateManager();
00132 void slotKeyListResult( const GpgME::KeyListResult & );
00133 void slotSelectionChanged();
00134 void slotCheckSelection() { slotCheckSelection( 0 ); }
00135 void slotCheckSelection( Kleo::KeyListViewItem * );
00136 void slotRMB( Kleo::KeyListViewItem *, const QPoint & );
00137 void slotRecheckKey();
00138 void slotTryOk();
00139 void slotOk();
00140 void slotCancel();
00141 void slotSearch( const QString & text );
00142 void slotSearch();
00143 void slotFilter();
00144
00145 private:
00146 void filterByKeyID( const QString & keyID );
00147 void filterByKeyIDOrUID( const QString & keyID );
00148 void filterByUID( const QString & uid );
00149 void showAllItems();
00150 bool anyChildMatches( const Kleo::KeyListViewItem * item, QRegExp & rx ) const;
00151
00152 void connectSignals();
00153 void disconnectSignals();
00154
00155 void startKeyListJobForBackend( const Kleo::CryptoBackend::Protocol *, const std::vector<GpgME::Key> &, bool );
00156 void startValidatingKeyListing();
00157
00158 void init( bool, bool, const QString &, const QString & );
00159
00160 private:
00161 QVBoxLayout* mTopLayout;
00162 Kleo::KeyListView * mKeyListView;
00163 const Kleo::CryptoBackend::Protocol * mOpenPGPBackend;
00164 const Kleo::CryptoBackend::Protocol * mSMIMEBackend;
00165 QCheckBox * mRememberCB;
00166 std::vector<GpgME::Key> mSelectedKeys, mKeysToCheck;
00167 unsigned int mKeyUsage;
00168 QTimer * mCheckSelectionTimer;
00169 QTimer * mStartSearchTimer;
00170
00171 QString mSearchText;
00172 Kleo::KeyListViewItem * mCurrentContextMenuItem;
00173 int mTruncated, mListJobCount, mSavedOffsetY;
00174 };
00175
00176 }
00177
00178 #endif // __KLEO_UI_KEYSELECTIONDIALOG_H__
This file is part of the documentation for certmanager/lib Library Version 3.3.2.