installationservices/swi/source/swis/server/planner.h
changeset 0 ba25891c3a9e
child 19 7ca52d38f8c3
child 25 98b66e4fb0be
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 the License "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: 
       
    15 * Definition of the CPlanner
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalTechnology
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __PLANNER_H__
       
    27 #define __PLANNER_H__
       
    28 
       
    29 #include <e32std.h>
       
    30 
       
    31 #include "sisuihandler.h"
       
    32 #include "sisinstallationresult.h"
       
    33 #include "application.h"
       
    34 #include "sisregistrywritableentry.h"
       
    35 #include "sisregistrywritablesession.h"
       
    36 #include "sisregistrypackage.h"
       
    37 
       
    38 namespace Swi 
       
    39 {
       
    40 class RUiHandler;            // UISS handle
       
    41 class CAppInfo;            
       
    42 class CInstallationPlan;
       
    43 class RSisRegistryEntry;
       
    44 class CSisRegistryPackage;
       
    45 class CPlan;
       
    46 class CUninstallationNode;
       
    47 class CApplication;
       
    48 
       
    49 namespace Sis 
       
    50 {
       
    51 class COptions;             // SISX options
       
    52 }
       
    53 
       
    54 /**
       
    55  * This class plans the uninstallation. It asks the user all the required 
       
    56  * questions (regarding dependencies and files/apps in use) and builds a list 
       
    57  * of application and files that need to be uninstalled, without actually 
       
    58  * changing the state of the device.
       
    59  *
       
    60  * @released
       
    61  * @internalTechnology
       
    62  */
       
    63 class CPlanner : public CBase
       
    64 	{
       
    65 public:
       
    66 	static CPlanner* NewL(RUiHandler& aUiHandler, CInstallationResult& aResult);
       
    67 	static CPlanner* NewLC(RUiHandler& aUiHandler, CInstallationResult& aResult);
       
    68 
       
    69 	virtual ~CPlanner(void);
       
    70 
       
    71 public:
       
    72 
       
    73 	CPlan* TransferPlanOwnership();
       
    74 	CApplication* UninstallPackageL(CSisRegistryPackage& aPackage, TBool aTopLevelPackage);
       
    75 	
       
    76 protected:
       
    77 	CPlanner(RUiHandler& aInstallerUI, CInstallationResult& aInstallationResult);
       
    78 
       
    79 	void ConstructL();
       
    80 	
       
    81 protected:
       
    82 	void AbortL();
       
    83 	void DisplayDependentPackagesDialogL(const RPointerArray<CSisRegistryPackage>& aDependentPackages) const;
       
    84 	void SetProgressBarFinalValueL(TInt aFinalValue);
       
    85 	void SetupApplicationInformationL(RSisRegistryEntry& aRegistryEntry);
       
    86 
       
    87 	inline RUiHandler& UiHandler();
       
    88 	inline CPlan& Plan();
       
    89 	inline const CPlan& Plan() const;
       
    90 
       
    91 private:
       
    92 	TBool IsInPlannedPackages(RPointerArray<CSisRegistryPackage>& aPlannedPackages, const CSisRegistryPackage& aPackage) const;
       
    93 	void CreateUninstallationTreeL(CUninstallationNode& aRootNode);
       
    94 	void CreateChildNodesL(CUninstallationNode& aParentNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages);
       
    95 	void CreateNewNodesL(RPointerArray<CSisRegistryPackage>& aProcessPackages, CUninstallationNode& aParentNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages);
       
    96 	TBool ValidateUninstallationCandidateL(CUninstallationNode& aAppToProcess, RPointerArray<CSisRegistryPackage>& aPlannedPackages);
       
    97 	CApplication* CreatePlannedApplicationL(CUninstallationNode& aRootNode);
       
    98 	void ConfirmForUninstallL(CUninstallationNode& aNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages);
       
    99 	void UpdateAppForUninstallL(CApplication& aApplication, CUninstallationNode& aNode);
       
   100 	
       
   101 protected:
       
   102 	/// The drive on which to store device integrity data (hashes, registry etc) 
       
   103 	TChar iSystemDriveChar;		
       
   104 	
       
   105 private:
       
   106 	/// Handle to UISS
       
   107 	RUiHandler& iUiHandler;
       
   108 
       
   109 	/// Result of uninstallation
       
   110 	CInstallationResult& iResult;
       
   111 
       
   112 	/// The uninstallation plan that will be populated by this class
       
   113 	CPlan* iPlan;
       
   114 
       
   115 	/**
       
   116 	 * Information about the application being installed or uninstalled.
       
   117 	 * This is passed to the UI callbacks.
       
   118 	 */
       
   119 	CAppInfo* iAppInfo;
       
   120 
       
   121 	// Registry Session
       
   122 	RSisRegistryWritableSession iRegistrySession;
       
   123 	};
       
   124 
       
   125 // inline functions from CPlanner
       
   126 
       
   127 /**
       
   128  * @return Returns the UI Handler.
       
   129  */
       
   130 inline RUiHandler& CPlanner::UiHandler()
       
   131 	{
       
   132 	return iUiHandler;
       
   133 	}
       
   134 
       
   135 /**
       
   136  * @return Returns a reference to the plan.
       
   137  */
       
   138 inline CPlan& CPlanner::Plan()
       
   139 	{
       
   140 	return *iPlan;
       
   141 	}
       
   142 
       
   143 /**
       
   144  * @return Returns a const reference to the plan.
       
   145  */
       
   146 inline const CPlan& CPlanner::Plan() const
       
   147 	{
       
   148 	return *iPlan;
       
   149 	}
       
   150 
       
   151 } // namespace Swi 
       
   152 
       
   153 #endif