emailservices/emailcommon/src/CFSMailBox.cpp
changeset 30 759dc5235cdb
parent 20 ecc8def7944a
child 49 00c7ae862740
--- a/emailservices/emailcommon/src/CFSMailBox.cpp	Thu May 27 12:43:55 2010 +0300
+++ b/emailservices/emailcommon/src/CFSMailBox.cpp	Fri Jun 11 13:27:14 2010 +0300
@@ -15,11 +15,12 @@
 *
 */
 
+#include "emailtrace.h"
+
 // <qmail>
 #include <nmcommonheaders.h>
 // <//qmail>
 
-#include "emailtrace.h"
 #include <bamdesca.h>
 #include "CFSMailPlugin.h"
 #include "cmrcalendarinfoimpl.h"
@@ -39,11 +40,12 @@
 // -----------------------------------------------------------------------------
 EXPORT_C CFSMailBox* CFSMailBox::NewLC(TFSMailMsgId aMailBoxId)
 {
-    FUNC_LOG;
-  CFSMailBox* api = new (ELeave) CFSMailBox();
-  CleanupStack:: PushL(api);
-  api->ConstructL(aMailBoxId);
-  return api;
+    NM_FUNCTION;
+    
+    CFSMailBox* api = new (ELeave) CFSMailBox();
+    CleanupStack:: PushL(api);
+    api->ConstructL(aMailBoxId);
+    return api;
 } 
 
 // -----------------------------------------------------------------------------
@@ -51,10 +53,11 @@
 // -----------------------------------------------------------------------------
 EXPORT_C CFSMailBox* CFSMailBox::NewL(TFSMailMsgId aMailBoxId)
 {
-    FUNC_LOG;
-  CFSMailBox* api =  CFSMailBox::NewLC(aMailBoxId);
-  CleanupStack:: Pop(api);
-  return api;
+    NM_FUNCTION;
+    
+    CFSMailBox* api =  CFSMailBox::NewLC(aMailBoxId);
+    CleanupStack:: Pop(api);
+    return api;
 }
 
 // -----------------------------------------------------------------------------
@@ -62,7 +65,8 @@
 // -----------------------------------------------------------------------------
 CFSMailBox::CFSMailBox()
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     // get requesthandler pointer
     iRequestHandler = static_cast<CFSMailRequestHandler*>(Dll::Tls());
 }
@@ -72,7 +76,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C CFSMailBox::~CFSMailBox()
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     iFolders.ResetAndDestroy();
 }
 
@@ -81,7 +86,8 @@
 // -----------------------------------------------------------------------------
 void CFSMailBox::ConstructL(TFSMailMsgId aMailBoxId)
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
 // <qmail>
     CFSMailBoxBase::ConstructL(aMailBoxId);
 // </qmail>
@@ -92,7 +98,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::GoOnlineL()
     {
-    FUNC_LOG;
+    NM_FUNCTION;
     
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
@@ -105,7 +111,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::GoOfflineL()
     {
-    FUNC_LOG;
+    NM_FUNCTION;
     
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
@@ -119,7 +125,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::CancelSyncL()
     {
-    FUNC_LOG;
+    NM_FUNCTION;
     
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
@@ -132,7 +138,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TFSProgress CFSMailBox::GetLastSyncStatusL()
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TFSProgress progress;
     progress.iError = EFalse;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
@@ -148,8 +155,8 @@
 EXPORT_C TInt CFSMailBox::RefreshNowL(
     MFSMailRequestObserver& aOperationObserver )
     {
-    FUNC_LOG;
-
+    NM_FUNCTION;
+    
     TFSPendingRequest request;
     request.iRequestId = 0;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
@@ -166,16 +173,15 @@
             }
         }
     return request.iRequestId;
-
-   }
+    }
 
 // -----------------------------------------------------------------------------
 // CFSMailBox::RefreshNowL
 // -----------------------------------------------------------------------------
 EXPORT_C TInt CFSMailBox::RefreshNowL( )
     {
-    FUNC_LOG;
-
+    NM_FUNCTION;
+    
     TFSPendingRequest request;
     request.iRequestId = 0;
     MFSMailRequestObserver* observer = NULL;
@@ -193,16 +199,15 @@
             }
         }
     return request.iRequestId;
-
-   }
+    }
 
 // -----------------------------------------------------------------------------
 // CFSMailBox::CreateMessageToSend
 // -----------------------------------------------------------------------------
 EXPORT_C CFSMailMessage* CFSMailBox::CreateMessageToSend( )
 {
-    FUNC_LOG;
-
+    NM_FUNCTION;
+    
     CFSMailMessage* message = NULL;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
@@ -222,6 +227,8 @@
 EXPORT_C TInt CFSMailBox::CreateMessageToSendL(
         MFSMailRequestObserver& aOperationObserver )
     {
+    NM_FUNCTION;
+    
     TFSPendingRequest request;
     
     CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() );
@@ -258,6 +265,8 @@
     RPointerArray<CFSMailMessage> &messages,
     MFSMailRequestObserver& aOperationObserver)
 {
+    NM_FUNCTION;
+    
     Q_UNUSED(aMailboxId);
     TFSPendingRequest request;
         
@@ -298,7 +307,8 @@
 EXPORT_C CFSMailMessage* CFSMailBox::CreateForwardMessage(  TFSMailMsgId aOriginalMessageId,
                                                             const TDesC& aHeaderDescriptor )
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     CFSMailMessage* message = NULL;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
@@ -321,6 +331,8 @@
                         MFSMailRequestObserver& aOperationObserver,
                         const TDesC& aHeaderDescriptor )
     {
+    NM_FUNCTION;
+    
     TFSPendingRequest request;
     
     CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() );
@@ -358,7 +370,8 @@
                                                          TBool aReplyToAll,
                                                          const TDesC& aHeaderDescriptor )
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     CFSMailMessage* message = NULL;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
@@ -383,6 +396,8 @@
                                       MFSMailRequestObserver& aOperationObserver,
                                       const TDesC& aHeaderDescriptor )
 {
+    NM_FUNCTION;
+    
     TFSPendingRequest request;
     
     CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() );
@@ -418,8 +433,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TFSMailMsgId CFSMailBox::GetStandardFolderId(TFSFolderType aFolderType)
 {
-    FUNC_LOG;
-
+    NM_FUNCTION;
+    
     TFSMailMsgId folderId;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
@@ -437,7 +452,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::SendMessageL( CFSMailMessage& aMessage )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
         // <qmail> Not activated yet.
@@ -457,7 +473,7 @@
         CFSMailMessage& aMessage,
         MFSMailRequestObserver& aOperationObserver )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
 
     TFSPendingRequest request;
 
@@ -501,8 +517,8 @@
 EXPORT_C void CFSMailBox::ListFolders(  TFSMailMsgId aFolder,
                                         RPointerArray<CFSMailFolder>& aFolderList)
 {
-    FUNC_LOG;
-
+    NM_FUNCTION;
+    
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
     {
         TRAPD(err, plugin->ListFoldersL(GetId(),aFolder,aFolderList));
@@ -518,6 +534,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C RPointerArray<CFSMailFolder>& CFSMailBox::ListFolders( )
 {   
+    NM_FUNCTION;
+    
     iFolders.ResetAndDestroy();
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
     {
@@ -536,7 +554,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TDesC& CFSMailBox::GetBrandingIdL( )
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     return BrandingId();
 }
 
@@ -547,7 +566,8 @@
                                          const TFSMailMsgId aSourceFolderId, 
                                          const TFSMailMsgId aDestinationFolderId )
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
         plugin->MoveMessagesL(GetId(), aMessageIds, aSourceFolderId, aDestinationFolderId);
@@ -562,7 +582,8 @@
                                          const TFSMailMsgId aSourceFolderId, 
                                          const TFSMailMsgId aDestinationFolderId )
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TFSPendingRequest request;
     if( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) )
         {
@@ -588,7 +609,8 @@
                                          const TFSMailMsgId aSourceFolderId, 
                                          const TFSMailMsgId aDestinationFolderId )
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
         plugin->CopyMessagesL(GetId(), aMessageIds, aNewMessages,
@@ -604,8 +626,7 @@
                                    MFSMailBoxSearchObserver&   /*aSearchObserver*/,
                                    const RArray<TFSMailMsgId>  /*aFolderIds */ )
     {
-    FUNC_LOG;
-
+    NM_FUNCTION;
     }
     
 // -----------------------------------------------------------------------------
@@ -615,7 +636,8 @@
                                    const TFSMailSortCriteria& aSortCriteria,
                                    MFSMailBoxSearchObserver& aSearchObserver )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
 
@@ -649,7 +671,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::CancelSearch()
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
         plugin->CancelSearch( GetId() );
@@ -661,7 +684,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::ClearSearchResultCache()
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
         plugin->ClearSearchResultCache( GetId() );
@@ -673,7 +697,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C MDesCArray* CFSMailBox::ListMrusL() const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     MDesCArray* mruList(0);
     if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId() ) )
         {
@@ -688,7 +713,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TSSMailSyncState CFSMailBox::CurrentSyncState() const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TSSMailSyncState syncState(Idle);
     if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) )
         {
@@ -702,7 +728,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TBool CFSMailBox::HasCapability( const TFSMailBoxCapabilities aCapability ) const
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TBool capability = EFalse;
     if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) )
         {
@@ -720,7 +747,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TFSMailBoxStatus CFSMailBox::GetMailBoxStatus()
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TFSMailBoxStatus status(EFSMailBoxOffline);
     if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId() ) )
     {
@@ -734,7 +762,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::SetCredentialsL( const TDesC& aUsername, const TDesC& aPassword )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId() ) )
         {
         plugin->SetCredentialsL( GetId(), aUsername, aPassword );
@@ -746,7 +775,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::RemoveDownLoadedAttachmentsL()
     {
-    FUNC_LOG;
+    NM_FUNCTION;
     
     CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() );
     if ( plugin )
@@ -767,7 +796,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TInt CFSMailBox::GetConnectionId( TUint32& aConnectionId )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TInt rcode = KErrNotSupported;
     if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) )
         {
@@ -781,7 +811,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TInt CFSMailBox::IsConnectionAllowedWhenRoaming( TBool& aConnectionAllowed )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TInt rcode = KErrNotSupported;
     if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) )
         {
@@ -795,7 +826,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C CFSMailMessage* CFSMailBox::CreateMessageFromFileL( const RFile& aFile )
 {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     CFSMailMessage* message = NULL;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
     {
@@ -812,7 +844,7 @@
     const RPointerArray<CFSMailAddress>& aCCRecipients,
     const RPointerArray<CFSMailAddress>& aBCCRecipients ) const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
     
     // First lets make a copy of the current mru list
     // whose content we can later alter as we wish
@@ -867,7 +899,8 @@
 // -----------------------------------------------------------------------------    
 CDesCArraySeg* CFSMailBox::CopyArrayL( MDesCArray& aArrayToBeCopied ) const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     CDesCArraySeg* newArray = new (ELeave) CDesCArraySeg( 10 );
     CleanupStack::PushL( newArray );
     
@@ -890,7 +923,8 @@
     CDesCArraySeg& aMruList,
     const RPointerArray<CFSMailAddress>& aNewRecentlyUsedOnes ) const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     TUint newCount( aNewRecentlyUsedOnes.Count() );
     TUint newIndexer( 0 );
     
@@ -931,7 +965,8 @@
                                          TDesC& searchedAddress,
                                          TInt& aPos ) const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     // CDesCArray::Find() is not used here because there is
     // possibility that we have to go through the whole array
     // and return the index for one specific match. Find() returns
@@ -971,7 +1006,8 @@
 void CFSMailBox::AddAndRemoveExcessMruL( CDesCArraySeg& aMruList,
                                          CFSMailAddress& aToBeAdded ) const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     if ( aMruList.Count() == KMaxMruEntries )
         {
         // Remove the oldest entry pair from the beginning
@@ -988,7 +1024,8 @@
                                       TInt aPosition,
                                       CFSMailAddress& aMostRecent ) const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     // Position of the address is given so the possible display name is
     // in the previous slot. Delete both.
     aMruList.Delete( aPosition - 1, 2 );
@@ -1002,7 +1039,8 @@
 void CFSMailBox::AppendMruItemL( CDesCArraySeg& aMruList,
                                  CFSMailAddress& aToBeAppended ) const
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     // In the array, display name is always the first and then comes
     // the actual address.
     
@@ -1028,7 +1066,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CFSMailBox::ReleaseExtension( CEmailExtension* aExtension )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     // no specialized behaviour, call base class
     CExtendableEmail::ReleaseExtension( aExtension );
     }
@@ -1038,11 +1077,14 @@
 // -----------------------------------------------------------------------------
 EXPORT_C CEmailExtension* CFSMailBox::ExtensionL( const TUid& aInterfaceUid )
     {
-    FUNC_LOG;
+    NM_FUNCTION;
+    
     CEmailExtension* extension = NULL;
+// <qmail>
+    extension = CExtendableEmail::ExtensionL( aInterfaceUid );    
     if ( aInterfaceUid == KMailboxExtMrCalInfo )
         {
-        extension = CExtendableEmail::ExtensionL( aInterfaceUid );
+// </qmail>        
         if ( extension == NULL )
             {
             extension = new ( ELeave ) CMRCalendarInfoImpl();