|
1 /* |
|
2 * Copyright (c) 2007-2010 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 CIAUpdateAppUi class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __IAUPDATE_APPUI_H__ |
|
21 #define __IAUPDATE_APPUI_H__ |
|
22 |
|
23 //INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <aknViewAppUi.h> |
|
26 #include <cmmanagerext.h> |
|
27 |
|
28 #include "iaupdateuidefines.h" |
|
29 #include "iaupdateuicontrollerobserver.h" |
|
30 #include "iaupdatedialogutil.h" |
|
31 #include "iaupdateuitimerobserver.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CIAUpdateMainView; |
|
35 class CIAUpdateHistoryView; |
|
36 class CIAUpdateUiController; |
|
37 class CIAUpdateParameters; |
|
38 class MIAUpdateRequestObserver; |
|
39 class CIAUpdateGlobalLockHandler; |
|
40 class CIAUpdateUITimer; |
|
41 |
|
42 /*! |
|
43 @class CIAUpdateAppUi |
|
44 |
|
45 An instance of class CIAUpdateAppUi is the UserInterface part of the AVKON |
|
46 application framework for the IAUpdate example application |
|
47 */ |
|
48 class CIAUpdateAppUi : |
|
49 public CAknViewAppUi, |
|
50 public MIAUpdateUiControllerObserver, |
|
51 public MIAUpdateTextLinkObserver, |
|
52 public MIAUpdateUITimerObserver |
|
53 { |
|
54 public: |
|
55 |
|
56 /* |
|
57 * Perform the second phase construction of a CIAUpdateAppUi object |
|
58 * this needs to be public due to the way the framework constructs the AppUi |
|
59 */ |
|
60 void ConstructL(); |
|
61 |
|
62 /*! |
|
63 * Perform the first phase of two phase construction. |
|
64 * This needs to be public due to the way the framework constructs the AppUi |
|
65 */ |
|
66 CIAUpdateAppUi(); |
|
67 |
|
68 |
|
69 /* |
|
70 * Destroy the object and release all memory objects |
|
71 */ |
|
72 virtual ~CIAUpdateAppUi(); |
|
73 |
|
74 void StartedByLauncherL( MIAUpdateRequestObserver& aObserver, |
|
75 TBool aRefreshFromNetworkDenied ); |
|
76 |
|
77 /** |
|
78 * When the update check operation is started through |
|
79 * the API, the session directs the requests for the UI. UI will |
|
80 * handle the operation and inform the observer when the operation is |
|
81 * completed. |
|
82 * @param aObserver This observer is informed when the operation has |
|
83 * been completed. |
|
84 * @param aFilterParams These parameters are used when update items |
|
85 * are filtered for the UI list. |
|
86 */ |
|
87 void CheckUpdatesRequestL( MIAUpdateRequestObserver& aObserver, |
|
88 CIAUpdateParameters* aFilterParams, |
|
89 TBool aForcedRefresh ); |
|
90 |
|
91 /** |
|
92 * When the show update operation is started through |
|
93 * the API, the session directs the requests for the UI. UI will |
|
94 * hanle the operation and inform the observer when the operation is |
|
95 * completed. |
|
96 * @param aObserver This observer is informed when the operation has |
|
97 * been completed. |
|
98 * @param aFilterParams These parameters are used when update items |
|
99 * are filtered for the UI list. |
|
100 */ |
|
101 void ShowUpdatesRequestL( MIAUpdateRequestObserver& aObserver, |
|
102 CIAUpdateParameters* aFilterParams ); |
|
103 |
|
104 |
|
105 |
|
106 /** |
|
107 * When the update operation is started through |
|
108 * the API, the session directs the requests for the UI. UI will |
|
109 * hanle the operation and inform the observer when the operation is |
|
110 * completed. |
|
111 * @param aObserver This observer is informed when the operation has |
|
112 * been completed. |
|
113 * @param aUid Uid of the caller of the request |
|
114 */ |
|
115 void ShowUpdateQueryRequestL( MIAUpdateRequestObserver& aObserver, TUint aUid ); |
|
116 |
|
117 /** |
|
118 * Handle removal of observer |
|
119 */ |
|
120 void HandleObserverRemoval(); |
|
121 |
|
122 /** |
|
123 * Set this application visible/unvisible |
|
124 * @param aVisible If EFalse application is put background and is hidden in FSW |
|
125 */ |
|
126 void SetVisibleL( TBool aVisible ); |
|
127 |
|
128 /** |
|
129 * Show status dialog of update |
|
130 */ |
|
131 void ShowStatusDialogL(); |
|
132 |
|
133 /** |
|
134 * Starts CIdle. Status dialog is shown in callback function. |
|
135 */ |
|
136 void ShowStatusDialogDeferredL(); |
|
137 |
|
138 /** |
|
139 * Get CIAUpdateUiController instance |
|
140 * @return Returns pointer of iController |
|
141 */ |
|
142 CIAUpdateUiController* Controller() const; |
|
143 |
|
144 /** |
|
145 * Performs cancel depending on ongoing request and state |
|
146 */ |
|
147 void PotentialCancel(); |
|
148 |
|
149 /** |
|
150 * Set ordinal position to foreground and |
|
151 * set iClientMovedToBackground to EFalse |
|
152 */ |
|
153 void HandleClientToForegroundL(); |
|
154 |
|
155 /** |
|
156 * Handle situation when iaupdate.exe leaves running although |
|
157 * client session has been closed |
|
158 */ |
|
159 void HandleAllClientsClosedL(); |
|
160 |
|
161 /** |
|
162 * Indicates whether Status dialog to be shown or not when history view is deactivated |
|
163 * |
|
164 * @return ETrue when status dialog to be re-shown |
|
165 */ |
|
166 TBool ShowStatusDialogAgain() const; |
|
167 |
|
168 /** |
|
169 * Starts monitoring of window group list changes |
|
170 */ |
|
171 void StartWGListChangeMonitoring(); |
|
172 |
|
173 /** |
|
174 * Stops monitoring of window group list changes |
|
175 */ |
|
176 void StopWGListChangeMonitoring(); |
|
177 |
|
178 /** |
|
179 * Set window group id of client application |
|
180 * |
|
181 * @param aWgId Window group id |
|
182 */ |
|
183 void SetClientWgId( TInt aWgId ); |
|
184 |
|
185 /** |
|
186 * Is client application in backround |
|
187 * |
|
188 * @param True value if client application is in background |
|
189 */ |
|
190 TInt ClientInBackgroundL() const; |
|
191 |
|
192 |
|
193 /** |
|
194 * Set DM support |
|
195 * |
|
196 * @param True value if DM is supported |
|
197 */ |
|
198 void SetDMSupport( TBool aDMSupport ); |
|
199 |
|
200 /** |
|
201 * Check DM support |
|
202 * |
|
203 * @return True value if DM is supported |
|
204 */ |
|
205 TBool IsDMSupport(); |
|
206 |
|
207 /** |
|
208 * Check if DM support is set |
|
209 * |
|
210 * @return True value if DM support is set |
|
211 */ |
|
212 TBool IsDMSupportSet(); |
|
213 |
|
214 /** |
|
215 * Check if UI refresh allowed |
|
216 * |
|
217 * @return True value if UI refresh is allowed |
|
218 */ |
|
219 TBool UiRefreshAllowed(); |
|
220 |
|
221 |
|
222 private: // from CAknViewAppUi |
|
223 |
|
224 /*! |
|
225 * @function HandleCommandL |
|
226 * @discussion Handle user menu selections |
|
227 * @param aCommand the enumerated code for the option selected |
|
228 */ |
|
229 void HandleCommandL( TInt aCommand ); |
|
230 |
|
231 /** |
|
232 * Handle window server event |
|
233 * |
|
234 * @param aEvent The window server event that occurred |
|
235 * @param aDestination The controller associated with the event |
|
236 */ |
|
237 void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ); |
|
238 |
|
239 |
|
240 private: // From MIAUpdateTextLinkObserver |
|
241 void TextLinkL( TInt aLinkId ); |
|
242 |
|
243 |
|
244 private: // From MIAUpdateUiControllerObserver |
|
245 /** |
|
246 * Called when async engine start-up is completed |
|
247 * |
|
248 * @param aError Error code |
|
249 */ |
|
250 void StartupComplete( TInt aError ); |
|
251 |
|
252 /** |
|
253 * Leaving method, called as trapped in StartupComplete |
|
254 */ |
|
255 void StartupCompleteL(); |
|
256 |
|
257 |
|
258 /** |
|
259 * Handles leave error. |
|
260 * |
|
261 * @param aError Error code |
|
262 */ |
|
263 void HandleLeaveErrorL( TInt aError ); |
|
264 |
|
265 /** |
|
266 * Handles leave error withot leaving |
|
267 * |
|
268 * @param aError Error code |
|
269 */ |
|
270 void HandleLeaveErrorWithoutLeave( TInt aError ); |
|
271 |
|
272 /** |
|
273 * Called when async update list refresh is completed |
|
274 * |
|
275 * @param aError Error code |
|
276 */ |
|
277 void RefreshCompleteL( TBool aWithViewActivation, TInt aError ); |
|
278 |
|
279 /** |
|
280 * Called when async updating is completed |
|
281 * |
|
282 * @param aError Error code |
|
283 */ |
|
284 void UpdateCompleteL( TInt aError ); |
|
285 |
|
286 /** |
|
287 * Choose a usable IAP from all SNAPs |
|
288 * |
|
289 * @param aCmManagerExt handle of connection manager |
|
290 */ |
|
291 TUint32 GetBestIAPInAllSNAPsL( RCmManagerExt& aCmManagerExt ); |
|
292 |
|
293 /** |
|
294 * Choose a usable IAP from Internet SNAP |
|
295 * |
|
296 * @param aCmManagerExt handle of connection manager |
|
297 */ |
|
298 TUint32 GetBestIAPInInternetSNAPL( RCmManagerExt& aCmManagerExt ); |
|
299 |
|
300 /** |
|
301 * Choose the best IAP under the given SNAP |
|
302 * |
|
303 * @param aCmManagerExt handle of connection manager |
|
304 * @param aSNAP SNAP ID |
|
305 */ |
|
306 TUint32 GetBestIAPInThisSNAPL( RCmManagerExt& aCmManagerExt, TUint32 aSNAP = 0); |
|
307 |
|
308 private: // from MIAUpdateUITimerObserver |
|
309 |
|
310 virtual void BackgroundDelayComplete( TInt aError ); |
|
311 |
|
312 virtual void ForegroundDelayComplete( TInt aError ); |
|
313 |
|
314 virtual void ProcessStartDelayComplete( TInt aError ); |
|
315 |
|
316 private: // new methods |
|
317 |
|
318 /** |
|
319 * Refreshes main view |
|
320 * @param aError Error code |
|
321 */ |
|
322 void RefreshL( TInt aError ); |
|
323 |
|
324 /** |
|
325 * Informs an observer that its async request is completed |
|
326 * |
|
327 * @param aError Error code |
|
328 */ |
|
329 void InformRequestObserver( TInt aError ); |
|
330 |
|
331 /** |
|
332 * Sets the default connection method used for network access. |
|
333 * Connection can be set as an accesspoint or as a snap for example. |
|
334 * |
|
335 * @param aTotalSilent Set to ETrue if want silent connection |
|
336 * |
|
337 * @note Not stored persistently. A client needs to set this |
|
338 * again every time it creates the controller. |
|
339 * |
|
340 * @note Leaves with KErrNotFound if connection method was not |
|
341 * set in the repocitory. |
|
342 */ |
|
343 void SetDefaultConnectionMethodL( TBool aTotalSilent ); |
|
344 |
|
345 |
|
346 /** |
|
347 * Shows update query dialog (now/later) |
|
348 */ |
|
349 void ShowUpdateQueryL(); |
|
350 |
|
351 /** |
|
352 * Hides this application from fast swap window |
|
353 * |
|
354 * @param aAlwaysAsk |
|
355 */ |
|
356 void HideApplicationInFSWL( TBool aHide); |
|
357 |
|
358 /** |
|
359 * Shows global error note |
|
360 * |
|
361 * @param aError Symbian error code |
|
362 */ |
|
363 void ShowGlobalErrorNoteL( TInt aError ) const; |
|
364 |
|
365 /** |
|
366 * CIdle callback function, that shows status dialog |
|
367 * To be used to guarantee that possible old status dialog is totally |
|
368 * removed by AVKON before showing new one |
|
369 * |
|
370 * @param aPtr Pointer to this instance |
|
371 */ |
|
372 static TInt ShowStatusDialogCallbackL( TAny* aPtr ); |
|
373 |
|
374 /** |
|
375 * CIdle callback function, that shows update query dialog |
|
376 * To be used because a client to be informed immediately that its |
|
377 * async request is issued. Waiting dialog cannot be shown before responding to a client |
|
378 * |
|
379 * @param aPtr Pointer to this instance |
|
380 */ |
|
381 static TInt UpdateQueryCallbackL( TAny* aPtr ); |
|
382 |
|
383 /** |
|
384 * CIdle callback function, that performs automatic update check ann query |
|
385 * |
|
386 * @param aPtr Pointer to this instance |
|
387 */ |
|
388 static TInt AutomaticCheckCallbackL( TAny* aPtr ); |
|
389 |
|
390 /** |
|
391 * History view is activated from a link in message query |
|
392 */ |
|
393 void HandleTextLinkL(); |
|
394 |
|
395 private: //data |
|
396 |
|
397 CIAUpdateMainView* iMainView; |
|
398 |
|
399 CIAUpdateHistoryView* iHistoryView; |
|
400 |
|
401 CIAUpdateUiController* iController; |
|
402 |
|
403 CIAUpdateGlobalLockHandler* iGlobalLockHandler; |
|
404 |
|
405 CIAUpdateUITimer* iForegroundTimer; |
|
406 |
|
407 CIAUpdateUITimer* iBackgroundTimer; |
|
408 |
|
409 MIAUpdateRequestObserver* iRequestObserver; |
|
410 |
|
411 TIAUpdateDialogParam* iDialogParam; |
|
412 |
|
413 IAUpdateUiDefines::TIAUpdateUiRequestType iRequestType; |
|
414 |
|
415 CIdle* iIdle; |
|
416 |
|
417 CIdle* iIdleAutCheck; |
|
418 |
|
419 TBool iShowStatusDialogAgain; |
|
420 |
|
421 TUint iUpdatequeryUid; |
|
422 |
|
423 TBool iUpdateNow; |
|
424 |
|
425 TBool iInstUiOnTop; |
|
426 |
|
427 TBool iStartedFromApplication; |
|
428 |
|
429 TBool iClientMovedToBackground; |
|
430 |
|
431 RArray<TUint32> iDestIdArray; |
|
432 |
|
433 TInt iWgId; |
|
434 |
|
435 TBool iIsDMSupported; |
|
436 |
|
437 TBool iIsDMSet; |
|
438 |
|
439 TBool iUiRefreshAllowed; |
|
440 |
|
441 TBool iRebootAfterInstall; |
|
442 }; |
|
443 |
|
444 |
|
445 #endif // __IAUPDATE_APPUI_H__ |
|
446 |