diff -r dcf0eedfc1a3 -r d189ee25cf9d emailservices/emailstore/base_plugin/src/BasePlugin.cpp --- a/emailservices/emailstore/base_plugin/src/BasePlugin.cpp Thu Aug 19 09:38:05 2010 +0300 +++ b/emailservices/emailstore/base_plugin/src/BasePlugin.cpp Tue Aug 31 15:04:17 2010 +0300 @@ -18,35 +18,42 @@ //MsgStore. // -#include "msgstore.h" -#include "msgstoreaccount.h" -#include "msgstoremailbox.h" -#include "msgstoremessage.h" -#include "msgstorefolder.h" -#include "msgstorepropertycontainer.h" -#include "msgstorepropertykeys.h" -#include "msgstoresortcriteria.h" -#include "msgstoresortresultiterator.h" +#include "MsgStore.h" +#include "MsgStoreAccount.h" +#include "MsgStoreMailBox.h" +#include "MsgStoreMessage.h" +#include "MsgStoreFolder.h" +#include "MsgStorePropertyContainer.h" +#include "MsgStorePropertyKeys.h" +#include "MsgStoreSortCriteria.h" +#include "MsgStoreSortResultIterator.h" //Freestyle. -#include "cfsmailcommon.h" -#include "cfsmailmessage.h" +#include "CFSMailCommon.h" +#include "CFSMailMessage.h" #include "cmrcalendarinfo.h" // //Base plugin. -#include "baseplugin.h" -#include "basepluginpanic.h" +#include "BasePlugin.h" +#include "BasePluginPanic.h" #include "baseplugincommonutils.h" -#include "mailiterator.h" +#include "MailIterator.h" #include "baseplugindelayedopsprivate.h" + +// +#include "CFSMailFolder.h" +#include "baseplugindef.h" +// + // Other #include #include #include +// // -#include "FreestyleEmailUiConstants.h" +//#include "freestyleemailuiconstants.h" // removed from 10.1 // - +// //size of the read buffer when reading body content from the quoted //message when replying/forwarding. const TInt KQuotedReadBufferSize = 1024*64; @@ -77,7 +84,7 @@ /** * */ -EXPORT_C void CBasePlugin::ConstructL() + void CBasePlugin::ConstructL() { __LOG_CONSTRUCT( "baseplugin", "CBasePlugin" ) @@ -93,7 +100,7 @@ /** * */ -EXPORT_C CBasePlugin::CBasePlugin() + CBasePlugin::CBasePlugin() : iMailboxes( RMap::CompareInt ) { } @@ -102,7 +109,7 @@ /** * */ -EXPORT_C CBasePlugin::~CBasePlugin() +CBasePlugin::~CBasePlugin() { //needs to be first thing to do as it might force execution of operations //that depend on the plugin's current state. @@ -111,7 +118,9 @@ iMailboxes.ResetAndDestroy(); iMailboxes.Close(); - if ( iObservers.Count() > 0 ) +// + if ( iObservers.Count() > 0 && iMsgStore ) +// { TRAP_IGNORE( iMsgStore->RemoveObserverL( this ) ); } @@ -121,7 +130,12 @@ iReqs.ResetAndDestroy(); iReqs.Close(); - +// + // Note that all the ops in iDelayedOpReqs array (if any) have already been + // deleted in the destructor of CDelayedOpsManager class. + iDelayedOpReqs.Reset(); + iDelayedOpReqs.Close(); +// ResetCache(); __LOG_DESTRUCT @@ -135,7 +149,7 @@ * Note that as the msgstore performs the delete immediately the observer will get * called from within this method. */ -EXPORT_C void CBasePlugin::DeleteMailBoxByUidL( + void CBasePlugin::DeleteMailBoxByUidL( const TFSMailMsgId& aMailBoxId, MFSMailRequestObserver& aOperationObserver, const TInt aRequestId ) @@ -188,7 +202,7 @@ /** * */ -EXPORT_C void CBasePlugin::ListMailBoxesL( RArray& aMailboxes ) + void CBasePlugin::ListMailBoxesL( RArray& aMailboxes ) { __LOG_ENTER( "ListMailBoxesL" ) @@ -230,7 +244,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C CFSMailBox* CBasePlugin::GetMailBoxByUidL( const TFSMailMsgId& aMailBox ) + CFSMailBox* CBasePlugin::GetMailBoxByUidL( const TFSMailMsgId& aMailBox ) { __LOG_ENTER( "GetMailBoxByUidL" ) @@ -304,7 +318,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C TFSMailMsgId CBasePlugin::GetStandardFolderIdL( + TFSMailMsgId CBasePlugin::GetStandardFolderIdL( const TFSMailMsgId& aMailBoxId, const TFSFolderType aFolderType ) @@ -332,7 +346,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C CFSMailFolder* CBasePlugin::GetFolderByUidL( + CFSMailFolder* CBasePlugin::GetFolderByUidL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& aFolderId ) @@ -403,7 +417,7 @@ * @param aMailBoxId if not found leaves with KErrNotFound. * @return if the folder already exists returns the existing one. */ -EXPORT_C CFSMailFolder* CBasePlugin::CreateFolderL( + CFSMailFolder* CBasePlugin::CreateFolderL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& aParentFolderId, const TDesC& aFolderName, @@ -449,7 +463,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C void CBasePlugin::DeleteFolderByUidL( + void CBasePlugin::DeleteFolderByUidL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& aFolder ) @@ -465,7 +479,7 @@ /** * */ -EXPORT_C void CBasePlugin::ListFoldersL( + void CBasePlugin::ListFoldersL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& aFolderId, RPointerArray& aFolderList ) @@ -490,7 +504,7 @@ /** * */ -EXPORT_C void CBasePlugin::ListFoldersL( + void CBasePlugin::ListFoldersL( const TFSMailMsgId& aMailBoxId, RPointerArray& aFolderList ) @@ -508,7 +522,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C MFSMailIterator* CBasePlugin::ListMessagesL( + MFSMailIterator* CBasePlugin::ListMessagesL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& aFolderId, const TFSMailDetails aDetails, @@ -587,7 +601,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C CFSMailMessage* CBasePlugin::GetMessageByUidL( + CFSMailMessage* CBasePlugin::GetMessageByUidL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& /*aFolderId*/, const TFSMailMsgId& aMessageId, @@ -612,7 +626,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C void CBasePlugin::DeleteMessagesByUidL( + void CBasePlugin::DeleteMessagesByUidL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& aFolderId, const RArray& aMessages ) @@ -634,7 +648,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C CFSMailMessage* CBasePlugin::CreateMessageToSendL( + CFSMailMessage* CBasePlugin::CreateMessageToSendL( const TFSMailMsgId& aMailBox ) { @@ -738,6 +752,28 @@ { CleanupStack::PopAndDestroy( signature ); } + +// + //create the text/html part. + props = CMsgStorePropertyContainer::NewL(); + CleanupStack::PushL( props ); + + props->AddPropertyL( + KMsgStorePropertyContentType, KFSMailContentTypeTextHtml ); + + props->AddPropertyL( KMsgStorePropertyCharset, KMessageBodyCharset ); + + props->AddPropertyL( + KMsgStorePropertyContentDisposition, KMessageBodyDisposition ); + + CMsgStoreMessagePart* htmlPlain = bodyPart->AddChildPartL( *props ); + CleanupStack::PopAndDestroy( props ); + CleanupStack::PushL( htmlPlain ); + htmlPlain->AppendToContentL(KNullDesC8); + CleanupStack::PopAndDestroy( htmlPlain ); +// + + //delete body part CleanupStack::PopAndDestroy( bodyPart ); //done. @@ -757,11 +793,26 @@ return result; } - + // + /** + * + */ + void CBasePlugin::CreateMessageToSendL( + const TFSMailMsgId& aMailBoxId, + MFSMailRequestObserver& aOperationObserver, + const TInt aRequestId) + { + CDelayedMessageToSendOp* delayedOp = CDelayedMessageToSendOp::NewLC( + *this,aMailBoxId,aOperationObserver,aRequestId); + iDelayedOpsManager->EnqueueOpL( delayedOp ); + iDelayedOpReqs.AppendL(delayedOp); + CleanupStack::Pop( delayedOp ); + } + // /** * */ -EXPORT_C CFSMailMessage* CBasePlugin::CreateForwardMessageL( + CFSMailMessage* CBasePlugin::CreateForwardMessageL( const TFSMailMsgId& aMailBox, const TFSMailMsgId& aOriginal, const TDesC& aHeaderDescriptor ) @@ -773,7 +824,7 @@ /** * Relying on the UI for the subject and recipients. */ -EXPORT_C CFSMailMessage* CBasePlugin::CreateReplyMessageL( + CFSMailMessage* CBasePlugin::CreateReplyMessageL( const TFSMailMsgId& aMailBoxId, const TFSMailMsgId& aOriginalMessageId, const TBool aReplyToAll, @@ -786,7 +837,7 @@ /** * */ -EXPORT_C CFSMailMessage* CBasePlugin::CreateMrReplyMessageL( + CFSMailMessage* CBasePlugin::CreateMrReplyMessageL( const TFSMailMsgId& aMailBoxId, MMRInfoObject& /*aMeetingRequest*/, const TFSMailMsgId& aOriginalMessageId ) @@ -799,7 +850,7 @@ * * @param aMailBoxId if not found leaves with KErrNotFound. */ -EXPORT_C void CBasePlugin::StoreMessageL( + void CBasePlugin::StoreMessageL( const TFSMailMsgId& aMailBoxId, CFSMailMessage& aMessage ) @@ -841,12 +892,62 @@ __LOG_EXIT } +// +/** + * + * @param aMailBoxId Mailbox id. + * @param aOperationObserver Operation observer. + * @param aRequestId The request id. + */ + void CBasePlugin::StoreMessagesL( + const TFSMailMsgId& aMailBox, + RPointerArray &messages, + MFSMailRequestObserver& aOperationObserver, + const TInt aRequestId ) + + { + __LOG_ENTER( "StoreMessagesL" ) + + CDelayedMessageStorerOp* delayedOp = CDelayedMessageStorerOp::NewLC( + aMailBox,messages,aOperationObserver,aRequestId); + iDelayedOpsManager->EnqueueOpL( delayedOp ); + CleanupStack::Pop( delayedOp ); + + + __LOG_EXIT + } +// + + +// +/** + * Asynchronous message part storing + * + * @param aMessagePart email parts data to be stored + * @param aOperationObserver Observer for the operation + * @param aRequestId id of the operation + */ + void CBasePlugin::StoreMessagePartsL( + RPointerArray& aMessageParts, + MFSMailRequestObserver& aOperationObserver, + const TInt aRequestId) +{ + __LOG_ENTER( "StoreMessagePartsL" ) + + CDelayedMessageStorerOp* delayedOp = CDelayedMessageStorerOp::NewLC( + aMessageParts,aOperationObserver,aRequestId); + iDelayedOpsManager->EnqueueOpL( delayedOp ); + CleanupStack::Pop( delayedOp ); + + __LOG_EXIT +} +// /** * Async operation, starts fetching. * @param aRequestId */ -EXPORT_C void CBasePlugin::FetchMessagesL( + void CBasePlugin::FetchMessagesL( const TFSMailMsgId& /*aMailBox*/, const TFSMailMsgId& /*aFolder*/, const RArray& /*aMessageIds*/, @@ -862,7 +963,7 @@ /** * */ -EXPORT_C void CBasePlugin::GetMessagesL( + void CBasePlugin::GetMessagesL( const TFSMailMsgId& /*aMailBoxId*/, const TFSMailMsgId& /*aParentFolderId*/, const RArray& /*aMessageIds*/, @@ -877,7 +978,7 @@ /** * CFSMailPlugin::SendMessageL */ -EXPORT_C void CBasePlugin::SendMessageL( CFSMailMessage& aMessage ) + void CBasePlugin::SendMessageL( CFSMailMessage& aMessage ) { __LOG_ENTER( "SendMessageL1" ) @@ -907,7 +1008,7 @@ * This allows for optimizing away of unnecessary writes to the msgstore. * @param aSentTime the sent time you want set for the message. */ -EXPORT_C void CBasePlugin::SendMessageL( + void CBasePlugin::SendMessageL( CMsgStoreMailBox& aMailBox, CMsgStoreMessage& aMsg, const TTime& aSentTime ) @@ -939,7 +1040,7 @@ /** * */ -EXPORT_C void CBasePlugin::MoveMessagesL( + void CBasePlugin::MoveMessagesL( const TFSMailMsgId& aMailBoxId, const RArray& aMessageIds, const TFSMailMsgId& aSourceFolderId, @@ -962,7 +1063,7 @@ /** * */ -EXPORT_C void CBasePlugin::CopyMessagesL( + void CBasePlugin::CopyMessagesL( const TFSMailMsgId& aMailBoxId, const RArray& aMessageIds, RArray& aNewMessages, @@ -996,7 +1097,7 @@ * * @param aId mailbox id, if none can be found leaves with KErrNotFound. */ -EXPORT_C CMailboxInfo& CBasePlugin::GetMailboxInfoL( + CMailboxInfo& CBasePlugin::GetMailboxInfoL( TMsgStoreId aId ) { @@ -1156,7 +1257,7 @@ * This methoed must be called before destruction of * CBasePlugin derived class. To fix bug EIZU-7XVF2Z. */ -EXPORT_C void CBasePlugin::DeleteDelayedOpsManager() +void CBasePlugin::DeleteDelayedOpsManager() { delete iDelayedOpsManager; iDelayedOpsManager = NULL; @@ -1196,7 +1297,7 @@ /** * */ -EXPORT_C CMsgStoreMessagePart* CBasePlugin::GetBodyPartL( + CMsgStoreMessagePart* CBasePlugin::GetBodyPartL( CMsgStoreMessage& aMessage, const TDesC& aContentType ) { @@ -1256,7 +1357,7 @@ /** * */ -EXPORT_C CFSMailMessage* CBasePlugin::CreateForwardReplyMessageL( + CFSMailMessage* CBasePlugin::CreateForwardReplyMessageL( const TFSMailMsgId& aMailBox, const TFSMailMsgId& aOriginal, const TBool aReplyToAll, @@ -1570,7 +1671,7 @@ * RefreshMailboxCacheL - This will refresh the mailbox instance cache maintained within the base plugin. * */ -EXPORT_C CMailboxInfo& CBasePlugin::RefreshMailboxCacheL( TMsgStoreId aMailBoxId ) + CMailboxInfo& CBasePlugin::RefreshMailboxCacheL( TMsgStoreId aMailBoxId ) { //save the observers CMailboxInfo& oldMailBox = GetMailboxInfoL( aMailBoxId );