emailuis/emailui/src/FreestyleEmailUiAppui.cpp
changeset 3 a4d6f1ea0416
parent 2 5253a20d2a1e
child 4 e7aa27f58ae1
--- a/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Mon Jan 18 20:08:26 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Tue Jan 26 11:45:42 2010 +0200
@@ -1539,29 +1539,39 @@
 
 	// Start connect automatically if asked by the caller
 	// Disabled if offline or roaming
-	if ( aAutoSync && !TFsEmailUiUtility::IsOfflineModeL() )
-		{
-		// Create at first auto-connect, autosync monitor will check whether
-		// it is ok to start auto-connect, e.g. phone is not roaming, searching for net, etc
-		if ( !iAutoSyncMonitor )
-			{
-			// TRAP following since failing to create auto sync monitor should not prevent user
-			// from opening mail list, leave only in OOM case.
-			TRAPD( err, iAutoSyncMonitor = CFSEmailUiAutosyncMonitor::NewL( *this ) );
-			if ( err == KErrNoMemory )
-				{
-				User::Leave( err );
-				}
-			}
-		// Request auto sync if allowed in the current network mode and
-		// autosyncmonitor has been succesfully created
-		if ( iAutoSyncMonitor )
-			{
-			iAutoSyncMonitor->StartMonitoring();
-			}
-		}
+    if ( aAutoSync )
+        {
+        StartMonitoringL();
+        }
 	}
 
+void CFreestyleEmailUiAppUi::StartMonitoringL()
+    {
+    FUNC_LOG;
+    // Start connect automatically if asked by the caller
+    // Disabled if offline or roaming
+    if ( !TFsEmailUiUtility::IsOfflineModeL() )
+        {
+        // Create at first auto-connect, autosync monitor will check whether
+        // it is ok to start auto-connect, e.g. phone is not roaming, searching for net, etc
+        if ( !iAutoSyncMonitor )
+            {
+            // TRAP following since failing to create auto sync monitor should not prevent user
+            // from opening mail list, leave only in OOM case.
+            TRAPD( err, iAutoSyncMonitor = CFSEmailUiAutosyncMonitor::NewL( *this ) );
+            if ( err == KErrNoMemory )
+                {
+                User::Leave( err );
+                }
+            }
+        // Request auto sync if allowed in the current network mode and
+        // autosyncmonitor has been succesfully created
+        if ( iAutoSyncMonitor )
+            {
+            iAutoSyncMonitor->StartMonitoring();
+            }
+        }
+    }
 
 void CFreestyleEmailUiAppUi::DoAutoConnectL()
 	{
@@ -2740,10 +2750,7 @@
 void CFSEmailUiAutosyncMonitor::StartMonitoring()
     {
     FUNC_LOG;
-    if ( IsActive() )
-        {
         Cancel();
-        }
 #ifdef __WINS__ // do not try to connect on the emulator
     iRegisterationStatus = RMobilePhone::ERegisteredOnHomeNetwork;
     TRequestStatus* status = &iStatus;