iaupdate/IAD/ui/src/iaupdateuicontroller.cpp
branchRCL_3
changeset 34 741e5bba2bd1
parent 18 3ba40be8e484
child 65 7333d7932ef7
equal deleted inserted replaced
28:98a43fae6e2b 34:741e5bba2bd1
   321     	iFilter->SetFilterParams( iParams ); //iParams ownership is changed
   321     	iFilter->SetFilterParams( iParams ); //iParams ownership is changed
   322     	iParams = NULL;
   322     	iParams = NULL;
   323         }
   323         }
   324      
   324      
   325     TBool agreementAccepted( EFalse ); 
   325     TBool agreementAccepted( EFalse ); 
   326     CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
   326     if ( !ForcedRefresh() )
   327     agreementAccepted = agreement->AgreementAcceptedL();
   327         {
   328     if ( ( !agreementAccepted )&& ( iRequestType != IAUpdateUiDefines::ECheckUpdates ) )
   328         CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
   329         {
   329         agreementAccepted = agreement->AgreementAcceptedL();
   330         // agreement (disclaimer) dialog is not prompted when CheckUpdates is called
   330         if ( ( !agreementAccepted )&& ( iRequestType != IAUpdateUiDefines::ECheckUpdates ) )
   331         //
   331             {
   332         // Refresh from network is allowed when first time case 
   332             // agreement (disclaimer) dialog is not prompted when CheckUpdates is called
   333         iRefreshFromNetworkDenied = EFalse;
   333             //
   334     	agreementAccepted = agreement->AcceptAgreementL();	
   334             // Refresh from network is allowed when first time case 
   335         }
   335             iRefreshFromNetworkDenied = EFalse;
   336         	
   336             agreementAccepted = agreement->AcceptAgreementL();  
   337     CleanupStack::PopAndDestroy( agreement );
   337             }
   338              
   338         CleanupStack::PopAndDestroy( agreement );
   339     if ( !agreementAccepted )
   339         }
       
   340   	             
       
   341     if ( !agreementAccepted && !ForcedRefresh() )
   340         {
   342         {
   341         if ( iRequestType == IAUpdateUiDefines::ECheckUpdates )
   343         if ( iRequestType == IAUpdateUiDefines::ECheckUpdates )
   342             {
   344             {
   343             CIAUpdateAutomaticCheck* automaticCheck = CIAUpdateAutomaticCheck::NewLC();
   345             CIAUpdateAutomaticCheck* automaticCheck = CIAUpdateAutomaticCheck::NewLC();
   344             TBool autoUpdateCheckEnabled = automaticCheck->AutoUpdateCheckEnabledL();
   346             TBool autoUpdateCheckEnabled = automaticCheck->AutoUpdateCheckEnabledL();
  2288     	    CIAUpdateParameters* params( iFilter->FilterParams() );
  2290     	    CIAUpdateParameters* params( iFilter->FilterParams() );
  2289     	    if ( params )
  2291     	    if ( params )
  2290     	        {
  2292     	        {
  2291     	    	if ( params->Refresh() )
  2293     	    	if ( params->Refresh() )
  2292     	    	    {
  2294     	    	    {
  2293       	      		// Check from the central repocitory what are the automatic checking and 
  2295     	    	    if ( ForcedRefresh() )
  2294                     // roaming settings.     
  2296     	    	        {
  2295                     TInt autoUpdateCheckValue( 0 );
  2297     	    	        allowRefresh = ETrue;
  2296                     CRepository* cenrep( 
  2298     	    	        }
       
  2299     	    	    else
       
  2300     	    	        {
       
  2301       	      		    // Check from the central repocitory what are the automatic checking and 
       
  2302                         // roaming settings.     
       
  2303                         TInt autoUpdateCheckValue( 0 );
       
  2304                         CRepository* cenrep( 
  2297                              CRepository::NewLC( KCRUidIAUpdateSettings ) );
  2305                              CRepository::NewLC( KCRUidIAUpdateSettings ) );
  2298                     // Notice, that KIAUpdateSettingAutoUpdateCheck can give following values
  2306                         // Notice, that KIAUpdateSettingAutoUpdateCheck can give following values
  2299                     // 0 = No automatic update check
  2307                         // 0 = No automatic update check
  2300                     // 1 = Automatic update check enabled when not roaming
  2308                         // 1 = Automatic update check enabled when not roaming
  2301                     // 2 = Automatic update enabled
  2309                         // 2 = Automatic update enabled
  2302 
  2310 
  2303                     User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, 
  2311                         User::LeaveIfError( cenrep->Get( KIAUpdateAutoUpdateCheck, 
  2304                                                      autoUpdateCheckValue ) );
  2312                                                          autoUpdateCheckValue ) );
  2305                     CleanupStack::PopAndDestroy( cenrep );
  2313                         CleanupStack::PopAndDestroy( cenrep );
  2306                     if ( ( autoUpdateCheckValue == EIAUpdateSettingValueEnable ) || 
  2314                         if ( ( autoUpdateCheckValue == EIAUpdateSettingValueEnable ) || 
  2307     	               ( autoUpdateCheckValue == EIAUpdateSettingValueDisableWhenRoaming &&
  2315     	                    ( autoUpdateCheckValue == EIAUpdateSettingValueDisableWhenRoaming &&
  2308     	                 !iRoamingHandler->IsRoaming() ) )
  2316     	                      !iRoamingHandler->IsRoaming() ) )
  2309                         {
  2317                             {
  2310                     	allowRefresh = ETrue;
  2318                     	    allowRefresh = ETrue;
  2311                         }
  2319                             }
       
  2320     	    	        }
  2312      	    	    }
  2321      	    	    }
  2313     	        }
  2322     	        }
  2314     	    }
  2323     	    }
  2315         }
  2324         }
  2316     
  2325     
  2624 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ParamsReadAndRemoveFileL() end");    
  2633 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ParamsReadAndRemoveFileL() end");    
  2625     
  2634     
  2626     return params;
  2635     return params;
  2627     }
  2636     }
  2628 
  2637 
       
  2638 // ---------------------------------------------------------------------------
       
  2639 // CIAUpdateUiController::ForcedRefresh
       
  2640 // 
       
  2641 // ---------------------------------------------------------------------------
       
  2642 //
       
  2643 TBool CIAUpdateUiController::ForcedRefresh() const
       
  2644     {
       
  2645     return iForcedRefresh;
       
  2646     }
       
  2647 
       
  2648 
       
  2649 // ---------------------------------------------------------------------------
       
  2650 // CIAUpdateUiController::SetForcedRefresh
       
  2651 // 
       
  2652 // ---------------------------------------------------------------------------
       
  2653 //
       
  2654 void CIAUpdateUiController::SetForcedRefresh( TBool aForcedRefresh )
       
  2655     {
       
  2656     iForcedRefresh = aForcedRefresh;
       
  2657     }
  2629 
  2658 
  2630 // ---------------------------------------------------------------------------
  2659 // ---------------------------------------------------------------------------
  2631 // CIAUpdateUiController::ParamsWriteFileL
  2660 // CIAUpdateUiController::ParamsWriteFileL
  2632 // 
  2661 // 
  2633 // ---------------------------------------------------------------------------
  2662 // ---------------------------------------------------------------------------