diff -r 139d4b7b2938 -r 99bcbff212ad emailservices/emailcommon/src/CFSMailFolder.cpp --- a/emailservices/emailcommon/src/CFSMailFolder.cpp Mon May 24 21:02:02 2010 +0300 +++ b/emailservices/emailcommon/src/CFSMailFolder.cpp Fri May 28 13:56:43 2010 +0300 @@ -15,12 +15,13 @@ * */ +#include "emailtrace.h" + // #include // // -#include "emailtrace.h" #include "CFSMailFolder.h" #include "CFSMailPlugin.h" // @@ -34,11 +35,12 @@ // ----------------------------------------------------------------------------- EXPORT_C CFSMailFolder* CFSMailFolder::NewLC( TFSMailMsgId aFolderId ) { - FUNC_LOG; - CFSMailFolder* api = new (ELeave) CFSMailFolder(); - CleanupStack:: PushL(api); - api->ConstructL( aFolderId ); - return api; + NM_FUNCTION; + + CFSMailFolder* api = new (ELeave) CFSMailFolder(); + CleanupStack:: PushL(api); + api->ConstructL( aFolderId ); + return api; } // ----------------------------------------------------------------------------- @@ -46,10 +48,11 @@ // ----------------------------------------------------------------------------- EXPORT_C CFSMailFolder* CFSMailFolder::NewL( TFSMailMsgId aFolderId ) { - FUNC_LOG; - CFSMailFolder* api = CFSMailFolder::NewLC( aFolderId ); - CleanupStack:: Pop(api); - return api; + NM_FUNCTION; + + CFSMailFolder* api = CFSMailFolder::NewLC( aFolderId ); + CleanupStack:: Pop(api); + return api; } // ----------------------------------------------------------------------------- @@ -57,8 +60,7 @@ // ----------------------------------------------------------------------------- CFSMailFolder::CFSMailFolder() { - FUNC_LOG; - + NM_FUNCTION; } // ----------------------------------------------------------------------------- @@ -66,7 +68,8 @@ // ----------------------------------------------------------------------------- void CFSMailFolder::ConstructL( TFSMailMsgId aFolderId ) { - FUNC_LOG; + NM_FUNCTION; + // CFSMailFolderBase::ConstructL( aFolderId ); // @@ -80,8 +83,7 @@ // ----------------------------------------------------------------------------- EXPORT_C CFSMailFolder::~CFSMailFolder() { - FUNC_LOG; - + NM_FUNCTION; } // ----------------------------------------------------------------------------- @@ -90,8 +92,8 @@ EXPORT_C MFSMailIterator* CFSMailFolder::ListMessagesL( const TFSMailDetails aDetails, const RArray& aSorting) { - FUNC_LOG; - + NM_FUNCTION; + CFSMailIterator* iterator = NULL; if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId())) { @@ -112,7 +114,8 @@ TFSMailDetails aDetails, MFSMailRequestObserver& aObserver ) { - FUNC_LOG; + NM_FUNCTION; + // init asynchronous request CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId()); TFSPendingRequest request = @@ -150,7 +153,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailFolder::GetSubFoldersL(RPointerArray& aSubFolders) { - FUNC_LOG; + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId())) { TRAPD(err,plugin->ListFoldersL( GetMailBoxId(), GetFolderId(), aSubFolders)); @@ -166,7 +170,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailFolder::RemoveMessageL(TFSMailMsgId aMessage) { - FUNC_LOG; + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId())) { RArray messages; @@ -177,13 +182,60 @@ } } +// +// ----------------------------------------------------------------------------- +// CFSMailFolder::RemoveMessageL +// ----------------------------------------------------------------------------- +EXPORT_C TInt CFSMailFolder::RemoveMessageL(TFSMailMsgId aMessage, + MFSMailRequestObserver& aObserver) +{ + NM_FUNCTION; + + // init asynchronous request + CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId()); + TFSPendingRequest request = + iRequestHandler->InitAsyncRequestL( GetFolderId().PluginId(), aObserver ); + + TInt err = KErrNone; + + if (plugin) + { + MFSMailRequestObserver* observer = request.iObserver; + + RArray messages; + messages.Reset(); + messages.Append(aMessage); + + TRAP(err,plugin->DeleteMessagesByUidL( + GetMailBoxId(), + GetFolderId(), + messages, + *observer, + request.iRequestId)); + + messages.Close(); + } + else + { + err = KErrNotFound; + } + + if(err != KErrNone) + { + iRequestHandler->CompleteRequest(request.iRequestId); + User::Leave(err); + } + return request.iRequestId; +} +// + // ----------------------------------------------------------------------------- // CFSMailFolder::SupportsCopyFromL // ----------------------------------------------------------------------------- EXPORT_C TBool CFSMailFolder::SupportsCopyFromL( TFSFolderType aFolderType ) { - FUNC_LOG; - + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId())) { TFSMailBoxStatus onlineStatus = plugin->GetMailBoxStatus(GetMailBoxId()); @@ -216,8 +268,8 @@ // ----------------------------------------------------------------------------- EXPORT_C TBool CFSMailFolder::SupportsMoveFromL( TFSFolderType aFolderType ) { - FUNC_LOG; - + NM_FUNCTION; + if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId())) { TFSMailBoxStatus onlineStatus = plugin->GetMailBoxStatus(GetMailBoxId()); @@ -250,7 +302,7 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailFolder::RemoveDownLoadedAttachmentsL() { - FUNC_LOG; + NM_FUNCTION; CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetFolderId()); if(plugin != NULL) @@ -291,7 +343,8 @@ // ----------------------------------------------------------------------------- EXPORT_C void CFSMailFolder::ReleaseExtension( CEmailExtension* aExtension ) { - FUNC_LOG; + NM_FUNCTION; + // no specialized behaviour, call base class CExtendableEmail::ReleaseExtension( aExtension ); } @@ -301,7 +354,8 @@ // ----------------------------------------------------------------------------- EXPORT_C CEmailExtension* CFSMailFolder::ExtensionL( const TUid& aInterfaceUid ) { - FUNC_LOG; + NM_FUNCTION; + return CExtendableEmail::ExtensionL( aInterfaceUid ); }