|
1 /* |
|
2 * Copyright (c) 2008 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 is the source file for the CClockAppUi class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <e32base.h> |
|
20 #include <avkon.hrh> |
|
21 #include <avkon.rsg> |
|
22 #include <bacntf.h> |
|
23 #include <clock.rsg> |
|
24 #include <akntitle.h> |
|
25 #include <akntabgrp.h> |
|
26 #include <aknnavide.h> |
|
27 #include <clockapp_tab.mbg> |
|
28 #include <AknsConstants.h> |
|
29 #include <featmgr.h> |
|
30 #include <e32property.h> |
|
31 #include <startupdomainpskeys.h> |
|
32 #include <touchfeedback.h> |
|
33 #include <gfxtranseffect/gfxtranseffect.h> |
|
34 |
|
35 // User includes |
|
36 #include "clock.h" |
|
37 #include "clockappui.h" |
|
38 #include "clockmainview.h" |
|
39 #include "clockworldview.h" |
|
40 #include "clkdatetimeview.h" |
|
41 #include "clkuialarmmodel.h" |
|
42 #include "clockdocument.h" |
|
43 #include "clock.hrh" |
|
44 #include "clkdatetimeview.hrh" |
|
45 #include "clock_debug.h" |
|
46 |
|
47 // Constants |
|
48 const TInt KClockNotiferPriority( CActive::EPriorityIdle ); |
|
49 const TInt KMaxTitleLength( 64 ); |
|
50 const TInt KInitialEvent( EChangesLocale | |
|
51 EChangesMidnightCrossover | |
|
52 EChangesThreadDeath | |
|
53 EChangesPowerStatus | |
|
54 EChangesSystemTime | |
|
55 EChangesFreeMemory | |
|
56 EChangesOutOfMemory ); |
|
57 |
|
58 // constants for control effects |
|
59 const TInt KGfxControlPageSwitchDisappear = 4; |
|
60 const TInt KGfxControlPageSwitchAppear = 3; |
|
61 |
|
62 const TUid KControlUid1 = {0x2000B47C}; |
|
63 const TUid KControlUid2 = {0x2000B47D}; |
|
64 |
|
65 // Literals |
|
66 _LIT( KIconFileName, "\\resource\\apps\\clockapp_tab.mif" ); |
|
67 _LIT( KIAParamExec, "clock.exe" ); |
|
68 |
|
69 // --------------------------------------------------------- |
|
70 // CClockAppUi::CClockAppUi |
|
71 // rest of the details are commented in the header |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 CClockAppUi::CClockAppUi() |
|
75 { |
|
76 // No implementation yet. |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------- |
|
80 // CClockAppUi::~CClockAppUi |
|
81 // rest of the details are commented in the header |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 CClockAppUi::~CClockAppUi() |
|
85 { |
|
86 // No more observing tab change events. |
|
87 if( iTabGroup ) |
|
88 { |
|
89 iTabGroup->SetObserver( NULL ); |
|
90 } |
|
91 if( iEnvChangeNotifier ) |
|
92 { |
|
93 delete iEnvChangeNotifier; |
|
94 iEnvChangeNotifier = NULL; |
|
95 } |
|
96 if( iNavigationDecorator ) |
|
97 { |
|
98 delete iNavigationDecorator; |
|
99 iNavigationDecorator = NULL; |
|
100 } |
|
101 // These should be deleted already when they are not needed any more, otherwise |
|
102 // the client-server connection is kept open. |
|
103 // These are here just in case they were not deleted earlier. |
|
104 if( iUpdate ) |
|
105 { |
|
106 delete iUpdate; |
|
107 iUpdate = NULL; |
|
108 } |
|
109 if( iParameters ) |
|
110 { |
|
111 delete iParameters; |
|
112 iParameters = NULL; |
|
113 } |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------- |
|
117 // CClockAppUi::ConstructL |
|
118 // rest of the details are commented in the header |
|
119 // --------------------------------------------------------- |
|
120 // |
|
121 void CClockAppUi::ConstructL() |
|
122 { |
|
123 //single click integration |
|
124 BaseConstructL( EAknEnableMSK | EAknEnableSkin | |
|
125 EAknSingleClickCompatible ); |
|
126 |
|
127 |
|
128 iIADUpdateFlag = ETrue; |
|
129 |
|
130 // Get the alarm model. |
|
131 CClkUiAlarmModel* alarmModel = static_cast< CClockDocument* > ( Document() )->AlarmModel(); |
|
132 |
|
133 // Construct the view and add it to the view server stack. |
|
134 CClockMainView* clockMainView = CClockMainView::NewL( alarmModel ); |
|
135 AddViewL( clockMainView ); |
|
136 |
|
137 // Construct the world view and add it to the view server stack. |
|
138 CClockWorldView* clockWorldView = CClockWorldView::NewL(); |
|
139 AddViewL( clockWorldView ); |
|
140 |
|
141 // Construct the datetime settings view. |
|
142 CClkDateTimeView* dateTimeView = CClkDateTimeView::NewLC( KClockAppMainViewId, ETrue ); |
|
143 AddViewL( dateTimeView ); |
|
144 CleanupStack::Pop( dateTimeView ); |
|
145 |
|
146 iTactileFeedbackSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); |
|
147 |
|
148 // Start the model. |
|
149 alarmModel->Start(); |
|
150 |
|
151 // Construct and start the environment change notifier. |
|
152 TCallBack callBack( NotifierCallbackL, this ); |
|
153 iEnvChangeNotifier = CEnvironmentChangeNotifier::NewL( KClockNotiferPriority, callBack ); |
|
154 if( !iEnvChangeNotifier->IsActive() ) |
|
155 { |
|
156 iEnvChangeNotifier->Start(); |
|
157 } |
|
158 |
|
159 // Set the above view as default. |
|
160 SetDefaultViewL( *clockMainView ); |
|
161 |
|
162 // Setup Navigation Pane. |
|
163 SetupNavigationPaneL(); |
|
164 |
|
165 // Clock is one of the applications which is launched in the phone boot and it runs in background. If thats the case, |
|
166 // the view is not activated when it is in background and it happens when clock is opened for the first time. |
|
167 // If the app is in background, we activate the main view here to ensure faster bootup when the application is opened for the first time. |
|
168 if( !IsForeground() ) |
|
169 { |
|
170 if( ExitHidesInBackground() ) |
|
171 { |
|
172 // First hide application in the background. |
|
173 HideInBackground(); |
|
174 // Set a flag indicating that the app is hidden. |
|
175 SetAppHidden( ETrue ); |
|
176 // Prevent the control from getting displayed immediately. |
|
177 SetCustomControl( 1 ); |
|
178 // Reset to initial state |
|
179 ResetToInitialStateL(); |
|
180 // This allows the prevented control to be displayed after the application is |
|
181 // reopened. |
|
182 // SetCustomControl( 0 ); |
|
183 } |
|
184 } |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------- |
|
188 // CClockAppUi::NotifierCallbackL |
|
189 // rest of the details are commented in the header |
|
190 // --------------------------------------------------------- |
|
191 // |
|
192 TInt CClockAppUi::NotifierCallbackL( TAny* aPtr ) |
|
193 { |
|
194 // Get the this object. |
|
195 CClockAppUi* self = static_cast< CClockAppUi* >( aPtr ); |
|
196 |
|
197 // Get the changes in environment. |
|
198 TInt envChanges( self->iEnvChangeNotifier->Change() ); |
|
199 |
|
200 if( KInitialEvent <= envChanges ) |
|
201 { |
|
202 // We're not concerned about handling environment changes in that range. |
|
203 return FALSE; |
|
204 } |
|
205 |
|
206 if( envChanges & ( EChangesMidnightCrossover | |
|
207 EChangesLocale | |
|
208 EChangesSystemTime ) ) |
|
209 { |
|
210 // We have to handle one of these changes. |
|
211 self->HandleEnvChangeL( EEnvChanged ); |
|
212 } |
|
213 |
|
214 return FALSE; |
|
215 } |
|
216 |
|
217 // --------------------------------------------------------- |
|
218 // CClockAppUi::HandleCommandL |
|
219 // rest of the details are commented in the header |
|
220 // --------------------------------------------------------- |
|
221 // |
|
222 void CClockAppUi::HandleCommandL( TInt aCommandId ) |
|
223 { |
|
224 switch( aCommandId ) |
|
225 { |
|
226 case EClockSettings: |
|
227 { |
|
228 // Open datetime settings view |
|
229 OpenSettingsViewL(); |
|
230 } |
|
231 break; |
|
232 |
|
233 case EClockMainViewExit: |
|
234 case EClockWorldExit: |
|
235 case EClkSettExitCmd: |
|
236 case EClockAlarmExit: |
|
237 case EAknSoftkeyExit: |
|
238 { |
|
239 TInt deviceState; |
|
240 RProperty::Get( KPSUidStartup, KPSGlobalSystemState , deviceState ); |
|
241 |
|
242 if( deviceState == ESwStateCharging || deviceState == ESwStateAlarm ) |
|
243 { |
|
244 |
|
245 Exit(); |
|
246 |
|
247 } |
|
248 else |
|
249 { |
|
250 if( ExitHidesInBackground() ) |
|
251 { |
|
252 HandleCommandL( EAknCmdHideInBackground ); |
|
253 } |
|
254 else |
|
255 { |
|
256 Exit(); |
|
257 } |
|
258 } |
|
259 } |
|
260 break; |
|
261 |
|
262 case EAknCmdHideInBackground: |
|
263 { |
|
264 // First hide application in the background. |
|
265 HideInBackground(); |
|
266 // Set a flag indicating that the app is hidden. |
|
267 SetAppHidden( ETrue ); |
|
268 |
|
269 iIADUpdateFlag = ETrue; |
|
270 // Prevent the control from getting displayed immediately. |
|
271 SetCustomControl( 1 ); |
|
272 // Reset to initial state |
|
273 ResetToInitialStateL(); |
|
274 |
|
275 } |
|
276 break; |
|
277 |
|
278 case EEikCmdExit: |
|
279 case EAknCmdExit: |
|
280 { |
|
281 iIADUpdateFlag = ETrue; |
|
282 |
|
283 // In these two cases, we do a hard exit i.e., we close the application. |
|
284 Exit(); |
|
285 } |
|
286 |
|
287 default: |
|
288 { |
|
289 // No implementation yet. |
|
290 } |
|
291 break; |
|
292 } |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------- |
|
296 // CClockAppUi::TabChangedL |
|
297 // rest of the details are commented in the header |
|
298 // --------------------------------------------------------- |
|
299 // |
|
300 void CClockAppUi::TabChangedL( TInt aTabIndex ) |
|
301 { |
|
302 TInt activeTabId( iTabGroup->TabIdFromIndex( aTabIndex ) ); |
|
303 |
|
304 // Switch on the active tab id and activate the corresponding view. |
|
305 switch( activeTabId ) |
|
306 { |
|
307 case EClockAppMainViewId: |
|
308 { |
|
309 // The main view. |
|
310 iTransitionOngoing = ETrue; |
|
311 iTransitionDirection = ETransitionLeft; |
|
312 ActivateLocalViewL( KClockAppMainViewId ); |
|
313 } |
|
314 break; |
|
315 |
|
316 case EClockAppWorldViewId: |
|
317 { |
|
318 // The clockworld view. |
|
319 iTransitionOngoing = ETrue; |
|
320 iTransitionDirection = ETransitionRight; |
|
321 ActivateLocalViewL( KClockAppWorldViewId ); |
|
322 } |
|
323 break; |
|
324 |
|
325 default: |
|
326 { |
|
327 // No implementaiton yet. |
|
328 } |
|
329 break; |
|
330 } |
|
331 } |
|
332 |
|
333 // --------------------------------------------------------- |
|
334 // CClockAppUi::HandleKeyEventL |
|
335 // rest of the details are commented in the header |
|
336 // --------------------------------------------------------- |
|
337 // |
|
338 TKeyResponse CClockAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
339 { |
|
340 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
341 |
|
342 if( iTabGroup ) |
|
343 { |
|
344 CAknTabGroup* tabGroup = NULL; |
|
345 |
|
346 if ( iNavigationDecorator ) |
|
347 { |
|
348 // Get the pointer to the tab group. |
|
349 tabGroup = ( CAknTabGroup* ) iNavigationDecorator->DecoratedControl(); |
|
350 // Pass the event to the tab group so that it handles the event. |
|
351 keyResponse = tabGroup->OfferKeyEventL( aKeyEvent, aType ); |
|
352 } |
|
353 } |
|
354 |
|
355 // Return the result. |
|
356 return keyResponse; |
|
357 } |
|
358 |
|
359 // --------------------------------------------------------- |
|
360 // CClockAppUi::HandleForegroundEventL |
|
361 // rest of the details are commented in the header |
|
362 // --------------------------------------------------------- |
|
363 // |
|
364 void CClockAppUi::HandleForegroundEventL( TBool aForeground ) |
|
365 { |
|
366 __PRINTS( "CClockAppUi::HandleForegroundEventL - Entry" ); |
|
367 |
|
368 // commented as a part of the error ESLM-83LG82. |
|
369 /*if( aForeground ) |
|
370 { |
|
371 __PRINTS( "CClockAppUi::HandleForegroundEventL - aForeground ETrue" ); |
|
372 |
|
373 if( iIADUpdateFlag ) |
|
374 { |
|
375 __PRINTS( "CClockAppUi::HandleForegroundEventL - iIADUpdateFlag ETrue" ); |
|
376 |
|
377 // check for IAD updates |
|
378 HandleIADUpdateL(); |
|
379 |
|
380 __PRINTS( "CClockAppUi::HandleForegroundEventL - Checking for updates" ); |
|
381 |
|
382 iIADUpdateFlag = EFalse; |
|
383 __PRINTS( "CClockAppUi::HandleForegroundEventL - iIADUpdateFlag EFalse" ); |
|
384 } |
|
385 }*/ |
|
386 |
|
387 // Inform the world clock view about the change |
|
388 CClockWorldView* clockWorldView = static_cast< CClockWorldView* > ( View( KClockAppWorldViewId ) ); |
|
389 if( clockWorldView ) |
|
390 { |
|
391 clockWorldView->HandleForegroundEventL( aForeground ); |
|
392 } |
|
393 |
|
394 CClockMainView* clockMainView = static_cast< CClockMainView* >( View( KClockAppMainViewId ) ); |
|
395 if( clockMainView ) |
|
396 { |
|
397 clockMainView->HandleForegroundEventL( aForeground ); |
|
398 } |
|
399 |
|
400 CAknAppUi::HandleForegroundEventL( aForeground ); |
|
401 |
|
402 __PRINTS( "CClockAppUi::HandleForegroundEventL - Exit" ); |
|
403 } |
|
404 |
|
405 // --------------------------------------------------------- |
|
406 // CClockAppUi::CheckUpdatesComplete |
|
407 // rest of the details commented in the header |
|
408 // --------------------------------------------------------- |
|
409 // |
|
410 void CClockAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) |
|
411 { |
|
412 __PRINTS( "CClockAppUi::CheckUpdatesComplete - Entry" ); |
|
413 |
|
414 __PRINT( "aErrorCode: %d", aErrorCode ); |
|
415 |
|
416 if ( aErrorCode == KErrNone ) |
|
417 { |
|
418 if ( aAvailableUpdates > 0 ) |
|
419 { |
|
420 __PRINT( "aAvailableUpdates: %d", aAvailableUpdates ); |
|
421 // There were some updates available. Let's ask if the user wants to update them. |
|
422 iUpdate->UpdateQuery(); |
|
423 |
|
424 __PRINTS( "CClockAppUi::CheckUpdatesComplete - update available" ); |
|
425 } |
|
426 else |
|
427 { |
|
428 __PRINTS( "CClockAppUi::CheckUpdatesComplete - no update available" ); |
|
429 |
|
430 // No updates available. CIAUpdate object could be deleted already now, since we are not |
|
431 // going to call anything else from the API. This will also close down the IAUpdate server. |
|
432 delete iUpdate; |
|
433 iUpdate = NULL; |
|
434 delete iParameters; |
|
435 iParameters = NULL; |
|
436 } |
|
437 } |
|
438 |
|
439 __PRINTS( "CClockAppUi::CheckUpdatesComplete - Exit" ); |
|
440 } |
|
441 |
|
442 // --------------------------------------------------------- |
|
443 // CClockAppUi::UpdateComplete |
|
444 // rest of the details commented in the header |
|
445 // --------------------------------------------------------- |
|
446 // |
|
447 void CClockAppUi::UpdateComplete( TInt /*aErrorCode*/, CIAUpdateResult* aResult ) |
|
448 { |
|
449 __PRINTS( "CClockAppUi::UpdateComplete - Entry" ); |
|
450 //Comment out the aErrorCode when Prints are enabled |
|
451 __PRINT( "aErrorCode: %d", aErrorCode ); |
|
452 |
|
453 delete aResult; // Ownership was transferred, so this must be deleted by the client |
|
454 |
|
455 // We do not need the client-server session anymore, let's delete the object to close the session |
|
456 delete iUpdate; |
|
457 iUpdate = NULL; |
|
458 delete iParameters; |
|
459 iParameters = NULL; |
|
460 |
|
461 __PRINTS( "CClockAppUi::UpdateComplete - Exit" ); |
|
462 } |
|
463 |
|
464 // --------------------------------------------------------- |
|
465 // CClockAppUi::UpdateQueryComplete |
|
466 // rest of the details commented in the header |
|
467 // --------------------------------------------------------- |
|
468 // |
|
469 void CClockAppUi::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ) |
|
470 { |
|
471 __PRINTS( "CClockAppUi::UpdateQueryComplete - Entry" ); |
|
472 |
|
473 __PRINT( "aErrorCode: %d", aErrorCode ); |
|
474 |
|
475 if ( aErrorCode == KErrNone ) |
|
476 { |
|
477 if ( aUpdateNow ) |
|
478 { |
|
479 __PRINTS( "CClockAppUi::UpdateQueryComplete - aUpdateNow is true" ); |
|
480 // User choosed to update now, so let's launch the IAUpdate UI. |
|
481 iUpdate->ShowUpdates( *iParameters ); |
|
482 } |
|
483 else |
|
484 { |
|
485 __PRINTS( "CClockAppUi::UpdateQueryComplete - update later" ); |
|
486 // The answer was 'Later'. CIAUpdate object could be deleted already now, since we are not |
|
487 // going to call anything else from the API. This will also close down the IAUpdate server. |
|
488 delete iUpdate; |
|
489 iUpdate = NULL; |
|
490 delete iParameters; |
|
491 iParameters = NULL; |
|
492 } |
|
493 } |
|
494 __PRINTS( "CClockAppUi::UpdateQueryComplete - Exit" ); |
|
495 } |
|
496 |
|
497 // --------------------------------------------------------- |
|
498 // CClockAppUi::HandleEnvChangeL |
|
499 // rest of the details are commented in the header |
|
500 // --------------------------------------------------------- |
|
501 // |
|
502 void CClockAppUi::HandleEnvChangeL( TClockEnvChanged aEnvChanged ) |
|
503 { |
|
504 // Notify the views about the change, so that they can update themselves. |
|
505 CClockMainView* mainView = static_cast< CClockMainView* > ( View( KClockAppMainViewId ) ); |
|
506 mainView->HandleEnvChangeL( aEnvChanged ); |
|
507 |
|
508 // Notify the views about the change, so that they can update themselves. |
|
509 CClockWorldView* clockworldView = static_cast< CClockWorldView* > ( View( KClockAppWorldViewId ) ); |
|
510 clockworldView->HandleEnvChangeL( aEnvChanged ); |
|
511 } |
|
512 |
|
513 // --------------------------------------------------------- |
|
514 // CClockAppUi::OpenSettingsViewL |
|
515 // rest of the details are commented in the header |
|
516 // --------------------------------------------------------- |
|
517 // |
|
518 void CClockAppUi::OpenSettingsViewL() |
|
519 { |
|
520 // Set the title pane text first |
|
521 SetTitlePaneTextL( R_CLOCK_TITLE_SETTINGS ); |
|
522 |
|
523 // Activate the date and time settings view |
|
524 ActivateLocalViewL( KClkDateTimeViewId ); |
|
525 |
|
526 // Don't display the navigation pane when switching to settings view. |
|
527 if( iNavigationDecorator ) |
|
528 { |
|
529 iNavigationDecorator->MakeVisible( EFalse ); |
|
530 } |
|
531 |
|
532 // Activate the date and time settings view |
|
533 ActivateLocalViewL( KClkDateTimeViewId ); |
|
534 } |
|
535 |
|
536 // --------------------------------------------------------- |
|
537 // CClockAppUi::SetTitlePaneTextL |
|
538 // rest of the details are commented in the header |
|
539 // --------------------------------------------------------- |
|
540 // |
|
541 void CClockAppUi::SetTitlePaneTextL( TInt aResourceId ) |
|
542 { |
|
543 CEikStatusPane* statusPane = StatusPane(); |
|
544 |
|
545 // Set the title pane text |
|
546 TBuf< KMaxTitleLength > titleText; |
|
547 iCoeEnv->ReadResourceL( titleText, aResourceId ); |
|
548 |
|
549 CAknTitlePane* titlePane = STATIC_CAST( CAknTitlePane*, statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
550 titlePane->SetTextL( titleText ); |
|
551 titlePane->DrawNow(); |
|
552 } |
|
553 |
|
554 // --------------------------------------------------------- |
|
555 // CClockAppUi::ResetToInitialStateL |
|
556 // rest of the details commented in the header |
|
557 // --------------------------------------------------------- |
|
558 // |
|
559 void CClockAppUi::ResetToInitialStateL() |
|
560 { |
|
561 TVwsViewId viewId; |
|
562 |
|
563 viewId.iAppUid = KClockAppUid; |
|
564 viewId.iViewUid = KClockAppMainViewId; |
|
565 |
|
566 // Switch to the main view |
|
567 if( iTabGroup->ActiveTabId() == EClockAppWorldViewId ) |
|
568 { |
|
569 ActivateLocalViewL( KClockAppMainViewId, TUid::Uid(KClockHideInBackground), KNullDesC8() ); |
|
570 //TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ; |
|
571 } |
|
572 else |
|
573 { |
|
574 // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() ); |
|
575 TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ; |
|
576 } |
|
577 // Update the tab. |
|
578 iTabGroup->SetActiveTabById( EClockAppMainViewId ); |
|
579 } |
|
580 |
|
581 // --------------------------------------------------------- |
|
582 // CClockAppUi::SetupNavigationPaneL |
|
583 // rest of the details commented in the header |
|
584 // --------------------------------------------------------- |
|
585 // |
|
586 void CClockAppUi::SetupNavigationPaneL() |
|
587 { |
|
588 // Add the tabs for each view in the navigation pane. |
|
589 // Gets a pointer to the status pane. |
|
590 CEikStatusPane* statusPane = StatusPane(); |
|
591 |
|
592 // Fetch pointer to the default navi pane control |
|
593 iNaviPane = static_cast< CAknNavigationControlContainer*> |
|
594 ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
595 |
|
596 iNavigationDecorator = iNaviPane->CreateTabGroupL( this ); |
|
597 iNavigationDecorator->SetControlType( CAknNavigationDecorator::ETabGroup ); |
|
598 |
|
599 // Construct the tabgroup and append tabs to it. |
|
600 iTabGroup = ( CAknTabGroup* ) iNavigationDecorator->DecoratedControl(); |
|
601 // Set observer for tab changes. |
|
602 iTabGroup->SetObserver( this ); |
|
603 // Set tab width. |
|
604 iTabGroup->SetTabFixedWidthL ( EAknTabWidthWithTwoTabs); |
|
605 |
|
606 // Load the images to be displayed in the tabs. |
|
607 // 1. The alarm/main view icon. |
|
608 CFbsBitmap* tabImageBitmap( NULL ); |
|
609 CFbsBitmap* tabImageMask( NULL ); |
|
610 |
|
611 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
612 KAknsIIDQgnPropClkClockTab4, |
|
613 KAknsIIDQsnIconColors, |
|
614 EAknsCIQsnIconColorsCG7, |
|
615 tabImageBitmap, |
|
616 tabImageMask, |
|
617 KIconFileName, |
|
618 EMbmClockapp_tabQgn_prop_clk_clock_tab4, |
|
619 EMbmClockapp_tabQgn_prop_clk_clock_tab4_mask, |
|
620 TRgb( NULL, NULL, 255 ) ); |
|
621 |
|
622 // Add the mainview tab. |
|
623 iTabGroup->AddTabL( EClockAppMainViewId, tabImageBitmap, tabImageMask ); |
|
624 |
|
625 // 2. The clock world icon. |
|
626 tabImageBitmap = NULL; |
|
627 tabImageMask = NULL; |
|
628 |
|
629 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
630 KAknsIIDQgnPropClkWrldClkTab4, |
|
631 KAknsIIDQsnIconColors, |
|
632 EAknsCIQsnIconColorsCG7, |
|
633 tabImageBitmap, |
|
634 tabImageMask, |
|
635 KIconFileName, |
|
636 EMbmClockapp_tabQgn_prop_clk_wrld_clk_tab4, |
|
637 EMbmClockapp_tabQgn_prop_clk_wrld_clk_tab4_mask, |
|
638 TRgb( NULL, NULL, 255 ) ); |
|
639 // Add the world view tab. |
|
640 iTabGroup->AddTabL( EClockAppWorldViewId, tabImageBitmap, tabImageMask ); |
|
641 |
|
642 iNaviPane->PushL( *iNavigationDecorator ); |
|
643 // Activate the main view tab. |
|
644 iTabGroup->SetActiveTabById( EClockAppMainViewId ); |
|
645 } |
|
646 |
|
647 // --------------------------------------------------------- |
|
648 // CClockAppUi::SetAppHidden |
|
649 // rest of the details commented in the header |
|
650 // --------------------------------------------------------- |
|
651 // |
|
652 void CClockAppUi::SetAppHidden( TBool aAppHidden ) |
|
653 { |
|
654 iAppHidden = aAppHidden; |
|
655 } |
|
656 |
|
657 // --------------------------------------------------------- |
|
658 // CClockAppUi::IsAppExitHidden |
|
659 // rest of the details commented in the header |
|
660 // --------------------------------------------------------- |
|
661 // |
|
662 TBool CClockAppUi::IsAppExitHidden() |
|
663 { |
|
664 return iAppHidden; |
|
665 } |
|
666 |
|
667 // --------------------------------------------------------- |
|
668 // CClockAppUi::MakeNavigationPaneVisible |
|
669 // rest of the details commented in the header |
|
670 // --------------------------------------------------------- |
|
671 // |
|
672 void CClockAppUi::MakeNavigationPaneVisible( TBool aVisible, TInt aViewId ) |
|
673 { |
|
674 if( iNavigationDecorator && iTabGroup ) |
|
675 { |
|
676 iNavigationDecorator->MakeVisible( aVisible ); |
|
677 |
|
678 if( aVisible ) |
|
679 { |
|
680 iTabGroup->SetActiveTabById( aViewId ); |
|
681 } |
|
682 } |
|
683 } |
|
684 |
|
685 // --------------------------------------------------------- |
|
686 // CClockAppUi::HandleIADUpdateL |
|
687 // rest of the details commented in the header |
|
688 // --------------------------------------------------------- |
|
689 // |
|
690 void CClockAppUi::HandleIADUpdateL() |
|
691 { |
|
692 __PRINTS( "CClockAppUi::HandleIADUpdateL - Entry" ); |
|
693 |
|
694 if( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) |
|
695 { |
|
696 // IAD update feature is supported. |
|
697 if( !iUpdate ) |
|
698 { |
|
699 TRAP_IGNORE( iUpdate = CIAUpdate::NewL( *this ) ); |
|
700 } |
|
701 __PRINTS( "CClockAppUi::HandleIADUpdateL - iUpdate created" ); |
|
702 |
|
703 if ( iUpdate ) // IAUpdate is supported in the phone |
|
704 { |
|
705 iParameters = CIAUpdateParameters::NewL(); |
|
706 |
|
707 // Search for updates to IAUpdateExampleClient, We know that the SIS package |
|
708 // uid is KClockAppUid, so let's use that as a search criteria. |
|
709 iParameters->SetUid( KClockAppUid ); |
|
710 |
|
711 __PRINT( "App Uid: %d", KClockAppUid ); |
|
712 |
|
713 // We want clock.exe to be started after update is finished |
|
714 iParameters->SetCommandLineExecutableL( KIAParamExec ); |
|
715 |
|
716 __PRINTS( "CClockAppUi::HandleIADUpdateL - clock.exe" ); |
|
717 |
|
718 |
|
719 // Check the updates |
|
720 iUpdate->CheckUpdates( *iParameters ); |
|
721 } |
|
722 } |
|
723 __PRINTS( "CClockAppUi::HandleIADUpdateL - Exit" ); |
|
724 } |
|
725 |
|
726 TBool CClockAppUi::TransitionOngoing() const |
|
727 { |
|
728 return iTransitionOngoing; |
|
729 } |
|
730 |
|
731 void CClockAppUi::SetTransitionOngoing( TBool aTransitionOngoing ) |
|
732 { |
|
733 iTransitionOngoing = aTransitionOngoing; |
|
734 } |
|
735 |
|
736 void CClockAppUi::SetTransitionGroupId( TInt aId ) |
|
737 { |
|
738 iTransitionGroupId = aId; |
|
739 } |
|
740 |
|
741 TInt CClockAppUi::TransitionGroupId() const |
|
742 { |
|
743 return iTransitionGroupId; |
|
744 } |
|
745 |
|
746 CClockAppUi::TTransitionDirection CClockAppUi::TransitionDirection() const |
|
747 { |
|
748 return iTransitionDirection; |
|
749 } |
|
750 |
|
751 void CClockAppUi::SetTransitionDirection( CClockAppUi::TTransitionDirection aDirection ) |
|
752 { |
|
753 iTransitionDirection = aDirection; |
|
754 } |
|
755 |
|
756 void CClockAppUi::DoDisappearTransition( CCoeControl* aControl ) |
|
757 { |
|
758 if( aControl && iTransitionOngoing ) |
|
759 { |
|
760 if( iTransitionDirection == ETransitionLeft ) |
|
761 { |
|
762 GfxTransEffect::Register( aControl, KControlUid2 ); |
|
763 } |
|
764 else |
|
765 { |
|
766 GfxTransEffect::Register( aControl, KControlUid1 ); |
|
767 } |
|
768 GfxTransEffect::Begin( aControl, KGfxControlPageSwitchDisappear ); |
|
769 aControl->MakeVisible( EFalse ); |
|
770 GfxTransEffect::SetDemarcation( aControl, aControl->Rect() ); |
|
771 GfxTransEffect::End( aControl ); |
|
772 GfxTransEffect::EndGroup( iTransitionGroupId ); |
|
773 iTransitionOngoing = EFalse; |
|
774 } |
|
775 } |
|
776 |
|
777 void CClockAppUi::DoAppearTransition( CCoeControl* aControl ) |
|
778 { |
|
779 if( aControl && iTransitionOngoing ) |
|
780 { |
|
781 if( iTransitionDirection == ETransitionLeft ) |
|
782 { |
|
783 GfxTransEffect::Register( aControl, KControlUid2 ); |
|
784 } |
|
785 else |
|
786 { |
|
787 GfxTransEffect::Register( aControl, KControlUid1 ); |
|
788 } |
|
789 iTransitionGroupId = GfxTransEffect::BeginGroup(); |
|
790 GfxTransEffect::Begin( aControl, KGfxControlPageSwitchAppear ); |
|
791 aControl->MakeVisible( ETrue ); |
|
792 GfxTransEffect::SetDemarcation( aControl, aControl->Rect() ); |
|
793 GfxTransEffect::End( aControl ); |
|
794 } |
|
795 } |
|
796 |
|
797 MTouchFeedback* CClockAppUi::GetFeedback() |
|
798 { |
|
799 if( !iFeedback && iTactileFeedbackSupported ) |
|
800 { |
|
801 iFeedback = MTouchFeedback::Instance(); |
|
802 } |
|
803 return iFeedback; |
|
804 } |
|
805 // End of file |