appinstaller/AppinstUi/Daemon/Src/SilentLauncher.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
--- a/appinstaller/AppinstUi/Daemon/Src/SilentLauncher.cpp	Thu Aug 19 10:02:49 2010 +0300
+++ b/appinstaller/AppinstUi/Daemon/Src/SilentLauncher.cpp	Tue Aug 31 15:21:33 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -44,14 +44,51 @@
 //
 void CSilentLauncher::ConstructL()
     {
-    iOptions.iUpgrade = SwiUI::EPolicyNotAllowed;
-    iOptions.iOCSP = SwiUI::EPolicyNotAllowed;
-#ifndef RD_MULTIPLE_DRIVE 
-    iOptions.iDrive = 'E';
-#endif       
-    iOptions.iUntrusted = SwiUI::EPolicyNotAllowed; 
-    iOptions.iCapabilities = SwiUI::EPolicyNotAllowed;    
-    iOptionsPckg = iOptions;    
+    iConnected = EFalse;
+    
+    iSifOptions = Usif::COpaqueNamedParams::NewL();
+    iSifResults = Usif::COpaqueNamedParams::NewL();
+    
+    // Set needed parameters for silent install.
+    FLOG( _L("Daemon: CSilentLauncher::ConstructL: InstallSilently") );
+    iSifOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );
+
+    iSifOptions->AddIntL( Usif::KSifInParam_PerformOCSP, EFalse );   
+    // Note if upgrade is allowed, see NeedsInstallingL function.
+    iSifOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, EFalse );
+    iSifOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, EFalse );
+    iSifOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, EFalse ); 
+    // Defined for the install.
+    iSifOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, ETrue );          
+    iSifOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, ETrue );            
+    iSifOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, ETrue );
+    iSifOptions->AddIntL( Usif::KSifInParam_AllowDownload, ETrue );
+    iSifOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, ETrue );
+    iSifOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, ETrue );
+    
+// TODO: is this defined in USIF?    
+    //iSifOptions->AddIntL( Usif::KSifInParam_Languages, NULL );
+// TODO: Not supported anymore after wk18, do we have some other param for this.
+    //iSifOptions->AddIntL( Usif::KSifInParam_DisplayPackageInfo, ETrue );
+    
+// TODO: remove old params.
+    /*
+    // Old swinstdefs.inl defines for install.   
+    iUpgrade( EPolicyAllowed ),
+    iOptionalItems( EPolicyAllowed ),
+    iOCSP( EPolicyAllowed ),    
+    iIgnoreOCSPWarnings( EPolicyAllowed ),
+    iUntrusted( EPolicyNotAllowed ),
+    iPackageInfo( EPolicyAllowed ),
+    iCapabilities( EPolicyAllowed ),
+    iKillApp( EPolicyAllowed ),
+    iDownload( EPolicyAllowed ),
+    iOverwrite( EPolicyAllowed ),
+    iDrive( 'C' ),
+    iLang( ELangNone ),
+    iUsePhoneLang( ETrue ),
+    iUpgradeData( EPolicyAllowed )
+    */        
     }
 
 // -----------------------------------------------------------------------------
@@ -67,38 +104,64 @@
     CleanupStack::Pop( self );
     return self;    
     }
-    
-// Destructor
+
+// -----------------------------------------------------------------------------
+// CSilentLauncher::~CSilentLauncher()
+// Destructor.
+// -----------------------------------------------------------------------------
+//    
 CSilentLauncher::~CSilentLauncher()
-    {
-    iLauncher.Close();
+    {   
+    delete iSifOptions;
+    delete iSifResults;
+    
+    if ( iConnected )
+        {
+        iSWInstallerFW.Close();
+        }
+    
+    delete iDrive;
     }
 
+
 // -----------------------------------------------------------------------------
 // CSilentLauncher::InstallL
-// Perform installation.
-// (other items were commented in a header).
+// Perform installation with file handle.
 // -----------------------------------------------------------------------------
 //
-void CSilentLauncher::InstallL( const TDesC& aFile, TRequestStatus& aStatus )
+void CSilentLauncher::InstallL( RFile& aFileHandle, 
+                                const TDesC& aFile, 
+                                TRequestStatus& aStatus )
     {
+    FLOG( _L("Daemon: CSilentLauncher::InstallL (aFileHandle) START") );
+    
     if ( !iConnected )
-        {
-        FLOG( _L("Daemon: Connect to installer server") );    
-        User::LeaveIfError( iLauncher.Connect() );    
-        FLOG( _L("Daemon: Connected to installer server") );
-        iConnected = ETrue;            
-        }
+         {
+         FLOG( _L("Daemon: Connect to sif installer server") );    
+         User::LeaveIfError( iSWInstallerFW.Connect() );             
+         iConnected = ETrue;            
+         }
         
-#ifdef RD_MULTIPLE_DRIVE 
-    FLOG( _L("Daemon: InstallL: Set drive for install") );   
-    // Set drive for installer.          
-    iOptions.iDrive = aFile[0];
-#endif                
-
-    // Launch the installation
+    // Set drive for installer.
+//    delete iDrive  
+//    iDrive = NULL;
+//    iDrive = HBufC::NewLC( 8 );
+//    TPtr drivePtr = iDrive->Des();
+//     
+//    TInt driveNumber = 0;
+//    TDriveInfo driveInfo;
+//    aFileHandle.Drive( driveNumber, driveInfo );
+// TODO: how is this used? Is this drive letter?      
+//    iSifOptions->AddStringL( Usif::KSifInParam_Drive , *drive );
+                                 
     FLOG( _L("Daemon: Launch install") );
-    iLauncher.SilentInstall( aStatus, aFile, iOptionsPckg );
+    iSWInstallerFW.Install( aFileHandle, 
+                           *iSifOptions, 
+                           *iSifResults,
+                           aStatus,
+                           ETrue );
+    
+    FLOG( _L("Daemon: CSilentLauncher::InstallL (aFileHandle) END") );       
     }
        
 // -----------------------------------------------------------------------------
@@ -109,8 +172,8 @@
 // 
 void CSilentLauncher::Cancel()
     {
-    FLOG( _L("Daemon: Install cancel requested") );        
-    iLauncher.CancelAsyncRequest( SwiUI::ERequestSilentInstall );   
+    FLOG( _L("Daemon: Cancel Install operation") );            
+    iSWInstallerFW.CancelOperation();
     }
 
 //  End of File