Commit dc965474 authored by Sandro Knauß's avatar Sandro Knauß 🐝
Browse files

Make nearExpiryChecker a method of ComposerViewBase.

parent 5d74180a
......@@ -712,14 +712,7 @@ QVector<MessageComposer::Composer *> ComposerViewBase::generateCryptoMessages(bo
bool canceled = false;
qCDebug(MESSAGECOMPOSER_LOG) << "filling crypto info";
NearExpiryChecker::Ptr nearExpiryChecker(new NearExpiryChecker(encryptKeyNearExpiryWarningThresholdInDays(),
signingKeyNearExpiryWarningThresholdInDays(),
encryptRootCertNearExpiryWarningThresholdInDays(),
signingRootCertNearExpiryWarningThresholdInDays(),
encryptChainCertNearExpiryWarningThresholdInDays(),
signingChainCertNearExpiryWarningThresholdInDays()));
connect(nearExpiryChecker.data(),
connect(nearExpiryChecker().data(),
&NearExpiryChecker::expiryMessage,
this,
[&canceled](const GpgME::Key &key, QString msg, NearExpiryChecker::ExpiryInformation info, bool isNewMessage) {
......@@ -749,7 +742,7 @@ QVector<MessageComposer::Composer *> ComposerViewBase::generateCryptoMessages(bo
});
QScopedPointer<Kleo::KeyResolver> keyResolver(
new Kleo::KeyResolver(encryptToSelf(), showKeyApprovalDialog(), id.pgpAutoEncrypt(), m_cryptoMessageFormat, nearExpiryChecker));
new Kleo::KeyResolver(encryptToSelf(), showKeyApprovalDialog(), id.pgpAutoEncrypt(), m_cryptoMessageFormat, nearExpiryChecker()));
keyResolver->setAutocryptEnabled(autocryptEnabled());
keyResolver->setAkonadiLookupEnabled(m_akonadiLookupEnabled);
......@@ -2239,3 +2232,16 @@ KMime::Message::Ptr ComposerViewBase::msg() const
{
return m_msg;
}
NearExpiryChecker::Ptr ComposerViewBase::nearExpiryChecker()
{
if (!mNearExpiryChecker) {
mNearExpiryChecker = NearExpiryChecker::Ptr(new NearExpiryChecker(encryptKeyNearExpiryWarningThresholdInDays(),
signingKeyNearExpiryWarningThresholdInDays(),
encryptRootCertNearExpiryWarningThresholdInDays(),
signingRootCertNearExpiryWarningThresholdInDays(),
encryptChainCertNearExpiryWarningThresholdInDays(),
signingChainCertNearExpiryWarningThresholdInDays()));
}
return mNearExpiryChecker;
}
......@@ -14,6 +14,8 @@
#include <Akonadi/Item>
#include <KMime/Message>
#include <MessageComposer/NearExpiryChecker>
#include <Libkleo/Enum>
#include <QObject>
#include <QUrl>
......@@ -233,6 +235,8 @@ public:
Q_REQUIRED_RESULT bool requestDeleveryConfirmation() const;
void setRequestDeleveryConfirmation(bool requestDeleveryConfirmation);
Q_REQUIRED_RESULT NearExpiryChecker::Ptr nearExpiryChecker();
public Q_SLOTS:
void identityChanged(const KIdentityManagement::Identity &ident, const KIdentityManagement::Identity &oldIdent, bool msgCleared = false);
......@@ -382,6 +386,8 @@ private:
MessageComposer::MessageSender::SendMethod mSendMethod;
MessageComposer::MessageSender::SaveIn mSaveIn;
NearExpiryChecker::Ptr mNearExpiryChecker;
QDate mFollowUpDate;
Akonadi::Collection mFollowUpCollection;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment