iaupdate/IAD/ui/src/iaupdateappui.cpp
changeset 2 661f3784fe57
parent 0 ba25891c3a9e
child 14 09e5ea190d07
equal deleted inserted replaced
1:c42dffbd5b4f 2:661f3784fe57
   323     switch(aCommand)
   323     switch(aCommand)
   324         {
   324         {
   325         case EIAUpdateCmdStartUpdate:
   325         case EIAUpdateCmdStartUpdate:
   326             {
   326             {
   327             IAUPDATE_TRACE("[IAUPDATE] CIAUpdateAppUi::HandleCommandL() EIAUpdateCmdStartUpdate");
   327             IAUPDATE_TRACE("[IAUPDATE] CIAUpdateAppUi::HandleCommandL() EIAUpdateCmdStartUpdate");
   328 
   328     
   329             // No need to be totally silent since the updating is started
       
   330             // by user.
       
   331             SetDefaultConnectionMethodL( EFalse );
       
   332 
   329 
   333             // by pushing object to cleanup stack it's destructor is called if leave happens
   330             // by pushing object to cleanup stack it's destructor is called if leave happens
   334             // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler
   331             // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler
   335             CIAUpdateGlobalLockHandler* globalLockHandler = CIAUpdateGlobalLockHandler::NewLC();
   332             CIAUpdateGlobalLockHandler* globalLockHandler = CIAUpdateGlobalLockHandler::NewLC();
   336             if ( !globalLockHandler->InUseByAnotherInstanceL() )
   333             if ( !globalLockHandler->InUseByAnotherInstanceL() )
   337                 {
   334                 {
   338             	globalLockHandler->SetToInUseForAnotherInstancesL( ETrue );
   335             	globalLockHandler->SetToInUseForAnotherInstancesL( ETrue );
       
   336             	// No need to be totally silent since the updating is started
       
   337             	// by user.
       
   338             	SetDefaultConnectionMethodL( EFalse );
   339             	iController->StartUpdateL();
   339             	iController->StartUpdateL();
   340             	CleanupStack::Pop( globalLockHandler );	
   340             	CleanupStack::Pop( globalLockHandler );	
   341             	delete iGlobalLockHandler;
   341             	delete iGlobalLockHandler;
   342             	iGlobalLockHandler = globalLockHandler;
   342             	iGlobalLockHandler = globalLockHandler;
   343             	//now possible deletion of iGlobalLockHandler in leave situation is handled
   343             	//now possible deletion of iGlobalLockHandler in leave situation is handled
   576 // -----------------------------------------------------------------------------
   576 // -----------------------------------------------------------------------------
   577 //    
   577 //    
   578 void CIAUpdateAppUi::StartupCompleteL()
   578 void CIAUpdateAppUi::StartupCompleteL()
   579     {
   579     {
   580     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateAppUi::StartupCompleteL() begin"); 
   580     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateAppUi::StartupCompleteL() begin"); 
   581     TBool totalSilent( EFalse );
   581     
   582     if ( iRequestType == IAUpdateUiDefines::ECheckUpdates )
       
   583         {
       
   584         if ( iController->Filter() )
       
   585             {
       
   586         	if ( iController->Filter()->FilterParams() )
       
   587         	    {
       
   588         	    if ( iController->Filter()->FilterParams()->Refresh() )
       
   589         	        {
       
   590         	    	//from bgchecker, make it silent
       
   591                     totalSilent = ETrue;
       
   592         	        }
       
   593            	    }
       
   594             }
       
   595         }
       
   596     
       
   597     TRAPD( err, SetDefaultConnectionMethodL( totalSilent ) );
       
   598     
       
   599     if ( err != KErrNone )
       
   600         {
       
   601         IAUPDATE_TRACE("[IAUPDATE] CIAUpdateAppUi::StartupCompleteL() IAP selection failed!!"); 
       
   602         //can't find usable IAP on the phone, complete the request
       
   603         //If background checker is the client, it will try again after 1 month
       
   604         if ( totalSilent )
       
   605             {
       
   606             //from bgchecker, report the error to so background checker will start retry mode
       
   607             RefreshCompleteL( EFalse, err );
       
   608             }
       
   609         else
       
   610             {
       
   611             //report it to the API caller or to main view
       
   612             RefreshCompleteL( ETrue, err );
       
   613             }
       
   614         return;
       
   615         }
       
   616        
       
   617     delete iGlobalLockHandler;
   582     delete iGlobalLockHandler;
   618     iGlobalLockHandler = NULL;
   583     iGlobalLockHandler = NULL;
   619     iGlobalLockHandler = CIAUpdateGlobalLockHandler::NewL();
   584     iGlobalLockHandler = CIAUpdateGlobalLockHandler::NewL();
   620     if ( !iGlobalLockHandler->InUseByAnotherInstanceL() )
   585     if ( !iGlobalLockHandler->InUseByAnotherInstanceL() )
   621         {
   586         {
       
   587         TBool totalSilent( EFalse );
       
   588         if ( iRequestType == IAUpdateUiDefines::ECheckUpdates )
       
   589             {
       
   590             if ( iController->Filter() )
       
   591                 {
       
   592                 if ( iController->Filter()->FilterParams() )
       
   593                     {
       
   594                     if ( iController->Filter()->FilterParams()->Refresh() )
       
   595                         {
       
   596                         //from bgchecker, make it silent
       
   597                         totalSilent = ETrue;
       
   598                         }
       
   599                     }
       
   600                 }
       
   601             }
       
   602         SetDefaultConnectionMethodL( totalSilent );
   622         iGlobalLockHandler->SetToInUseForAnotherInstancesL( ETrue );
   603         iGlobalLockHandler->SetToInUseForAnotherInstancesL( ETrue );
   623         iController->StartRefreshL();	
   604         iController->StartRefreshL();  
   624         }
   605         }
   625     else
   606     else
   626         {
   607         {
   627         RefreshCompleteL( ETrue, KErrServerBusy );
   608         RefreshCompleteL( ETrue, KErrServerBusy );
   628         }    
   609         }    
       
   610  
       
   611        
       
   612     
   629     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateAppUi::StartupCompleteL() end");    
   613     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateAppUi::StartupCompleteL() end");    
   630     }
   614     }
   631     
   615     
   632  
   616  
   633 // -----------------------------------------------------------------------------
   617 // -----------------------------------------------------------------------------
   692         {
   676         {
   693   	    InformRequestObserver( aError );
   677   	    InformRequestObserver( aError );
   694         }
   678         }
   695     else 
   679     else 
   696         {    
   680         {    
   697         /*if ( ( iController->TestRole() ) && 
       
   698              ( !iStartedFromApplication ) && 
       
   699              ( aWithViewActivation  ) )
       
   700             {
       
   701     	    for( TInt i = 0; i < iController->Nodes().Count(); ++i )
       
   702                 {
       
   703                 MIAUpdateNode* node = iController->Nodes()[i];
       
   704                 node->Base().SetSelected( EFalse ); 
       
   705                 }
       
   706             }*/    
       
   707         RefreshL( aError );   
   681         RefreshL( aError );   
   708         if ( aWithViewActivation)
   682         if ( aWithViewActivation)
   709             {
   683             {
   710         	ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) );
   684         	ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) );
   711             }
   685             }