iaupdate/IAD/ui/src/iaupdateuicontroller.cpp
changeset 52 92f864ef0288
parent 42 d17dc5398051
child 53 ae54820ef82c
equal deleted inserted replaced
42:d17dc5398051 52:92f864ef0288
   480             }
   480             }
   481         // Inform the controller that we are now starting updates. This way the
   481         // Inform the controller that we are now starting updates. This way the
   482         // controller can handle situations as a whole and not as one item at the
   482         // controller can handle situations as a whole and not as one item at the
   483         // time.
   483         // time.
   484         iController->StartingUpdatesL();
   484         iController->StartingUpdatesL();
   485             
   485         
       
   486         //Store current node list before update
       
   487         iFilter->StoreNodeListL( iNodes );
       
   488         
       
   489         iFilter->SortSelectedNodesFirstL( iSelectedNodesArray, iNodes );
       
   490                     
   486         iFileInUseError = EFalse;
   491         iFileInUseError = EFalse;
   487         // Set the node index to -1 because ContinueUpdateL increases it by one
   492         // Set the node index to -1 because ContinueUpdateL increases it by one
   488         // in the beginning of the function. So, we can use the ContinueUpdateL
   493         // in the beginning of the function. So, we can use the ContinueUpdateL
   489         // also in here.
   494         // also in here.
   490         iNodeIndex = -1;
   495         iNodeIndex = -1;
   544             MIAUpdateNode* selectedNode = iSelectedNodesArray[ iNodeIndex ];
   549             MIAUpdateNode* selectedNode = iSelectedNodesArray[ iNodeIndex ];
   545 
   550 
   546             // Only update items that have not been installed yet.
   551             // Only update items that have not been installed yet.
   547             if ( !selectedNode->IsInstalled() )
   552             if ( !selectedNode->IsInstalled() )
   548                 {
   553                 {
   549                 IAUPDATE_TRACE("[IAUPDATE] Item not installed yet");    
   554                 IAUPDATE_TRACE("[IAUPDATE] Item not installed yet"); 
       
   555                 iFilter->SortThisNodeFirstL( selectedNode, iNodes );
   550                 if ( !selectedNode->IsDownloaded() )
   556                 if ( !selectedNode->IsDownloaded() )
   551                     {
   557                     {
   552                     // Because content has not been downloaded or installed yet,
   558                     // Because content has not been downloaded or installed yet,
   553                     // it needs to be downloaded before it can be installed.
   559                     // it needs to be downloaded before it can be installed.
   554                     IAUPDATE_TRACE("[IAUPDATE] Download");
   560                     IAUPDATE_TRACE("[IAUPDATE] Download");
   555                     selectedNode->DownloadL( *this );
   561                     selectedNode->DownloadL( *this );
   556                     iState = EDownloading;
   562                     iState = EDownloading;
   557                     iClosingAllowedByClient = ETrue;
   563                     iClosingAllowedByClient = ETrue;
   558                     selectedNode->SetDownloading( ETrue);
   564                     selectedNode->SetUiState( MIAUpdateNode::EDownloading );
   559                     /*ShowUpdatingDialogL( R_IAUPDATE_DOWNLOADING_NOTE,
   565                     iObserver.RefreshUI();
   560                                          selectedNode->Base().Name(),
       
   561                                          iNodeIndex + 1,
       
   562                                          iSelectedNodesArray.Count() );*/ 
       
   563                     nextUpdate = EFalse;
   566                     nextUpdate = EFalse;
   564                     }
   567                     }
   565                 else
   568                 else
   566                     {
   569                     {
   567                     // Because content has been downloaded but not installed yet,
   570                     // Because content has been downloaded but not installed yet,
   568                     // it needs to be installed now.
   571                     // it needs to be installed now.
   569                     IAUPDATE_TRACE("[IAUPDATE] Install");
   572                     IAUPDATE_TRACE("[IAUPDATE] Install");
   570                     selectedNode->InstallL( *this );
   573                     selectedNode->InstallL( *this );
   571                     iState = EInstalling;
   574                     iState = EInstalling;
   572                     iClosingAllowedByClient = EFalse;
   575                     iClosingAllowedByClient = EFalse;
   573                     /*CIAUpdateAppUi* appUi = 
   576                     selectedNode->SetUiState( MIAUpdateNode::EInstalling );
   574                         static_cast< CIAUpdateAppUi* >( iEikEnv->EikAppUi() );
   577                     iObserver.RefreshUI();
   575                     appUi->StartWGListChangeMonitoring();
       
   576                     ShowUpdatingDialogL( R_IAUPDATE_INSTALLING_NOTE,
       
   577                                          selectedNode->Base().Name(),
       
   578                                          iNodeIndex + 1,
       
   579                                          iSelectedNodesArray.Count() ); */
       
   580                     nextUpdate = EFalse;                     
   578                     nextUpdate = EFalse;                     
   581                     }      
   579                     }      
   582                 }
   580                 }
   583             }
   581             }
   584         else
   582         else
   608         aNode.GetDependenciesL( iServicePackNodes, ETrue );
   606         aNode.GetDependenciesL( iServicePackNodes, ETrue );
   609         }
   607         }
   610             
   608             
   611     aNode.InstallL( *this );
   609     aNode.InstallL( *this );
   612     iState = EInstalling;
   610     iState = EInstalling;
   613     /*CIAUpdateAppUi* appUi = static_cast<CIAUpdateAppUi*>( iEikEnv->EikAppUi() );
   611     aNode.SetUiState( MIAUpdateNode::EInstalling );
   614     appUi->StartWGListChangeMonitoring();
   612     iObserver.RefreshUI();
   615     iClosingAllowedByClient = EFalse;
   613         
   616     ShowUpdatingDialogL( R_IAUPDATE_INSTALLING_NOTE,
       
   617                          aNode.Base().Name(),
       
   618                          iNodeIndex + 1,
       
   619                          iSelectedNodesArray.Count()  ); */
       
   620     
       
   621 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::StartInstallL() end");
   614 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::StartInstallL() end");
   622     }
   615     }
   623 
   616 
   624     
   617     
   625 // ---------------------------------------------------------------------------
   618 // ---------------------------------------------------------------------------
  1935                                               TInt aError )    
  1928                                               TInt aError )    
  1936     {
  1929     {
  1937     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::InstallCompleteL() begin");
  1930     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::InstallCompleteL() begin");
  1938     IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError );
  1931     IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError );
  1939 
  1932 
  1940     // In release mode, we do not need the aError info, because
  1933     if ( aError == KErrNone )
  1941     // success counters are counted by using the last operation error info
  1934         {
  1942     // when counter info is asked. In debug mode the error code is logged above.
  1935         aNode.SetUiState( MIAUpdateNode::EUpdated );   
  1943     (void)aError;
  1936         iObserver.RefreshUI();
       
  1937         }
       
  1938     else
       
  1939         {
       
  1940         aNode.SetUiState( MIAUpdateNode::EFailed );
       
  1941         iObserver.RefreshUI();
       
  1942         }
  1944     
  1943     
  1945     // pass UID of installed package to starter
  1944     // pass UID of installed package to starter
  1946     if ( iStarter )
  1945     if ( iStarter )
  1947         {
  1946         {
  1948     	if ( aNode.Type() == MIAUpdateNode::EPackageTypeServicePack )
  1947     	if ( aNode.Type() == MIAUpdateNode::EPackageTypeServicePack )
  1983     {
  1982     {
  1984     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::UpdateCompleteL() begin");
  1983     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::UpdateCompleteL() begin");
  1985 
  1984 
  1986     iState = EIdle;
  1985     iState = EIdle;
  1987     iClosingAllowedByClient = EFalse;
  1986     iClosingAllowedByClient = EFalse;
  1988 
  1987        
  1989     // Remove installed nodes from the node array.
       
  1990 	for ( TInt i = iNodes.Count() - 1; i >= 0; --i ) 
       
  1991         {   
       
  1992         MIAUpdateNode* node = iNodes[ i ];
       
  1993         if ( node->IsInstalled() ) 
       
  1994             {
       
  1995             iNodes.Remove( i );
       
  1996             }
       
  1997         }
       
  1998     
       
  1999     TInt error( aError );
  1988     TInt error( aError );
  2000     TBool selfUpdaterStarted( EFalse );
  1989     TBool selfUpdaterStarted( EFalse );
  2001 
  1990 
  2002     if ( error == KErrNone )
  1991     if ( error == KErrNone )
  2003         {
  1992         {
  2725     {
  2714     {
  2726     iForcedRefresh = aForcedRefresh;
  2715     iForcedRefresh = aForcedRefresh;
  2727     }
  2716     }
  2728 
  2717 
  2729 // ---------------------------------------------------------------------------
  2718 // ---------------------------------------------------------------------------
       
  2719 // CIAUpdateUiController::RefreshNodeList
       
  2720 // 
       
  2721 // ---------------------------------------------------------------------------
       
  2722 //
       
  2723 void CIAUpdateUiController::RefreshNodeList()
       
  2724     {
       
  2725     // Restore list after update, that nodes are shown in original sequence
       
  2726     iFilter->RestoreNodeListL( iNodes );
       
  2727     // Remove installed nodes from the node array.
       
  2728     // Set temp UI state to normal for remaining nodes 
       
  2729     for ( TInt i = iNodes.Count() - 1; i >= 0; --i ) 
       
  2730         {   
       
  2731         MIAUpdateNode* node = iNodes[ i ];
       
  2732         if ( node->IsInstalled() ) 
       
  2733             {
       
  2734             iNodes.Remove( i );
       
  2735             }
       
  2736         else
       
  2737             {
       
  2738             node->SetUiState( MIAUpdateNode::ENormal );        
       
  2739             }
       
  2740         }
       
  2741     }
       
  2742 
       
  2743 
       
  2744 // ---------------------------------------------------------------------------
  2730 // CIAUpdateUiController::ParamsWriteFileL
  2745 // CIAUpdateUiController::ParamsWriteFileL
  2731 // 
  2746 // 
  2732 // ---------------------------------------------------------------------------
  2747 // ---------------------------------------------------------------------------
  2733 //  
  2748 //  
  2734 void CIAUpdateUiController::ParamsWriteFileL()
  2749 void CIAUpdateUiController::ParamsWriteFileL()