16#include "kleo_export.h"
18#include <QGpgME/Protocol>
22#include <gpgme++/key.h>
46class KLEO_EXPORT KeySelectionDialog :
public QDialog
53 ExternalCertificateManager = 0x02,
54 ExtendedSelection = 0x04,
55 RememberChoice = 0x08,
58 Q_DECLARE_FLAGS(Options, Option)
68 CertificationKeys = 64,
69 AuthenticationKeys = 128,
72 AllKeys = PublicKeys | SecretKeys | OpenPGPKeys | SMIMEKeys,
73 ValidEncryptionKeys = AllKeys | EncryptionKeys | ValidKeys,
74 ValidTrustedEncryptionKeys = AllKeys | EncryptionKeys | ValidKeys | TrustedKeys
78 explicit KeySelectionDialog(
QWidget *parent =
nullptr, Options options = Options());
80 KeySelectionDialog(
const QString &title,
82 const std::vector<GpgME::Key> &selectedKeys = std::vector<GpgME::Key>(),
83 unsigned int keyUsage = AllKeys,
84 bool extendedSelection =
false,
85 bool rememberChoice =
false,
88 KeySelectionDialog(
const QString &title,
91 const std::vector<GpgME::Key> &selectedKeys,
92 unsigned int keyUsage = AllKeys,
93 bool extendedSelection =
false,
94 bool rememberChoice =
false,
97 KeySelectionDialog(
const QString &title,
100 unsigned int keyUsage = AllKeys,
101 bool extendedSelection =
false,
102 bool rememberChoice =
false,
105 ~KeySelectionDialog()
override;
107 void setText(
const QString &text);
109 void setKeys(
const std::vector<GpgME::Key> &keys);
113 const GpgME::Key &selectedKey()
const;
118 const std::vector<GpgME::Key> &selectedKeys()
const
120 return mSelectedKeys;
131 bool rememberSelection()
const;
140 void slotRereadKeys();
141 void slotStartCertificateManager(
const QString &query =
QString());
142 void slotStartSearchForExternalCertificates()
144 slotStartCertificateManager(mInitialQuery);
146 void slotKeyListResult(
const GpgME::KeyListResult &);
147 void slotSelectionChanged();
148 void slotCheckSelection()
150 slotCheckSelection(
nullptr);
152 void slotCheckSelection(Kleo::KeyListViewItem *);
153 void slotRMB(Kleo::KeyListViewItem *,
const QPoint &);
154 void slotRecheckKey();
158 void slotSearch(
const QString &text);
163 void filterByKeyID(
const QString &keyID);
164 void filterByKeyIDOrUID(
const QString &keyID);
165 void filterByUID(
const QString &uid);
168 void connectSignals();
169 void disconnectSignals();
171 void startKeyListJobForBackend(
const QGpgME::Protocol *,
const std::vector<GpgME::Key> &,
bool);
172 void startValidatingKeyListing();
174 void setUpUI(Options options,
const QString &);
179 QLabel *mTextLabel =
nullptr;
180 Kleo::KeyListView *mKeyListView =
nullptr;
181 Kleo::KeyListViewItem *mCurrentContextMenuItem =
nullptr;
185 const QGpgME::Protocol *mOpenPGPBackend =
nullptr;
186 const QGpgME::Protocol *mSMIMEBackend =
nullptr;
187 std::vector<GpgME::Key> mSelectedKeys, mKeysToCheck;
188 unsigned int mKeyUsage;
189 QTimer *mCheckSelectionTimer =
nullptr;
190 QTimer *mStartSearchTimer =
nullptr;
195 int mListJobCount = 0;
196 int mSavedOffsetY = 0;
199Q_DECLARE_OPERATORS_FOR_FLAGS(KeySelectionDialog::Options)
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)