emailuis/emailui/src/FreestyleEmailUiAppui.cpp
changeset 3 a4d6f1ea0416
parent 2 5253a20d2a1e
child 4 e7aa27f58ae1
equal deleted inserted replaced
2:5253a20d2a1e 3:a4d6f1ea0416
  1537 
  1537 
  1538 	SubscribeMailboxL( iActiveMailboxId );
  1538 	SubscribeMailboxL( iActiveMailboxId );
  1539 
  1539 
  1540 	// Start connect automatically if asked by the caller
  1540 	// Start connect automatically if asked by the caller
  1541 	// Disabled if offline or roaming
  1541 	// Disabled if offline or roaming
  1542 	if ( aAutoSync && !TFsEmailUiUtility::IsOfflineModeL() )
  1542     if ( aAutoSync )
  1543 		{
  1543         {
  1544 		// Create at first auto-connect, autosync monitor will check whether
  1544         StartMonitoringL();
  1545 		// it is ok to start auto-connect, e.g. phone is not roaming, searching for net, etc
  1545         }
  1546 		if ( !iAutoSyncMonitor )
  1546 	}
  1547 			{
  1547 
  1548 			// TRAP following since failing to create auto sync monitor should not prevent user
  1548 void CFreestyleEmailUiAppUi::StartMonitoringL()
  1549 			// from opening mail list, leave only in OOM case.
  1549     {
  1550 			TRAPD( err, iAutoSyncMonitor = CFSEmailUiAutosyncMonitor::NewL( *this ) );
  1550     FUNC_LOG;
  1551 			if ( err == KErrNoMemory )
  1551     // Start connect automatically if asked by the caller
  1552 				{
  1552     // Disabled if offline or roaming
  1553 				User::Leave( err );
  1553     if ( !TFsEmailUiUtility::IsOfflineModeL() )
  1554 				}
  1554         {
  1555 			}
  1555         // Create at first auto-connect, autosync monitor will check whether
  1556 		// Request auto sync if allowed in the current network mode and
  1556         // it is ok to start auto-connect, e.g. phone is not roaming, searching for net, etc
  1557 		// autosyncmonitor has been succesfully created
  1557         if ( !iAutoSyncMonitor )
  1558 		if ( iAutoSyncMonitor )
  1558             {
  1559 			{
  1559             // TRAP following since failing to create auto sync monitor should not prevent user
  1560 			iAutoSyncMonitor->StartMonitoring();
  1560             // from opening mail list, leave only in OOM case.
  1561 			}
  1561             TRAPD( err, iAutoSyncMonitor = CFSEmailUiAutosyncMonitor::NewL( *this ) );
  1562 		}
  1562             if ( err == KErrNoMemory )
  1563 	}
  1563                 {
  1564 
  1564                 User::Leave( err );
       
  1565                 }
       
  1566             }
       
  1567         // Request auto sync if allowed in the current network mode and
       
  1568         // autosyncmonitor has been succesfully created
       
  1569         if ( iAutoSyncMonitor )
       
  1570             {
       
  1571             iAutoSyncMonitor->StartMonitoring();
       
  1572             }
       
  1573         }
       
  1574     }
  1565 
  1575 
  1566 void CFreestyleEmailUiAppUi::DoAutoConnectL()
  1576 void CFreestyleEmailUiAppUi::DoAutoConnectL()
  1567 	{
  1577 	{
  1568     FUNC_LOG;
  1578     FUNC_LOG;
  1569 	if ( iActiveMailbox && iActiveMailbox->HasCapability( EFSMBoxCapaSupportsSync ) )
  1579 	if ( iActiveMailbox && iActiveMailbox->HasCapability( EFSMBoxCapaSupportsSync ) )
  2738 // -----------------------------------------------------------------------------
  2748 // -----------------------------------------------------------------------------
  2739 //
  2749 //
  2740 void CFSEmailUiAutosyncMonitor::StartMonitoring()
  2750 void CFSEmailUiAutosyncMonitor::StartMonitoring()
  2741     {
  2751     {
  2742     FUNC_LOG;
  2752     FUNC_LOG;
  2743     if ( IsActive() )
       
  2744         {
       
  2745         Cancel();
  2753         Cancel();
  2746         }
       
  2747 #ifdef __WINS__ // do not try to connect on the emulator
  2754 #ifdef __WINS__ // do not try to connect on the emulator
  2748     iRegisterationStatus = RMobilePhone::ERegisteredOnHomeNetwork;
  2755     iRegisterationStatus = RMobilePhone::ERegisteredOnHomeNetwork;
  2749     TRequestStatus* status = &iStatus;
  2756     TRequestStatus* status = &iStatus;
  2750     User::RequestComplete( status, KErrNone );
  2757     User::RequestComplete( status, KErrNone );
  2751 #else
  2758 #else