|
|
|
|
@ -644,6 +644,30 @@ namespace KMail { |
|
|
|
|
return bIsOpaqueSigned; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ObjectTreeParser::writeDeferredDecryptionBlock() { |
|
|
|
|
kdDebug(5006) << k_funcinfo << endl; |
|
|
|
|
assert( mReader ); |
|
|
|
|
const QString iconName = KGlobal::instance()->iconLoader()->iconPath( "decrypted", KIcon::Small ); |
|
|
|
|
const QString decryptedData = |
|
|
|
|
"<div style=\"font-size:large; text-align:center;padding-top:20pt;\">" + |
|
|
|
|
i18n("This message is encrypted.") + |
|
|
|
|
"</div>" |
|
|
|
|
"<div style=\"text-align:center; padding-bottom:20pt;\">" |
|
|
|
|
"<a href=\"kmail:decryptMessage\">" |
|
|
|
|
"<img src=\"" + iconName + "\"/>" + |
|
|
|
|
i18n("Decrypt Message") + |
|
|
|
|
"</a></div>"; |
|
|
|
|
PartMetaData messagePart; |
|
|
|
|
messagePart.isDecryptable = true; |
|
|
|
|
messagePart.isEncrypted = true; |
|
|
|
|
messagePart.isSigned = false; |
|
|
|
|
mRawReplyString += decryptedData.utf8(); |
|
|
|
|
htmlWriter()->queue( writeSigstatHeader( messagePart, |
|
|
|
|
cryptoProtocol(), |
|
|
|
|
QString() ) ); |
|
|
|
|
htmlWriter()->queue( decryptedData ); |
|
|
|
|
htmlWriter()->queue( writeSigstatFooter( messagePart ) ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool ObjectTreeParser::okDecryptMIME( partNode& data, |
|
|
|
|
QCString& decryptedData, |
|
|
|
|
@ -670,19 +694,7 @@ bool ObjectTreeParser::okDecryptMIME( partNode& data, |
|
|
|
|
if ( cryptProto ) |
|
|
|
|
cryptPlugLibName = cryptProto->name(); |
|
|
|
|
|
|
|
|
|
if ( mReader && !mReader->decryptMessage() ) { |
|
|
|
|
QString iconName = KGlobal::instance()->iconLoader()->iconPath( "decrypted", KIcon::Small ); |
|
|
|
|
decryptedData = "<div style=\"font-size:large; text-align:center;" |
|
|
|
|
"padding-top:20pt;\">" |
|
|
|
|
+ i18n("This message is encrypted.").utf8() |
|
|
|
|
+ "</div>" |
|
|
|
|
"<div style=\"text-align:center; padding-bottom:20pt;\">" |
|
|
|
|
"<a href=\"kmail:decryptMessage\">" |
|
|
|
|
"<img src=\"" + iconName.utf8() + "\"/>" |
|
|
|
|
+ i18n("Decrypt Message").utf8() |
|
|
|
|
+ "</a></div>"; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
assert( !mReader || mReader->decryptMessage() ); |
|
|
|
|
|
|
|
|
|
if ( cryptProto && !kmkernel->contextMenuShown() ) { |
|
|
|
|
QByteArray ciphertext( data.msgPart().bodyDecodedBinary() ); |
|
|
|
|
@ -1223,9 +1235,16 @@ namespace KMail { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
node->setEncryptionState( KMMsgFullyEncrypted ); |
|
|
|
|
|
|
|
|
|
if ( mReader && !mReader->decryptMessage() ) { |
|
|
|
|
writeDeferredDecryptionBlock(); |
|
|
|
|
data->setProcessed( true, false ); // Set the data node to done to prevent it from being processed
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
kdDebug(5006) << "\n-----> Initially processing encrypted data\n" << endl; |
|
|
|
|
PartMetaData messagePart; |
|
|
|
|
node->setEncryptionState( KMMsgFullyEncrypted ); |
|
|
|
|
QCString decryptedData; |
|
|
|
|
bool signatureFound; |
|
|
|
|
std::vector<GpgME::Signature> signatures; |
|
|
|
|
@ -1373,6 +1392,8 @@ namespace KMail { |
|
|
|
|
writeBodyString( cstr, node->trueFromAddress(), |
|
|
|
|
codecFor( node ), result, false ); |
|
|
|
|
mRawReplyString += cstr; |
|
|
|
|
} else if ( mReader && !mReader->decryptMessage() ) { |
|
|
|
|
writeDeferredDecryptionBlock(); |
|
|
|
|
} else { |
|
|
|
|
/*
|
|
|
|
|
ATTENTION: This code is to be replaced by the planned 'auto-detect' feature. |
|
|
|
|
@ -1549,7 +1570,10 @@ namespace KMail { |
|
|
|
|
bool passphraseError; |
|
|
|
|
bool actuallyEncrypted = true; |
|
|
|
|
|
|
|
|
|
if ( okDecryptMIME( *node, |
|
|
|
|
if ( mReader && !mReader->decryptMessage() ) { |
|
|
|
|
writeDeferredDecryptionBlock(); |
|
|
|
|
isEncrypted = true; |
|
|
|
|
} else if ( okDecryptMIME( *node, |
|
|
|
|
decryptedData, |
|
|
|
|
signatureFound, |
|
|
|
|
signatures, |
|
|
|
|
@ -1592,10 +1616,8 @@ namespace KMail { |
|
|
|
|
htmlWriter()->queue( writeSigstatHeader( messagePart, |
|
|
|
|
cryptoProtocol(), |
|
|
|
|
node->trueFromAddress() ) ); |
|
|
|
|
if ( mReader->decryptMessage() ) |
|
|
|
|
writePartIcon( &node->msgPart(), node->nodeId() ); |
|
|
|
|
else |
|
|
|
|
htmlWriter()->queue( QString::fromUtf8( decryptedData ) ); |
|
|
|
|
assert( mReader->decryptMessage() ); // handled above
|
|
|
|
|
writePartIcon( &node->msgPart(), node->nodeId() ); |
|
|
|
|
htmlWriter()->queue( writeSigstatFooter( messagePart ) ); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
|