diff --git a/objecttreeparser.cpp b/objecttreeparser.cpp index 84848339c..df7257a56 100644 --- a/objecttreeparser.cpp +++ b/objecttreeparser.cpp @@ -112,7 +112,7 @@ using KPIMUtils::LinkLocator; #include #include #include -#include +#include #include "chiasmuskeyselector.h" namespace KMail { @@ -654,6 +654,25 @@ namespace KMail { return bIsOpaqueSigned; } +void ObjectTreeParser::writeDecryptionInProgressBlock() +{ + kDebug(5006) << k_funcinfo << endl; + assert( mReader ); + // PENDING(marc) find an animated icon here: + //const QString iconName = KGlobal::instance()->iconLoader()->iconPath( "decrypted", KIcon::Small ); + const QString decryptedData = i18n("Encrypted data not shown"); + PartMetaData messagePart; + messagePart.isDecryptable = true; + messagePart.isEncrypted = true; + messagePart.isSigned = false; + messagePart.inProgress = true; + htmlWriter()->queue( writeSigstatHeader( messagePart, + cryptoProtocol(), + QString() ) ); + //htmlWriter()->queue( decryptedData ); + htmlWriter()->queue( writeSigstatFooter( messagePart ) ); +} + void ObjectTreeParser::writeDeferredDecryptionBlock() { kDebug(); @@ -1568,14 +1587,13 @@ namespace KMail { } htmlWriter()->queue( "" + i18n( "Certificate import details:" ) + "
" ); for ( std::vector::const_iterator it = imports.begin() ; it != imports.end() ; ++it ) { - if ( (*it).error() ) + if ( (*it).error() ) { htmlWriter()->queue( i18nc( "Certificate import failed.", "Failed: %1 (%2)", (*it).fingerprint(), - QString::fromLocal8Bit( (*it).error().asString() ) ) ); - else if ( (*it).status() & ~GpgME::Import::ContainedSecretKey ) { + QString::fromLocal8Bit( (*it).error().asString() ) ) ); + } else if ( (*it).status() & ~GpgME::Import::ContainedSecretKey ) { if ( (*it).status() & GpgME::Import::ContainedSecretKey ) { htmlWriter()->queue( i18n( "New or changed: %1 (secret key available)", (*it).fingerprint() ) ); - } - else { + } else { htmlWriter()->queue( i18n( "New or changed: %1", (*it).fingerprint() ) ); } } @@ -2201,42 +2219,51 @@ QString ObjectTreeParser::writeSigstatHeader( PartMetaData & block, const QString & fromAddress, const QString & filename ) { - const bool isSMIME = cryptProto && ( cryptProto == Kleo::CryptoBackendFactory::instance()->smime() ); - QString signer = block.signer; + const bool isSMIME = cryptProto && ( cryptProto == Kleo::CryptoBackendFactory::instance()->smime() ); + QString signer = block.signer; - QString htmlStr, simpleHtmlStr; - QString dir = ( QApplication::isRightToLeft() ? "rtl" : "ltr" ); - QString cellPadding("cellpadding=\"1\""); + QString htmlStr, simpleHtmlStr; + QString dir = ( QApplication::isRightToLeft() ? "rtl" : "ltr" ); + QString cellPadding("cellpadding=\"1\""); + + if ( block.isEncapsulatedRfc822Message ) { + htmlStr += "" + "
"; + if ( !filename.isEmpty() ) { + htmlStr += "" + + i18n("Encapsulated message") + ""; + } else { + htmlStr += i18n("Encapsulated message"); + } + htmlStr += "
"; + } - if( block.isEncapsulatedRfc822Message ) - { - htmlStr += "" - "
"; - if( !filename.isEmpty() ) - htmlStr += "" - + i18n("Encapsulated message") + ""; - else - htmlStr += i18n("Encapsulated message"); - htmlStr += "
"; + if ( block.isEncrypted ) { + htmlStr += "" + "
"; + if ( block.inProgress ) { + htmlStr += i18n("Please wait while the message is being decrypted..."); + } else if ( block.isDecryptable ) { + htmlStr += i18n("Encrypted message"); + } else { + htmlStr += i18n("Encrypted message (decryption not possible)"); + if( !block.errorText.isEmpty() ) + htmlStr += "
" + i18n("Reason: %1", block.errorText ); } + htmlStr += "
"; + } - if( block.isEncrypted ) - { - htmlStr += "" - "
"; - if( block.isDecryptable ) - htmlStr += i18n("Encrypted message"); - else { - htmlStr += i18n("Encrypted message (decryption not possible)"); - if( !block.errorText.isEmpty() ) - htmlStr += "
" + i18n("Reason: %1", block.errorText ); - } - htmlStr += "
"; + if ( block.isSigned && block.inProgress ) { + block.signClass = "signInProgress"; + htmlStr += "" + "
"; + htmlStr += i18n("Please wait while the signature is being verified..."); + htmlStr += "
"; } simpleHtmlStr = htmlStr; - if( block.isSigned ) { + if ( block.isSigned && !block.inProgress ) { QStringList& blockAddrs( block.signerMailAddresses ); // note: At the moment frameColor and showKeyInfos are // used for CMS only but not for PGP signatures diff --git a/objecttreeparser.h b/objecttreeparser.h index 8e99883f2..7e2552681 100644 --- a/objecttreeparser.h +++ b/objecttreeparser.h @@ -194,6 +194,10 @@ namespace KMail { but we're deferring decryption for later. */ void writeDeferredDecryptionBlock(); + /** Writes out the block that we use when the node is encrypted, + but we've just kicked off async decryption. */ + void writeDecryptionInProgressBlock(); + /** Returns the contents of the given multipart/encrypted object. Data is decypted. May contain body parts. */ bool okDecryptMIME( partNode& data, diff --git a/partmetadata.h b/partmetadata.h index b22b0b90a..3b6c2befe 100644 --- a/partmetadata.h +++ b/partmetadata.h @@ -34,6 +34,7 @@ namespace KMail { isGoodSignature( false ), isEncrypted( false ), isDecryptable( false ), + inProgress( false ), technicalProblem( false ), isEncapsulatedRfc822Message( false ) { @@ -55,6 +56,7 @@ namespace KMail { bool isGoodSignature : 1; bool isEncrypted : 1; bool isDecryptable : 1; + bool inProgress : 1; bool technicalProblem : 1; bool isEncapsulatedRfc822Message : 1; };