appinstaller/AppinstUi/Daemon/Src/SilentLauncher.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    42 // Symbian 2nd phase constructor can leave.
    42 // Symbian 2nd phase constructor can leave.
    43 // -----------------------------------------------------------------------------
    43 // -----------------------------------------------------------------------------
    44 //
    44 //
    45 void CSilentLauncher::ConstructL()
    45 void CSilentLauncher::ConstructL()
    46     {
    46     {
    47     iOptions.iUpgrade = SwiUI::EPolicyNotAllowed;
    47     iConnected = EFalse;
    48     iOptions.iOCSP = SwiUI::EPolicyNotAllowed;
    48     
    49 #ifndef RD_MULTIPLE_DRIVE 
    49     iSifOptions = Usif::COpaqueNamedParams::NewL();
    50     iOptions.iDrive = 'E';
    50     iSifResults = Usif::COpaqueNamedParams::NewL();
    51 #endif       
    51     
    52     iOptions.iUntrusted = SwiUI::EPolicyNotAllowed; 
    52     // Set needed parameters for silent install.
    53     iOptions.iCapabilities = SwiUI::EPolicyNotAllowed;    
    53     FLOG( _L("Daemon: CSilentLauncher::ConstructL: InstallSilently") );
    54     iOptionsPckg = iOptions;    
    54     iSifOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );
       
    55 
       
    56     iSifOptions->AddIntL( Usif::KSifInParam_PerformOCSP, EFalse );   
       
    57     // Note if upgrade is allowed, see NeedsInstallingL function.
       
    58     iSifOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, EFalse );
       
    59     iSifOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, EFalse );
       
    60     iSifOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, EFalse ); 
       
    61     // Defined for the install.
       
    62     iSifOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, ETrue );          
       
    63     iSifOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, ETrue );            
       
    64     iSifOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, ETrue );
       
    65     iSifOptions->AddIntL( Usif::KSifInParam_AllowDownload, ETrue );
       
    66     iSifOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, ETrue );
       
    67     iSifOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, ETrue );
       
    68     
       
    69 // TODO: is this defined in USIF?    
       
    70     //iSifOptions->AddIntL( Usif::KSifInParam_Languages, NULL );
       
    71 // TODO: Not supported anymore after wk18, do we have some other param for this.
       
    72     //iSifOptions->AddIntL( Usif::KSifInParam_DisplayPackageInfo, ETrue );
       
    73     
       
    74 // TODO: remove old params.
       
    75     /*
       
    76     // Old swinstdefs.inl defines for install.   
       
    77     iUpgrade( EPolicyAllowed ),
       
    78     iOptionalItems( EPolicyAllowed ),
       
    79     iOCSP( EPolicyAllowed ),    
       
    80     iIgnoreOCSPWarnings( EPolicyAllowed ),
       
    81     iUntrusted( EPolicyNotAllowed ),
       
    82     iPackageInfo( EPolicyAllowed ),
       
    83     iCapabilities( EPolicyAllowed ),
       
    84     iKillApp( EPolicyAllowed ),
       
    85     iDownload( EPolicyAllowed ),
       
    86     iOverwrite( EPolicyAllowed ),
       
    87     iDrive( 'C' ),
       
    88     iLang( ELangNone ),
       
    89     iUsePhoneLang( ETrue ),
       
    90     iUpgradeData( EPolicyAllowed )
       
    91     */        
    55     }
    92     }
    56 
    93 
    57 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
    58 // CSilentLauncher::NewL
    95 // CSilentLauncher::NewL
    59 // Two-phased constructor.
    96 // Two-phased constructor.
    65     CleanupStack::PushL( self );
   102     CleanupStack::PushL( self );
    66     self->ConstructL();
   103     self->ConstructL();
    67     CleanupStack::Pop( self );
   104     CleanupStack::Pop( self );
    68     return self;    
   105     return self;    
    69     }
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CSilentLauncher::~CSilentLauncher()
       
   110 // Destructor.
       
   111 // -----------------------------------------------------------------------------
       
   112 //    
       
   113 CSilentLauncher::~CSilentLauncher()
       
   114     {   
       
   115     delete iSifOptions;
       
   116     delete iSifResults;
    70     
   117     
    71 // Destructor
   118     if ( iConnected )
    72 CSilentLauncher::~CSilentLauncher()
   119         {
    73     {
   120         iSWInstallerFW.Close();
    74     iLauncher.Close();
   121         }
       
   122     
       
   123     delete iDrive;
    75     }
   124     }
       
   125 
    76 
   126 
    77 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
    78 // CSilentLauncher::InstallL
   128 // CSilentLauncher::InstallL
    79 // Perform installation.
   129 // Perform installation with file handle.
    80 // (other items were commented in a header).
       
    81 // -----------------------------------------------------------------------------
   130 // -----------------------------------------------------------------------------
    82 //
   131 //
    83 void CSilentLauncher::InstallL( const TDesC& aFile, TRequestStatus& aStatus )
   132 void CSilentLauncher::InstallL( RFile& aFileHandle, 
       
   133                                 const TDesC& aFile, 
       
   134                                 TRequestStatus& aStatus )
    84     {
   135     {
       
   136     FLOG( _L("Daemon: CSilentLauncher::InstallL (aFileHandle) START") );
       
   137     
    85     if ( !iConnected )
   138     if ( !iConnected )
    86         {
   139          {
    87         FLOG( _L("Daemon: Connect to installer server") );    
   140          FLOG( _L("Daemon: Connect to sif installer server") );    
    88         User::LeaveIfError( iLauncher.Connect() );    
   141          User::LeaveIfError( iSWInstallerFW.Connect() );             
    89         FLOG( _L("Daemon: Connected to installer server") );
   142          iConnected = ETrue;            
    90         iConnected = ETrue;            
   143          }
    91         }
       
    92         
   144         
    93 #ifdef RD_MULTIPLE_DRIVE 
   145     // Set drive for installer.
    94     FLOG( _L("Daemon: InstallL: Set drive for install") );   
   146 //    delete iDrive  
    95     // Set drive for installer.          
   147 //    iDrive = NULL;
    96     iOptions.iDrive = aFile[0];
   148 //    iDrive = HBufC::NewLC( 8 );
    97 #endif                
   149 //    TPtr drivePtr = iDrive->Des();
    98 
   150 //     
    99     // Launch the installation
   151 //    TInt driveNumber = 0;
       
   152 //    TDriveInfo driveInfo;
       
   153 //    aFileHandle.Drive( driveNumber, driveInfo );
       
   154 // TODO: how is this used? Is this drive letter?      
       
   155 //    iSifOptions->AddStringL( Usif::KSifInParam_Drive , *drive );
       
   156                                  
   100     FLOG( _L("Daemon: Launch install") );
   157     FLOG( _L("Daemon: Launch install") );
   101     iLauncher.SilentInstall( aStatus, aFile, iOptionsPckg );
   158     iSWInstallerFW.Install( aFileHandle, 
       
   159                            *iSifOptions, 
       
   160                            *iSifResults,
       
   161                            aStatus,
       
   162                            ETrue );
       
   163     
       
   164     FLOG( _L("Daemon: CSilentLauncher::InstallL (aFileHandle) END") );       
   102     }
   165     }
   103        
   166        
   104 // -----------------------------------------------------------------------------
   167 // -----------------------------------------------------------------------------
   105 // CSilentLauncher::Cancel
   168 // CSilentLauncher::Cancel
   106 // Cancel the current installation.
   169 // Cancel the current installation.
   107 // (other items were commented in a header).
   170 // (other items were commented in a header).
   108 // -----------------------------------------------------------------------------
   171 // -----------------------------------------------------------------------------
   109 // 
   172 // 
   110 void CSilentLauncher::Cancel()
   173 void CSilentLauncher::Cancel()
   111     {
   174     {
   112     FLOG( _L("Daemon: Install cancel requested") );        
   175     FLOG( _L("Daemon: Cancel Install operation") );            
   113     iLauncher.CancelAsyncRequest( SwiUI::ERequestSilentInstall );   
   176     iSWInstallerFW.CancelOperation();
   114     }
   177     }
   115 
   178 
   116 //  End of File  
   179 //  End of File