Show the audit log message/link in fewer cases. Pt.4 of kolab/issue 2627: KMail reader.

svn path=/branches/kdepim/enterprise/kdepim/; revision=886606
wilder-work
Marc Mutz 18 years ago
parent deb0dfa9b8
commit e85d4351df
  1. 25
      objecttreeparser.cpp
  2. 5
      objecttreeparser.h
  3. 2
      partmetadata.h

@ -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 "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td rowspan=\"2\">";
}
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 += "</a></td></tr>";
html += "<tr><td align=\"right\" valign=\"bottom\" nowrap=\"nowrap\">";
html += makeShowAuditLogLink( pmd.auditLog );
html += makeShowAuditLogLink( pmd.auditLogError, pmd.auditLog );
html += "</td></tr></table>";
return html;
}

@ -46,6 +46,10 @@ class QString;
class QWidget;
class partNode;
namespace GpgME {
class Error;
}
namespace KMail {
class AttachmentStrategy;
@ -199,6 +203,7 @@ namespace KMail {
bool& passphraseError,
bool& actuallyEncrypted,
QString& aErrorText,
GpgME::Error & auditLogError,
QString& auditLog );
bool processMailmanMessage( partNode * node );

@ -18,6 +18,7 @@
#define _KMAIL_PARTMETADATA_H_
#include <gpgmepp/verificationresult.h>
#include <gpgmepp/context.h>
#include <kpgp.h>
#include <qstring.h>
@ -50,6 +51,7 @@ namespace KMail {
QDateTime creationTime;
QString decryptionError;
QString auditLog;
GpgME::Error auditLogError;
bool isSigned : 1;
bool isGoodSignature : 1;
bool isEncrypted : 1;

Loading…
Cancel
Save