diff -r 139d4b7b2938 -r 99bcbff212ad emailservices/emailcommon/src/CFSMailMessagePart.cpp --- a/emailservices/emailcommon/src/CFSMailMessagePart.cpp Mon May 24 21:02:02 2010 +0300 +++ b/emailservices/emailcommon/src/CFSMailMessagePart.cpp Fri May 28 13:56:43 2010 +0300 @@ -15,11 +15,12 @@ * */ +#include "emailtrace.h" + // #include // -#include "emailtrace.h" #include #include #include // CleanupResetAndDestroy @@ -44,11 +45,12 @@ EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewLC( TFSMailMsgId aMessageId, TFSMailMsgId aMessagePartId ) { - FUNC_LOG; - CFSMailMessagePart* adr = new (ELeave) CFSMailMessagePart(); - CleanupStack::PushL(adr); - adr->ConstructL( aMessageId, aMessagePartId ); - return adr; + NM_FUNCTION; + + CFSMailMessagePart* adr = new (ELeave) CFSMailMessagePart(); + CleanupStack::PushL(adr); + adr->ConstructL( aMessageId, aMessagePartId ); + return adr; } // ----------------------------------------------------------------------------- @@ -57,10 +59,11 @@ EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewL( TFSMailMsgId aMessageId, TFSMailMsgId aMessagePartId ) { - FUNC_LOG; - CFSMailMessagePart* adr = CFSMailMessagePart::NewLC( aMessageId, aMessagePartId ); - CleanupStack::Pop(adr); - return adr; + NM_FUNCTION; + + CFSMailMessagePart* adr = CFSMailMessagePart::NewLC( aMessageId, aMessagePartId ); + CleanupStack::Pop(adr); + return adr; } // @@ -70,7 +73,8 @@ EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewLC(const NmId &aNmMessageId, const NmMessagePart& aNmMessage ) { - FUNC_LOG; + NM_FUNCTION; + CFSMailMessagePart* self = new (ELeave) CFSMailMessagePart(); CleanupStack::PushL(self); self->ConstructL( aNmMessageId,aNmMessage ); @@ -84,7 +88,8 @@ void CFSMailMessagePart::ConstructL( TFSMailMsgId aMessageId, TFSMailMsgId aMessagePartId ) { - FUNC_LOG; + NM_FUNCTION; + // // Base class initialization CFSMailMessageBase::ConstructL(aMessageId); @@ -107,7 +112,8 @@ // ----------------------------------------------------------------------------- void CFSMailMessagePart::ConstructL( const NmId &aNmMessageId,const NmMessagePart& aNmMessage ) { - FUNC_LOG; + NM_FUNCTION; + // Base class initialization CFSMailMessageBase::ConstructL(TFSMailMsgId(aNmMessageId)); @@ -129,7 +135,8 @@ const NmMessagePart& aNmMessage, const NmMessageEnvelope& aNmMessageEnvelope) { - FUNC_LOG; + NM_FUNCTION; + // Base class initialization CFSMailMessageBase::ConstructL(aNmMessageEnvelope); @@ -148,7 +155,8 @@ // ----------------------------------------------------------------------------- EXPORT_C CFSMailMessagePart::~CFSMailMessagePart() { - FUNC_LOG; + NM_FUNCTION; + // iContentType, iContentDescription, iContentDisposition, iContentID removed if(iAttachmentName) { @@ -187,7 +195,7 @@ // ----------------------------------------------------------------------------- CFSMailMessagePart::CFSMailMessagePart() : CFSMailMessageBase() { - FUNC_LOG; + NM_FUNCTION; // iContentType, iContentDescription, iContentDisposition, iContentID removed iContentClass = HBufC::New(1); @@ -204,7 +212,8 @@ // ----------------------------------------------------------------------------- EXPORT_C const TDesC& CFSMailMessagePart::GetContentType() const { - FUNC_LOG; + NM_FUNCTION; + // iContentTypePtr.Set(reinterpret_cast (iNmPrivateMessagePart->mContentType.utf16()), iNmPrivateMessagePart->mContentType.length()); @@ -217,7 +226,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContentType(const TDesC& aContentType) { - FUNC_LOG; + NM_FUNCTION; + // QString qtContentType = QString::fromUtf16(aContentType.Ptr(), aContentType.Length()); iNmPrivateMessagePart->mContentType = qtContentType; @@ -229,7 +239,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TFSMailMsgId CFSMailMessagePart::GetPartId() const { - FUNC_LOG; + NM_FUNCTION; + // return TFSMailMsgId(iNmPrivateMessagePart->mPartId); // @@ -242,7 +253,7 @@ EXPORT_C void CFSMailMessagePart::ChildPartsL( RPointerArray& aParts, TFSMailMessagePartDataSource aDataSource) { - FUNC_LOG; + NM_FUNCTION; if (aDataSource == EDataSourceMessageStore) { @@ -272,7 +283,7 @@ // ----------------------------------------------------------------------------- EXPORT_C CFSMailMessagePart* CFSMailMessagePart::ChildPartL(TFSMailMsgId aPartId) { - FUNC_LOG; + NM_FUNCTION; CFSMailMessagePart* part = NULL; if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId())) @@ -290,7 +301,7 @@ // ----------------------------------------------------------------------------- EXPORT_C TBool CFSMailMessagePart::IsMessageL() const { - FUNC_LOG; + NM_FUNCTION; TBuf ptr; // @@ -318,7 +329,7 @@ EXPORT_C CFSMailMessagePart* CFSMailMessagePart::NewChildPartL( const TFSMailMsgId aInsertBefore, const TDesC& aContentType ) { - FUNC_LOG; + NM_FUNCTION; CFSMailMessagePart* part = NULL; @@ -335,7 +346,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::RemoveChildPartL(TFSMailMsgId aPartId) { - FUNC_LOG; + NM_FUNCTION; + // get plugin pointer TFSMailMsgId id = GetPartId(); if(id.IsNullId()) @@ -357,7 +369,8 @@ EXPORT_C TInt CFSMailMessagePart::RemoveChildPartL( TFSMailMsgId aPartId, MFSMailRequestObserver& aOperationObserver) { - FUNC_LOG; + NM_FUNCTION; + TFSPendingRequest request; // get plugin pointer TFSMailMsgId id = GetPartId(); @@ -402,7 +415,8 @@ // ----------------------------------------------------------------------------- EXPORT_C const TDesC& CFSMailMessagePart::GetContentClass() { - FUNC_LOG; + NM_FUNCTION; + return *iContentClass; } @@ -411,7 +425,7 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContentClass( const TDesC& aContentClass ) { - FUNC_LOG; + NM_FUNCTION; // HBufC* contentClass = HBufC::New(aContentClass.Length()); @@ -435,7 +449,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TUint CFSMailMessagePart::ContentSize() const { - FUNC_LOG; + NM_FUNCTION; + // return (TUint)iNmPrivateMessagePart->mSize; // @@ -446,7 +461,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContentSize( TUint aContentSize ) { - FUNC_LOG; + NM_FUNCTION; + // iNmPrivateMessagePart->mSize = quint32(aContentSize); // @@ -457,7 +473,8 @@ // ----------------------------------------------------------------------------- EXPORT_C const TDesC& CFSMailMessagePart::ContentID() { - FUNC_LOG; + NM_FUNCTION; + // iContentIDPtr.Set(reinterpret_cast (iNmPrivateMessagePart->mContentId.utf16()), iNmPrivateMessagePart->mContentId.length()); @@ -470,7 +487,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContentIDL(const TDesC& aContentID) { - FUNC_LOG; + NM_FUNCTION; + // QString qtContentID = QString::fromUtf16(aContentID.Ptr(), aContentID.Length()); iNmPrivateMessagePart->mContentId = qtContentID; @@ -484,7 +502,7 @@ TFSMailMsgId aInsertBefore, CFSMailMessage* aMessage) { - FUNC_LOG; + NM_FUNCTION; CFSMailMessagePart* part = NULL; if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) @@ -500,7 +518,7 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::RemoveContentL() { - FUNC_LOG; + NM_FUNCTION; CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); if(plugin == NULL) @@ -529,7 +547,7 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::RemoveDownLoadedAttachmentsL() { - FUNC_LOG; + NM_FUNCTION; CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId()); if(plugin == NULL) @@ -569,7 +587,7 @@ // ----------------------------------------------------------------------------- EXPORT_C RFile CFSMailMessagePart::GetContentFileL() { - FUNC_LOG; + NM_FUNCTION; if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) { @@ -596,7 +614,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContentFromFileL(const TDesC& aFilePath) { - FUNC_LOG; + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) { plugin->SetPartContentFromFileL(GetMailBoxId(), GetFolderId(), @@ -609,7 +628,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::CopyContentFileL( const TDesC& aFilePath ) { - FUNC_LOG; + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) { plugin->CopyMessagePartFileL( GetMailBoxId(), GetFolderId(), @@ -622,7 +642,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::GetContentToBufferL(TDes16& aBuffer, TUint aStartOffset) { - FUNC_LOG; + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) { plugin->GetContentToBufferL( GetMailBoxId(), GetFolderId(), GetMessageId(), @@ -635,7 +656,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContent( TDes16& aBuffer ) { - FUNC_LOG; + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) { // @@ -650,7 +672,8 @@ // ----------------------------------------------------------------------------- EXPORT_C const TDesC& CFSMailMessagePart::ContentDescription() { - FUNC_LOG; + NM_FUNCTION; + // iContentDescriptionPtr.Set(reinterpret_cast ( iNmPrivateMessagePart->mContentDescription.utf16()), @@ -665,7 +688,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContentDescription( const TDesC& aContentDescription ) { - FUNC_LOG; + NM_FUNCTION; + // QString qtContentDescription = QString::fromUtf16( aContentDescription.Ptr(), aContentDescription.Length()); @@ -677,7 +701,8 @@ // ----------------------------------------------------------------------------- EXPORT_C const TDesC& CFSMailMessagePart::ContentDisposition() { - FUNC_LOG; + NM_FUNCTION; + // iContentDispositionPtr.Set(reinterpret_cast ( iNmPrivateMessagePart->mContentDisposition.utf16()), @@ -691,7 +716,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetContentDisposition( const TDesC& aContentDisposition ) { - FUNC_LOG; + NM_FUNCTION; + // QString qtContentDisposition = QString::fromUtf16( aContentDisposition.Ptr(), aContentDisposition.Length()); @@ -704,7 +730,8 @@ // ----------------------------------------------------------------------------- EXPORT_C CDesCArray& CFSMailMessagePart::ContentTypeParameters() { - FUNC_LOG; + NM_FUNCTION; + // if (iNmPrivateMessagePart->mContentType.isNull()) { @@ -801,7 +828,7 @@ // ----------------------------------------------------------------------------- EXPORT_C CDesCArray& CFSMailMessagePart::ContentDispositionParameters() { - FUNC_LOG; + NM_FUNCTION; // const TDesC& contentDisposition = ContentDisposition(); @@ -935,7 +962,8 @@ // ----------------------------------------------------------------------------- EXPORT_C MMRInfoObject& CFSMailMessagePart::GetMRInfo() { - FUNC_LOG; + NM_FUNCTION; + return *iMeetingRequest; } @@ -944,7 +972,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TBool CFSMailMessagePart::IsMRInfoSet() { - FUNC_LOG; + NM_FUNCTION; + if(iMeetingRequest) { return ETrue; @@ -960,7 +989,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetMRInfo(MMRInfoObject* aMeetingRequest) { - FUNC_LOG; + NM_FUNCTION; + if(iMeetingRequest) { delete iMeetingRequest; @@ -973,7 +1003,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SaveL() { - FUNC_LOG; + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) { plugin->StoreMessagePartL( GetMailBoxId(), GetFolderId(), GetMessageId(), *this ); @@ -986,7 +1017,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetAttachmentNameL(const TDesC& aFilePath) { - FUNC_LOG; + NM_FUNCTION; + // Parse file name in case full path is given TPtrC name; for(TInt i=0;i // Look first from Content-Type param "name" TInt ptr = GetContentType().Find(KFSMailContentTypeParamName); @@ -1109,7 +1142,7 @@ const TDesC& aContentType, TFSMailMessagePartDataSource aDataSource) { - FUNC_LOG; + NM_FUNCTION; TBuf ptr; if (!iNmPrivateMessagePart->mContentType.isNull()) @@ -1216,7 +1249,7 @@ // ----------------------------------------------------------------------------- EXPORT_C TBool CFSMailMessagePart::ContentTypeMatches( const TDesC& aContentType ) { - FUNC_LOG; + NM_FUNCTION; TBuf ptr; TBool result(EFalse); @@ -1246,7 +1279,8 @@ EXPORT_C void CFSMailMessagePart::AppendAttachmentsL( RPointerArray& aParts) { - FUNC_LOG; + NM_FUNCTION; + CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); if ( plugin ) { @@ -1283,7 +1317,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TUint CFSMailMessagePart::FetchedContentSize() const { - FUNC_LOG; + NM_FUNCTION; + // return (TUint)iNmPrivateMessagePart->mFetchedSize; // @@ -1294,7 +1329,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetFetchedContentSize(TUint aContentSize) { - FUNC_LOG; + NM_FUNCTION; + // iNmPrivateMessagePart->mFetchedSize = quint32(aContentSize); // @@ -1305,7 +1341,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TFSPartFetchState CFSMailMessagePart::FetchLoadState() const { - FUNC_LOG; + NM_FUNCTION; + // if(iMessagePartsStatus != EFSDefault) { @@ -1337,7 +1374,7 @@ MFSMailRequestObserver& aOperationObserver, const TUint aPreferredByteCount) { - FUNC_LOG; + NM_FUNCTION; TInt requestId(0); if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetPartId())) @@ -1379,7 +1416,7 @@ MFSMailRequestObserver& aOperationObserver, const TUint aPreferredByteCount) { - FUNC_LOG; + NM_FUNCTION; TInt requestId(0); @@ -1421,7 +1458,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetMessagePartsStatus(TFSPartFetchState aMessagePartStatus) { - FUNC_LOG; + NM_FUNCTION; + iMessagePartsStatus = aMessagePartStatus; } @@ -1432,7 +1470,8 @@ const TFSMailMsgId /*aInsertBefore*/, const TDesC& aContentType ) { - FUNC_LOG; + NM_FUNCTION; + CFSMailMessagePart* newPart = NULL; CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetMessageId() ); @@ -1464,7 +1503,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TUint CFSMailMessagePart::ReadOnlyPartSize() const { - FUNC_LOG; + NM_FUNCTION; + return iReadOnlyPartSize; } @@ -1473,7 +1513,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailMessagePart::SetReadOnlyPartSize(const TUint aReadOnlyPartSize) { - FUNC_LOG; + NM_FUNCTION; + iReadOnlyPartSize = aReadOnlyPartSize; } @@ -1482,7 +1523,7 @@ // ----------------------------------------------------------------------------- void CFSMailMessagePart::DoAttachmentListL( RPointerArray& /*aParts*/ ) { - FUNC_LOG; + NM_FUNCTION; } // @@ -1491,7 +1532,8 @@ // ----------------------------------------------------------------------------- EXPORT_C NmMessagePart* CFSMailMessagePart::GetNmMessagePart() { - FUNC_LOG; + NM_FUNCTION; + return new NmMessagePart(iNmPrivateMessagePart); } // @@ -1502,7 +1544,8 @@ // ----------------------------------------------------------------------------- EXPORT_C HBufC* CFSMailMessagePart::GetLocalTextContentLC() { - FUNC_LOG; + NM_FUNCTION; + return NmConverter::qstringToHBufCLC(iNmPrivateMessagePart->mTextContent); } //