38 #include "xnnode.h" |
38 #include "xnnode.h" |
39 #include "xntype.h" |
39 #include "xntype.h" |
40 #include "xnfocuscontrol.h" |
40 #include "xnfocuscontrol.h" |
41 #include "xneditor.h" |
41 #include "xneditor.h" |
42 #include "xnbackgroundmanager.h" |
42 #include "xnbackgroundmanager.h" |
|
43 #include "xneffectmanager.h" |
|
44 #include "xnwallpaperview.h" |
43 |
45 |
44 #include "xnviewadapter.h" |
46 #include "xnviewadapter.h" |
45 #include "xnmenu.h" |
47 #include "xnmenu.h" |
46 #include "xneditmode.h" |
48 #include "xneditmode.h" |
47 #include "xnrootdata.h" |
49 #include "xnrootdata.h" |
48 |
50 |
49 #include "debug.h" |
51 #include "debug.h" |
50 |
52 |
51 // Constants |
53 // Constants |
52 const TUid KXmlViewUid = { 1 }; |
54 const TUid KXmlViewUid = { 1 }; |
|
55 |
53 _LIT8( KActivateDefaultView, "activatedefault" ); |
56 _LIT8( KActivateDefaultView, "activatedefault" ); |
|
57 _LIT8( KSetWallpaper, "setwallpaper" ); |
|
58 |
54 _LIT8( KMenuBar, "menubar" ); |
59 _LIT8( KMenuBar, "menubar" ); |
55 |
60 |
56 // Data types |
61 // Data types |
57 enum |
62 enum |
58 { |
63 { |
62 EIsForeground, |
67 EIsForeground, |
63 EIsControlsAwake, |
68 EIsControlsAwake, |
64 EIsDestructionRunning |
69 EIsDestructionRunning |
65 }; |
70 }; |
66 |
71 |
|
72 enum TAction |
|
73 { |
|
74 ENoAction = 0, |
|
75 EActivateDefault, |
|
76 ESetWallpaper |
|
77 }; |
|
78 |
67 // ============================= LOCAL FUNCTIONS =============================== |
79 // ============================= LOCAL FUNCTIONS =============================== |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CleanupEffect |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 static void CleanupEffect( TAny* aAny ) |
|
85 { |
|
86 static_cast< CXnEffectManager* >( aAny )->CleanupControlEffect(); |
|
87 } |
|
88 |
68 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
69 // DetermineStatusPaneLayout |
90 // DetermineStatusPaneLayout |
70 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
71 // |
92 // |
72 static TInt DetermineStatusPaneLayout( CXnProperty* aProperty ) |
93 static TInt DetermineStatusPaneLayout( CXnProperty* aProperty ) |
262 // Called when application UI is reloaded |
283 // Called when application UI is reloaded |
263 // ----------------------------------------------------------------------------- |
284 // ----------------------------------------------------------------------------- |
264 // |
285 // |
265 void CXnViewAdapter::ReloadUiL() |
286 void CXnViewAdapter::ReloadUiL() |
266 { |
287 { |
|
288 iTimer->Cancel(); |
|
289 iAction = ENoAction; |
|
290 |
267 DeactivateContainerL(); |
291 DeactivateContainerL(); |
268 |
292 |
269 iAppUiAdapter.RemoveFromStack( iEventDispatcher ); |
293 iAppUiAdapter.RemoveFromStack( iEventDispatcher ); |
270 |
294 |
271 delete iEventDispatcher; |
295 delete iEventDispatcher; |
408 { |
432 { |
409 sp->EnableTransparent( ETrue ); |
433 sp->EnableTransparent( ETrue ); |
410 sp->DrawNow(); |
434 sp->DrawNow(); |
411 } |
435 } |
412 |
436 |
|
437 if ( aCustomMessage == KSetWallpaper ) |
|
438 { |
|
439 iAction = ESetWallpaper; |
|
440 |
|
441 iTimer->Cancel(); |
|
442 iTimer->Start( 1000, 1000, TCallBack( TimerCallback, this ) ); |
|
443 } |
|
444 |
413 // Set the active container |
445 // Set the active container |
414 if ( aCustomMessage == KActivateDefaultView ) |
446 if ( aCustomMessage == KActivateDefaultView ) |
415 { |
447 { |
416 __PRINTS( "*** CXnViewAdapter::DoActivateL - activating default container" ); |
448 __PRINTS( "*** CXnViewAdapter::DoActivateL - activating default container" ); |
417 |
449 |
418 ActivateDefaultContainerL(); |
450 ActivateDefaultContainerL(); |
419 |
451 |
|
452 iAction = EActivateDefault; |
|
453 |
420 iTimer->Cancel(); |
454 iTimer->Cancel(); |
421 iTimer->Start( 1000, 1000, TCallBack( TimerCallback, this ) ); |
455 iTimer->Start( 1000, 1000, TCallBack( TimerCallback, this ) ); |
422 } |
456 } |
423 else |
457 else |
424 { |
458 { |
442 __PRINTS( "*** CXnViewAdapter::TimerCallback" ); |
476 __PRINTS( "*** CXnViewAdapter::TimerCallback" ); |
443 |
477 |
444 CXnViewAdapter* self = reinterpret_cast< CXnViewAdapter* >( aPtr ); |
478 CXnViewAdapter* self = reinterpret_cast< CXnViewAdapter* >( aPtr ); |
445 self->iTimer->Cancel(); |
479 self->iTimer->Cancel(); |
446 |
480 |
447 self->iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( |
481 if ( self->iAction == EActivateDefault ) |
448 self->iCoeEnv->RootWin().Identifier(), 0 ); |
482 { |
|
483 self->iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( |
|
484 self->iCoeEnv->RootWin().Identifier(), 0 ); |
|
485 } |
|
486 else if ( self->iAction == ESetWallpaper ) |
|
487 { |
|
488 CAknViewAppUi& appui = static_cast< CAknViewAppUi& >( self->iAppUiAdapter ); |
|
489 |
|
490 CXnWallpaperView* view = |
|
491 static_cast< CXnWallpaperView* >( appui.View( KWallpaperViewUid ) ); |
|
492 |
|
493 if ( view ) |
|
494 { |
|
495 TFileName filename( KNullDesC ); |
|
496 |
|
497 // Get selected wallpaper |
|
498 view->SelectedWallpaper( filename ); |
|
499 |
|
500 if ( filename != KNullDesC ) |
|
501 { |
|
502 if ( self->BgManager().SetWallpaper( filename ) ) |
|
503 { |
|
504 self->iAppUiAdapter.EffectManager()->BgAppearEffect( |
|
505 self->iBgManager, ETrue ); |
|
506 } |
|
507 } |
|
508 } |
|
509 } |
|
510 |
|
511 self->iAction = ENoAction; |
449 |
512 |
450 __PRINTS( "*** CXnViewAdapter::TimerCallback, done" ); |
513 __PRINTS( "*** CXnViewAdapter::TimerCallback, done" ); |
451 |
514 |
452 return KErrNone; |
515 return KErrNone; |
453 } |
516 } |
484 // CXnViewAdapter::ActivateContainerL |
547 // CXnViewAdapter::ActivateContainerL |
485 // Activates container |
548 // Activates container |
486 // ----------------------------------------------------------------------------- |
549 // ----------------------------------------------------------------------------- |
487 // |
550 // |
488 void CXnViewAdapter::ActivateContainerL( CXnViewData& aContainer, |
551 void CXnViewAdapter::ActivateContainerL( CXnViewData& aContainer, |
489 TBool aEnterEditState, TBool aForceActivation ) |
552 TBool aEnterEditState, TUid aEffect ) |
490 { |
553 { |
491 // Returns if the container remains the same and activation is not forced |
554 // Returns if the container remains the same and activation is not forced |
492 // Otherwise the old container is deactivated and the new is activated |
555 // Otherwise the old container is deactivated and the new is activated |
493 if ( iFlags.IsSet( EIsDestructionRunning ) || |
556 if ( iFlags.IsSet( EIsDestructionRunning ) || iContainer == &aContainer ) |
494 ( ( !aForceActivation ) && ( iContainer == &aContainer ) ) ) |
557 { |
495 { |
558 return; |
496 return; |
559 } |
497 } |
560 |
498 |
561 // Get previous container and then deactivate it |
499 // Find previous container and then deactivate it |
562 const CXnViewData* previous( iContainer ); |
500 const CXnViewData* previous( iContainer ); |
563 const CXnViewData& active( iAppUiAdapter.ViewManager().ActiveViewData() ); |
501 DeactivateContainerL(); |
564 |
|
565 DeactivateContainerL( EFalse ); |
502 |
566 |
503 if ( iFlags.IsClear( EIsActivated ) ) |
567 if ( iFlags.IsClear( EIsActivated ) ) |
504 { |
568 { |
505 // Some other view than this in this appui is currently active, |
569 // Some other view than this in this appui is currently active, |
506 // postpone container activation |
570 // postpone container activation |
508 } |
572 } |
509 |
573 |
510 // Update |
574 // Update |
511 iContainer = &aContainer; |
575 iContainer = &aContainer; |
512 |
576 |
|
577 CXnEffectManager* mgr( iAppUiAdapter.EffectManager() ); |
|
578 |
|
579 CleanupStack::PushL( TCleanupItem( CleanupEffect, mgr ) ); |
|
580 |
513 // Disable layout and redraw until container activation is done |
581 // Disable layout and redraw until container activation is done |
514 iAppUiAdapter.UiEngine().DisableRenderUiLC(); |
582 iAppUiAdapter.UiEngine().DisableRenderUiLC(); |
515 |
583 |
516 // Try exit controls from powersave mode |
584 // Try exit controls from powersave mode |
517 ChangeControlsStateL( ETrue ); |
585 ChangeControlsStateL( ETrue ); |
539 } |
607 } |
540 else |
608 else |
541 { |
609 { |
542 EnterEditStateL( aContainer, EFalse ); |
610 EnterEditStateL( aContainer, EFalse ); |
543 } |
611 } |
544 |
612 |
545 iAppUiAdapter.ViewManager().NotifyContainerChangedL( aContainer ); |
613 TBool started( |
546 |
614 mgr->BeginActivateViewEffect( active, aContainer, aEffect ) ); |
547 if ( previous && iContainer ) |
615 |
548 { |
616 if ( previous ) |
549 iBgManager->WallpaperChanged( *previous, *iContainer ); |
617 { |
550 } |
618 CXnControlAdapter* previousControl( |
551 |
619 previous->Node()->LayoutNode()->Control() ); |
|
620 |
|
621 previousControl->MakeVisible( EFalse ); |
|
622 } |
|
623 |
552 CXnControlAdapter* adapter( node->Control() ); |
624 CXnControlAdapter* adapter( node->Control() ); |
553 adapter->MakeVisible( ETrue ); |
625 adapter->MakeVisible( ETrue ); |
554 |
626 |
|
627 iAppUiAdapter.ViewManager().NotifyContainerChangedL( aContainer ); |
|
628 |
|
629 iBgManager->ChangeWallpaper( active, aContainer, !started ); |
|
630 |
555 iAppUiAdapter.UiEngine().RenderUIL(); |
631 iAppUiAdapter.UiEngine().RenderUIL(); |
556 |
632 |
557 CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
633 CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
|
634 |
|
635 mgr->EndActivateViewEffect( active, aContainer, aEffect ); |
|
636 |
|
637 CleanupStack::PopAndDestroy(); // cleanupitem |
|
638 |
|
639 iAppUiAdapter.ViewManager().UpdatePageManagementInformationL(); |
|
640 |
|
641 if ( iEventDispatcher ) |
|
642 { |
|
643 iEventDispatcher->SetMenuNodeL( |
|
644 iAppUiAdapter.UiEngine().MenuBarNode() ); |
|
645 } |
558 } |
646 } |
559 |
647 |
560 // ----------------------------------------------------------------------------- |
648 // ----------------------------------------------------------------------------- |
561 // CXnViewAdapter::ActivateDefaultContainerL |
649 // CXnViewAdapter::ActivateDefaultContainerL |
562 // Activates default container |
650 // Activates default container |
579 if ( viewData ) |
667 if ( viewData ) |
580 { |
668 { |
581 EnterEditStateL( *viewData, aEnterEditState ); |
669 EnterEditStateL( *viewData, aEnterEditState ); |
582 // Deactivate container even though it hasn't changed to close all |
670 // Deactivate container even though it hasn't changed to close all |
583 // popups and other windows |
671 // popups and other windows |
584 ActivateContainerL( *viewData, aEnterEditState, ETrue ); |
672 ActivateContainerL( *viewData, aEnterEditState ); |
585 } |
673 } |
586 } |
674 } |
587 |
675 |
588 // ----------------------------------------------------------------------------- |
676 // ----------------------------------------------------------------------------- |
589 // CXnViewAdapter::EnterEditStateL |
677 // CXnViewAdapter::EnterEditStateL |
629 // ----------------------------------------------------------------------------- |
717 // ----------------------------------------------------------------------------- |
630 // CXnViewAdapter::DeactivateContainerL |
718 // CXnViewAdapter::DeactivateContainerL |
631 // Deactivates current container |
719 // Deactivates current container |
632 // ----------------------------------------------------------------------------- |
720 // ----------------------------------------------------------------------------- |
633 // |
721 // |
634 void CXnViewAdapter::DeactivateContainerL() |
722 void CXnViewAdapter::DeactivateContainerL( TBool aHide ) |
635 { |
723 { |
636 if ( !iContainer || iFlags.IsSet( EIsDestructionRunning ) ) |
724 if ( !iContainer || iFlags.IsSet( EIsDestructionRunning ) ) |
637 { |
725 { |
638 return; |
726 return; |
639 } |
727 } |
649 } |
737 } |
650 |
738 |
651 CXnNode* node( iContainer->Node()->LayoutNode() ); |
739 CXnNode* node( iContainer->Node()->LayoutNode() ); |
652 |
740 |
653 node->ReportXuikonEventL( *iDeactivate ); |
741 node->ReportXuikonEventL( *iDeactivate ); |
654 node->Control()->MakeVisible( EFalse ); |
742 |
655 |
743 if ( aHide ) |
|
744 { |
|
745 node->Control()->MakeVisible( EFalse ); |
|
746 } |
|
747 |
656 iContainer = NULL; |
748 iContainer = NULL; |
657 } |
749 } |
658 |
750 |
659 // ----------------------------------------------------------------------------- |
751 // ----------------------------------------------------------------------------- |
660 // CXnViewAdapter::NotifyForegroundChanged |
752 // CXnViewAdapter::NotifyForegroundChanged |