appinstaller/AppinstUi/Daemon/Src/silentuninstaller.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 #include "silentuninstaller.h"
    19 #include "silentuninstaller.h"
       
    20 #include "SWInstDefs.h"
    20 #include "SWInstDebug.h"
    21 #include "SWInstDebug.h"
    21 #include "SWInstDefs.h"
    22 
    22 
    23 
    23 using namespace Swi;
    24 using namespace Swi;
    24 
    25 
    25 // ============================ MEMBER FUNCTIONS ===============================
    26 // ============================ MEMBER FUNCTIONS ===============================
    26 
    27 
    38 // 2nd constructor
    39 // 2nd constructor
    39 // -----------------------------------------------------------------------------
    40 // -----------------------------------------------------------------------------
    40 //
    41 //
    41 void CSilentUninstaller::ConstructL()
    42 void CSilentUninstaller::ConstructL()
    42     {
    43     {
    43     // Silently kill the app. if needed.
    44     iConnected = EFalse;     
    44     FLOG(_L("[CSilentUninstaller] iKillApp = SwiUI::EPolicyAllowed;"));
    45     iSifOptions = Usif::COpaqueNamedParams::NewL();
    45     iOptions.iKillApp = SwiUI::EPolicyAllowed; 
    46     iSifResults = Usif::COpaqueNamedParams::NewL();    
    46     FLOG(_L("[CSilentUninstaller] iBreakDependency = SwiUI::EPolicyNotAllowed"));
    47     // Set parameters for silent uninstall.    
    47     iOptions.iBreakDependency = SwiUI::EPolicyNotAllowed;         
    48     iSifOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );       
    48     iOptionsPckg = iOptions;      
    49     iSifOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, ETrue );    
       
    50     iSifOptions->AddIntL( Usif::KSifInParam_AllowAppBreakDependency, EFalse );     
    49     }
    51     }
    50 
    52 
    51 
    53 
    52 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
    53 // Two-phased constructor.
    55 // Two-phased constructor.
    68 // -----------------------------------------------------------------------------
    70 // -----------------------------------------------------------------------------
    69 //
    71 //
    70 CSilentUninstaller::~CSilentUninstaller()
    72 CSilentUninstaller::~CSilentUninstaller()
    71     {
    73     {
    72     FLOG( _L("[CSilentUninstaller] ~CSilentUninstaller") );
    74     FLOG( _L("[CSilentUninstaller] ~CSilentUninstaller") );
    73     iLauncher.Close();
    75 
       
    76     delete iSifOptions;
       
    77     delete iSifResults;
       
    78     
       
    79     if ( iConnected )
       
    80         {
       
    81         iSWInstallerFW.Close();
       
    82         iRegistrySession.Close();
       
    83         }    
    74     }
    84     }
    75 
    85 
    76 
    86 
    77 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
    78 // Perform uninstallation.
    88 // Perform uninstallation.
    79 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
    80 //
    90 //
    81 void CSilentUninstaller::UninstallL( 
    91 void CSilentUninstaller::UninstallL( 
    82     TUid& aUid, 
    92     TUid& aUid, 
    83     TRequestStatus& aReqStatus, 
    93     TRequestStatus& aReqStatus, 
    84     TDesC8& aMIME )
    94     TDesC& aMIME )
    85     {
    95     {
       
    96     FLOG_1( _L("Daemon: UninstallL: UID = 0x%x"), aUid.iUid );
       
    97     
    86     if ( !iConnected )
    98     if ( !iConnected )
    87         {
    99         {               
    88         FLOG( _L("[CSilentUninstaller] Connect to server") );
   100         FLOG( _L("[CSilentUninstaller] Connect to sif installer server") );    
    89         User::LeaveIfError( iLauncher.Connect() );
   101         User::LeaveIfError( iSWInstallerFW.Connect() );                         
    90         iConnected = ETrue;            
   102         FLOG( _L("[CSilentUninstaller] Connect to SisRegistery") );      
    91         }                
   103         User::LeaveIfError( iRegistrySession.Connect() );                   
       
   104         iConnected = ETrue;   
       
   105         }
       
   106       
       
   107     // Set MIME type.
       
   108     iSifOptions->AddStringL( Usif::KSifInParam_MimeType, aMIME );  
       
   109            
       
   110     // Usif need the component ID, so we need to map the package UID to 
       
   111     // component ID. To do this simple we need SisRegistry.           
       
   112     Usif::TComponentId componentId;
       
   113     componentId = iRegistrySession.GetComponentIdForUidL( aUid );
       
   114     FLOG_1( _L("Daemon: UninstallL: ComponentId = %d"), componentId );
       
   115                                    
    92     // Launch the installation
   116     // Launch the installation
    93     FLOG( _L("[CSilentUninstaller] Launch uninstall") );
   117     FLOG( _L("[CSilentUninstaller] Launch uninstall") );                 
    94     iLauncher.SilentUninstall( aReqStatus, aUid, iOptionsPckg, aMIME );
   118     iSWInstallerFW.Uninstall( componentId, 
       
   119                               *iSifOptions,
       
   120                               *iSifResults, 
       
   121                               aReqStatus,
       
   122                               ETrue );
    95     }
   123     }
    96   
   124   
    97 
   125 
    98 // -----------------------------------------------------------------------------
   126 // -----------------------------------------------------------------------------
    99 // Cancel the current installation.
   127 // Cancel the current installation.
   100 // -----------------------------------------------------------------------------
   128 // -----------------------------------------------------------------------------
   101 // 
   129 // 
   102 void CSilentUninstaller::Cancel()
   130 void CSilentUninstaller::Cancel()
   103     {
   131     {
   104     FLOG( _L("[CSilentUninstaller] Cancel silet uninstall") );     
   132     FLOG( _L("[CSilentUninstaller] Cancel silet uninstall") );              
   105     iLauncher.CancelAsyncRequest( SwiUI::ERequestSilentUninstall );   
   133     iSWInstallerFW.CancelOperation(); 
   106     }
   134     }
   107 
   135 
   108 //  End of File  
   136 //  End of File