appinstaller/AppinstUi/Daemon/Src/SilentLauncher.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
equal deleted inserted replaced
65:7333d7932ef7 66:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2007 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     iConnected = EFalse;
    47     iOptions.iUpgrade = SwiUI::EPolicyNotAllowed;
    48     
    48     iOptions.iOCSP = SwiUI::EPolicyNotAllowed;
    49     iSifOptions = Usif::COpaqueNamedParams::NewL();
    49 #ifndef RD_MULTIPLE_DRIVE 
    50     iSifResults = Usif::COpaqueNamedParams::NewL();
    50     iOptions.iDrive = 'E';
    51     
    51 #endif       
    52     // Set needed parameters for silent install.
    52     iOptions.iUntrusted = SwiUI::EPolicyNotAllowed; 
    53     FLOG( _L("Daemon: CSilentLauncher::ConstructL: InstallSilently") );
    53     iOptions.iCapabilities = SwiUI::EPolicyNotAllowed;    
    54     iSifOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );
    54     iOptionsPckg = iOptions;    
    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     */        
       
    92     }
    55     }
    93 
    56 
    94 // -----------------------------------------------------------------------------
    57 // -----------------------------------------------------------------------------
    95 // CSilentLauncher::NewL
    58 // CSilentLauncher::NewL
    96 // Two-phased constructor.
    59 // Two-phased constructor.
   102     CleanupStack::PushL( self );
    65     CleanupStack::PushL( self );
   103     self->ConstructL();
    66     self->ConstructL();
   104     CleanupStack::Pop( self );
    67     CleanupStack::Pop( self );
   105     return self;    
    68     return self;    
   106     }
    69     }
   107 
    70     
   108 // -----------------------------------------------------------------------------
    71 // Destructor
   109 // CSilentLauncher::~CSilentLauncher()
       
   110 // Destructor.
       
   111 // -----------------------------------------------------------------------------
       
   112 //    
       
   113 CSilentLauncher::~CSilentLauncher()
    72 CSilentLauncher::~CSilentLauncher()
   114     {   
    73     {
   115     delete iSifOptions;
    74     iLauncher.Close();
   116     delete iSifResults;
       
   117     
       
   118     if ( iConnected )
       
   119         {
       
   120         iSWInstallerFW.Close();
       
   121         }
       
   122     
       
   123     delete iDrive;
       
   124     }
    75     }
   125 
       
   126 
    76 
   127 // -----------------------------------------------------------------------------
    77 // -----------------------------------------------------------------------------
   128 // CSilentLauncher::InstallL
    78 // CSilentLauncher::InstallL
   129 // Perform installation with file handle.
    79 // Perform installation.
       
    80 // (other items were commented in a header).
   130 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
   131 //
    82 //
   132 void CSilentLauncher::InstallL( RFile& aFileHandle, 
    83 void CSilentLauncher::InstallL( const TDesC& aFile, TRequestStatus& aStatus )
   133                                 const TDesC& aFile, 
       
   134                                 TRequestStatus& aStatus )
       
   135     {
    84     {
   136     FLOG( _L("Daemon: CSilentLauncher::InstallL (aFileHandle) START") );
       
   137     
       
   138     if ( !iConnected )
    85     if ( !iConnected )
   139          {
    86         {
   140          FLOG( _L("Daemon: Connect to sif installer server") );    
    87         FLOG( _L("Daemon: Connect to installer server") );    
   141          User::LeaveIfError( iSWInstallerFW.Connect() );             
    88         User::LeaveIfError( iLauncher.Connect() );    
   142          iConnected = ETrue;            
    89         FLOG( _L("Daemon: Connected to installer server") );
   143          }
    90         iConnected = ETrue;            
       
    91         }
   144         
    92         
   145     // Set drive for installer.
    93 #ifdef RD_MULTIPLE_DRIVE 
   146 //    delete iDrive  
    94     FLOG( _L("Daemon: InstallL: Set drive for install") );   
   147 //    iDrive = NULL;
    95     // Set drive for installer.          
   148 //    iDrive = HBufC::NewLC( 8 );
    96     iOptions.iDrive = aFile[0];
   149 //    TPtr drivePtr = iDrive->Des();
    97 #endif                
   150 //     
    98 
   151 //    TInt driveNumber = 0;
    99     // Launch the installation
   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                                  
       
   157     FLOG( _L("Daemon: Launch install") );
   100     FLOG( _L("Daemon: Launch install") );
   158     iSWInstallerFW.Install( aFileHandle, 
   101     iLauncher.SilentInstall( aStatus, aFile, iOptionsPckg );
   159                            *iSifOptions, 
       
   160                            *iSifResults,
       
   161                            aStatus,
       
   162                            ETrue );
       
   163     
       
   164     FLOG( _L("Daemon: CSilentLauncher::InstallL (aFileHandle) END") );       
       
   165     }
   102     }
   166        
   103        
   167 // -----------------------------------------------------------------------------
   104 // -----------------------------------------------------------------------------
   168 // CSilentLauncher::Cancel
   105 // CSilentLauncher::Cancel
   169 // Cancel the current installation.
   106 // Cancel the current installation.
   170 // (other items were commented in a header).
   107 // (other items were commented in a header).
   171 // -----------------------------------------------------------------------------
   108 // -----------------------------------------------------------------------------
   172 // 
   109 // 
   173 void CSilentLauncher::Cancel()
   110 void CSilentLauncher::Cancel()
   174     {
   111     {
   175     FLOG( _L("Daemon: Cancel Install operation") );            
   112     FLOG( _L("Daemon: Install cancel requested") );        
   176     iSWInstallerFW.CancelOperation();
   113     iLauncher.CancelAsyncRequest( SwiUI::ERequestSilentInstall );   
   177     }
   114     }
   178 
   115 
   179 //  End of File  
   116 //  End of File