|
1 /* |
|
2 * Copyright (c) 2006 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: cbsinstallhandler.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CBSINSTALLHANDLER_H__ |
|
20 #define __CBSINSTALLHANDLER_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class RFs; |
|
26 |
|
27 /** |
|
28 * CBSInstallHandler |
|
29 * |
|
30 * Handles installation and uninstallation of brand packages. |
|
31 * Calls external application "bsinstall.exe" to do the actual work. |
|
32 * Can Observe the installation directory so that any sis installation |
|
33 * can be detected while the server is running. |
|
34 * |
|
35 */ |
|
36 NONSHARABLE_CLASS( CBSInstallHandler ): public CActive |
|
37 { |
|
38 public: |
|
39 |
|
40 // Operations for folder synchronization: |
|
41 enum TInstallOperation |
|
42 { |
|
43 // copy files from source to destination if they don't |
|
44 // already exists. |
|
45 EInstallCopyNewToDest, |
|
46 |
|
47 // Delete files from source directory if the same |
|
48 // files doesn't exist in destination directory. |
|
49 EInstallDeleteFromSrc |
|
50 }; |
|
51 |
|
52 public: // constructors |
|
53 |
|
54 static CBSInstallHandler* NewL(); |
|
55 |
|
56 virtual ~CBSInstallHandler(); |
|
57 |
|
58 private: // constructors |
|
59 |
|
60 void ConstructL(); |
|
61 |
|
62 CBSInstallHandler(); |
|
63 |
|
64 public: |
|
65 |
|
66 /** |
|
67 * Uninstall removed brands and installs new brands. |
|
68 * This should be called right after construction to sync the |
|
69 * installation state. |
|
70 */ |
|
71 void InstallNewFilesL(); |
|
72 |
|
73 /** |
|
74 * Start observing installation folder. Detects new brands if they |
|
75 * are installed while the server is active. |
|
76 */ |
|
77 void StartObservingL(); |
|
78 |
|
79 /** |
|
80 * Stop observing installation folder. All new brands are installed |
|
81 * only when calling InstallNewFilesL. |
|
82 */ |
|
83 void StopObserving(); |
|
84 |
|
85 private: // From CActive |
|
86 |
|
87 /** |
|
88 * @see CActive |
|
89 */ |
|
90 void RunL(); |
|
91 |
|
92 /** |
|
93 * @see CActive |
|
94 */ |
|
95 void DoCancel(); |
|
96 |
|
97 private: // new methods |
|
98 |
|
99 /** |
|
100 * Launches external installer application. It should install all |
|
101 * available brands into server. |
|
102 */ |
|
103 void LaunchInstallerAppL(); |
|
104 |
|
105 /** |
|
106 * Sync files between aSrcDir and aDestDir, according to given |
|
107 * operation. See TInstallOperation for operations. Calls |
|
108 * OperationNotifyL before every operation. |
|
109 * |
|
110 * @param aSrcDir Source directory |
|
111 * @param aDestDir Destination directory |
|
112 * @param aOperation Sync operation to execute |
|
113 * @return ETrue - Something synchronized |
|
114 * EFalse - Nothing synchronized |
|
115 */ |
|
116 TBool SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, |
|
117 TInstallOperation aOperation ); |
|
118 |
|
119 /** |
|
120 * Notification that file is about to be synchronized. |
|
121 * |
|
122 * @param aOperation operation type which will be executed |
|
123 * @param aSrcFile file under operation |
|
124 */ |
|
125 void OperationNotifyL( TInstallOperation aOperation, |
|
126 const TDesC& aSrcFile ); |
|
127 |
|
128 /** |
|
129 * check if some version of given brand is installed in |
|
130 * branding server. |
|
131 * |
|
132 * @param aBrand brand installation file to check |
|
133 * this has to be brand file name without extension and |
|
134 * version information. |
|
135 */ |
|
136 TBool IsBrandInstalled( const TDesC& aBrand ); |
|
137 |
|
138 /** |
|
139 * Helper method to get servers private path |
|
140 * @param aPath contains the path to servers private folder |
|
141 * @param aAppend text to add into private path. |
|
142 */ |
|
143 void GetPrivateFolder( TDes& aPath, const TDesC& aAppend = KNullDesC ); |
|
144 |
|
145 /** |
|
146 * To create a flag file if brand gets discarded |
|
147 * @param aSrcFile file under operation |
|
148 */ |
|
149 void CreateFlagFile(const TDesC& aSrcFile); |
|
150 |
|
151 /** |
|
152 * Checks if an discarded brand exists. |
|
153 * (It also writes the RProperty for the bsinstall.exe) |
|
154 * |
|
155 * @param aDir the folder of the data storages |
|
156 * @return ETrue, in case a discarded brand was found, EFalse otherwise |
|
157 */ |
|
158 TBool CheckForDiscardedBrandsL( const TDesC& aDir ); |
|
159 |
|
160 |
|
161 /** |
|
162 * Updates the RProperty. The specified string is added to the |
|
163 * RProperty only if RProperty does not contain the same string yet. |
|
164 * |
|
165 * @param aUninstallationString a string |
|
166 */ |
|
167 void UpdateRPropertyL( const TDesC& aUninstallationString ); |
|
168 |
|
169 private: // data |
|
170 |
|
171 // Own. File server session handle. |
|
172 RFs iFs; |
|
173 }; |
|
174 |
|
175 #endif // __CBSINSTALLHANDLER_H__ |
|
176 // END OF FILE |