65 // |
65 // |
66 void CFsEmailUiViewBase::DoActivateL( const TVwsViewId& aPrevViewId, |
66 void CFsEmailUiViewBase::DoActivateL( const TVwsViewId& aPrevViewId, |
67 TUid aCustomMessageId, |
67 TUid aCustomMessageId, |
68 const TDesC8& aCustomMessage ) |
68 const TDesC8& aCustomMessage ) |
69 { |
69 { |
70 FUNC_LOG; |
70 FUNC_LOG; |
71 SetViewActive( ETrue ); |
71 SetViewActive( ETrue ); |
72 //<cmail> |
72 SetStatusBarLayout(); |
73 iAppUi.StatusPane()->DrawNow(); |
73 iAppUi.StatusPane()->DrawNow(); |
74 //</cmail> |
74 iFocusVisible = iAppUi.IsFocusShown(); |
75 iFocusVisible = iAppUi.IsTimerFocusShown(); |
75 |
76 |
|
77 // fix view stack in case of external activation |
76 // fix view stack in case of external activation |
78 if ( aPrevViewId.iAppUid != KFSEmailUiUid ) |
77 if ( aPrevViewId.iAppUid != KFSEmailUiUid ) |
79 { |
78 { |
80 iActiveMailboxBeforeExternalActivation = iAppUi.GetActiveMailboxId(); |
79 iActiveMailboxBeforeExternalActivation = iAppUi.GetActiveMailboxId(); |
81 iAppUi.ViewActivatedExternallyL( Id() ); |
80 iAppUi.ViewActivatedExternallyL( Id() ); |
96 { |
95 { |
97 previousView->DeactivateControlGroup(); |
96 previousView->DeactivateControlGroup(); |
98 } |
97 } |
99 previousView->DoTransition( ETrue ); // fade out prev view |
98 previousView->DoTransition( ETrue ); // fade out prev view |
100 } |
99 } |
101 |
100 |
102 // Clear the flag of long transition effect |
101 // Clear the flag of long transition effect |
103 SetNextTransitionOutLong( EFalse ); |
102 SetNextTransitionOutLong( EFalse ); |
104 UpdateToolbarL(); |
103 UpdateToolbarL(); |
105 |
|
106 SetStatusBarLayout(); |
|
107 |
104 |
108 // Make sure Alfred display is of correct size (there is some problems with toolbar) |
105 // Make sure Alfred display is of correct size (there is some problems with toolbar) |
109 TRect metricsRect; |
106 TRect metricsRect; |
110 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, metricsRect); |
107 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, metricsRect); |
111 CAlfEnv::Static()->PrimaryDisplay().ForceSetVisibleArea(metricsRect); |
108 CAlfEnv::Static()->PrimaryDisplay().ForceSetVisibleArea(metricsRect); |
112 |
109 |
113 // Finally call child classes activation method |
110 // Finally call child classes activation method |
114 TRAPD( error, ChildDoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage) ); |
111 TRAPD( error, ChildDoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage) ); |
115 if ( !error ) |
112 if ( !error ) |
116 { |
113 { |
117 // View activated succesfully. Change visible control group, but not |
114 // View activated succesfully. Change visible control group, but not |
118 // when application is being sent to background. |
115 // when application is being sent to background. |
119 if ( !iAppUi.SwitchingToBackground() ) |
116 if ( !iAppUi.SwitchingToBackground() ) |
220 // --------------------------------------------------------------------------- |
217 // --------------------------------------------------------------------------- |
221 // |
218 // |
222 void CFsEmailUiViewBase::DoDeactivate() |
219 void CFsEmailUiViewBase::DoDeactivate() |
223 { |
220 { |
224 FUNC_LOG; |
221 FUNC_LOG; |
225 SetViewActive( EFalse ); |
222 SetViewActive( EFalse ); |
226 |
223 |
227 HideToolbar(); |
224 HideToolbar(); |
228 |
225 |
229 // Make control group ignore input and hide it if it's not already fading out. |
226 // Make control group ignore input and hide it if it's not already fading out. |
230 DeactivateControlGroup(); |
227 DeactivateControlGroup(); |
231 |
228 |
232 // do view specific deactivation |
229 // do view specific deactivation |
233 ChildDoDeactivate(); |
230 ChildDoDeactivate(); |
234 |
231 |
235 // Return to another app in case this view was activated externally |
232 // Return to another app in case this view was activated externally |
236 if ( iSendToBackgroundOnDeactivation ) |
233 if ( iSendToBackgroundOnDeactivation ) |
237 { |
234 { |
238 iSendToBackgroundOnDeactivation = EFalse; |
235 iSendToBackgroundOnDeactivation = EFalse; |
239 |
236 |
240 // Try to bring calling external app into foreground if found |
237 // Try to bring calling external app into foreground if found |
241 TApaTaskList taskList( iEikonEnv->WsSession() ); |
238 TApaTaskList taskList( iEikonEnv->WsSession() ); |
242 TApaTask prevAppTask = taskList.FindApp( iPreviousAppUid ); |
239 TApaTask prevAppTask = taskList.FindApp( iPreviousAppUid ); |
243 TApaTask fsEmailTask = taskList.FindApp( KFSEmailUiUid ); |
240 TApaTask fsEmailTask = taskList.FindApp( KFSEmailUiUid ); |
244 if ( prevAppTask.Exists() ) |
241 if ( prevAppTask.Exists() ) |
269 // --------------------------------------------------------------------------- |
266 // --------------------------------------------------------------------------- |
270 // Inheriting Alfred views can override these functions, if they need to do |
267 // Inheriting Alfred views can override these functions, if they need to do |
271 // some special tricks for transition effects |
268 // some special tricks for transition effects |
272 // |
269 // |
273 void CFsEmailUiViewBase::DoTransitionEffect( TBool aDirectionOut ) |
270 void CFsEmailUiViewBase::DoTransitionEffect( TBool aDirectionOut ) |
274 { |
271 { |
275 FUNC_LOG; |
272 FUNC_LOG; |
276 RPointerArray<CAlfVisual> layoutArray; |
273 RPointerArray<CAlfVisual> layoutArray; |
277 TRAP_IGNORE( GetParentLayoutsL( layoutArray ) ); |
274 TRAP_IGNORE( GetParentLayoutsL( layoutArray ) ); |
278 |
275 |
279 // For views that return valid parent layout(s), use the fade effect, |
276 // For views that return valid parent layout(s), use the fade effect, |
280 // for all other views, use the showing/hiding of control groups |
277 // for all other views, use the showing/hiding of control groups |
281 for ( TInt i = 0 ; i < layoutArray.Count() ; i++ ) |
278 for ( TInt i = 0 ; i < layoutArray.Count() ; i++ ) |
282 { |
279 { |
283 // Returned parent layout might be NULL, if view construction is not |
280 // Returned parent layout might be NULL, if view construction is not |
313 // |
310 // |
314 void CFsEmailUiViewBase::FadeVisual( |
311 void CFsEmailUiViewBase::FadeVisual( |
315 CAlfVisual* aVisual, |
312 CAlfVisual* aVisual, |
316 TBool aFadeDirectionOut, |
313 TBool aFadeDirectionOut, |
317 TBool aImmediate /*= EFalse*/) |
314 TBool aImmediate /*= EFalse*/) |
318 { |
315 { |
319 FUNC_LOG; |
316 FUNC_LOG; |
320 // Check that we are not exiting and is fade effect activated |
317 // Check that we are not exiting and is fade effect activated |
321 if ( !iAppUi.AppUiExitOngoing() ) |
318 if ( !iAppUi.AppUiExitOngoing() ) |
322 { |
319 { |
323 TInt effectTime = 0; |
320 TInt effectTime = 0; |
324 |
321 |
325 if ( !aImmediate && iAppUi.LayoutHandler() ) |
322 if ( !aImmediate && iAppUi.LayoutHandler() ) |
326 { |
323 { |
327 if( aFadeDirectionOut ) |
324 if( aFadeDirectionOut ) |
328 { |
325 { |
329 effectTime = iAppUi.LayoutHandler()->ViewFadeOutEffectTime(); |
326 effectTime = iAppUi.LayoutHandler()->ViewFadeOutEffectTime(); |
331 else |
328 else |
332 { |
329 { |
333 effectTime = iAppUi.LayoutHandler()->ViewFadeInEffectTime(); |
330 effectTime = iAppUi.LayoutHandler()->ViewFadeInEffectTime(); |
334 } |
331 } |
335 } |
332 } |
336 |
333 |
337 if ( aFadeDirectionOut && IsNextTransitionOutLong() ) |
334 if ( aFadeDirectionOut && IsNextTransitionOutLong() ) |
338 { |
335 { |
339 effectTime = effectTime * 2; |
336 effectTime = effectTime * 2; |
340 } |
337 } |
341 |
338 |
342 // Initialize for out fading |
339 // Initialize for out fading |
343 TAlfTimedValue timedValue( 0, effectTime ); |
340 TAlfTimedValue timedValue( 0, effectTime ); |
344 // Check value and initialze for in fading if set |
341 // Check value and initialze for in fading if set |
345 if ( !aFadeDirectionOut ) |
342 if ( !aFadeDirectionOut ) |
346 { |
343 { |
347 timedValue.SetTarget( 1, effectTime ); |
344 timedValue.SetTarget( 1, effectTime ); |
348 } |
345 } |
349 aVisual->SetOpacity( timedValue ); |
346 aVisual->SetOpacity( timedValue ); |
350 } |
347 } |
351 } |
348 } |
352 |
349 |
374 { |
371 { |
375 FUNC_LOG; |
372 FUNC_LOG; |
376 if ( !iAppUi.AppUiExitOngoing() ) |
373 if ( !iAppUi.AppUiExitOngoing() ) |
377 { |
374 { |
378 TAlfGroupCommand showCmd( ControlGroup(), EAlfOpShow, &iAppUi.Display() ); |
375 TAlfGroupCommand showCmd( ControlGroup(), EAlfOpShow, &iAppUi.Display() ); |
379 iAppUi.AlfEnv().Send( showCmd, aDelay ); |
376 iAppUi.AlfEnv().Send( showCmd, aDelay ); |
380 ControlGroup().SetAcceptInput( ETrue ); |
377 ControlGroup().SetAcceptInput( ETrue ); |
381 |
378 |
382 // Status indicator is "always on top" while visible |
379 // Status indicator is "always on top" while visible |
383 /*if ( iAppUi.StatusIndicator() && iAppUi.StatusIndicator()->IsVisible() ) |
380 /*if ( iAppUi.StatusIndicator() && iAppUi.StatusIndicator()->IsVisible() ) |
384 { |
381 { |
385 CAlfControlGroup& indicatorGroup = iAppUi.AlfEnv().ControlGroup( KStatusIndicatorDisplayGroup ); |
382 CAlfControlGroup& indicatorGroup = iAppUi.AlfEnv().ControlGroup( KStatusIndicatorDisplayGroup ); |
386 TAlfGroupCommand indicShowCmd( indicatorGroup, EAlfOpShow, &iAppUi.Display() ); |
383 TAlfGroupCommand indicShowCmd( indicatorGroup, EAlfOpShow, &iAppUi.Display() ); |
387 iAppUi.AlfEnv().Send( indicShowCmd, 0 ); |
384 iAppUi.AlfEnv().Send( indicShowCmd, 0 ); |
388 indicatorGroup.SetAcceptInput( EFalse ); |
385 indicatorGroup.SetAcceptInput( EFalse ); |
389 }*/ |
386 }*/ |
390 } |
387 } |
391 } |
388 } |
392 |
389 |
393 // --------------------------------------------------------------------------- |
390 // --------------------------------------------------------------------------- |
394 // |
391 // |
395 void CFsEmailUiViewBase::DeactivateControlGroup( TInt aDelay /*= 0*/ ) |
392 void CFsEmailUiViewBase::DeactivateControlGroup( TInt aDelay /*= 0*/ ) |
396 { |
393 { |
397 FUNC_LOG; |
394 FUNC_LOG; |
398 const TReal32 KDelta = 0.01; // floating point comparison tolerance |
395 const TReal32 KDelta = 0.01; // floating point comparison tolerance |
399 |
396 |
400 if ( !iAppUi.AppUiExitOngoing() ) |
397 if ( !iAppUi.AppUiExitOngoing() ) |
401 { |
398 { |
402 ControlGroup().SetAcceptInput( EFalse ); |
399 ControlGroup().SetAcceptInput( EFalse ); |
403 |
400 |
404 // Hide the control group immediately only if it's not already faded or |
401 // Hide the control group immediately only if it's not already faded or |
405 // fading out. This is to not interfere with the cross fading effect. |
402 // fading out. This is to not interfere with the cross fading effect. |
406 RPointerArray<CAlfVisual> layoutArray; |
403 RPointerArray<CAlfVisual> layoutArray; |
407 TRAP_IGNORE( GetParentLayoutsL( layoutArray ) ); |
404 TRAP_IGNORE( GetParentLayoutsL( layoutArray ) ); |
408 TInt layoutCount = layoutArray.Count(); |
405 TInt layoutCount = layoutArray.Count(); |
409 TInt fadingCount = 0; |
406 TInt fadingCount = 0; |
410 for ( TInt i = 0 ; i < layoutCount ; ++i ) |
407 for ( TInt i = 0 ; i < layoutCount ; ++i ) |
411 { |
408 { |
412 CAlfVisual* layout = layoutArray[i]; |
409 CAlfVisual* layout = layoutArray[i]; |
413 if ( layout && layout->Opacity().Target() < KDelta ) |
410 if ( layout && layout->Opacity().Target() < KDelta ) |
414 { |
411 { |
415 fadingCount++; |
412 fadingCount++; |
416 } |
413 } |
417 } |
414 } |
418 layoutArray.Close(); |
415 layoutArray.Close(); |
419 |
416 |
420 if ( !layoutCount || fadingCount != layoutCount ) |
417 if ( !layoutCount || fadingCount != layoutCount ) |
421 { |
418 { |
422 iAppUi.AlfEnv().CancelCommands( &ControlGroup(), EAlfOpShow ); |
419 iAppUi.AlfEnv().CancelCommands( &ControlGroup(), EAlfOpShow ); |
423 TAlfGroupCommand hideCmd( ControlGroup(), EAlfOpHide, &iAppUi.Display() ); |
420 TAlfGroupCommand hideCmd( ControlGroup(), EAlfOpHide, &iAppUi.Display() ); |
424 iAppUi.AlfEnv().Send( hideCmd, aDelay ); |
421 iAppUi.AlfEnv().Send( hideCmd, aDelay ); |
479 void CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( TDynamicSwitchType /*aType*/ ) |
476 void CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( TDynamicSwitchType /*aType*/ ) |
480 { |
477 { |
481 FUNC_LOG; |
478 FUNC_LOG; |
482 // Inherited classes should override this to react to skin and layout changes |
479 // Inherited classes should override this to react to skin and layout changes |
483 // which happen while the view is on background |
480 // which happen while the view is on background |
484 |
481 |
485 #ifdef __WINSCW__ |
482 #ifdef __WINSCW__ |
486 // For emulator testing: landscape mode is "flip open" |
483 // For emulator testing: landscape mode is "flip open" |
487 FlipStateChangedL( Layout_Meta_Data::IsLandscapeOrientation() ); |
484 FlipStateChangedL( Layout_Meta_Data::IsLandscapeOrientation() ); |
488 #endif |
485 #endif |
489 } |
486 } |
490 |
487 |
491 // --------------------------------------------------------------------------- |
488 // --------------------------------------------------------------------------- |
492 // |
489 // |
493 TBool CFsEmailUiViewBase::IsNextMsgAvailable( TFSMailMsgId /*aCurrentMsgId*/, |
490 TBool CFsEmailUiViewBase::IsNextMsgAvailable( TFSMailMsgId /*aCurrentMsgId*/, |
494 TFSMailMsgId& /*aFoundNextMsgId*/, |
491 TFSMailMsgId& /*aFoundNextMsgId*/, |
495 TFSMailMsgId& /*aFoundNextMsgFolderId*/ ) const |
492 TFSMailMsgId& /*aFoundNextMsgFolderId*/ ) const |
496 { |
493 { |
497 FUNC_LOG; |
494 FUNC_LOG; |
498 return EFalse; |
495 return EFalse; |
499 } |
496 } |
500 |
497 |
501 // --------------------------------------------------------------------------- |
498 // --------------------------------------------------------------------------- |
502 // |
499 // |
503 TBool CFsEmailUiViewBase::IsPreviousMsgAvailable( TFSMailMsgId /*aCurrentMsgId*/, |
500 TBool CFsEmailUiViewBase::IsPreviousMsgAvailable( TFSMailMsgId /*aCurrentMsgId*/, |
504 TFSMailMsgId& /*aFoundPreviousMsgId*/, |
501 TFSMailMsgId& /*aFoundPreviousMsgId*/, |
505 TFSMailMsgId& /*aFoundPrevMsgFolderId*/ ) const |
502 TFSMailMsgId& /*aFoundPrevMsgFolderId*/ ) const |
506 { |
503 { |
507 FUNC_LOG; |
504 FUNC_LOG; |
508 return EFalse; |
505 return EFalse; |
617 return ToolbarResourceId() != R_FREESTYLE_EMAIL_UI_TOOLBAR_BLANK; |
622 return ToolbarResourceId() != R_FREESTYLE_EMAIL_UI_TOOLBAR_BLANK; |
618 } |
623 } |
619 |
624 |
620 // ----------------------------------------------------------------------------- |
625 // ----------------------------------------------------------------------------- |
621 // CFsEmailUiViewBase::ToolbarResourceId |
626 // CFsEmailUiViewBase::ToolbarResourceId |
622 // |
627 // |
623 // ----------------------------------------------------------------------------- |
628 // ----------------------------------------------------------------------------- |
624 TInt CFsEmailUiViewBase::ToolbarResourceId() const |
629 TInt CFsEmailUiViewBase::ToolbarResourceId() const |
625 { |
630 { |
626 FUNC_LOG; |
631 FUNC_LOG; |
627 return R_FREESTYLE_EMAIL_UI_TOOLBAR_BLANK; |
632 return R_FREESTYLE_EMAIL_UI_TOOLBAR_BLANK; |
628 } |
633 } |
629 |
634 |
630 // ----------------------------------------------------------------------------- |
635 // ----------------------------------------------------------------------------- |
631 // CFsEmailUiViewBase::OfferToolbarEventL |
636 // CFsEmailUiViewBase::OfferToolbarEventL |