From 28c0fec6bb6f92d9c4b83766156ced96553ec246 Mon Sep 17 00:00:00 2001 From: Paul Schwabauer Date: Fri, 1 Dec 2023 14:25:44 +0100 Subject: Fixes #94 HTML emails can't be opened because they are not written to disk. This fixes it by writing all parts of the email unconditionally to disk and adds a '.html' file extension if the part is of type HTML. Signed-off-by: Paul Schwabauer --- kmail/kmreaderwin.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'kmail') diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp index 1e4eab6da..26c5573ed 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(); @@ -3041,11 +3045,11 @@ TQString KMReaderWin::renderAttachments(partNode * node, const TQColor &bgColor html += ""; } } else { + TQString fileName = writeMessagePartToTempFile( &node->msgPart(), node->nodeId() ); partNode::AttachmentDisplayInfo info = node->attachmentDisplayInfo(); if ( info.displayInHeader ) { html += "
"; html += TQString::fromLatin1( "" ).arg( bgColor.name() ); - TQString fileName = writeMessagePartToTempFile( &node->msgPart(), node->nodeId() ); TQString href = node->asHREF( "header" ); html += TQString::fromLatin1( "" ); -- cgit v1.2.1