summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpschwabauer <pschwabauer@intevation.de>2024-02-12 09:25:41 +0100
committerSlávek Banko <slavek.banko@axis.cz>2024-02-12 11:59:41 +0100
commit112a9744d3683c34be761331465c8505618ea9ef (patch)
tree1756bde964748032d93fa039442c1a78ae715ab5
parent7ad14b004aabad9e185cbc1e894489b24e4b5d48 (diff)
downloadtdepim-112a9744d3683c34be761331465c8505618ea9ef.tar.gz
tdepim-112a9744d3683c34be761331465c8505618ea9ef.zip
Fix open HTML with an external program
HTML emails can't be opened because they are not written to disk. This fixes it by writing HTML parts of the email unconditionally to disk and adds a '.html' file extension if the part is of type HTML. This resolves Issue #94 (cherry picked from commit 33ffa952335f63ccaacd90dd611c6d5896412c53)
-rw-r--r--kmail/kmreaderwin.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp
index feac1d07c..d0d78b728 100644
--- a/kmail/kmreaderwin.cpp
+++ b/kmail/kmreaderwin.cpp
@@ -1775,8 +1775,12 @@ TQString KMReaderWin::writeMessagePartToTempFile( KMMessagePart* aMsgPart,
int slashPos = fileName.findRev( '/' );
if( -1 != slashPos )
fileName = fileName.mid( slashPos + 1 );
- if( fileName.isEmpty() )
+ if( fileName.isEmpty() ) {
fileName = "unnamed";
+ // Save html emails with extension
+ if ( aMsgPart->subtype() == DwMime::kSubtypeHtml )
+ fileName += ".html";
+ }
fname += "/" + fileName;
TQByteArray data = aMsgPart->bodyDecodedBinary();
@@ -3042,10 +3046,15 @@ TQString KMReaderWin::renderAttachments(partNode * node, const TQColor &bgColor
}
} else {
partNode::AttachmentDisplayInfo info = node->attachmentDisplayInfo();
+
+ // Write HTML parts and attachments to disk to allow them to be opened
+ bool writePartToDisk = info.displayInHeader || node->msgPart().subtype() == DwMime::kSubtypeHtml;
+ if ( writePartToDisk )
+ TQString fileName = writeMessagePartToTempFile( &node->msgPart(), node->nodeId() );
+
if ( info.displayInHeader ) {
html += "<div style=\"float:left;\">";
html += TQString::fromLatin1( "<span style=\"white-space:nowrap; border-width: 0px; border-left-width: 5px; border-color: %1; 2px; border-left-style: solid;\">" ).arg( bgColor.name() );
- TQString fileName = writeMessagePartToTempFile( &node->msgPart(), node->nodeId() );
TQString href = node->asHREF( "header" );
html += TQString::fromLatin1( "<a href=\"" ) + href +
TQString::fromLatin1( "\">" );