summaryrefslogtreecommitdiff
path: root/nonprism/kdepim/bug333611.patch
blob: 44befd8d0c8245df5c94a537ca13e7608489a723 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- a/messageviewer/src/viewer/objecttreeparser.cpp
+++ b/messageviewer/src/viewer/objecttreeparser.cpp
@@ -696,29 +696,36 @@
             signatureFound = verifyResult.signatures().size() > 0;
             signatures = verifyResult.signatures();
             bDecryptionOk = !decryptResult.error();
-            passphraseError =  decryptResult.error().isCanceled()
-                               || decryptResult.error().code() == GPG_ERR_NO_SECKEY;
-            actuallyEncrypted = decryptResult.error().code() != GPG_ERR_NO_DATA;
-            partMetaData.errorText = QString::fromLocal8Bit(decryptResult.error().asString());
             partMetaData.auditLogError = m->auditLogError();
             partMetaData.auditLog = m->auditLogAsHtml();
-            partMetaData.isEncrypted = actuallyEncrypted;
-            if (actuallyEncrypted && decryptResult.numRecipients() > 0) {
-                partMetaData.keyId = decryptResult.recipient(0).keyID();
-            }
-
-            qCDebug(MESSAGEVIEWER_LOG) << "ObjectTreeParser::decryptMIME: returned from CRYPTPLUG";
-            if (bDecryptionOk) {
+            if (!bDecryptionOk && signatureFound) {
+                //Only a signed part
+                actuallyEncrypted = false;
+                bDecryptionOk = true;
                 decryptedData = plainText;
-            } else if (htmlWriter() && showWarning) {
-                decryptedData = "<div style=\"font-size:x-large; text-align:center;"
-                                "padding:20pt;\">"
-                                + errorMsg.toUtf8()
-                                + "</div>";
-                if (!passphraseError)
-                    partMetaData.errorText = i18n("Crypto plug-in \"%1\" could not decrypt the data.", cryptPlugLibName)
-                                             + QLatin1String("<br />")
-                                             + i18n("Error: %1", partMetaData.errorText);
+            } else {
+                passphraseError =  decryptResult.error().isCanceled()
+                                   || decryptResult.error().code() == GPG_ERR_NO_SECKEY;
+                actuallyEncrypted = decryptResult.error().code() != GPG_ERR_NO_DATA;
+                partMetaData.errorText = QString::fromLocal8Bit(decryptResult.error().asString());
+                partMetaData.isEncrypted = actuallyEncrypted;
+                if (actuallyEncrypted && decryptResult.numRecipients() > 0) {
+                    partMetaData.keyId = decryptResult.recipient(0).keyID();
+                }
+
+                qCDebug(MESSAGEVIEWER_LOG) << "ObjectTreeParser::decryptMIME: returned from CRYPTPLUG";
+                if (bDecryptionOk) {
+                    decryptedData = plainText;
+                } else if (htmlWriter() && showWarning) {
+                    decryptedData = "<div style=\"font-size:x-large; text-align:center; padding:20pt;\">"
+                                    + errorMsg.toUtf8()
+                                    + "</div>";
+                    if (!passphraseError) {
+                        partMetaData.errorText = i18n("Crypto plug-in \"%1\" could not decrypt the data.", cryptPlugLibName)
+                                                 + QLatin1String("<br />")
+                                                 + i18n("Error: %1", partMetaData.errorText);
+                    }
+                }
             }
         }
     }