iaupdate/IAD/ui/src/iaupdateuicontroller.cpp
branchRCL_3
changeset 9 51c0f5edf5ef
parent 0 ba25891c3a9e
child 11 3ba40be8e484
equal deleted inserted replaced
5:aba6b8104af3 9:51c0f5edf5ef
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    24 #include <centralrepository.h>
    24 #include <centralrepository.h>
    25 #include <AknUtils.h>
    25 #include <AknUtils.h>
    26 #include <SWInstDefs.h>
    26 #include <SWInstDefs.h>
    27 #include <avkon.rsg>
    27 #include <avkon.rsg>
    28 #include <featurecontrol.h>
    28 #include <featurecontrol.h>
       
    29 #include <cmmanager.h>
    29 #include <iaupdate.rsg>
    30 #include <iaupdate.rsg>
    30 #include <iaupdateparameters.h>
    31 #include <iaupdateparameters.h>
    31 
    32 
    32 #include "iaupdateuicontroller.h"
    33 #include "iaupdateuicontroller.h"
    33 #include "iaupdateuicontrollerobserver.h"
    34 #include "iaupdateuicontrollerobserver.h"
   358        	            static_cast< CIAUpdateAppUi* >( iEikEnv->EikAppUi() );
   359        	            static_cast< CIAUpdateAppUi* >( iEikEnv->EikAppUi() );
   359             appUi->Exit();
   360             appUi->Exit();
   360        	    return;	
   361        	    return;	
   361        	    }
   362        	    }
   362         }
   363         }
   363             
   364     if ( iRequestType == IAUpdateUiDefines::ECheckUpdates && 
   364     if ( iRequestType == IAUpdateUiDefines::EShowUpdates && iRefreshed )
   365          AllowNetworkRefreshL() && 
       
   366          iRoamingHandler->IsRoaming() && 
       
   367          !AutomaticConnectionWhenRoamingL() )
       
   368         {
       
   369         // In Silent check updates case, global setting when roaming to be automatic 
       
   370         // Promt dialog is not allowed in the silent check
       
   371         // error is returned that a client (backround checker) will try again later 
       
   372         iObserver.RefreshCompleteL( EFalse, KErrAbort );
       
   373         }  
       
   374     else if ( iRequestType == IAUpdateUiDefines::EShowUpdates && iRefreshed )
   365         {
   375         {
   366     	iFilter->FilterAndSortNodesL( iNodes, iFwNodes );
   376     	iFilter->FilterAndSortNodesL( iNodes, iFwNodes );
   367         iObserver.RefreshCompleteL( ETrue, KErrNone );
   377         iObserver.RefreshCompleteL( ETrue, KErrNone );
   368         }
   378         }
   369     else
   379     else
   370         {
   380         {
   371         if ( IsStartedByLauncher() && AllowNetworkRefreshL() )
       
   372             {
       
   373         	iUserRoamingRejection = iRoamingHandler->RoamingRejectionL();
       
   374             }
       
   375 
       
   376         TInt ret( iController->Startup() );
   381         TInt ret( iController->Startup() );
   377         if ( ret == KErrAlreadyExists )   
   382         if ( ret == KErrAlreadyExists )   
   378             {
   383             {
   379             IAUPDATE_TRACE("[IAUPDATE] Controller startup already done.");
   384             IAUPDATE_TRACE("[IAUPDATE] Controller startup already done.");
   380             // Controller startup has already been done. 
   385             // Controller startup has already been done. 
   409     // Just to be sure that self update related information
   414     // Just to be sure that self update related information
   410     // is always in resetted state when new update flows are
   415     // is always in resetted state when new update flows are
   411     // started.
   416     // started.
   412     iController->ResetSelfUpdate();
   417     iController->ResetSelfUpdate();
   413 
   418 
   414     iUserRoamingRejection = iRoamingHandler->RoamingRejectionL();
   419     CreateSelectedNodesArrayL();
   415     if ( !iUserRoamingRejection )
       
   416         {
       
   417         CreateSelectedNodesArrayL();
       
   418                 
   420                 
   419         if ( !IAUpdateUtils::SpaceAvailableInInternalDrivesL( iSelectedNodesArray ) )
   421     if ( !IAUpdateUtils::SpaceAvailableInInternalDrivesL( iSelectedNodesArray ) )
   420             {
   422         {
   421     	    HBufC* noteText = NULL;
   423   	    HBufC* noteText = NULL;
   422             noteText = StringLoader::LoadLC( R_IAUPDATE_INSUFFICIENT_MEMORY );
   424         noteText = StringLoader::LoadLC( R_IAUPDATE_INSUFFICIENT_MEMORY );
   423             IAUpdateDialogUtil::ShowInformationQueryL( *noteText ); 
   425         IAUpdateDialogUtil::ShowInformationQueryL( *noteText ); 
   424             CleanupStack::PopAndDestroy( noteText );
   426         CleanupStack::PopAndDestroy( noteText );
   425             }
   427         }
   426         else
   428     else
   427             {
   429         {
   428             if ( !IsStartedByLauncher() )
   430         if ( !IsStartedByLauncher() )
       
   431             {
       
   432             if ( !iStarter )
   429                 {
   433                 {
   430                 if ( !iStarter )
   434                 // Notice, that the ownership of the filter parameters will
   431                     {
   435                 // remain in the filter.
   432                     // Notice, that the ownership of the filter parameters will
   436                 CIAUpdateParameters* params = iFilter->FilterParams();
   433                     // remain in the filter.
   437       	        iStarter = CIAUpdateStarter::NewL( params->CommandLineExecutable(), 
   434                     CIAUpdateParameters* params = iFilter->FilterParams();
       
   435         	        iStarter = CIAUpdateStarter::NewL( params->CommandLineExecutable(), 
       
   436         	                                           params->CommandLineArguments() );
   438         	                                           params->CommandLineArguments() );
   437                     }
       
   438                 }
   439                 }
   439             // Inform the controller that we are now starting updates. This way the
   440             }
   440             // controller can handle situations as a whole and not as one item at the
   441         // Inform the controller that we are now starting updates. This way the
   441             // time.
   442         // controller can handle situations as a whole and not as one item at the
   442             iController->StartingUpdatesL();
   443         // time.
       
   444         iController->StartingUpdatesL();
   443             
   445             
   444             iFileInUseError = EFalse;
   446         iFileInUseError = EFalse;
   445             // Set the node index to -1 because ContinueUpdateL increases it by one
   447         // Set the node index to -1 because ContinueUpdateL increases it by one
   446             // in the beginning of the function. So, we can use the ContinueUpdateL
   448         // in the beginning of the function. So, we can use the ContinueUpdateL
   447             // also in here.
   449         // also in here.
   448             iNodeIndex = -1;
   450         iNodeIndex = -1;
   449             ContinueUpdateL( EFalse );
   451         ContinueUpdateL( EFalse );
   450             }
       
   451         }
   452         }
   452 
   453 
   453 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::StartUpdateL() end");
   454 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::StartUpdateL() end");
   454     }
   455     }
   455 
   456 
  2265     
  2266     
  2266     TBool allowRefresh( EFalse );
  2267     TBool allowRefresh( EFalse );
  2267     if ( IsStartedByLauncher() )
  2268     if ( IsStartedByLauncher() )
  2268         {
  2269         {
  2269     	if ( !iRefreshFromNetworkDenied && 
  2270     	if ( !iRefreshFromNetworkDenied && 
  2270     	     !iUserRoamingRejection && 
       
  2271     	     !RestartedFromSelfUpdate() )
  2271     	     !RestartedFromSelfUpdate() )
  2272     	    {
  2272     	    {
  2273     		if ( LocalNodesExpiredL() )
  2273     		if ( LocalNodesExpiredL() )
  2274     		    {
  2274     		    {
  2275     			allowRefresh = ETrue;
  2275     			allowRefresh = ETrue;
  2716     featureControl.Close(); 
  2716     featureControl.Close(); 
  2717     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::IAUpdateEnabledL() end");
  2717     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::IAUpdateEnabledL() end");
  2718     return enabled;        
  2718     return enabled;        
  2719     }
  2719     }
  2720 
  2720 
       
  2721 // ---------------------------------------------------------------------------
       
  2722 // CIAUpdateUiController::AutomaticConnectionWhenRoamingL()
       
  2723 // ---------------------------------------------------------------------------
       
  2724 //
       
  2725 TBool CIAUpdateUiController::AutomaticConnectionWhenRoamingL() const
       
  2726     {
       
  2727     TBool automaticConnection = EFalse;
       
  2728     RCmManager cmManager;
       
  2729     cmManager.OpenLC();
       
  2730     TCmGenConnSettings genConnSettings;
       
  2731     cmManager.ReadGenConnSettingsL( genConnSettings );
       
  2732     CleanupStack::PopAndDestroy( &cmManager );
       
  2733     if ( genConnSettings.iCellularDataUsageVisitor == ECmCellularDataUsageAutomatic )
       
  2734         {
       
  2735         automaticConnection = ETrue;
       
  2736         }
       
  2737     return automaticConnection;
       
  2738     }
       
  2739 
       
  2740 
  2721 // End of File  
  2741 // End of File