37 #ifndef __KLEO_UI_KEYSELECTIONDIALOG_H__
38 #define __KLEO_UI_KEYSELECTIONDIALOG_H__
40 #include <kdialogbase.h>
42 #include <kleo/cryptobackend.h>
43 #include <gpgmepp/key.h>
44 #include <tdemacros.h>
57 class KeyListViewItem;
66 class TDE_EXPORT KeySelectionDialog :
public KDialogBase {
78 CertificationKeys = 64,
79 AuthenticationKeys = 128,
82 AllKeys = PublicKeys | SecretKeys | OpenPGPKeys | SMIMEKeys,
83 ValidEncryptionKeys = AllKeys | EncryptionKeys | ValidKeys,
84 ValidTrustedEncryptionKeys = AllKeys | EncryptionKeys | ValidKeys | TrustedKeys
87 KeySelectionDialog(
const TQString & title,
88 const TQString & text,
89 const std::vector<GpgME::Key> & selectedKeys=std::vector<GpgME::Key>(),
90 unsigned int keyUsage=AllKeys,
91 bool extendedSelection=
false,
92 bool rememberChoice=
false,
93 TQWidget * parent=0,
const char * name=0,
95 KeySelectionDialog(
const TQString & title,
96 const TQString & text,
97 const TQString & initialPattern,
98 const std::vector<GpgME::Key> & selectedKeys,
99 unsigned int keyUsage=AllKeys,
100 bool extendedSelection=
false,
101 bool rememberChoice=
false,
102 TQWidget * parent=0,
const char * name=0,
104 KeySelectionDialog(
const TQString & title,
105 const TQString & text,
106 const TQString & initialPattern,
107 unsigned int keyUsage=AllKeys,
108 bool extendedSelection=
false,
109 bool rememberChoice=
false,
110 TQWidget * parent=0,
const char * name=0,
112 ~KeySelectionDialog();
116 const GpgME::Key & selectedKey()
const;
118 TQString fingerprint()
const;
121 const std::vector<GpgME::Key> & selectedKeys()
const {
return mSelectedKeys; }
124 TQStringList fingerprints()
const;
127 TQStringList pgpKeyFingerprints()
const;
129 TQStringList smimeFingerprints()
const;
131 bool rememberSelection()
const;
138 TQVBoxLayout* topLayout()
const {
return mTopLayout; }
141 void slotRereadKeys();
142 void slotStartCertificateManager(
const TQString &query = TQString() );
143 void slotStartSearchForExternalCertificates() {
144 slotStartCertificateManager( mInitialQuery );
146 void slotKeyListResult(
const GpgME::KeyListResult & );
147 void slotSelectionChanged();
148 void slotCheckSelection() { slotCheckSelection( 0 ); }
149 void slotCheckSelection( Kleo::KeyListViewItem * );
150 void slotRMB( Kleo::KeyListViewItem *,
const TQPoint & );
151 void slotRecheckKey();
155 void slotSearch(
const TQString & text );
160 void filterByKeyID(
const TQString & keyID );
161 void filterByKeyIDOrUID(
const TQString & keyID );
162 void filterByUID(
const TQString & uid );
164 bool anyChildMatches(
const Kleo::KeyListViewItem * item, TQRegExp & rx )
const;
166 void connectSignals();
167 void disconnectSignals();
169 void startKeyListJobForBackend(
const Kleo::CryptoBackend::Protocol *,
const std::vector<GpgME::Key> &,
bool );
170 void startValidatingKeyListing();
172 void init(
bool,
bool,
const TQString &,
const TQString & );
175 TQVBoxLayout* mTopLayout;
176 Kleo::KeyListView * mKeyListView;
177 const Kleo::CryptoBackend::Protocol * mOpenPGPBackend;
178 const Kleo::CryptoBackend::Protocol * mSMIMEBackend;
179 TQCheckBox * mRememberCB;
180 std::vector<GpgME::Key> mSelectedKeys, mKeysToCheck;
181 unsigned int mKeyUsage;
182 TQTimer * mCheckSelectionTimer;
183 TQTimer * mStartSearchTimer;
185 TQString mSearchText;
186 const TQString mInitialQuery;
187 Kleo::KeyListViewItem * mCurrentContextMenuItem;
188 int mTruncated, mListJobCount, mSavedOffsetY;