diff -r 5315654608de -r 08c6ee43b396 idlehomescreen/widgetmanager/src/wmplugin.cpp --- a/idlehomescreen/widgetmanager/src/wmplugin.cpp Thu Jan 07 12:39:41 2010 +0200 +++ b/idlehomescreen/widgetmanager/src/wmplugin.cpp Mon Jan 18 20:10:36 2010 +0200 @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include "wmcommon.h" #include "widgetmanager.hrh" @@ -49,15 +51,35 @@ // CWmPlugin::~CWmPlugin() { + iPostponedCommand = ENone; if ( iViewAppUi ) { - Deactivate(); - iViewAppUi->RemoveView( TUid::Uid( EWmMainContainerViewId ) ); - } - iWmMainContainer = NULL; + if ( iWmMainContainer && IsActive() ) + { + iWmMainContainer->SetClosingDown( ETrue ); + TRAPD( err, iViewAppUi->ActivateLocalViewL( + iPreviousViewUid.iViewUid ); ); + if ( KErrNone == err ) + { + iWait->Start(); + // remove view from appui + iViewAppUi->RemoveView( + TUid::Uid( EWmMainContainerViewId ) ); + } + else + { + TRAP_IGNORE( iViewAppUi->DeactivateActiveViewL(); ); + iViewAppUi->RemoveFromViewStack( + *iWmMainView, iWmMainContainer ); + delete iWmMainContainer; + iWmMainContainer = NULL; + } + } + } delete iResourceLoader; delete iEffectManager; delete iPostponedContent; + delete iWait; } // --------------------------------------------------------- @@ -76,6 +98,7 @@ void CWmPlugin::ConstructL() { iWmMainContainer = NULL; + iWmMainView = NULL; // store static view app ui CEikonEnv* eikonEnv = CEikonEnv::Static(); @@ -88,12 +111,16 @@ iResourceLoader = CWmResourceLoader::NewL( *eikonEnv ); iEffectManager = CWmEffectManager::NewL( *eikonEnv ); + // wait object + iWait = new (ELeave) CActiveSchedulerWait(); + // main view CWmMainContainerView* mainView = CWmMainContainerView::NewL( *this ); CleanupStack::PushL( mainView ); iViewAppUi->AddViewL( mainView ); CleanupStack::Pop( mainView ); + iWmMainView = mainView; } // --------------------------------------------------------- @@ -152,6 +179,9 @@ iWmMainContainer = aWmMainContainer; iEffectManager->UiRendered(); iWmMainContainer->SetClosingDown( EFalse ); + + // Don't forward numeric keys to phone + ForwardNumericKeysToPhone( EFalse ); } // --------------------------------------------------------- @@ -160,11 +190,35 @@ // void CWmPlugin::MainViewDeactivated() { + // Forward numeric keys to phone + ForwardNumericKeysToPhone( ETrue ); + iPreviousViewUid.iViewUid = KNullUid; iWmMainContainer = NULL; - iEffectManager->UiRendered(); + if ( iEffectManager && !iWait->IsStarted() ) + { + iEffectManager->UiRendered(); + } + + TRAP_IGNORE( ExecuteCommandL(); ); + + if ( iWait->IsStarted() ) { iWait->AsyncStop(); } + } - TRAP_IGNORE( ExecutePostponedCommandL(); ); +// --------------------------------------------------------- +// CWmPlugin::ForwardNumericKeysToPhone +// --------------------------------------------------------- +// +void CWmPlugin::ForwardNumericKeysToPhone( TBool aEnabled ) + { + TInt value = aEnabled ? + EPSAiForwardNumericKeysToPhone : + EPSAiDontForwardNumericKeysToPhone; + + RProperty::Set( + KPSUidAiInformation, + KActiveIdleForwardNumericKeysToPhone, + value ); } // --------------------------------------------------------- @@ -181,10 +235,10 @@ } // --------------------------------------------------------- -// CWmPlugin::ExecutePostponedCommandL +// CWmPlugin::ExecuteCommandL // --------------------------------------------------------- // -void CWmPlugin::ExecutePostponedCommandL() +void CWmPlugin::ExecuteCommandL() { if ( iPostponedCommand == EAddToHomescreen ) { @@ -257,7 +311,7 @@ // void CWmPlugin::NotifyWidgetListChanged() { - if ( iWmMainContainer ) + if ( iWmMainContainer && !iWmMainContainer->ClosingDown() ) { iWmMainContainer->HandleWidgetListChanged(); }