diff --git a/objecttreeparser.cpp b/objecttreeparser.cpp index 6f4bd4650..d671b0e44 100644 --- a/objecttreeparser.cpp +++ b/objecttreeparser.cpp @@ -457,6 +457,7 @@ namespace KMail { QByteArray plainData = cleartext; plainData.resize( cleartext.size() - 1 ); result = job->exec( signaturetext, plainData ); + messagePart.auditLogError = job->auditLogError(); messagePart.auditLog = job->auditLogAsHtml(); } else { cryptPlugError = CANT_VERIFY_SIGNATURES; @@ -466,6 +467,7 @@ namespace KMail { QByteArray plainData; result = job->exec( signaturetext, plainData ); cleartext = QCString( plainData.data(), plainData.size() + 1 ); + messagePart.auditLogError = job->auditLogError(); messagePart.auditLog = job->auditLogAsHtml(); } else { cryptPlugError = CANT_VERIFY_SIGNATURES; @@ -645,10 +647,12 @@ bool ObjectTreeParser::okDecryptMIME( partNode& data, bool& passphraseError, bool& actuallyEncrypted, QString& aErrorText, + GpgME::Error & auditLogError, QString& auditLog ) { passphraseError = false; aErrorText = QString::null; + auditLogError = GpgME::Error(); auditLog = QString::null; bool bDecryptionOk = false; enum { NO_PLUGIN, NOT_INITIALIZED, CANT_DECRYPT } @@ -719,6 +723,7 @@ bool ObjectTreeParser::okDecryptMIME( partNode& data, || decryptResult.error().code() == GPG_ERR_NO_SECKEY; actuallyEncrypted = decryptResult.error().code() != GPG_ERR_NO_DATA; aErrorText = QString::fromLocal8Bit( decryptResult.error().asString() ); + auditLogError = job->auditLogError(); auditLog = job->auditLogAsHtml(); kdDebug(5006) << "ObjectTreeParser::decryptMIME: returned from CRYPTPLUG" @@ -1226,6 +1231,7 @@ namespace KMail { passphraseError, actuallyEncrypted, messagePart.errorText, + messagePart.auditLogError, messagePart.auditLog ); // paint the frame @@ -1378,6 +1384,7 @@ namespace KMail { passphraseError, actuallyEncrypted, messagePart.errorText, + messagePart.auditLogError, messagePart.auditLog ); // paint the frame @@ -1541,6 +1548,7 @@ namespace KMail { passphraseError, actuallyEncrypted, messagePart.errorText, + messagePart.auditLogError, messagePart.auditLog ) ) { kdDebug(5006) << "pkcs7 mime - encryption found - enveloped (encrypted) data !" << endl; isEncrypted = true; @@ -2077,9 +2085,18 @@ static QString beginVerboseSigstatHeader() return "
| "; } -static QString makeShowAuditLogLink( const QString & auditLog ) { - if ( auditLog.isEmpty() ) - return i18n("No Audit Log available"); +static QString makeShowAuditLogLink( const GpgME::Error & err, const QString & auditLog ) { + if ( const unsigned int code = err.code() ) { + if ( code == GPG_ERR_NOT_IMPLEMENTED ) { + kdDebug(5006) << "makeShowAuditLogLink: not showing link (not implemented)" << endl; + return QString(); + } else if ( code == GPG_ERR_NO_DATA ) { + kdDebug(5006) << "makeShowAuditLogLink: not showing link (not available)" << endl; + return i18n("No Audit Log available"); + } else { + return i18n("Error Retrieving Audit Log: %1").arg( QString::fromLocal8Bit( err.asString() ) ); + } + } KURL url; url.setProtocol( "kmail" ); @@ -2097,7 +2114,7 @@ static QString endVerboseSigstatHeader( const PartMetaData & pmd ) html += i18n( "Hide Details" ); html += " |
| "; - html += makeShowAuditLogLink( pmd.auditLog ); + html += makeShowAuditLogLink( pmd.auditLogError, pmd.auditLog ); html += " |