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