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