Commit 3738dc0c authored by Laurent Montel's avatar Laurent Montel 😁

Don't assert when we finally send as encrypted.

parent 7dfb296f
......@@ -1079,8 +1079,13 @@ Kpgp::Result Kleo::KeyResolver::resolveAllKeys( bool& signingRequested, bool& en
return Kpgp::Ok;
}
Kpgp::Result result = Kpgp::Ok;
if ( encryptionRequested )
result = resolveEncryptionKeys( signingRequested );
if ( encryptionRequested ) {
bool finalySendUnencrypted = false;
result = resolveEncryptionKeys( signingRequested, finalySendUnencrypted );
if (finalySendUnencrypted) {
encryptionRequested = false;
}
}
if ( result != Kpgp::Ok )
return result;
if ( signingRequested ) {
......@@ -1098,7 +1103,7 @@ Kpgp::Result Kleo::KeyResolver::resolveAllKeys( bool& signingRequested, bool& en
return result;
}
Kpgp::Result Kleo::KeyResolver::resolveEncryptionKeys( bool signingRequested ) {
Kpgp::Result Kleo::KeyResolver::resolveEncryptionKeys( bool signingRequested, bool &finalySendUnencrypted ) {
//
// 1. Get keys for all recipients:
//
......@@ -1134,7 +1139,7 @@ Kpgp::Result Kleo::KeyResolver::resolveEncryptionKeys( bool signingRequested ) {
// 1a: Present them to the user
const Kpgp::Result res = showKeyApprovalDialog();
const Kpgp::Result res = showKeyApprovalDialog(finalySendUnencrypted);
if ( res != Kpgp::Ok )
return res;
......@@ -1443,7 +1448,7 @@ void Kleo::KeyResolver::dump() const {
#endif
}
Kpgp::Result Kleo::KeyResolver::showKeyApprovalDialog() {
Kpgp::Result Kleo::KeyResolver::showKeyApprovalDialog(bool &finalySendUnencrypted) {
const bool showKeysForApproval = showApprovalDialog()
|| std::find_if( d->mPrimaryEncryptionKeys.begin(), d->mPrimaryEncryptionKeys.end(),
ApprovalNeeded ) != d->mPrimaryEncryptionKeys.end()
......@@ -1540,6 +1545,7 @@ Kpgp::Result Kleo::KeyResolver::showKeyApprovalDialog() {
KGuiItem(i18n("Send &Unencrypted")) )
== KMessageBox::Cancel )
return Kpgp::Canceled;
finalySendUnencrypted = true;
} else if ( emptyListCount > 0 ) {
const QString msg = ( emptyListCount == 1 )
? i18n("You did not select an encryption key for one of "
......
......@@ -240,11 +240,11 @@ private:
std::vector<Item> getEncryptionItems( const QStringList & recipients );
std::vector<GpgME::Key> getEncryptionKeys( const QString & recipient, bool quiet ) const;
Kpgp::Result showKeyApprovalDialog();
Kpgp::Result showKeyApprovalDialog(bool &finalySendUnencrypted);
bool encryptionPossible() const;
bool signingPossible() const;
Kpgp::Result resolveEncryptionKeys( bool signingRequested );
Kpgp::Result resolveEncryptionKeys(bool signingRequested , bool &finalySendUnencrypted);
Kpgp::Result resolveSigningKeysForEncryption();
Kpgp::Result resolveSigningKeysForSigningOnly();
Kpgp::Result checkKeyNearExpiry( const GpgME::Key & key,
......
Markdown is supported
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