|
1 /* |
|
2 * Copyright (c) 2002-2007 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: Personalisation application UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_PSLNUI_H |
|
20 #define C_PSLNUI_H |
|
21 |
|
22 #include <aknViewAppUi.h> |
|
23 #ifndef RD_CONTROL_PANEL |
|
24 #include <akntabgrp.h> |
|
25 #include <akntabobserver.h> |
|
26 #endif //RD_CONTROL_PANEL |
|
27 #include <AknsSrvClient.h> |
|
28 #include <e32property.h> |
|
29 |
|
30 class CAknNavigationControlContainer; |
|
31 class CAknNavigationDecorator; |
|
32 class MAknBackgroundProcess; |
|
33 #ifndef RD_CONTROL_PANEL |
|
34 class CAknTabGroup; |
|
35 #endif //RD_CONTROL_PANEL |
|
36 class CPslnMainView; |
|
37 class CPslnPluginHandler; |
|
38 class CPslnFWPluginInterface; |
|
39 class CPslnIdleTaskCreateViews; |
|
40 class CPslnModel; |
|
41 class CPslnPropertySubscriber; |
|
42 class CPslnGeneralThemeView; |
|
43 |
|
44 |
|
45 /** |
|
46 * 'AppUi' class. |
|
47 * |
|
48 * @since S60 v2.0 |
|
49 */ |
|
50 class CPslnUi : public CAknViewAppUi, |
|
51 public MAknsSkinChangeObserver |
|
52 #ifndef RD_CONTROL_PANEL |
|
53 ,public MAknTabObserver |
|
54 #endif //RD_CONTROL_PANEL |
|
55 { |
|
56 |
|
57 public: |
|
58 |
|
59 /** |
|
60 * C++ default constructor |
|
61 */ |
|
62 CPslnUi(); |
|
63 |
|
64 /** |
|
65 * Symbian default constructor. |
|
66 */ |
|
67 void ConstructL(); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 ~CPslnUi(); |
|
73 |
|
74 /** |
|
75 * From CEikAppUi. |
|
76 * Takes care of command handling. |
|
77 * @param aCommand command to be handled |
|
78 */ |
|
79 void HandleCommandL( TInt aCommand ); |
|
80 |
|
81 /** |
|
82 * From CEikAppUi. |
|
83 * Handles a change to the application's resources |
|
84 * which are shared across the environment. |
|
85 * @param aType type of resources that have changed. |
|
86 */ |
|
87 void HandleResourceChangeL( TInt aType ); |
|
88 |
|
89 /** |
|
90 * From CAknViewAppUi. |
|
91 * Activates a specified application view, without passing any message. |
|
92 * The function leaves if activation of the view fails. |
|
93 * @param aViewId Identifier of the view to activate. |
|
94 */ |
|
95 void ActivateLocalViewL( TUid aViewId ); |
|
96 |
|
97 /** |
|
98 * From MAknsSkinChangeObserver. |
|
99 * Called by the skin server when skin content is changed and the |
|
100 * connected client wants to be informed. |
|
101 * |
|
102 * @since 2.0 |
|
103 */ |
|
104 void SkinContentChanged(); |
|
105 |
|
106 /** |
|
107 * From MAknsSkinChangeObserver. |
|
108 * Called by the skin server to indicate that the current skin |
|
109 * configuration has changed. |
|
110 * |
|
111 * @param aReason Reason code. |
|
112 * |
|
113 * @since 2.5 |
|
114 */ |
|
115 void SkinConfigurationChanged( |
|
116 const TAknsSkinStatusConfigurationChangeReason aReason ); |
|
117 |
|
118 /** |
|
119 * From MAknsSkinChangeObserver. |
|
120 * Called by the skin server to indicate that the available |
|
121 * skin packages have changed. |
|
122 * |
|
123 * @param aReason Reason code. |
|
124 * |
|
125 * @since 2.5 |
|
126 */ |
|
127 void SkinPackageChanged( |
|
128 const TAknsSkinStatusPackageChangeReason aReason ); |
|
129 |
|
130 /** |
|
131 * Returns pointer to Psln model which is owned by the AppUi. |
|
132 * |
|
133 * @return Psln model. |
|
134 */ |
|
135 CPslnModel* Model() const; |
|
136 |
|
137 /** |
|
138 * Updates Tab index. If the parameters are not given, tab is set |
|
139 * according to active selection in Main View. |
|
140 * |
|
141 * @param aMyId Uid of the active view. |
|
142 * @param aMyTabIndex Index of the active tab. |
|
143 * @since 3.1 |
|
144 */ |
|
145 void UpdateTabIndex( const TInt aMyId = KErrNotFound, |
|
146 const TInt aMyTabIndex = KErrNotFound ); |
|
147 |
|
148 /** |
|
149 * Creates the given view. |
|
150 * @since 3.1 |
|
151 * @param aViewUid Uid of view to be created. |
|
152 */ |
|
153 void CreateViewL( TUid aViewUid ); |
|
154 |
|
155 /** |
|
156 * Returns application's CAknNavigationControlContainer. |
|
157 * @since 3.1 |
|
158 * @return CAknNavigationControlContainer. |
|
159 */ |
|
160 CAknNavigationControlContainer* NaviContainer() const; |
|
161 |
|
162 /** |
|
163 * Returns tab group. |
|
164 * @since 3.1 |
|
165 * @return CAknNavigationDecorator. |
|
166 */ |
|
167 CAknNavigationDecorator* PslnTabGroup(); |
|
168 |
|
169 /** |
|
170 * Returns pointer to ECOM plugin handler which is owned by the AppUi. |
|
171 * @since 3.1 |
|
172 * @return ECOM plugin handler. |
|
173 */ |
|
174 CPslnPluginHandler* PluginHandler() const; |
|
175 |
|
176 /** |
|
177 * Add new view to Ui Class. |
|
178 * @since 3.1 |
|
179 * @param aNewView new view to add to Ui class. |
|
180 */ |
|
181 void AddNewViewL( CAknView* aNewView ); |
|
182 |
|
183 /** |
|
184 * Indicate from caller class that Ui-class has now all the applicable views. |
|
185 * @since 3.1 |
|
186 */ |
|
187 void AllViewsDone(); |
|
188 |
|
189 /** |
|
190 * Handles errors when settings wallpapers. |
|
191 * @param aError error code received from WallpaperUtils API. |
|
192 */ |
|
193 void HandleImageErrorsL( TInt aError ); |
|
194 |
|
195 #ifndef RD_CONTROL_PANEL |
|
196 /** |
|
197 * From MAknTabObserver. |
|
198 * Takes care of tab handling. |
|
199 * @since 3.1 |
|
200 * @param aIndex tab to be handled |
|
201 */ |
|
202 void TabChangedL( TInt aIndex ); |
|
203 #endif //RD_CONTROL_PANEL |
|
204 |
|
205 /** |
|
206 * Create views when application is idle. |
|
207 * @since 3.1 |
|
208 */ |
|
209 void LoadViewsWhenIdleL(); |
|
210 |
|
211 /** |
|
212 * Constructs tab group, containing all static views and |
|
213 * ECOM plugin views. |
|
214 * @since 3.1 |
|
215 */ |
|
216 void ConstructTabGroupL(); |
|
217 |
|
218 /** |
|
219 * Toggles screen blanker on/off. |
|
220 * @param aToggleValue ETrue activates screen blanker; EFalse removes it. |
|
221 * @param aStatusPaneVisible indicates if the blanker should cover the |
|
222 * statuspane as well. This is irrelevant, when removing the blanker. |
|
223 * @since 3.1 |
|
224 */ |
|
225 void ToggleScreenBlankerL( |
|
226 const TBool& aToggleValue, |
|
227 const TBool& aStatusPaneVisible, |
|
228 const TBool& aRealAct = ETrue ); |
|
229 |
|
230 /** |
|
231 * Indicates if the UI class has deployed the skin already and is ready to |
|
232 * receive further skin activation related commands. |
|
233 * @return ETrue when UI class can handle a new skin activation related |
|
234 * command, otherwise EFalse, |
|
235 */ |
|
236 TBool IsReadyToHandleCommands(); |
|
237 |
|
238 /** |
|
239 * Handles exit command correctly when leave occurs in application exit. |
|
240 */ |
|
241 void HandleCmdExitLeave(); |
|
242 |
|
243 /** |
|
244 * Sets title back to default (application name). |
|
245 */ |
|
246 void SetTitleToDefaultL(); |
|
247 |
|
248 /** |
|
249 * Binary flags to indicate if view is going to be created. |
|
250 * Statuses are valid irregardless if view has, or has not |
|
251 * been already created. These values cannot change dynamically. |
|
252 * |
|
253 */ |
|
254 enum TPslnViewSupport |
|
255 { |
|
256 EPslnScreensaverView = 0x00000001, |
|
257 EPslnWallpaperView = 0x00000002 |
|
258 }; |
|
259 |
|
260 /** |
|
261 * Gets view creation statuses as a bitmask. |
|
262 * See TPslnViewSupport for optional views whose statuses |
|
263 * can be inquiried. |
|
264 * To check if a view is supported, check flag value. |
|
265 * E.g. TBitflags views = ViewSupport(); |
|
266 * if ( views.IsSet( EPslnScreensaverView ) ) |
|
267 * { |
|
268 * // Screensaver view is supported |
|
269 * ... |
|
270 * |
|
271 * @return bitmask containing view support status. |
|
272 */ |
|
273 TBitFlags ViewSupport(); |
|
274 |
|
275 void SetDRMProtectedSkinInSkinList( |
|
276 const TBool& aProtectedSkinInList ); |
|
277 |
|
278 /** |
|
279 * USB Callback. |
|
280 */ |
|
281 static TInt USBCallBackL(TAny* aPtr); |
|
282 |
|
283 /** |
|
284 * USB Attach State. |
|
285 * @return ETrue when USB already attached, otherwise EFalse, |
|
286 */ |
|
287 TBool USBAttachState(); |
|
288 |
|
289 private: |
|
290 |
|
291 /** |
|
292 * From CCoeAppUi. |
|
293 * Handles events sent to the application by the window server. |
|
294 * @param The event that occurred. |
|
295 * @param The control that the event occurred in. |
|
296 * (For key events this is the applications window group.) |
|
297 */ |
|
298 void HandleWsEventL( |
|
299 const TWsEvent& aEvent, |
|
300 CCoeControl* aDestination ); |
|
301 |
|
302 /** |
|
303 * From CEikAppUi. |
|
304 * Key event handler. |
|
305 */ |
|
306 virtual TKeyResponse HandleKeyEventL( |
|
307 const TKeyEvent& aKeyEvent, |
|
308 TEventCode aType ); |
|
309 |
|
310 /** |
|
311 * @see SkinConfigurationChanged, same functionality, but |
|
312 * leaving internal method. |
|
313 */ |
|
314 void SkinConfigurationChangedL( |
|
315 const TAknsSkinStatusConfigurationChangeReason aReason ); |
|
316 |
|
317 /* Activates skin. */ |
|
318 void ActivateSkinL(); |
|
319 |
|
320 /* Activates sounds in skin. */ |
|
321 void ActivateSoundsL(); |
|
322 |
|
323 /* Downloads skin. */ |
|
324 void DownloadSkinL(); |
|
325 |
|
326 /* Creates wait dialog and shows it */ |
|
327 void CreateAndShowWaitWrapperL( |
|
328 MAknBackgroundProcess& aTask, |
|
329 const TInt aResourceID, const TDesC& aString, |
|
330 const TBool aShowImmediately = ETrue ); |
|
331 |
|
332 #ifndef RD_CONTROL_PANEL |
|
333 /* Adds given view plugin to TabGrp */ |
|
334 void AddPluginToTabL( CPslnFWPluginInterface& aPlugin ); |
|
335 #endif //!RD_CONTROL_PANEL |
|
336 |
|
337 /* Handles exit command. */ |
|
338 void HandleCmdExitL(); |
|
339 |
|
340 /* Shows error note. */ |
|
341 void ShowErrorNoteL( HBufC& aErrorBuf ) const; |
|
342 |
|
343 /** |
|
344 * Callback when idle time occurs. |
|
345 */ |
|
346 static TInt DoCreateWaitNoteL( TAny* aAny ); |
|
347 |
|
348 /* Creates and shows wait note. */ |
|
349 void DoCreateWaitNoteL(); |
|
350 |
|
351 /* Activates skin, cannot leave. */ |
|
352 TInt ActivateSkin( const TInt aPslnStatus ); |
|
353 |
|
354 #ifndef RD_CONTROL_PANEL |
|
355 /* Non-leaving version of AddPluginToTabL. */ |
|
356 TInt AddPluginToTab( CPslnFWPluginInterface& aPlugin ); |
|
357 #endif //!RD_CONTROL_PANEL |
|
358 |
|
359 /* Set internal state to post-skin-deployment.*/ |
|
360 void SkinDeployedL(); |
|
361 |
|
362 /** |
|
363 * Creates model instance. |
|
364 * @since 3.1 |
|
365 */ |
|
366 void CreateModelL(); |
|
367 |
|
368 /** |
|
369 * Callback when idle time occurs for skin activation. |
|
370 */ |
|
371 static TInt DoActivateSkinL( TAny* aAny ); |
|
372 |
|
373 /** |
|
374 * Activates skin |
|
375 */ |
|
376 void DoActivateSkinL(); |
|
377 |
|
378 // INLINE METHODS |
|
379 |
|
380 /* Checks if internal state is on or off. */ |
|
381 inline TBool GetStatus( TInt aInternalState ) const; |
|
382 |
|
383 /* Sets internal state on. Includes check that state is now off. */ |
|
384 inline void SetStateOn( TInt aInternalState ); |
|
385 |
|
386 /* Sets internal state off. Includes check that state is now on. */ |
|
387 inline void SetStateOff( TInt aInternalState ); |
|
388 |
|
389 /** |
|
390 * Handle USB Callback. |
|
391 */ |
|
392 void HandleUSBCallBackL(); |
|
393 |
|
394 private: // data |
|
395 |
|
396 /** |
|
397 * Psln Model. |
|
398 * Own. |
|
399 */ |
|
400 CPslnModel* iModel; |
|
401 |
|
402 /** |
|
403 * Navigation Pane. |
|
404 * Not own. |
|
405 */ |
|
406 CAknNavigationControlContainer* iNaviPane; |
|
407 |
|
408 /** |
|
409 * Frame for tabgroup. |
|
410 * Own. |
|
411 */ |
|
412 CAknNavigationDecorator* iDecoratedTabGroup; |
|
413 |
|
414 /** |
|
415 * Main view. |
|
416 * Not own (application framework 'owns' this). |
|
417 */ |
|
418 CPslnMainView* iMainView; |
|
419 |
|
420 /** |
|
421 * ECOM view plugin handler. |
|
422 * Own. |
|
423 */ |
|
424 CPslnPluginHandler* iPluginHandler; |
|
425 |
|
426 /** |
|
427 * Internal status of Psln. The specific states are: |
|
428 * |
|
429 * EPslnCreated |
|
430 * Psln has this status when default constructor |
|
431 * has been called. It's set off, once all views |
|
432 * have been added. |
|
433 * EPslnSoundActivationPending |
|
434 * Psln has this status when skin server about to activate |
|
435 * sounds included in skin package. It is set off when |
|
436 * activation is finished. |
|
437 * EPslnListUpdateNeeded |
|
438 * Psln has this status when skin list needs updating. |
|
439 * EPslnWallpaperViewCreated |
|
440 * This state is active when wallpaper view has been created. |
|
441 * It is initially off and set on when either view is loaded |
|
442 * due to idle activity, or when needed. |
|
443 * EPslnScreenSaverViewCreated |
|
444 * This state is active when screensaver view has been created. |
|
445 * It is initially off and set on when either view is loaded |
|
446 * due to idle activity, or when needed. |
|
447 * EPslnGeneralViewCreated |
|
448 * This state is active when general theme view has been created. |
|
449 * It is initially off and set on when either view is loaded |
|
450 * due to idle activity, or when needed. |
|
451 * EPslnSkinActivated |
|
452 * User has opted to activate a skin. This state prevails until |
|
453 * skin server indicates that skin changes has been deployed. |
|
454 * EPslnTabGroupCreated |
|
455 * This state is active when tab group has been created. |
|
456 * It is initially off and set on when either any other view is |
|
457 * activated (other than main) or with time due to idle activity. |
|
458 * EPslnModelCreated |
|
459 * This state is active when model has been created. |
|
460 * It is initially off and set on when either any other view is |
|
461 * activated (other than main) or with time due to idle activity. |
|
462 * EPslnSkinChangeRequested |
|
463 * This state is active when user has indicated that he/she would |
|
464 * would like to change the active skin (i.e. preview or actual |
|
465 * activation). It is initially off and is set on when user selects |
|
466 * Apply for the skin from General Theme view. |
|
467 * It is again set off when skin server indicates that skin was |
|
468 * either activated, or there was an error. |
|
469 * This differs from EPslnSkinActivated in that this is purely tied |
|
470 * to user activity. |
|
471 * EPslnViewSupportChecked |
|
472 * This state indicates that the view support has been checked. |
|
473 * It is set active once, the view support status has been checked |
|
474 * for the first time. |
|
475 * EPslnNoScreenSaverView |
|
476 * This state indicates that there is no Screensaver view in the |
|
477 * application. View statuses are set when ViewSupport is called. |
|
478 * EPslnNoWallpaperView |
|
479 * This state indicates that there is no Wallpaper view in the |
|
480 * application. View statuses are set when ViewSupport is called. |
|
481 */ |
|
482 enum TPslnStatus { |
|
483 EPslnCreated = 0x00000001, |
|
484 EPslnProtectedSkinInList = 0x00000002, |
|
485 //Not used = 0x00000004, |
|
486 EPslnSoundActivationPending = 0x00000008, |
|
487 EPslnListUpdateNeeded = 0x00000010, |
|
488 EPslnWallpaperViewCreated = 0x00000020, |
|
489 EPslnScreenSaverViewCreated = 0x00000040, |
|
490 EPslnGeneralViewCreated = 0x00000080, |
|
491 EPslnSkinActivated = 0x00000200, |
|
492 EPslnTabGroupCreated = 0x00000400, |
|
493 EPslnModelCreated = 0x00000800, |
|
494 EPslnSkinChangeRequested = 0x00001000, |
|
495 EPslnViewSupportChecked = 0x00002000, |
|
496 EPslnNoScreenSaverView = 0x00004000, |
|
497 EPslnNoWallpaperView = 0x00008000 |
|
498 }; |
|
499 TInt iPslnUiStatus; |
|
500 |
|
501 #ifndef RD_CONTROL_PANEL |
|
502 /** |
|
503 * Tab group. |
|
504 * Not own - owned by iDecoratedTabGroup. |
|
505 */ |
|
506 CAknTabGroup* iTabGroup; |
|
507 #endif //RD_CONTROL_PANEL |
|
508 |
|
509 /** |
|
510 * Creates views when application is idle. |
|
511 * Own. |
|
512 */ |
|
513 CPslnIdleTaskCreateViews* iIdleTask; |
|
514 /** |
|
515 * |
|
516 */ |
|
517 CIdle* iIdleActivateSkin; |
|
518 |
|
519 /** |
|
520 * |
|
521 */ |
|
522 CIdle* iIdleUpdateSkin; |
|
523 |
|
524 /** |
|
525 * USB Watch Property. |
|
526 */ |
|
527 RProperty iEnableUSBWatchProperty; |
|
528 |
|
529 |
|
530 /** |
|
531 * USB Watch Property Subscriber. |
|
532 * Own. |
|
533 */ |
|
534 CPslnPropertySubscriber* iUSBWatchSubscriber; |
|
535 |
|
536 /** |
|
537 * USB Attached. |
|
538 */ |
|
539 TBool iUSBAttached; |
|
540 |
|
541 /** |
|
542 * General Theme view. |
|
543 * Not own (application framework 'owns' this). |
|
544 */ |
|
545 CPslnGeneralThemeView* iGeneralThemeView; |
|
546 |
|
547 }; |
|
548 |
|
549 // Inline methods. |
|
550 #include "pslnui.inl" |
|
551 |
|
552 #endif // C_PSLNUI_H |
|
553 |
|
554 // End of File |
|
555 |