diff -r c743ef5928ba -r f966699dea19 idlehomescreen/xmluirendering/uiengine/src/xnappuiadapter.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnappuiadapter.cpp Tue Feb 02 00:04:13 2010 +0200 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnappuiadapter.cpp Fri Feb 19 22:42:37 2010 +0200 @@ -41,7 +41,7 @@ // ----------------------------------------------------------------------------- // EXPORT_C CXnAppUiAdapter::CXnAppUiAdapter( TUid aApplicationUid ) - : iApplicationUid( aApplicationUid ) + : iExitingApp( EFalse ), iApplicationUid( aApplicationUid ) { } @@ -97,7 +97,8 @@ // ----------------------------------------------------------------------------- // EXPORT_C CXnAppUiAdapter::~CXnAppUiAdapter() - { + { + iExitingApp = ETrue; delete iUiEngineAppIf; delete iImpl; @@ -155,14 +156,15 @@ } // ----------------------------------------------------------------------------- -// CXnAppUiAdapter::LoadDataPluginsL +// CXnAppUiAdapter::LoadPublisher // // ----------------------------------------------------------------------------- // -EXPORT_C void CXnAppUiAdapter::LoadDataPluginsL( - RPointerArray< CXnNodeAppIf >& /*aList*/ ) +EXPORT_C TInt CXnAppUiAdapter::LoadPublisher( CXnNodeAppIf& /*aPublisher*/, + TInt /*aReason*/ ) { // Default empty implementation + return KErrNone; } // ----------------------------------------------------------------------------- @@ -170,10 +172,11 @@ // // ----------------------------------------------------------------------------- // -EXPORT_C void CXnAppUiAdapter::DestroyDataPluginsL( - RPointerArray< CXnNodeAppIf >& /*aList*/ ) +EXPORT_C TInt CXnAppUiAdapter::DestroyPublisher( CXnNodeAppIf& /*aPublisher*/, + TInt /*aReason*/ ) { // Default empty implementation + return KErrNone; } // ----------------------------------------------------------------------------- @@ -189,17 +192,6 @@ } // ----------------------------------------------------------------------------- -// CXnAppUiAdapter::SetOnlineStateL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CXnAppUiAdapter::SetOnlineStateL( - RPointerArray< CXnNodeAppIf >& /*aList*/ ) - { - // Default empty implementation - } - -// ----------------------------------------------------------------------------- // CXnAppUiAdapter::View // // ----------------------------------------------------------------------------- @@ -210,16 +202,6 @@ } // ----------------------------------------------------------------------------- -// CXnAppUiAdapter::HandlePageSwitch -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CXnAppUiAdapter::HandlePageSwitch() - { - // Default empty implementation - } - -// ----------------------------------------------------------------------------- // CXnAppUiAdapter::HandleEnterEditModeL // // ----------------------------------------------------------------------------- @@ -228,7 +210,84 @@ { // Default empty implementation } - + +// ----------------------------------------------------------------------------- +// CXnAppUiAdapter::HandleEventL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnAppUiAdapter::HandleEventL( const TDesC& /*aEvent*/, + CXnNodeAppIf& /*aDestination*/ ) + { + // Default empty implementation + } + +// ----------------------------------------------------------------------------- +// CXnAppUiAdapter::RemoveViewL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnAppUiAdapter::RemoveViewL( CAknView& aView ) + { + if ( iExitingApp ) return; // framework will destroy view + TVwsViewId activeViewId(KNullUid,KNullUid); + TBool activateDefaultView( EFalse ); + if ( GetActiveViewId( activeViewId ) == KErrNone && + activeViewId.iViewUid == aView.Id() ) + { + // currently active, deactivate + activateDefaultView = ETrue; + DeactivateActiveViewIfOwnerMatchL(); + } + + if ( iView == &aView ) { iView = NULL; } + CCoeAppUi::DeregisterView( aView ); + + const TInt count( iViews->Count() ); + for ( TInt i = 0; i < count; ++i ) + { + CAknView* view( iViews->At( i ) ); + if ( view == &aView && + view->Id() == aView.Id() ) + { + iViews->Delete( i ); + delete view; + view = NULL; + break; + } + } + + if ( activateDefaultView ) + { + // check which view is active now. + activeViewId = TVwsViewId(KNullUid,KNullUid); + GetActiveViewId( activeViewId ); + + TVwsViewId defaultViewId( KNullUid,KNullUid ); + // activate default if needed + if ( GetDefaultViewId( defaultViewId ) == KErrNone && + activeViewId != defaultViewId ) + { + ActivateViewL( defaultViewId ); + } + } + } + +// ----------------------------------------------------------------------------- +// CXnAppUiAdapter::PrepareToExit +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnAppUiAdapter::PrepareToExit() + { + iExitingApp = ETrue; + delete iUiEngineAppIf; + iUiEngineAppIf = NULL; + delete iImpl; + iImpl = NULL; + CAknViewAppUi::PrepareToExit(); + } + // ----------------------------------------------------------------------------- // CXnAppUiAdapter::ReloadUiL // @@ -335,7 +394,7 @@ // // ----------------------------------------------------------------------------- // -void CXnAppUiAdapter::ShowFocus() +void CXnAppUiAdapter::ShowFocus() { return iImpl->ViewAdapter().FocusControl().MakeVisible( ETrue ); }