appinstaller/AppinstUi/Plugin/SisxUI/Inc/SisxUIOperationWatcher.h
changeset 80 9dcba1ee99f7
parent 77 d1838696558c
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   This file contains the header file of the CSisxUIOperationWatcher class 
       
    15 *
       
    16 *                This class handles the asynchronous install / unsinstall 
       
    17 *                requests.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef SISXUIOPERATIONWATCHER_H
       
    23 #define SISXUIOPERATIONWATCHER_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <SWInstStartupTaskParam.h>
       
    28 #include <SWInstLogTaskParam.h>
       
    29 
       
    30 #include "SisxUIHandler.h"
       
    31 #include "CUICancelTimer.h"
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 namespace ContentAccess
       
    35 {
       
    36 class CManager;
       
    37 class TAgent;
       
    38 }
       
    39 
       
    40 namespace Swi 
       
    41 { 
       
    42 class CInstallPrefs; 
       
    43 class CAsyncLauncher;
       
    44 class CSisRegistryPackage;
       
    45 }
       
    46 
       
    47 namespace SwiUI
       
    48 {
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 
       
    52 class CTaskManager;
       
    53 class CTask;
       
    54 class CSisxUIAppInfo;
       
    55 
       
    56 // CLASS DECLARATION
       
    57 
       
    58 /**
       
    59 * This class handles the asynchronous install / unsinstall requests.
       
    60 *
       
    61 * @lib sisxui.lib
       
    62 * @since 3.0
       
    63 */
       
    64 class CSisxUIOperationWatcher : public CActive, 
       
    65                                 public MSisxUICancelObserver,
       
    66                                 public CommonUI::MCUICancellable
       
    67     {
       
    68     public:  // Constructors and destructor
       
    69      
       
    70         /**
       
    71         * Two-phased constructor.
       
    72         */
       
    73         static CSisxUIOperationWatcher* NewL();
       
    74 
       
    75         /**
       
    76         * Destructor.
       
    77         */
       
    78         virtual ~CSisxUIOperationWatcher();
       
    79 
       
    80     public: // New functions
       
    81 
       
    82         /**
       
    83         * Handle install request.
       
    84         * @since 3.0
       
    85         */
       
    86         void InstallL( RFile& aFile, 
       
    87                        const TDesC8& aMIME, 
       
    88                        TBool aIsDRM,
       
    89                        TRequestStatus& aRequestStatus );
       
    90 
       
    91         /**
       
    92         * Handle silent install request.
       
    93         * @since 3.0
       
    94         */
       
    95         void SilentInstallL( RFile& aFile, 
       
    96                              const TDesC8& aMIME, 
       
    97                              TBool aIsDRM,
       
    98                              TInstallOptions& aOptions, 
       
    99                              TRequestStatus& aRequestStatus );
       
   100         
       
   101         /**
       
   102         * Handle uninstall request.
       
   103         * @since 3.0
       
   104         */
       
   105         void UninstallL( const TUid& aUid, TRequestStatus& aRequestStatus );
       
   106 
       
   107         /**
       
   108         * Handle silent uninstall request.
       
   109         * @since 3.0
       
   110         */
       
   111         void SilentUninstallL( const TUid& aUid, 
       
   112                                TUninstallOptions& aOptions, 
       
   113                                TRequestStatus& aRequestStatus );
       
   114         /**
       
   115         * Uninstalls only a specific augmentation (sispatch)
       
   116         * @since 3.0
       
   117         * @param aUid - Uid of the package.
       
   118         * @param aIndex - Index of the augmentation.
       
   119         */
       
   120         void UninstallAugmentationL( const TUid& aUid, TInt aIndex, TRequestStatus& aRequestStatus ); 
       
   121 
       
   122         /**
       
   123         * Uninstalls only a specific augmentation (sispatch) - silently.
       
   124         * @since 3.0
       
   125         * @param aUid - Uid of the package.
       
   126         * @param aOptions - Options for the silent operation.
       
   127         * @param aIndex - Index of the augmentation.
       
   128         */
       
   129         void SilentUninstallAugmentationL( const TUid& aUid, 
       
   130                                            TUninstallOptions& aOptions,
       
   131                                            TInt aIndex, 
       
   132                                            TRequestStatus& aRequestStatus );         
       
   133 
       
   134         /**
       
   135         * Informs the UI, about final completion.
       
   136         * @since 3.0
       
   137         */
       
   138         void FinalCompleteL();  
       
   139 
       
   140     public: // Functions from base classes
       
   141 
       
   142         /**
       
   143         * From CActive, Override.
       
   144         * @since 3.0
       
   145         */
       
   146         void Cancel();
       
   147 
       
   148         /**
       
   149         * From CActive, Called by framework when request is finished.
       
   150         * @since 3.0
       
   151         */
       
   152         void RunL();
       
   153 
       
   154         /**
       
   155         * From CActive, Called by framework when request is cancelled.
       
   156         * @since 3.0
       
   157         */        
       
   158         void DoCancel();  
       
   159 
       
   160         /**
       
   161         * From CActive, Handles a leave occurring in the request completion 
       
   162         * event handler RunL().
       
   163         * @since 3.0
       
   164         */
       
   165         TInt RunError( TInt aError );
       
   166 
       
   167         /**
       
   168         * From MSisxUICancelObserver, Called when user has cancelled the operation.
       
   169         * @since 3.0
       
   170         */  
       
   171         void UserCancelL( TBool aCancelImmediately );   
       
   172 
       
   173         /**
       
   174         * From MCUICancellable, Indicates if a modal dialog is currently shown.
       
   175         */
       
   176         TBool IsShowingDialog();
       
   177 
       
   178         /**
       
   179         * From MCUICancellable, Cancels the installation engine.
       
   180         */       
       
   181         void CancelEngine();
       
   182 
       
   183         /**
       
   184         * From MCUICancellable, Called when nothing else has worked.
       
   185         */               
       
   186         void ForceCancel();         
       
   187 
       
   188         /**
       
   189         * From MCUICancellable, Called to indicate that the cancelling progress 
       
   190         * has been started.
       
   191         */  
       
   192         void StartedCancellingL();         
       
   193 
       
   194     private:
       
   195 
       
   196         /**
       
   197         * Completes the pending request.
       
   198         * @param aResult - Result of the request
       
   199         */
       
   200         void CompleteRequest( TInt aResult );
       
   201         
       
   202     private:
       
   203 
       
   204         /**
       
   205         * C++ default constructor.
       
   206         * @param aRequestStatus - Status of the request.
       
   207         */
       
   208         CSisxUIOperationWatcher();
       
   209 
       
   210         /**
       
   211         * 2nd phase constructor.
       
   212         */
       
   213         void ConstructL();
       
   214 
       
   215         /**
       
   216         * Add files to startup list.
       
   217         * @since 3.0
       
   218         */
       
   219         void AddStartupItemsL( RArray<TStartupTaskParam>& aParams );
       
   220         
       
   221         /**
       
   222         * Remove files from the startup list.
       
   223         * @since 3.0
       
   224         */
       
   225         void RemoveStartupItemsL( RArray<TStartupTaskParam>& aParams );
       
   226 
       
   227         /**
       
   228         * Checks if the given uid has installed a startup file. If it finds one
       
   229         * it removes it and creates a task to remove the items as well.
       
   230         * @since 3.0
       
   231         */
       
   232         void RemoveStartupFileL( TUid aUid );        
       
   233 
       
   234         /**
       
   235         * Handles the log entry addition.
       
   236         * @since 3.0
       
   237         * @param aAppInfo - Package info.
       
   238         * @param aAction - Action of the log.
       
   239         * @param aIsStartup - Indicates if the startup list was modified.
       
   240         */
       
   241         void HandleLogL( const CSisxUIAppInfo& aAppInfo, 
       
   242                          const TLogTaskAction& aAction, 
       
   243                          TBool aIsStartup );   
       
   244 
       
   245         /**
       
   246         * Helper to handle the case of pip file.
       
   247         * @since 3.0
       
   248         * @param aPipFileHandle - Handle to pip file.
       
   249         * @param aSisFileHandle - On return contains handle to sis file.
       
   250         */
       
   251         void HandlePipFileL( RFile& aPipFileHandle, RFile& aSisFileHandle );        
       
   252 
       
   253         /**
       
   254         * Helper to read ocsp values from central repository and prepare the ui.
       
   255         * @since 3.0
       
   256         * @param aUIHandler - UI handler.
       
   257         * @param aPrefs - Engine install preferences.
       
   258         */
       
   259         void PrepareOCSPL( CSisxUIHandler* aUIHandler, Swi::CInstallPrefs* aPrefs );
       
   260 
       
   261         /**
       
   262         * Helper to get the packages that were installed in this session.
       
   263         * @since 3.0
       
   264         * @param aPackages - On return contains the installed packages.
       
   265         */
       
   266         void GetInstalledPackagesL( RPointerArray<CSisxUIAppInfo>& aPackages );
       
   267         
       
   268         /**
       
   269         * Helper to handle startup list addition.
       
   270         * @since 3.0
       
   271         * @param aAppInfo - Installed application.
       
   272         */
       
   273         void HandleStartupAdditionL( const CSisxUIAppInfo& aAppInfo ); 
       
   274 
       
   275         /**
       
   276         * Prepares the installation.
       
   277         * @since 3.0
       
   278         */
       
   279         void PrepareInstallL();
       
   280 
       
   281         /**
       
   282         * Completes the installation
       
   283         * @since 3.0
       
   284         */
       
   285         void CompleteInstallationL();
       
   286 
       
   287         /**
       
   288         * Completes the uninstallation
       
   289         * @since 3.0
       
   290         */
       
   291         void CompleteUninstallationL();  
       
   292 
       
   293         /**
       
   294         * Performs the uninstallation of augmentation.
       
   295         * @since 3.0
       
   296         * @param aUid - Uid of the package.
       
   297         * @param aIndex - Index of the augmentation.
       
   298         */
       
   299         void DoUninstallAugmentationL( TUid aUid, TInt aIndex ); 
       
   300 
       
   301         /**
       
   302         * Notifies that uninstallation is about to start.
       
   303         * @since 3.0
       
   304         * @param aUid - Uid of the package to be uninstalled.
       
   305         */
       
   306         void NotifyStartUninstallL( TUid aUid );
       
   307         
       
   308         /**
       
   309         * Notifies that uninstallation has been completed.
       
   310         * @since 3.0
       
   311         */
       
   312         void NotifyEndUninstall();   
       
   313 
       
   314         /**
       
   315         * Handles searching correct manager for DRM registration
       
   316         * @since 3.0
       
   317         * @param aAgent - content access agent
       
   318         * @return Manager - Manages files and content access agents
       
   319         */        
       
   320         ContentAccess::CManager* GetCafDataL( ContentAccess::TAgent& aAgent );
       
   321         
       
   322         /**
       
   323          * Register PIP package content to DRM DCF server.
       
   324          * @since 5.0
       
   325          * @param aUID - Sis package UID       
       
   326          */                        
       
   327          void RegisterContentToDCF( TUid aUid );
       
   328   
       
   329          /**
       
   330           * Search files which should be register to DCF server.
       
   331           * @since 5.0
       
   332           * @param aSourceArray - Array conteining file paths.
       
   333           * @param aTargetArray - Array for files which should be register.     
       
   334           */                      
       
   335          void SearchFilesForDCFL( 
       
   336              RPointerArray<HBufC>& aSourceArray,
       
   337              RPointerArray<HBufC>& aTargetArray );        
       
   338         
       
   339                 
       
   340     private: // Data
       
   341 
       
   342         Swi::CAsyncLauncher* iLauncher;        
       
   343         CSisxUIHandler* iUIHandler;
       
   344         CTaskManager* iTaskManager;        
       
   345 
       
   346         TRequestStatus* iRequestStatus;
       
   347         RFile iSourceFile;
       
   348         HBufC8* iMIME;        
       
   349 
       
   350         TUid iUninstalledUid;
       
   351 
       
   352         // Pip file related
       
   353         RFile iTempFile;  // Points to extracted sis file
       
   354         RFs iRfs;        
       
   355         TBool iIsPipFile;
       
   356         TFileName iTempDir;        
       
   357 
       
   358         RPointerArray<HBufC> iInstalledFiles;
       
   359         RPointerArray<Swi::CSisRegistryPackage> iAugmentations;        
       
   360 
       
   361         TBool iStartupModified; 
       
   362         TBool iPreparing;  
       
   363         TBool iCancelOngoing;   
       
   364         TBool iIsUserCancel;        
       
   365         TBool iIsAugmentation;        
       
   366 
       
   367         TBool iIsSilent;
       
   368         TBool iDoSilentOcsp;        
       
   369         
       
   370         CommonUI::CCUICancelTimer* iCanceller;
       
   371         RArray<TInt> iSupportedLanguages;
       
   372         TBool iDeletionOngoing;
       
   373     };
       
   374 }
       
   375 
       
   376 #endif      // SISXUIOPERATIONWATCHER_H   
       
   377             
       
   378 // End of File