appinstaller/AppinstUi/Daemon/Src/silentuninstaller.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
--- a/appinstaller/AppinstUi/Daemon/Src/silentuninstaller.cpp	Tue Aug 31 15:21:33 2010 +0300
+++ b/appinstaller/AppinstUi/Daemon/Src/silentuninstaller.cpp	Wed Sep 01 12:22:02 2010 +0100
@@ -17,9 +17,8 @@
 
 // INCLUDE FILES
 #include "silentuninstaller.h"
+#include "SWInstDebug.h"
 #include "SWInstDefs.h"
-#include "SWInstDebug.h"
-
 
 using namespace Swi;
 
@@ -41,13 +40,12 @@
 //
 void CSilentUninstaller::ConstructL()
     {
-    iConnected = EFalse;     
-    iSifOptions = Usif::COpaqueNamedParams::NewL();
-    iSifResults = Usif::COpaqueNamedParams::NewL();    
-    // Set parameters for silent uninstall.    
-    iSifOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );       
-    iSifOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, ETrue );    
-    iSifOptions->AddIntL( Usif::KSifInParam_AllowAppBreakDependency, EFalse );     
+    // Silently kill the app. if needed.
+    FLOG(_L("[CSilentUninstaller] iKillApp = SwiUI::EPolicyAllowed;"));
+    iOptions.iKillApp = SwiUI::EPolicyAllowed; 
+    FLOG(_L("[CSilentUninstaller] iBreakDependency = SwiUI::EPolicyNotAllowed"));
+    iOptions.iBreakDependency = SwiUI::EPolicyNotAllowed;         
+    iOptionsPckg = iOptions;      
     }
 
 
@@ -72,15 +70,7 @@
 CSilentUninstaller::~CSilentUninstaller()
     {
     FLOG( _L("[CSilentUninstaller] ~CSilentUninstaller") );
-
-    delete iSifOptions;
-    delete iSifResults;
-    
-    if ( iConnected )
-        {
-        iSWInstallerFW.Close();
-        iRegistrySession.Close();
-        }    
+    iLauncher.Close();
     }
 
 
@@ -91,35 +81,17 @@
 void CSilentUninstaller::UninstallL( 
     TUid& aUid, 
     TRequestStatus& aReqStatus, 
-    TDesC& aMIME )
+    TDesC8& aMIME )
     {
-    FLOG_1( _L("Daemon: UninstallL: UID = 0x%x"), aUid.iUid );
-    
     if ( !iConnected )
-        {               
-        FLOG( _L("[CSilentUninstaller] Connect to sif installer server") );    
-        User::LeaveIfError( iSWInstallerFW.Connect() );                         
-        FLOG( _L("[CSilentUninstaller] Connect to SisRegistery") );      
-        User::LeaveIfError( iRegistrySession.Connect() );                   
-        iConnected = ETrue;   
-        }
-      
-    // Set MIME type.
-    iSifOptions->AddStringL( Usif::KSifInParam_MimeType, aMIME );  
-           
-    // Usif need the component ID, so we need to map the package UID to 
-    // component ID. To do this simple we need SisRegistry.           
-    Usif::TComponentId componentId;
-    componentId = iRegistrySession.GetComponentIdForUidL( aUid );
-    FLOG_1( _L("Daemon: UninstallL: ComponentId = %d"), componentId );
-                                   
+        {
+        FLOG( _L("[CSilentUninstaller] Connect to server") );
+        User::LeaveIfError( iLauncher.Connect() );
+        iConnected = ETrue;            
+        }                
     // Launch the installation
-    FLOG( _L("[CSilentUninstaller] Launch uninstall") );                 
-    iSWInstallerFW.Uninstall( componentId, 
-                              *iSifOptions,
-                              *iSifResults, 
-                              aReqStatus,
-                              ETrue );
+    FLOG( _L("[CSilentUninstaller] Launch uninstall") );
+    iLauncher.SilentUninstall( aReqStatus, aUid, iOptionsPckg, aMIME );
     }
   
 
@@ -129,8 +101,8 @@
 // 
 void CSilentUninstaller::Cancel()
     {
-    FLOG( _L("[CSilentUninstaller] Cancel silet uninstall") );              
-    iSWInstallerFW.CancelOperation(); 
+    FLOG( _L("[CSilentUninstaller] Cancel silet uninstall") );     
+    iLauncher.CancelAsyncRequest( SwiUI::ERequestSilentUninstall );   
     }
 
 //  End of File