diff -r 000000000000 -r 2f259fa3e83a uifw/AknGlobalUI/AknCapServer/src/AknFastswapWindowControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uifw/AknGlobalUI/AknCapServer/src/AknFastswapWindowControl.cpp Tue Feb 02 01:00:49 2010 +0200 @@ -0,0 +1,3280 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Control container for fastswap. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // tooltip +#include // method ConvertToVisualAndClipL +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_UI_TRANSITION_EFFECTS_LIST +#include +#include +#endif // RD_UI_TRANSITION_EFFECTS_LIST + +#include +#include +#include +#include +#include +#include + +#include "AknFastswapWindowControl.h" +#include "AknFastswapWindowGrid.h" +#include "AknCapServerEntry.h" +#include "akntrace.h" +void InvalidateWindows( CCoeControl* aControl ) + { + if ( aControl ) + { + if ( aControl->OwnsWindow() ) + { + ( (RWindow*) aControl->DrawableWindow() )->ClearRedrawStore(); + } + + for ( TInt i = aControl->CountComponentControls() - 1; i >= 0; --i ) + { + InvalidateWindows( aControl->ComponentControl( i ) ); + } + } + } + +const TInt KFSWArrayGranularity = 4; +const TInt KMinimumSupportedApps = 20; + +const TBool KVerticalOrientation = EFalse; +const TBool KLeftToRight = ETrue; +const TBool KRightToLeft = EFalse; +const TBool KTopToBottom = ETrue; + +const TInt KTooltipTimeBefore = 600; +const TInt KTooltipTimeView = 1500; + +// Values for touch mode tooltip. +const TInt KTooltipTimeBeforeTouch = 0; +const TInt KTooltipTimeViewTouch = 0; // Shown until canceled + +// Always shown applications spesified in the ui specs. +const TInt KAlwaysShownAppCount = 3; +const TUid KMenuAppUid = {0x101F4CD2}; +const TUid KSearchAppUid = {0x0EFC346A}; + +// new idle from 3.2 onwards, old idle uid is 0x101FD64C +const TUid KIdleAppUid = {0x102750F0}; + +const TInt KApplicationWithoutWG = KErrNotFound; + +const TInt KWidgetWithoutWG = KErrGeneral; +// Uid of the Widget application. +const TUid KWidgetAppUid = {0x10282822}; + +// Matrix Menu P&S category +const TUid KFSWMMenuPSCat = {0x101F4CD2}; +// Key that stores last used - current view (it is text value) +const TUint KFSWMMenuLastViewKey = 0x01; +// name of folder view +_LIT(KFSWMMenuFolderView, "foldersuite"); + +const TInt KTimeDelayBeforeAnimation = 200000; // 0.2 seconds +const TInt KLongTapDelay = 800000; // 0.8 seconds +const TInt KTimeNeverHappenEvent = 100000000; // 100 seconds +const TInt KPressedDownEffectTime = 500000;//0.5 seconds +enum TAknCapServerCommands + { + EAknCapServerCmdOpen = 0x6100, + EAknCapServerCmdClose + }; + +NONSHARABLE_CLASS(CAknFastSwapData) : public CBase, + public MAknTransitionUtilsObserver + { + public: + CAknFastSwapData(TInt aKey, CAknInfoPopupNoteController* aTooltip); + + private: + TInt AknTransitionCallback(TInt aEvent, TInt aState = 0, + const TDesC8* aParams = NULL); + + private: + CAknInfoPopupNoteController* iTooltip; + TInt iKey; + }; + +CAknFastSwapData::CAknFastSwapData( TInt aKey, + CAknInfoPopupNoteController* aTooltip ) + : iTooltip( aTooltip ), iKey( aKey ) + { + } + +TInt CAknFastSwapData::AknTransitionCallback(TInt aEvent, TInt /*aState*/, + const TDesC8* /*aParams*/) + { + _AKNTRACE_FUNC_ENTER; + iTooltip->ShowInfoPopupNote(); + + CAknTransitionUtils::RemoveObserver( this, aEvent ); + _AKNTRACE_FUNC_EXIT; + return KErrNone; + } + +NONSHARABLE_CLASS(CAknWidgetList) : public CBase + { + public: + static CAknWidgetList* NewL( CAknFastSwapWindowControl& aParent ); + /** Destructor */ + ~CAknWidgetList(); + + /** + * Initializes the list that stores widgets. + * @return - + */ + void InitializeWidgetListL(); + + /** + * Check if a uid is the uid of the widget application. + * @param aAppUid The application uid to be checked. + * @return ETrue application uid belongs to widget application - EFalse otherwise. + */ + TBool IsWidgetAppUI( TUid aAppUid ); + + /** + * Check if the window group id value refers to widget. + * @param aWgId window group id. + * @return ETrue if window group id has value that refers to widget. + */ + TBool IsWidget( TInt aWgId ); + + /** + * Map tasklist application index to application Uid. + * + * @param aIndex index of tasklist item array. + * @param aAlwaysShownCount number of applications that are always shown on + the active applications list. + * @return application Uid + */ + TUid IndexToAppUid( TInt aIndex, TInt aAlwaysShownCount ); + + private: + /** Constructor */ + CAknWidgetList( CAknFastSwapWindowControl& aParent ); + void ConstructL(); + void ResetArrayOfWidgetInfo( RWidgetInfoArray& aWidgetInfoArr ); + + static void CleanupConnect( TAny* aThis ); + + public: + /** Contains list of widgets that are currently running */ + RWidgetInfoArray iRunningWidgets; + private: + CAknFastSwapWindowControl& iParent; + RWidgetRegistryClientSession iWidgetRegistryClientSession; + }; + + +CAknWidgetList* CAknWidgetList::NewL( CAknFastSwapWindowControl& aParent ) + { + _AKNTRACE_FUNC_ENTER; + CAknWidgetList* self = new (ELeave) CAknWidgetList( aParent ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); //self + _AKNTRACE_FUNC_EXIT; + return self; + } + +CAknWidgetList::CAknWidgetList( CAknFastSwapWindowControl& aParent ): iParent( aParent ) + { + } + +CAknWidgetList::~CAknWidgetList() + { + _AKNTRACE_FUNC_ENTER; + ResetArrayOfWidgetInfo( iRunningWidgets ); + iRunningWidgets.Reset(); + _AKNTRACE_FUNC_EXIT; + } + +void CAknWidgetList::ConstructL() + { + } + +void CAknWidgetList::CleanupConnect( TAny* aThis ) + { + _AKNTRACE_FUNC_ENTER; + (( CAknWidgetList*)aThis)->iWidgetRegistryClientSession.Disconnect(); + _AKNTRACE_FUNC_EXIT; + } + +void CAknWidgetList::InitializeWidgetListL() + { + _AKNTRACE_FUNC_ENTER; + ResetArrayOfWidgetInfo( iRunningWidgets ); + iRunningWidgets.Reset(); + User::LeaveIfError( iWidgetRegistryClientSession.Connect() ); + CleanupStack::PushL( TCleanupItem( CleanupConnect, this) ); + iWidgetRegistryClientSession.RunningWidgetsL(iRunningWidgets); + for ( TInt i = iRunningWidgets.Count() - 1; i > -1; i-- ) + { + if ( !iWidgetRegistryClientSession.IsWidgetInFullView(iRunningWidgets[i]->iUid) ) + { + delete iRunningWidgets[i]; + iRunningWidgets.Remove(i); + } + } + CleanupStack::Pop(); // clean WidgetRegistryClientSession item + iWidgetRegistryClientSession.Disconnect(); + _AKNTRACE_FUNC_EXIT; + } + +TBool CAknWidgetList::IsWidgetAppUI( TUid aAppUid ) + { + _AKNTRACE( "[%s] aAppUid = %d", + __FUNCTION__, aAppUid.iUid ); + return (aAppUid == KWidgetAppUid); + } + +TBool CAknWidgetList::IsWidget( TInt aWgId ) + { + _AKNTRACE( "[%s] aWgId = %d", + __FUNCTION__, aWgId ); + return (aWgId == KWidgetWithoutWG); + } + +TUid CAknWidgetList::IndexToAppUid( TInt aIndex, TInt aAlwaysShownCount ) + { + _AKNTRACE( "[%s] aIndex = %d aAlwaysShownCount = %d", + __FUNCTION__, aIndex, aAlwaysShownCount ); + return iRunningWidgets[aIndex + iRunningWidgets.Count() + + aAlwaysShownCount - iParent.iNumberOfWGs]->iUid; + } + +void CAknWidgetList::ResetArrayOfWidgetInfo( + RWidgetInfoArray& aWidgetInfoArr ) + { + _AKNTRACE_FUNC_ENTER; + for ( TInt i = 0; i < aWidgetInfoArr.Count(); i++ ) + { + CWidgetInfo *item = aWidgetInfoArr[i]; + delete item ; + } + _AKNTRACE_FUNC_EXIT; + } + + +NONSHARABLE_CLASS(CAknAlwaysShownAppList) : public CBase + { + public: + // always shown application info + // used in the always shown application list + struct SAlwaysShownAppInfo + { + TUid iAppUid; + TInt iWgId; + }; + public: + static CAknAlwaysShownAppList* NewL( CAknFastSwapWindowControl& aParent ); + CAknAlwaysShownAppList( CAknFastSwapWindowControl& aParent ); + ~CAknAlwaysShownAppList(); + + /** + * Initializes the list that stores applications that are always + * shown in the fast swap provided they have been installed + * in the phone rom + * @return - + */ + void InitializeAlwaysShownListL(); + + /** + * Add window group id to spesific appication (=uid) + * @return - + * @param TUid aAppUid the application uid + * @param TInt aWgId the window group where task resides + */ + void AddWgGroupToAlwaysShownList( TUid aAppUid, TInt aWgId ); + + /** + * If application uid exists in the always shown application list + * @return ETrue application uid exists in the list + * EFalse application uid doesn't exist in the list + * @param TUid aAppUid the application uid + */ + TBool IsAlwaysShownApp( TUid aAppUid ); + + /** + * If application window group exists in the always shown application list + * @return ETrue wg exists in the list + * EFalse wg doesn't exist in the list + * @param TInt aWgId the application window group + */ + TBool IsAlwaysShownApp( TInt aWgId ); + + /** + * + * Map Tasklist application index to application Uid + * @return TUid application Uid + * + * @param TInt aIndex index of tasklist item arrays + */ + TUid IndexToAppUid( TInt aIndex ); + + public: + RArray* iAppList; + private: + void ConstructL(); + private: + // the list of applications always shown in the fsw + CAknFastSwapWindowControl& iParent; + }; + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::NewL +// --------------------------------------------------------- +// +CAknAlwaysShownAppList* CAknAlwaysShownAppList::NewL( CAknFastSwapWindowControl& aParent ) + { + _AKNTRACE_FUNC_ENTER; + CAknAlwaysShownAppList* self = new (ELeave) CAknAlwaysShownAppList( aParent ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); //self + _AKNTRACE_FUNC_EXIT; + return self; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::CAknAlwaysShownAppList +// --------------------------------------------------------- +// +CAknAlwaysShownAppList::CAknAlwaysShownAppList( CAknFastSwapWindowControl& aParent ) +: iParent( aParent ) + { + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::~CAknAlwaysShownAppList +// --------------------------------------------------------- +// +CAknAlwaysShownAppList::~CAknAlwaysShownAppList() + { + _AKNTRACE_FUNC_ENTER; + if (iAppList) + { + iAppList->Close(); + } + delete iAppList; + _AKNTRACE_FUNC_EXIT; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::ConstructL +// --------------------------------------------------------- +// +void CAknAlwaysShownAppList::ConstructL() + { + // the list for always shown applications in the fast swap + iAppList = new (ELeave) RArray(); + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::InitializeAlwaysShownListL +// Applications that are always shown in fast swap are stored +// in different their own list whether they exist +// in the phone rom or not +// --------------------------------------------------------- +// +void CAknAlwaysShownAppList::InitializeAlwaysShownListL() + { + _AKNTRACE_FUNC_ENTER; + iAppList->Close(); + // order of always shown applications + TUid uidArray[] = {KMenuAppUid, KSearchAppUid, KIdleAppUid}; + TApaAppInfo applicationInfo; + SAlwaysShownAppInfo fixedAppInfo; + for ( TInt index = 0; index < KAlwaysShownAppCount; index++) + { + // if exists in phone rom + if ( iParent.iAppArcSession.GetAppInfo(applicationInfo, uidArray[index]) != KErrNotFound ) + { + fixedAppInfo.iAppUid = uidArray[index]; + // list is created without known window groups + fixedAppInfo.iWgId = KApplicationWithoutWG; + iAppList->AppendL( fixedAppInfo ); + } + } + _AKNTRACE_FUNC_EXIT; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::AddWgGroupToAlwaysShownList +// The window groups are stored with the application uids +// --------------------------------------------------------- +// +void CAknAlwaysShownAppList::AddWgGroupToAlwaysShownList( TUid aAppUid, TInt aWgId ) + { + _AKNTRACE_FUNC_ENTER; + _AKNTRACE( "[%s] aAppUid = %d aWgId = %d", + __FUNCTION__, aAppUid.iUid, aWgId ); + for ( TInt index = 0; index < iAppList->Count(); index++) + { + if ( (*iAppList)[index].iAppUid == aAppUid ) + { + (*iAppList)[index].iWgId = aWgId; + } + } + _AKNTRACE_FUNC_EXIT; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::IsAlwaysShownApp +// If application uid exists in the always shown application list +// --------------------------------------------------------- +// +TBool CAknAlwaysShownAppList::IsAlwaysShownApp( TUid aAppUid ) + { + _AKNTRACE_FUNC_ENTER; + _AKNTRACE( "[%s] aAppUid = %d", __FUNCTION__, aAppUid.iUid ); + for ( TInt index = 0; index < iAppList->Count(); index++) + { + if ( (*iAppList)[index].iAppUid == aAppUid ) + { + _AKNTRACE_FUNC_EXIT; + return ETrue; + } + } + _AKNTRACE_FUNC_EXIT; + return EFalse; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::IsAlwaysShownApp +// If application window group exists in the always shown application list +// --------------------------------------------------------- +// +TBool CAknAlwaysShownAppList::IsAlwaysShownApp( TInt aWgId ) + { + _AKNTRACE_FUNC_ENTER; + _AKNTRACE( "[%s] aWgId = %d", __FUNCTION__, aWgId ); + for ( TInt index = 0; index < iAppList->Count(); index++) + { + if ( (*iAppList)[index].iWgId == aWgId ) + { + _AKNTRACE_FUNC_EXIT; + return ETrue; + } + } + _AKNTRACE_FUNC_EXIT; + return EFalse; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::IndexToAppUid +// Map Tasklist application index to application Uid +// --------------------------------------------------------- +// +TUid CAknAlwaysShownAppList::IndexToAppUid( TInt aIndex ) + { + _AKNTRACE( "[%s] aIndex = %d", __FUNCTION__, aIndex ); + return (*iAppList)[aIndex + iAppList->Count() - iParent.iNumberOfWGs].iAppUid; + } + + +CAknGridView::TScrollingType KVerticalScrollingType = CAknGridView::EScrollFollowsItemsAndLoops; +CAknGridView::TScrollingType KHorizontalScrollingType = CAknGridView::EScrollFollowsItemsAndLoops; + +_LIT(KTab,"\t"); + +// ================= MEMBER FUNCTIONS ======================= +// C++ default constructor can NOT contain any code, that +// might leave. +// +CAknFastSwapWindowControl::CAknFastSwapWindowControl(CAknCapAppServerAppUi& aAppUi) +: iAppUi( aAppUi ),iLowMemory( EFalse ), iLowMemIcons( EFalse ), iAppArcSessionInitiated( EFalse ), + iWidgetAppUiWgId(-1), iWidgetsSupported( EFalse ), + iTooltipModeTouch( EFalse ),iTransparencyEnabled( CAknEnv::Static()->TransparencyEnabled() ), + iIsStylusPopupShow(EFalse), iState( EWaiting ) + { + AKNTASHOOK_ADD( this, "CAknFastSwapWindowControl" ); + } + +// Symbian OS default constructor can leave. +void CAknFastSwapWindowControl::ConstructL() + { + _AKNTRACE_FUNC_ENTER; + GfxTransEffect::Enable(); + + CreateWindowL(); + SetComponentsToInheritVisibility(); + Window().SetShadowDisabled( ETrue ); + Window().SetPointerGrab( ETrue ); + SetGloballyCapturing( ETrue ); + + if( iTransparencyEnabled ) + { + Window().SetRequiredDisplayMode( EColor16MA ); + TInt err = Window().SetTransparencyAlphaChannel(); + + if ( err == KErrNone ) + { + Window().SetBackgroundColor(~0); + } + } + + if (FeatureManager::FeatureSupported(KFeatureIdWebWidgets)) + { + iWidgetsSupported = ETrue; + } + CreateCbaL(); + CreateGridL(); + CreateItemArraysL(); + CreateTooltipL(); + CreateLabelL(); + UpdateHeadingIconL(); + + //create animation + iLongTapAnimation = CAknLongTapAnimation::NewL( EFalse ); + iThemesAppRepository = CRepository::NewL( KCRUidThemes ); + //create TimeOut + iTimeOut = CPeriodic::NewL(CActive::EPriorityStandard); + iToolTipTimer = CPeriodic::NewL(CActive::EPriorityStandard); + + CreateComponentArrayL(); + + // create control context + TRect nullRect( 0, 0 , 0, 0 ); + iFrameContext = CAknsFrameBackgroundControlContext::NewL( + KAknsIIDQsnFrPopup, nullRect, nullRect, EFalse); + + // the list for always shown applications in the fast swap + iAlwaysShownList = CAknAlwaysShownAppList::NewL( *this ); + + if (iWidgetsSupported) + { + iWidgetList = CAknWidgetList::NewL( *this ); + } + MakeVisible( EFalse ); + _AKNTRACE_FUNC_EXIT; + } + +// Destructor +CAknFastSwapWindowControl::~CAknFastSwapWindowControl() + { + _AKNTRACE_FUNC_ENTER; + AKNTASHOOK_REMOVE(); + AknGlobalPopupPriorityController::RemovePopupPriority(*this); + GfxTransEffect::Deregister( this ); + + iAppArcSession.Close(); + ClearItemArrays( ETrue ); + if ( iGrid ) + { + AknsUtils::DeregisterControlPosition( iGrid ); + } + delete iAlwaysShownList; + delete iWidgetList; + FadeBackground( EFalse ); + delete iFrameContext; + delete iGrid; // destroys also iIconArray and scrollbar frame + delete iShownWgIds; + if ( iAllWgIds ) + { + iAllWgIds->Close(); + } + + CAknFastSwapData *data = + (CAknFastSwapData*)CAknTransitionUtils::GetData( (TInt)this ); + if ( data ) + { + CAknTransitionUtils::RemoveObserver( data, + CAknTransitionUtils::EEventControlTransitionFinished ); + CAknTransitionUtils::RemoveData( (TInt)this ); + delete data; + } + + delete iItemTextArray; + delete iAllWgIds; + delete iDefaultAppIcon; + delete iCba; + delete iConfirmCloseDialog; + delete iHeadingIcon; + delete iTooltip; + delete iLabel; + delete iPopupMenu; + delete iLongTapAnimation; + delete iTimeOut; + delete iToolTipTimer; + delete iThemesAppRepository; + _AKNTRACE_FUNC_EXIT; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::RunFastSwapL +// Function that is called from CEikServAppUi to launch +// task switching. Updates all relevant data (see more detailed +// description from the functions called) and brings the +// window to foreground +// --------------------------------------------------------- +// +void CAknFastSwapWindowControl::RunFastSwapL() + { + _AKNTRACE_FUNC_ENTER; + if ( iIsDisplayed ) + { + _AKNTRACE_FUNC_EXIT; + return; + } + TInt effectValue( 0 ); + iThemesAppRepository->Get( KThemesTransitionEffects, effectValue ); + if ( effectValue == 0 ) /* TAT on */ + { + MTouchFeedback* feedback = MTouchFeedback::Instance(); + if ( feedback ) + { + feedback->InstantFeedback( ETouchFeedbackIncreasingPopUp ); + } + } + + GfxTransEffect::Register( this, KGfxTaskSwapperControlUid, EFalse ); + GfxTransEffect::Abort(); + + TPoint dPoint( iGrid->PositionRelativeToScreen() ); + TRect dRect( iGrid->Rect() ); + dRect.Move( dPoint ); + + + + SetPointerCapture( ETrue ); + + CleanupStack::PushL( TCleanupItem( CleanupRunFastSwap, this) ); + + iIsDisplayed = ETrue; + + AknGlobalPopupPriorityController::AddPopupToControlStackL(*this,ECoeStackPriorityDialog,0 ); + AknGlobalPopupPriorityController::AddPopupToControlStackL(*iCba->ButtonGroup()->AsControl(), + ECoeStackPriorityCba, ECoeStackFlagRefusesFocus ); + AknGlobalPopupPriorityController::ShowPopup(*this, ETrue); + + TBool areWeInIdleState = CEikStatusPaneBase::Current()->PaneCapabilities( + TUid::Uid( EEikStatusPaneUidClock ) ).IsInCurrentLayout(); + + if (areWeInIdleState) + { // idle state + ( (CEikCba*) iCba->ButtonGroup() )->SetSkinBackgroundId(KAknsIIDQsnBgAreaControlIdle); + } + else + { + ( (CEikCba*) iCba->ButtonGroup() )->SetSkinBackgroundId(KAknsIIDQsnBgAreaControl); + } + + iCba->HandleResourceChange(KEikDynamicLayoutVariantSwitch); + iCba->MakeVisible( ETrue ); + + + SetRect( FastSwapWindowRect() ); // Causes call of SizeChanged() + + iBackgroundWgId = (*iAllWgIds)[0].iId; // where to switch if cancel is pressed + + ActivateL(); + + CleanupStack::Pop(); // clean fast swap cleanup item + + // if the grid creation failed, fsw closes + if ( iGrid->Model()->NumberOfItems() == 0 ) + { + // if memory runs out, FSW uses what it has + // and continues (should never happen) + CloseFastSwap(); + } + else + { + iGrid->SetTopItemIndex( 0 ); + iGrid->SetCurrentDataIndex( 0 ); + UpdateTooltipL(); + if ( !CAknTransitionUtils::TransitionsEnabled( + AknTransEffect::EComponentTransitionsOff ) ) + { + iTooltip->ShowInfoPopupNote(); + } + } + CAknTransitionUtils::SetAllParents( this ); + + TBool rsWasEnabled( EFalse ); + + if( !iTransparencyEnabled && Window().IsRedrawStoreEnabled() ) + { + rsWasEnabled = ETrue; + // disable redrawstore during transition to avoid + // drawing problems behind FSW + Window().EnableRedrawStore( EFalse ); + } + + GfxTransEffect::Begin( this, KGfxControlAppearAction ); + GfxTransEffect::NotifyExternalState(ECaptureComponentsBegin, (const TDesC8*)this); + + // Temporarily set to nonfading to prevent a faded version + // from appearing on screen + Window().SetNonFading(ETrue); + FadeBackground( ETrue ); + MakeVisible( ETrue ); + SetFocus( ETrue ); + + Window().SetNonFading(EFalse); + GfxTransEffect::SetDemarcation( this, dRect ); + CAknTransitionUtils::MakeVisibleSubComponents( this, + CAknTransitionUtils::EForceVisible ); + + // Delay display of tooltip until the appear animation has finished, + // to avoid the fast swap window being drawn on top of the tooltip. + CAknFastSwapData *data = + (CAknFastSwapData*)CAknTransitionUtils::GetData( (TInt)this ); + if ( !data ) + { + data = new (ELeave) CAknFastSwapData( (TInt)this, iTooltip ); + CAknTransitionUtils::SetData( (TInt)this, data ); + } + + if ( CAknTransitionUtils::AddObserver( data, + CAknTransitionUtils::EEventControlTransitionFinished, + (const TDesC8 *)this ) == KErrNone ) + { + GfxTransEffect::NotifyExternalState(ECaptureComponentsEnd, (const TDesC8*)this); + GfxTransEffect::End( this ); + } + else + { + CAknTransitionUtils::RemoveData( (TInt)this ); + delete data; + GfxTransEffect::Deregister( this ); + } + + if( !iTransparencyEnabled && rsWasEnabled ) + { + // if redrawstore was on before transition, + // enable it again + Window().EnableRedrawStore( ETrue ); + } + _AKNTRACE_FUNC_EXIT; + } + +// --------------------------------------------------------- +// CAknFastSwapWindowControl::HandleChangeInWindowGroupListL +// Function that is called from CEikServAppUi when apps list changes. +// Resets window size and selection if FSW is displayed. +// --------------------------------------------------------- +// +void CAknFastSwapWindowControl::HandleChangeInWindowGroupListL() + { + _AKNTRACE_FUNC_ENTER; + if ( !iIsDisplayed ) + { + _AKNTRACE_FUNC_EXIT; + return; + } + + if ( iNumberOfWGs <= 0 ) + { + CloseFastSwap(); + _AKNTRACE_FUNC_EXIT; + return; + } + + TInt currPos = iGrid->CurrentDataIndex(); + + SetRect( FastSwapWindowRect() ); // Causes call of SizeChanged() + + TInt iOrgWgId = iBackgroundWgId; + + TInt count = iAllWgIds->Count(); + for ( TInt ii=0; ii