diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp index feac1d07..d0d78b72 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 += "
"; html += TQString::fromLatin1( "" ).arg( bgColor.name() ); - TQString fileName = writeMessagePartToTempFile( &node->msgPart(), node->nodeId() ); TQString href = node->asHREF( "header" ); html += TQString::fromLatin1( "" );