|
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 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: This file contains the header file of the CWidgetOperationsWatcher class. |
|
15 * |
|
16 * This class implements the ECom SWInstUIPluginAPI interface |
|
17 * for midlet installation. |
|
18 * |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef WIDGETUIOPERATIONWATCHER_H |
|
24 #define WIDGETUIOPERATIONWATCHER_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include <SWInstDefs.h> |
|
29 #include <SWInstTaskManager.h> |
|
30 #include <SWInstLogTaskParam.h> |
|
31 #include <WidgetRegistryClient.h> |
|
32 #include "cuicanceltimer.h" |
|
33 #include "WidgetUIHandler.h" |
|
34 #include "IconConverter.h" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CZipFile; |
|
38 class CZipFileMemberIterator; |
|
39 |
|
40 namespace SwiUI |
|
41 { |
|
42 // CONSTANTS |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 class CWidgetUIConfigHandler; |
|
46 class CWidgetRegistrationManager; |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 |
|
51 /** |
|
52 * This class is provided for callback to notify icon conversion completion. |
|
53 * @lib WidgetInstallerUI.lib |
|
54 * @since 3.1 |
|
55 */ |
|
56 class MConverterController |
|
57 { |
|
58 public: |
|
59 /** |
|
60 * notify icon conversion completion |
|
61 */ |
|
62 virtual void NotifyCompletionL( TInt aErr ) = 0; |
|
63 }; |
|
64 |
|
65 |
|
66 /** |
|
67 * This class handles the asynchronous install / unsinstall requests. |
|
68 * |
|
69 * @lib WidgetInstallerUi.lib |
|
70 * @since 3.1 |
|
71 */ |
|
72 class CWidgetUIOperationsWatcher : public CActive, |
|
73 public CommonUI::MCUICancellable, |
|
74 public MWidgetUICancelObserver, |
|
75 public MConverterController |
|
76 { |
|
77 public: // Constructors and destructor |
|
78 /** |
|
79 * Two-phased constructor. |
|
80 */ |
|
81 static CWidgetUIOperationsWatcher* NewL(); |
|
82 |
|
83 /** |
|
84 * Destructor. |
|
85 */ |
|
86 virtual ~CWidgetUIOperationsWatcher(); |
|
87 |
|
88 public: // New functions |
|
89 /** |
|
90 * Handle install request. |
|
91 * @since 3.1 |
|
92 */ |
|
93 void InstallL( RFile&, const TDesC8&, TRequestStatus& ); |
|
94 |
|
95 /** |
|
96 * Handle silent install request. |
|
97 * @since 3.1 |
|
98 */ |
|
99 void SilentInstallL( RFile&, const TDesC8&, TRequestStatus& ); |
|
100 |
|
101 /** |
|
102 * Handle uninstall request. |
|
103 * @since 3.1 |
|
104 */ |
|
105 void UninstallL( const TUid& aUid, TRequestStatus& aRequestStatus ); |
|
106 |
|
107 /** |
|
108 * Handle silent uninstall request. |
|
109 * @since 3.1 |
|
110 */ |
|
111 void SilentUninstallL( const TUid&, TRequestStatus& ); |
|
112 |
|
113 /** |
|
114 * Called when installation or update is finished, do the final |
|
115 * steps of registration, file clean up (remove temporary files, |
|
116 * display complete message, or handle error. |
|
117 */ |
|
118 void FinishInstallL(); |
|
119 |
|
120 /** |
|
121 * Called when uninstallation is finished, do the final steps of |
|
122 * deregistration, etc, display complete message, or handle error. |
|
123 */ |
|
124 void FinishUninstallL( TInt aErr ); |
|
125 |
|
126 /** |
|
127 * Called when install or uninstallation is finished, to update installer log |
|
128 */ |
|
129 void HandleLogsL(const TDesC& aWidgetName, const TUid &aUid,TBool aVendor, SwiUI::TLogTaskAction aAction); |
|
130 |
|
131 |
|
132 public: // Functions from base classes |
|
133 /** |
|
134 * From CActive, Called by framework when request is finished. |
|
135 * @since 3.1 |
|
136 */ |
|
137 void RunL(); |
|
138 |
|
139 /** |
|
140 * From CActive, Called by framework when request is cancelled. |
|
141 * @since 3.1 |
|
142 */ |
|
143 void DoCancel(); |
|
144 |
|
145 /** |
|
146 * From CActive, Handles a leave occurring in the request completion |
|
147 * event handler RunL(). |
|
148 * @since 3.1 |
|
149 */ |
|
150 TInt RunError( TInt aError ); |
|
151 |
|
152 /** |
|
153 * From MWidgetUICancelObserver, Called when user has cancelled |
|
154 * the operation. |
|
155 * @since 3.1 |
|
156 */ |
|
157 void UserCancelL( TBool aCancelImmediately = ETrue ); |
|
158 |
|
159 /** |
|
160 * From MCUICancellable, Indicates if a modal dialog is currently shown. |
|
161 */ |
|
162 TBool IsShowingDialog(); |
|
163 |
|
164 /** |
|
165 * From MCUICancellable, Cancels the installation engine. |
|
166 */ |
|
167 void CancelEngine(); |
|
168 |
|
169 /** |
|
170 * From MCUICancellable, Called when nothing else has worked. |
|
171 */ |
|
172 void ForceCancel(); |
|
173 |
|
174 /** |
|
175 * From MCUICancellable, Called to indicate that the cancelling progress |
|
176 * has been started. |
|
177 */ |
|
178 void StartedCancellingL(); |
|
179 |
|
180 /** |
|
181 * Used for notify icon convertion complete |
|
182 */ |
|
183 void NotifyCompletionL( TInt aErr ) ; |
|
184 |
|
185 private: |
|
186 /** |
|
187 * C++ default constructor. |
|
188 * @param aRequestStatus - Status of the request. |
|
189 */ |
|
190 CWidgetUIOperationsWatcher(); |
|
191 |
|
192 /** |
|
193 * 2nd phase constructor. |
|
194 */ |
|
195 void ConstructL(); |
|
196 |
|
197 /** |
|
198 * @since 5.0 |
|
199 */ |
|
200 void InstallSubfunctionL( RFile& aFile, TBool& userCancel, |
|
201 TRequestStatus& aRequestStatus ); |
|
202 |
|
203 /** |
|
204 * Create widget entry by parsing the info.plist, insert the entry into the entry list |
|
205 * if the entry is not already existing. |
|
206 * @return the existed widget's index if already present |
|
207 * @since 3.1 |
|
208 */ |
|
209 TInt PreprocessWidgetBundleL(); |
|
210 |
|
211 /** |
|
212 * Prompt user to choose mamory to install/update the widget |
|
213 * @return true if user choose a momory unit, Leaves if user's choosed memory is not sufficient |
|
214 * @since 3.1 |
|
215 */ |
|
216 TBool SelectMemoryL(); |
|
217 |
|
218 /** |
|
219 * update basepath of widget |
|
220 * @since 3.1 |
|
221 */ |
|
222 void UpdateWidgetBasePathL( TDriveUnit& aDrive ); |
|
223 |
|
224 |
|
225 /** |
|
226 * Start the icon convertion |
|
227 * @since 3.1 |
|
228 */ |
|
229 void ConvertIconL( TUid& aUid, const TDesC& aIconPath ); |
|
230 |
|
231 /** |
|
232 * Prompt user to install and select memory to use |
|
233 * @since 3.1 |
|
234 */ |
|
235 TBool PromptUserForInstallL( TBool aOverwrite ); |
|
236 |
|
237 /** |
|
238 * Prompt user with security warning about installing |
|
239 * untrusted widgets |
|
240 * @since 5.0 |
|
241 */ |
|
242 TBool PromptUserForUntrustedWidgetL( ); |
|
243 |
|
244 /** |
|
245 * When overwriting an installed widget, backup so can restore on error |
|
246 * @since 3.1 |
|
247 */ |
|
248 void BackupL(); |
|
249 |
|
250 /** |
|
251 * When overwriting an installed widget, restore on error |
|
252 * @since 3.1 |
|
253 */ |
|
254 void RestoreL(); |
|
255 |
|
256 private: // Data |
|
257 |
|
258 // A few state variables with the normal case complexity being |
|
259 // that icon processing runs in parallel with unzipping so if |
|
260 // unzipping ends first then final steps are triggered by icon |
|
261 // processing completion and if icon processing ends first then |
|
262 // unzipping triggers the final steps. If cancelling either by |
|
263 // user or some external system event, then final steps are |
|
264 // triggered by DoCancel(). |
|
265 TBool iUnzipping; |
|
266 TBool iOverwriting; |
|
267 TBool iProcessingIcon; |
|
268 TBool iIconSearchFinished; // search in zip archive |
|
269 TInt iIconError; |
|
270 TBool iCancelled; |
|
271 // TODO: may need to implement silent mode in future |
|
272 TBool iSilent; // silent mode |
|
273 |
|
274 TRequestStatus* iRequestStatus; // pointer to request status of caller |
|
275 |
|
276 CFileMan* iFileMgr; // owned |
|
277 RFs iRfs; // owned |
|
278 CZipFile* iZipFile; // owed |
|
279 CZipFileMemberIterator* iMembers; // owned |
|
280 |
|
281 RWidgetRegistryClientSession iRegistry; |
|
282 TBool iServerConnected; // to Widget Registry server |
|
283 |
|
284 CWidgetUIHandler* iUIHandler; // owned |
|
285 CWidgetUIConfigHandler* iWidgetConfigHandler; // owned |
|
286 CWidgetRegistrationManager* iAppManager; // owned |
|
287 |
|
288 // active object to asynchronously convert png icon to mbm |
|
289 CIconConverter* iIconConverter; // owned |
|
290 |
|
291 TFileName iOriginalDir; // for overwrite backup/restore |
|
292 TFileName iBackupDir; // for overwrite backup/restore |
|
293 |
|
294 // these values mainly come from parsing bundle metadata file |
|
295 // (info.plist) and are passed to WidgetRegistry for registration. |
|
296 RPointerArray<CWidgetPropertyValue> iPropertyValues; |
|
297 |
|
298 // task manager pointer for install logs |
|
299 CTaskManager* iTaskManager; |
|
300 // TODO: To be investigated |
|
301 //CommonUI::CCUICancelTimer* iCanceller; |
|
302 }; |
|
303 } |
|
304 |
|
305 #endif // WIDGETUIOPERATIONWATCHER_H |
|
306 |
|
307 // End of File |