16 #include "messagecomposer_export.h"
17 #include <Libkleo/Enum>
18 #include <Libkleo/KeyApprovalDialog>
20 #include <gpgme++/key.h>
24 #include <QSharedPointer>
25 #include <QStringList>
29 class ContactPreference;
30 class NearExpiryChecker;
121 struct Item :
public KeyApprovalDialog::Item {
123 : KeyApprovalDialog::Item()
124 , signPref(UnknownSigningPreference)
130 Item(
const QString &a, EncryptionPreference e, SigningPreference s, CryptoMessageFormat f)
131 : KeyApprovalDialog::Item(a, std::vector<GpgME::Key>(), e)
138 Item(
const QString &a,
const std::vector<GpgME::Key> &k, EncryptionPreference e, SigningPreference s, CryptoMessageFormat f)
139 : KeyApprovalDialog::Item(a, k, e)
146 SigningPreference signPref;
147 CryptoMessageFormat format;
156 Q_REQUIRED_RESULT Kleo::Result setEncryptToSelfKeys(
const QStringList &fingerprints);
161 Q_REQUIRED_RESULT Kleo::Result setSigningKeys(
const QStringList &fingerprints);
166 void setPrimaryRecipients(
const QStringList &addresses);
171 void setSecondaryRecipients(
const QStringList &addresses);
178 Q_REQUIRED_RESULT
Action checkSigningPreferences(
bool signingRequested)
const;
184 Q_REQUIRED_RESULT
Action checkEncryptionPreferences(
bool encryptionRequested)
const;
190 Q_REQUIRED_RESULT Kleo::Result resolveAllKeys(
bool &signingRequested,
bool &encryptionRequested);
196 Q_REQUIRED_RESULT std::vector<GpgME::Key> signingKeys(CryptoMessageFormat f)
const;
199 SplitInfo() =
default;
206 SplitInfo(
const QStringList &r,
const std::vector<GpgME::Key> &k)
213 std::vector<GpgME::Key> keys;
219 Q_REQUIRED_RESULT std::vector<SplitInfo> encryptionItems(CryptoMessageFormat f)
const;
221 std::vector<GpgME::Key> encryptToSelfKeysFor(CryptoMessageFormat f)
const;
225 void setAutocryptEnabled(
bool autocryptEnabled);
227 std::map<QByteArray, QString> useAutocrypt()
const;
233 void setAkonadiLookupEnabled(
bool akonadiLookupEnabled);
237 std::vector<Item> getEncryptionItems(
const QStringList &recipients);
238 std::vector<GpgME::Key> getEncryptionKeys(
const QString &recipient,
bool quiet)
const;
240 Kleo::Result showKeyApprovalDialog(
bool &finalySendUnencrypted);
242 bool encryptionPossible()
const;
243 bool signingPossible()
const;
244 Kleo::Result resolveEncryptionKeys(
bool signingRequested,
bool &finalySendUnencrypted);
245 Kleo::Result resolveSigningKeysForEncryption();
246 Kleo::Result resolveSigningKeysForSigningOnly();
247 void collapseAllSplitInfos();
248 void addToAllSplitInfos(
const std::vector<GpgME::Key> &keys,
unsigned int formats);
249 void addKeys(
const std::vector<Item> &items, CryptoMessageFormat f);
250 void addKeys(
const std::vector<Item> &items);
252 std::vector<GpgME::Key> signingKeysFor(CryptoMessageFormat f)
const;
254 std::vector<GpgME::Key> lookup(
const QStringList &patterns,
bool secret =
false)
const;
256 std::vector<GpgME::Key>
257 selectKeys(
const QString &person,
const QString &msg,
const std::vector<GpgME::Key> &selectedKeys = std::vector<GpgME::Key>())
const;
262 bool encryptToSelf()
const;
263 bool showApprovalDialog()
const;
265 MessageComposer::ContactPreference lookupContactPreferences(
const QString &address)
const;
266 void saveContactPreference(
const QString &email,
const MessageComposer::ContactPreference &pref)
const;
269 class EncryptionPreferenceCounter;
270 friend class ::Kleo::KeyResolver::EncryptionPreferenceCounter;
271 class SigningPreferenceCounter;
272 friend class ::Kleo::KeyResolver::SigningPreferenceCounter;
274 struct KeyResolverPrivate;
275 std::unique_ptr<KeyResolverPrivate>
const d;
278 const bool mShowApprovalDialog : 1;
279 const bool mOpportunisticEncyption : 1;
280 const unsigned int mCryptoMessageFormats;