diff -r 578830873419 -r ecc8def7944a emailservices/emailcommon/src/CFSMailMessage.cpp --- a/emailservices/emailcommon/src/CFSMailMessage.cpp Fri Apr 16 14:51:52 2010 +0300 +++ b/emailservices/emailcommon/src/CFSMailMessage.cpp Mon May 03 12:23:15 2010 +0300 @@ -15,7 +15,6 @@ * */ -#include #include "emailtrace.h" #include #include @@ -29,6 +28,7 @@ #include "CFSMailRequestObserver.h" // +#include #include "nmmessage.h" // @@ -37,24 +37,24 @@ // ----------------------------------------------------------------------------- // CFSMailMessage::NewLC // ----------------------------------------------------------------------------- -EXPORT_C CFSMailMessage * CFSMailMessage::NewLC( TFSMailMsgId aMessageId ) +EXPORT_C CFSMailMessage * CFSMailMessage::NewLC(TFSMailMsgId aMessageId) { FUNC_LOG; - CFSMailMessage* message = new (ELeave) CFSMailMessage(); - CleanupStack:: PushL(message); - message->ConstructL( aMessageId ); - return message; + CFSMailMessage* message = new (ELeave) CFSMailMessage(); + CleanupStack:: PushL(message); + message->ConstructL( aMessageId ); + return message; } // ----------------------------------------------------------------------------- // CFSMailMessage::NewL // ----------------------------------------------------------------------------- -EXPORT_C CFSMailMessage * CFSMailMessage::NewL( TFSMailMsgId aMessageId ) +EXPORT_C CFSMailMessage * CFSMailMessage::NewL(TFSMailMsgId aMessageId) { FUNC_LOG; - CFSMailMessage* message = CFSMailMessage::NewLC(aMessageId); - CleanupStack:: Pop(message); - return message; + CFSMailMessage* message = CFSMailMessage::NewLC(aMessageId); + CleanupStack:: Pop(message); + return message; } // @@ -78,8 +78,10 @@ void CFSMailMessage::ConstructL( TFSMailMsgId aMessageId ) { FUNC_LOG; +// // Base class initialization CFSMailMessagePart::ConstructL( aMessageId, TFSMailMsgId() ); +// } // @@ -98,11 +100,9 @@ // ----------------------------------------------------------------------------- // CFSMailMessage::CFSMailMessage // ----------------------------------------------------------------------------- -CFSMailMessage::CFSMailMessage() +CFSMailMessage::CFSMailMessage() : CFSMailMessagePart() { FUNC_LOG; - // set request handler pointer - iRequestHandler = static_cast(Dll::Tls()); } // ----------------------------------------------------------------------------- @@ -111,20 +111,22 @@ EXPORT_C CFSMailMessage::~CFSMailMessage() { FUNC_LOG; +// iMessageBufferForAsyncOp.Reset(); +// } // ----------------------------------------------------------------------------- // CFSMailMessage::SaveMessageL // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessage::SaveMessageL() -{ + { FUNC_LOG; - if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) - { - plugin->StoreMessageL(GetMailBoxId(),*this); - } -} + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) + { + plugin->StoreMessageL(GetMailBoxId(),*this); + } + } // // ----------------------------------------------------------------------------- @@ -205,7 +207,7 @@ // ----------------------------------------------------------------------------- EXPORT_C CFSMailMessagePart* CFSMailMessage::AddNewAttachmentL( RFile& aFile, const TDesC8& aMimeType ) -{ + { FUNC_LOG; CFSMailMessagePart* newPart = NULL; @@ -249,48 +251,49 @@ SetFlag(EFSMsgFlag_Attachments); } return newPart; -} + } // ----------------------------------------------------------------------------- // CFSMailMessage::AddNewAttachmentL // ----------------------------------------------------------------------------- -EXPORT_C CFSMailMessagePart* CFSMailMessage::AddNewAttachmentL( const TDesC& aFilePath, - const TFSMailMsgId /*aInsertBefore*/ ) -{ +EXPORT_C CFSMailMessagePart* CFSMailMessage::AddNewAttachmentL( const TDesC& aFilePath, + const TFSMailMsgId /*aInsertBefore*/ ) + { FUNC_LOG; - CFSMailMessagePart* newPart = NULL; - - if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) - { - // use recognizer to find out ContentType - RApaLsSession apaSession; - TDataRecognitionResult dataType; - TBufC8 buf; - User::LeaveIfError(apaSession.Connect()); - User::LeaveIfError(apaSession.RecognizeData(aFilePath, buf, dataType)); - apaSession.Close(); + CFSMailMessagePart* newPart = NULL; + + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) + { + // use recognizer to find out ContentType + RApaLsSession apaSession; + TDataRecognitionResult dataType; + TBufC8 buf; + User::LeaveIfError(apaSession.Connect()); + User::LeaveIfError(apaSession.RecognizeData(aFilePath, buf, dataType)); + apaSession.Close(); - // Create new message part with correct Content-Type - TBuf contentType; - contentType.Copy(dataType.iDataType.Des()); - newPart = plugin->NewChildPartFromFileL( GetMailBoxId(), - GetFolderId(), - GetMessageId(), - GetPartId(), - contentType, - aFilePath ); + // Create new message part with correct Content-Type + TBuf contentType; + contentType.Copy(dataType.iDataType.Des()); + newPart = plugin->NewChildPartFromFileL( GetMailBoxId(), + GetFolderId(), + GetMessageId(), + GetPartId(), + contentType, + aFilePath ); - - // Set attachment name - newPart->SetAttachmentNameL(aFilePath); + + // Set attachment name + newPart->SetAttachmentNameL(aFilePath); - // store message part - newPart->SaveL(); + // store message part + newPart->SaveL(); - // set flag + // set flag SetFlag(EFSMsgFlag_Attachments); - } + } + return newPart; } @@ -354,7 +357,7 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessage::AttachmentListL( RPointerArray& aParts ) -{ + { FUNC_LOG; // First list all message parts AppendAttachmentsL( aParts ); @@ -370,7 +373,8 @@ // find plain text body part from the list CFSMailMessagePart* txtPart = FindBodyPartL(KFSMailContentTypeTextPlain); CleanupStack::PushL( txtPart ); - if ( txtPart ) + if ( txtPart + && txtPart->AttachmentNameL().Length() == 0 ) // real attachments have names { // remove plain text body part from attachment list for ( TInt ii = aParts.Count() - 1; ii >= 0; --ii ) @@ -388,7 +392,8 @@ // find html body part from the list CFSMailMessagePart* htmlPart = FindBodyPartL(KFSMailContentTypeTextHtml); CleanupStack::PushL( htmlPart ); - if ( htmlPart ) + if ( htmlPart + && htmlPart->AttachmentNameL().Length() == 0 ) // real attachments have names { // remove html body part from attachment list for ( TInt ii = aParts.Count() - 1; ii >= 0; --ii ) @@ -406,8 +411,9 @@ iMessageParts.ResetAndDestroy(); iReadMessageParts = ETrue; -} + } +// // ----------------------------------------------------------------------------- // CFSMailMessage::PlainTextBodyPartL // ----------------------------------------------------------------------------- @@ -418,18 +424,18 @@ CFSMailMessagePart* part = FindBodyPartL(KFSMailContentTypeTextPlain, aDataSource); // special case, single part content type is not given - // - if(!part && iMessageParts.Count() == 1 && iMessageParts[0]->GetContentType().Length() == 0) - // - { - part = iMessageParts[0]; - iMessageParts.Remove(0); - } + if(part == NULL && iMessageParts.Count() == 1 && iMessageParts[0]->GetContentType().Length() == 0) + { + part = iMessageParts[0]; + iMessageParts.Remove(0); + } iMessageParts.ResetAndDestroy(); - iReadMessageParts = ETrue; + iReadMessageParts = ETrue; return part; } +// +// // ----------------------------------------------------------------------------- // CFSMailMessage::HtmlBodyPartL // ----------------------------------------------------------------------------- @@ -439,18 +445,21 @@ FUNC_LOG; CFSMailMessagePart* part = FindBodyPartL(KFSMailContentTypeTextHtml, aDataSource); iMessageParts.ResetAndDestroy(); - iReadMessageParts = ETrue; + iReadMessageParts = ETrue; return part; } +// +// // ----------------------------------------------------------------------------- // CFSMailMessage::IsMessageL // ----------------------------------------------------------------------------- EXPORT_C TBool CFSMailMessage::IsMessageL() const -{ + { FUNC_LOG; return CFSMailMessagePart::IsMessageL(); } +// // ----------------------------------------------------------------------------- // CFSMailMessage::ContentTypeParameters() @@ -458,18 +467,18 @@ CDesCArray& CFSMailMessage::ContentTypeParameters() { FUNC_LOG; - CDesCArray* faked = NULL; - return *faked; + CDesCArray* faked = NULL; + return *faked; } // ----------------------------------------------------------------------------- // CFSMailMessage::DoAttachmentListL // ----------------------------------------------------------------------------- void CFSMailMessage::DoAttachmentListL( RPointerArray& aParts ) -{ + { FUNC_LOG; AttachmentListL(aParts); -} + } // // -----------------------------------------------------------------------------