From 9cc9eb1007b4e008ce89ff4b8c49c695524ba754 Mon Sep 17 00:00:00 2001 From: Carsten Burghardt Date: Wed, 31 Dec 2003 13:34:33 +0000 Subject: [PATCH] Do not create the message for inlined messages (iconic view) from string but from the DwMessage. Fixes bug 70169 70169-done@bugs.kde.org svn path=/trunk/kdepim/; revision=275746 --- bodyvisitor.cpp | 6 +++++- kmcommands.cpp | 3 ++- kmreaderwin.cpp | 49 ++++++++++++++++++++++++------------------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/bodyvisitor.cpp b/bodyvisitor.cpp index 6851a06d8..a1d8ce8d6 100644 --- a/bodyvisitor.cpp +++ b/bodyvisitor.cpp @@ -190,8 +190,12 @@ namespace KMail { } //----------------------------------------------------------------------------- - bool BodyVisitorHidden::addPartToList( KMMessagePart * ) + bool BodyVisitorHidden::addPartToList( KMMessagePart * part ) { + // header of an encapsulated message + if ( part->partSpecifier().endsWith(".HEADER") ) + return true; + return false; } diff --git a/kmcommands.cpp b/kmcommands.cpp index fa385bf62..eeec07bbd 100644 --- a/kmcommands.cpp +++ b/kmcommands.cpp @@ -1906,7 +1906,8 @@ void KMLoadPartsCommand::start() connect( job, SIGNAL(messageUpdated(KMMessage*, QString)), this, SLOT(slotPartRetrieved(KMMessage*, QString)) ); job->start(); - } + } else + kdWarning(5006) << "KMLoadPartsCommand - msg has no parent" << endl; } ++it; } diff --git a/kmreaderwin.cpp b/kmreaderwin.cpp index ea04485f4..d36e1757c 100644 --- a/kmreaderwin.cpp +++ b/kmreaderwin.cpp @@ -1121,7 +1121,10 @@ void KMReaderWin::parseMsg(KMMessage* aMsg) } delete mRootNode; - mRootNode = new partNode( mainBody, mainType, mainSubType, true ); + if ( firstBodyPart && mainType == DwMime::kTypeText ) + mRootNode = new partNode( firstBodyPart ); + else + mRootNode = new partNode( mainBody, mainType, mainSubType, true ); mRootNode->setFromAddress( aMsg->from() ); QString cntDesc = aMsg->subject(); @@ -1614,10 +1617,22 @@ void KMReaderWin::slotCopySelectedText() //----------------------------------------------------------------------------- void KMReaderWin::atmViewMsg(KMMessagePart* aMsgPart) { - KMMessage* msg = new KMMessage; assert(aMsgPart!=0); - msg->fromString(aMsgPart->bodyDecoded()); + partNode* node = mRootNode ? mRootNode->findId( mAtmCurrent ) : 0; + KMMessage* msg; + if (node && node->dwPart()->Body().Message()) { + // make a deep copy + msg = new KMMessage( new DwMessage(*node->dwPart()->Body().Message()) ); + } else { + msg = new KMMessage; + msg->fromString(aMsgPart->bodyDecoded()); + } assert(msg != 0); + // some information that is needed for imap messages with LOD + msg->setParent( message()->parent() ); + if ( !message()->headerField("X-UID").isEmpty() ) + msg->setHeaderField("X-UID", message()->headerField("X-UID")); + msg->setComplete(true); KMReaderMainWin *win = new KMReaderMainWin(); win->showMsg( overrideCodec(), msg ); win->resize(550,600); @@ -1775,8 +1790,10 @@ void KMReaderWin::openAttachment( int id, const QString & name ) { QString str, pname, cmd, fileName; partNode* node = mRootNode ? mRootNode->findId( id ) : 0; - if( !node ) + if( !node ) { + kdWarning(5006) << "KMReaderWin::openAttachment - could not find node " << id << endl; return; + } KMMessagePart& msgPart = node->msgPart(); if (qstricmp(msgPart.typeStr(), "message")==0) @@ -1874,8 +1891,10 @@ void KMReaderWin::slotAtmSave() return; partNode * node = mRootNode->findId( mAtmCurrent ); - if ( !node ) + if ( !node ) { + kdWarning(5006) << "KMReaderWin::slotAtmSave - could not find node " << mAtmCurrent << endl; return; + } QPtrList parts; parts.append( node ); @@ -1883,26 +1902,6 @@ void KMReaderWin::slotAtmSave() KMSaveAttachmentsCommand *command = new KMSaveAttachmentsCommand( this, parts, message(), false ); command->start(); -/* - const KMMessagePart & msgPart = node->msgPart(); - - // prepend the previously used save dir, - // replace all ':' with '_' because ':' isn't allowed on FAT volumes - const QString fileName = - mSaveAttachDir + mAtmCurrentName.section( '/', -1 ).replace( ':', '_' ); - - // ### getSaveURL should allow setting "::" _and_ a - // ### proposed filename (currently, it's xor)... - // ### We could then get rid of mSaveAttachDir! - const KURL url = KFileDialog::getSaveURL( fileName, QString::null, this, - i18n("Save Attachment As") ); - if ( url.isEmpty() ) - return; - - mSaveAttachDir = url.directory() + '/'; - - kmkernel->byteArrayToRemoteFile( msgPart.bodyDecodedBinary(), url ); - */ }