iaupdate/IAD/ui/src/iaupdateuicontroller.cpp
changeset 52 92f864ef0288
parent 42 d17dc5398051
child 53 ae54820ef82c
--- a/iaupdate/IAD/ui/src/iaupdateuicontroller.cpp	Fri Jun 11 13:45:18 2010 +0300
+++ b/iaupdate/IAD/ui/src/iaupdateuicontroller.cpp	Wed Jun 23 18:20:02 2010 +0300
@@ -482,7 +482,12 @@
         // controller can handle situations as a whole and not as one item at the
         // time.
         iController->StartingUpdatesL();
-            
+        
+        //Store current node list before update
+        iFilter->StoreNodeListL( iNodes );
+        
+        iFilter->SortSelectedNodesFirstL( iSelectedNodesArray, iNodes );
+                    
         iFileInUseError = EFalse;
         // Set the node index to -1 because ContinueUpdateL increases it by one
         // in the beginning of the function. So, we can use the ContinueUpdateL
@@ -546,7 +551,8 @@
             // Only update items that have not been installed yet.
             if ( !selectedNode->IsInstalled() )
                 {
-                IAUPDATE_TRACE("[IAUPDATE] Item not installed yet");    
+                IAUPDATE_TRACE("[IAUPDATE] Item not installed yet"); 
+                iFilter->SortThisNodeFirstL( selectedNode, iNodes );
                 if ( !selectedNode->IsDownloaded() )
                     {
                     // Because content has not been downloaded or installed yet,
@@ -555,11 +561,8 @@
                     selectedNode->DownloadL( *this );
                     iState = EDownloading;
                     iClosingAllowedByClient = ETrue;
-                    selectedNode->SetDownloading( ETrue);
-                    /*ShowUpdatingDialogL( R_IAUPDATE_DOWNLOADING_NOTE,
-                                         selectedNode->Base().Name(),
-                                         iNodeIndex + 1,
-                                         iSelectedNodesArray.Count() );*/ 
+                    selectedNode->SetUiState( MIAUpdateNode::EDownloading );
+                    iObserver.RefreshUI();
                     nextUpdate = EFalse;
                     }
                 else
@@ -570,13 +573,8 @@
                     selectedNode->InstallL( *this );
                     iState = EInstalling;
                     iClosingAllowedByClient = EFalse;
-                    /*CIAUpdateAppUi* appUi = 
-                        static_cast< CIAUpdateAppUi* >( iEikEnv->EikAppUi() );
-                    appUi->StartWGListChangeMonitoring();
-                    ShowUpdatingDialogL( R_IAUPDATE_INSTALLING_NOTE,
-                                         selectedNode->Base().Name(),
-                                         iNodeIndex + 1,
-                                         iSelectedNodesArray.Count() ); */
+                    selectedNode->SetUiState( MIAUpdateNode::EInstalling );
+                    iObserver.RefreshUI();
                     nextUpdate = EFalse;                     
                     }      
                 }
@@ -610,14 +608,9 @@
             
     aNode.InstallL( *this );
     iState = EInstalling;
-    /*CIAUpdateAppUi* appUi = static_cast<CIAUpdateAppUi*>( iEikEnv->EikAppUi() );
-    appUi->StartWGListChangeMonitoring();
-    iClosingAllowedByClient = EFalse;
-    ShowUpdatingDialogL( R_IAUPDATE_INSTALLING_NOTE,
-                         aNode.Base().Name(),
-                         iNodeIndex + 1,
-                         iSelectedNodesArray.Count()  ); */
-    
+    aNode.SetUiState( MIAUpdateNode::EInstalling );
+    iObserver.RefreshUI();
+        
 	IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::StartInstallL() end");
     }
 
@@ -1937,10 +1930,16 @@
     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::InstallCompleteL() begin");
     IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError );
 
-    // In release mode, we do not need the aError info, because
-    // success counters are counted by using the last operation error info
-    // when counter info is asked. In debug mode the error code is logged above.
-    (void)aError;
+    if ( aError == KErrNone )
+        {
+        aNode.SetUiState( MIAUpdateNode::EUpdated );   
+        iObserver.RefreshUI();
+        }
+    else
+        {
+        aNode.SetUiState( MIAUpdateNode::EFailed );
+        iObserver.RefreshUI();
+        }
     
     // pass UID of installed package to starter
     if ( iStarter )
@@ -1985,17 +1984,7 @@
 
     iState = EIdle;
     iClosingAllowedByClient = EFalse;
-
-    // Remove installed nodes from the node array.
-	for ( TInt i = iNodes.Count() - 1; i >= 0; --i ) 
-        {   
-        MIAUpdateNode* node = iNodes[ i ];
-        if ( node->IsInstalled() ) 
-            {
-            iNodes.Remove( i );
-            }
-        }
-    
+       
     TInt error( aError );
     TBool selfUpdaterStarted( EFalse );
 
@@ -2727,6 +2716,32 @@
     }
 
 // ---------------------------------------------------------------------------
+// CIAUpdateUiController::RefreshNodeList
+// 
+// ---------------------------------------------------------------------------
+//
+void CIAUpdateUiController::RefreshNodeList()
+    {
+    // Restore list after update, that nodes are shown in original sequence
+    iFilter->RestoreNodeListL( iNodes );
+    // Remove installed nodes from the node array.
+    // Set temp UI state to normal for remaining nodes 
+    for ( TInt i = iNodes.Count() - 1; i >= 0; --i ) 
+        {   
+        MIAUpdateNode* node = iNodes[ i ];
+        if ( node->IsInstalled() ) 
+            {
+            iNodes.Remove( i );
+            }
+        else
+            {
+            node->SetUiState( MIAUpdateNode::ENormal );        
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
 // CIAUpdateUiController::ParamsWriteFileL
 // 
 // ---------------------------------------------------------------------------