appinstaller/AppinstUi/Daemon/Src/uninstaller.cpp
changeset 37 6e7b00453237
parent 29 26b6f0522fd8
--- a/appinstaller/AppinstUi/Daemon/Src/uninstaller.cpp	Fri May 14 15:58:48 2010 +0300
+++ b/appinstaller/AppinstUi/Daemon/Src/uninstaller.cpp	Thu May 27 12:58:35 2010 +0300
@@ -281,6 +281,20 @@
                      // Display installing note for user.
                      iDialogs->ShowWaitingNoteForUninstallerL(); 
                      
+                     if ( iUidArrayIndex == 0 )
+                         {
+                         // Set uninstall mode for universal indicator and
+                         // set percent value to 0%.
+                         iDialogs->SetModeToIndicatorL( KSWIDaemonUninstallerMode );
+                         }
+                     else
+                         {
+                         // Calculate current percent value to iPercentValue. 
+                         CalcPercentValue();
+                         // Activate new value to universal indicator.
+                         iDialogs->ActivateIndicatorL( iPercentValue );
+                         }
+                     
                      FLOG_1( _L("[SISUninstaller] Run uninstall index = %d"), 
                              iUidArrayIndex ); 
                      
@@ -347,6 +361,8 @@
 void CSisPkgUninstaller::UninstallationCompleted( TInt /*aResult*/ )
     {
     FLOG( _L("[SISUninstaller] UninstallationCompleted") );
+    // Update indicator value last time and show 100% to user.
+    iDialogs->ActivateIndicatorL( 100 );
     
     if ( EStateUninstalling == iProgramStatus->GetProgramStatus() )
          {   
@@ -358,7 +374,9 @@
     iState = EUninstallerStateIdle; 
           
     // Cancel waiting note.
-    TRAP_IGNORE( iDialogs->CancelWaitingNoteL() );       
+    TRAP_IGNORE( iDialogs->CancelWaitingNoteForUninstaller());
+    // Close indicator.
+    iDialogs->CancelIndicatorL();
     }  
 
 
@@ -374,4 +392,38 @@
     iRevisor->Exit();
     }
 
+// -----------------------------------------------------------------------
+// CSisInstaller::CalcPrecentValue
+// -----------------------------------------------------------------------
+//
+void CSisPkgUninstaller::CalcPercentValue()
+    {     
+    FLOG( _L("[SISUninstaller] CalcPercentValue") );
+    FLOG_1( _L("[SISUninstaller] iUidArrayIndex = %d"), iUidArrayIndex ); 
+    // Let's calculate indicator value for UI now.
+    TInt packageUidCount = iPkgUidArray.Count();
+    FLOG_1( _L("[SISUninstaller] pkg UID count = %d"), packageUidCount ); 
+    
+    iPercentValue = 0;
+
+    if ( iUidArrayIndex && packageUidCount )
+        {
+        // Let's calculate new precent value.     
+        if ( iUidArrayIndex <= packageUidCount )
+            {
+            TReal32 realArrayIndex = iUidArrayIndex;
+            TReal32 realPkgCount = packageUidCount;
+            iPercentValue = (realArrayIndex/realPkgCount)*100;                                   
+            }
+        else
+            {
+            // Most probably all is uninstalled if index is bigger then
+            // filen count. Let's not show over 100% to user.           
+            iPercentValue = 100;
+            }
+        }
+            
+    FLOG_1( _L("[SISUninstaller] percent value = %d"), (TInt)iPercentValue );
+    }
+
 //EOF