menufw/menufwui/matrixmenu/src/mmappui.cpp
changeset 1 5315654608de
parent 0 f72a12da539e
child 2 08c6ee43b396
equal deleted inserted replaced
0:f72a12da539e 1:5315654608de
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Application UI class
    14 * Description:  Application UI class
    15 *  Version     : %version: MM_176.1.28.1.52 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_176.1.28.1.54 % << Don't touch! Updated by Synergy at check-out.
    16 *  Version     : %version: MM_176.1.28.1.52 % << Don't touch! Updated by Synergy at check-out.
    16 *  Version     : %version: MM_176.1.28.1.54 % << Don't touch! Updated by Synergy at check-out.
    17 *
    17 *
    18 */
    18 */
    19 
    19 
    20 #include <e32base.h>
    20 #include <e32base.h>
    21 #include <e32cmn.h>
    21 #include <e32cmn.h>
    40 #include <AknSgcc.h>                           // for transition effects
    40 #include <AknSgcc.h>                           // for transition effects
    41 #include <featmgr.h>
    41 #include <featmgr.h>
    42 #include <matrixmenu.rsg>
    42 #include <matrixmenu.rsg>
    43 #include <akntabgrp.h>
    43 #include <akntabgrp.h>
    44 #include <apgcli.h>
    44 #include <apgcli.h>
    45 #include <hwrmdomainpskeys.h> //flip status enums
       
    46 #include <AknDef.hrh>
    45 #include <AknDef.hrh>
    47 #include <AknDlgShut.h>
    46 #include <AknDlgShut.h>
    48 #include <mmenuinternalPSkeys.h>
    47 #include <mmenuinternalPSkeys.h>
    49 #include <aknstyluspopupmenu.h> //stylus popup for long tap event
    48 #include <aknstyluspopupmenu.h> //stylus popup for long tap event
    50 
    49 
    64 #include "hnmdbasekey.h"
    63 #include "hnmdbasekey.h"
    65 #include "hnmdkeyfactory.h"
    64 #include "hnmdkeyfactory.h"
    66 #include "mmwidgetcontainer.h"
    65 #include "mmwidgetcontainer.h"
    67 #include "mmtemplatelibrary.h"
    66 #include "mmtemplatelibrary.h"
    68 #include "mmextensionmanager.h"
    67 #include "mmextensionmanager.h"
    69 #include "mmpropertysubscriber.h"
       
    70 #include "hnitemsorder.h"
    68 #include "hnitemsorder.h"
    71 
    69 
    72 #include "mmnomemory.h"
    70 #include "mmnomemory.h"
    73 #include "mmappkeyhandler.h"
    71 #include "mmappkeyhandler.h"
    74 
    72 
   121     iHNInterface = CHnEngine::NewL( *this );
   119     iHNInterface = CHnEngine::NewL( *this );
   122     iTemplateLibrary = CMmTemplateLibrary::NewL();
   120     iTemplateLibrary = CMmTemplateLibrary::NewL();
   123     InitializeL();
   121     InitializeL();
   124 
   122 
   125     iMmExtManager = CMMExtensionManager::NewL( *this );
   123     iMmExtManager = CMMExtensionManager::NewL( *this );
   126 
       
   127     iKeyboardFlipStatus = EPSHWRMFlipStatusUninitialized;
       
   128     iSliderEventSubscriber = CMmPropertySubscriber::NewL(KPSUidHWRM,
       
   129             KHWRMFlipStatus, *this);
       
   130 
   124 
   131     iScreenOn = ETrue;
   125     iScreenOn = ETrue;
   132     iSkinChangeNeeded = EFalse;
   126     iSkinChangeNeeded = EFalse;
   133     iSkinChangeInProgress = EFalse;
   127     iSkinChangeInProgress = EFalse;
   134     iHasFocus = ETrue;
   128     iHasFocus = ETrue;
   188     ResetContainerMap();
   182     ResetContainerMap();
   189     iGarbage.ResetAndDestroy();
   183     iGarbage.ResetAndDestroy();
   190     delete iHNInterface;
   184     delete iHNInterface;
   191     FeatureManager::UnInitializeLib();
   185     FeatureManager::UnInitializeLib();
   192     delete iMmExtManager;
   186     delete iMmExtManager;
   193     delete iSliderEventSubscriber;
       
   194     delete iTemplateLibrary;
   187     delete iTemplateLibrary;
   195     delete iDummyTemplateLib;
   188     delete iDummyTemplateLib;
   196     delete iAppkeyHandler;
   189     delete iAppkeyHandler;
   197     delete iPopupMenu;
   190     delete iPopupMenu;
   198     iSkinSrvSession.Close();
   191     iSkinSrvSession.Close();
   313     if ( !ignoreCommand )
   306     if ( !ignoreCommand )
   314         {
   307         {
   315         CAknAppUi::ProcessCommandL( aCommand );
   308         CAknAppUi::ProcessCommandL( aCommand );
   316         }
   309         }
   317 
   310 
   318     if (iCurrentContainer && iCurrentContainer == TopFocusedControl() )
   311     if ( iCurrentContainer )
   319     	{
   312     	{
   320     	iCurrentContainer->HandleTopFocusL();
   313     	iCurrentContainer->EndLongTapL();
   321     	}
   314     	}
   322     }
   315     }
   323 
   316 
   324 // ---------------------------------------------------------------------------
   317 // ---------------------------------------------------------------------------
   325 //
   318 //
   726     if ( iCurrentContainer )
   719     if ( iCurrentContainer )
   727         {
   720         {
   728         TBool idByContainer = iCurrentContainer->IsHighlightVisible() &&
   721         TBool idByContainer = iCurrentContainer->IsHighlightVisible() &&
   729                 iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1;
   722                 iCurrentContainer->GetSuiteModelL()->GetItemModelsCount() > 1;
   730         TInt current = idByContainer ?
   723         TInt current = idByContainer ?
   731              iCurrentContainer->GetHighlight() : KErrNotFound;
   724              iCurrentContainer->GetHighlight():
       
   725              iCurrentContainer->GetSuiteModelL()->GetSuiteHighlight();
   732         ForwardEventToHNL( aEvent, current );
   726         ForwardEventToHNL( aEvent, current );
   733         }
   727         }
   734 
   728 
   735     DEBUG(("_Mm_:CMmAppUi::ForwardEventToHNL OUT"));
   729     DEBUG(("_Mm_:CMmAppUi::ForwardEventToHNL OUT"));
   736     }
   730     }
   760         case EStartEditMode:
   754         case EStartEditMode:
   761             SetEditModeL( ETrue );
   755             SetEditModeL( ETrue );
   762             break;
   756             break;
   763         case EStopEditMode:
   757         case EStopEditMode:
   764             SetEditModeL( EFalse );
   758             SetEditModeL( EFalse );
   765             break;
       
   766         case EZoomLarge:
       
   767             SetZoom( EAknUiZoomLarge );
       
   768             break;
       
   769         case EZoomSmall:
       
   770             SetZoom( EAknUiZoomSmall );
       
   771             break;
       
   772         case EZoomNormal:
       
   773             SetZoom( EAknUiZoomNormal );
       
   774             break;
   759             break;
   775         case EForegroundGain:
   760         case EForegroundGain:
   776             {
   761             {
   777             DEBUG(("_MM_:CMmAppUi::NotifyUiRefreshL Foreground"));
   762             DEBUG(("_MM_:CMmAppUi::NotifyUiRefreshL Foreground"));
   778             TApaTaskList taskList( iCoeEnv->WsSession() );
   763             TApaTaskList taskList( iCoeEnv->WsSession() );
  1331 			CleanupStack::PopAndDestroy( &positionArray );
  1316 			CleanupStack::PopAndDestroy( &positionArray );
  1332 			}
  1317 			}
  1333 		MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP"));
  1318 		MMPERF(("CMmAppUi::DynInitMenuPaneL - STOP"));
  1334 		}
  1319 		}
  1335 
  1320 
  1336 	if ( !popupMenuDisplayed && iCurrentContainer
  1321 	if ( !popupMenuDisplayed && iCurrentContainer )
  1337 			&& iCurrentContainer == TopFocusedControl() )
       
  1338 		{
  1322 		{
  1339 		iCurrentContainer->HandleTopFocusL( EFalse );
  1323 		iCurrentContainer->EndLongTapL( EFalse );
  1340 		HandleHighlightItemSingleClickedL(
  1324 		HandleHighlightItemSingleClickedL(
  1341 				iCurrentContainer->Widget()->CurrentItemIndex() );
  1325 				iCurrentContainer->Widget()->CurrentItemIndex() );
  1342 		}
  1326 		}
  1343     }
  1327     }
  1344 
  1328 
  1354     if ( iCurrentSuiteModel->WidgetType() == EListWidget
  1338     if ( iCurrentSuiteModel->WidgetType() == EListWidget
  1355         && iCurrentContainer->GetPreviousHighlight() == aIndex )
  1339         && iCurrentContainer->GetPreviousHighlight() == aIndex )
  1356         {
  1340         {
  1357         ForwardEventToHNL( KKeyIdSelect, aIndex );
  1341         ForwardEventToHNL( KKeyIdSelect, aIndex );
  1358         }
  1342         }
  1359     else if ( iCurrentSuiteModel->WidgetType() == EGridWidget && FlipOpen() )
       
  1360 		{
       
  1361 		ForwardEventToHNL( KKeyIdSelect, aIndex );
       
  1362 		}
       
  1363     else if ( iCurrentSuiteModel->WidgetType() == EGridWidget
  1343     else if ( iCurrentSuiteModel->WidgetType() == EGridWidget
  1364             && IsEditMode() && iCurrentContainer->GetPreviousHighlight() == aIndex
  1344             && IsEditMode() && iCurrentContainer->GetPreviousHighlight() == aIndex
  1365             && !iCurrentContainer->IsDraggable())
  1345             && !iCurrentContainer->IsDraggable())
  1366         {
  1346         {
  1367         ForwardEventToHNL( KKeyIdSelect, aIndex );
  1347         ForwardEventToHNL( KKeyIdSelect, aIndex );
  1759 
  1739 
  1760     iCurrentContainer = aWidgetContainer;
  1740     iCurrentContainer = aWidgetContainer;
  1761     iCurrentContainer->Widget()->View()->SetDisableRedraw(ETrue);
  1741     iCurrentContainer->Widget()->View()->SetDisableRedraw(ETrue);
  1762     iDummyContainer->MakeVisible( ETrue );
  1742     iDummyContainer->MakeVisible( ETrue );
  1763     RefreshCbaL();
  1743     RefreshCbaL();
  1764     iCurrentContainer->SetZoom( iZoom );
       
  1765     iCurrentContainer->SetFlipOpenL( FlipOpen() );
       
  1766     iCurrentContainer->SetEditModeL( IsEditMode() );
  1744     iCurrentContainer->SetEditModeL( IsEditMode() );
  1767     iCurrentContainer->SetSuiteModelL( iCurrentSuiteModel );
  1745     iCurrentContainer->SetSuiteModelL( iCurrentSuiteModel );
  1768     iCurrentContainer->HandleResourceChange( KAknsMessageSkinChange );
  1746     iCurrentContainer->HandleResourceChange( KAknsMessageSkinChange );
  1769     iCurrentContainer->HandleResourceChange( KUidValueCoeColorSchemeChangeEvent );
  1747     iCurrentContainer->HandleResourceChange( KUidValueCoeColorSchemeChangeEvent );
  1770     iCurrentContainer->SetEmptyTextL( iCurrentSuiteModel->EmptyText() );
  1748     iCurrentContainer->SetEmptyTextL( iCurrentSuiteModel->EmptyText() );
  1794 void CMmAppUi::HandleNoWidgetChangeRefreshL()
  1772 void CMmAppUi::HandleNoWidgetChangeRefreshL()
  1795     {
  1773     {
  1796     if ( iCurrentSuiteModel )
  1774     if ( iCurrentSuiteModel )
  1797         {
  1775         {
  1798         iCurrentContainer->Widget()->View()->SetDisableRedraw(ETrue);
  1776         iCurrentContainer->Widget()->View()->SetDisableRedraw(ETrue);
  1799         iCurrentContainer->SetZoom( iZoom );
       
  1800         iCurrentContainer->SetFlipOpenL( FlipOpen() );
       
  1801         iCurrentContainer->SetEditModeL( IsEditMode() );
  1777         iCurrentContainer->SetEditModeL( IsEditMode() );
  1802         iCurrentContainer->SetSuiteModelL( iCurrentSuiteModel );
  1778         iCurrentContainer->SetSuiteModelL( iCurrentSuiteModel );
  1803         iCurrentContainer->SetEmptyTextL( iCurrentSuiteModel->EmptyText() );
  1779         iCurrentContainer->SetEmptyTextL( iCurrentSuiteModel->EmptyText() );
  1804         iCurrentContainer->SetHasFocusL( iHasFocus );
  1780         iCurrentContainer->SetHasFocusL( iHasFocus );
  1805         iCurrentContainer->SetIsFaded( IsFaded() );
  1781         iCurrentContainer->SetIsFaded( IsFaded() );
  2342     iGarbage.ResetAndDestroy();
  2318     iGarbage.ResetAndDestroy();
  2343     delete iHNInterface;
  2319     delete iHNInterface;
  2344     iHNInterface = NULL;
  2320     iHNInterface = NULL;
  2345     delete iMmExtManager;
  2321     delete iMmExtManager;
  2346     iMmExtManager = NULL;
  2322     iMmExtManager = NULL;
  2347     delete iSliderEventSubscriber;
       
  2348     iSliderEventSubscriber = NULL;
       
  2349     delete iTemplateLibrary;
  2323     delete iTemplateLibrary;
  2350     iTemplateLibrary = NULL;
  2324     iTemplateLibrary = NULL;
  2351 
  2325 
  2352     iCurrentSuiteModel = NULL;
  2326     iCurrentSuiteModel = NULL;
  2353     iCurrentContainer = NULL;
  2327     iCurrentContainer = NULL;
  2364     iHNInterface = CHnEngine::NewL( *this );
  2338     iHNInterface = CHnEngine::NewL( *this );
  2365     iTemplateLibrary = CMmTemplateLibrary::NewL();
  2339     iTemplateLibrary = CMmTemplateLibrary::NewL();
  2366     InitializeL();
  2340     InitializeL();
  2367 
  2341 
  2368     iMmExtManager = CMMExtensionManager::NewL( *this );
  2342     iMmExtManager = CMMExtensionManager::NewL( *this );
  2369 
       
  2370     iKeyboardFlipStatus = EPSHWRMFlipStatusUninitialized;
       
  2371 
  2343 
  2372     iScreenOn = ETrue;
  2344     iScreenOn = ETrue;
  2373     iSkinChangeNeeded = EFalse;
  2345     iSkinChangeNeeded = EFalse;
  2374     iSkinChangeInProgress = EFalse;
  2346     iSkinChangeInProgress = EFalse;
  2375     }
  2347     }
  2431             CMmWidgetContainer* containerToLoad = NULL;
  2403             CMmWidgetContainer* containerToLoad = NULL;
  2432             TBool created( CreateNewContainerL( aModel, containerToLoad ) );
  2404             TBool created( CreateNewContainerL( aModel, containerToLoad ) );
  2433             if( created )
  2405             if( created )
  2434                 {
  2406                 {
  2435                 containerToLoad->Widget()->View()->SetDisableRedraw( ETrue );
  2407                 containerToLoad->Widget()->View()->SetDisableRedraw( ETrue );
  2436                 containerToLoad->SetFlipOpenL( FlipOpen() );
       
  2437                 containerToLoad->SetEditModeL( IsEditMode() );
  2408                 containerToLoad->SetEditModeL( IsEditMode() );
  2438                 containerToLoad->SetSuiteModelL( aModel );
  2409                 containerToLoad->SetSuiteModelL( aModel );
  2439                 containerToLoad->SetEmptyTextL( aModel->EmptyText() );
  2410                 containerToLoad->SetEmptyTextL( aModel->EmptyText() );
  2440                 containerToLoad->SetObserver( this );
  2411                 containerToLoad->SetObserver( this );
  2441                 containerToLoad->SetRect( ClientRect() );
  2412                 containerToLoad->SetRect( ClientRect() );
  2774 
  2745 
  2775 // ---------------------------------------------------------------------------
  2746 // ---------------------------------------------------------------------------
  2776 //
  2747 //
  2777 // ---------------------------------------------------------------------------
  2748 // ---------------------------------------------------------------------------
  2778 //
  2749 //
  2779 void CMmAppUi::PropertyChangedL(TInt aValue)
       
  2780     {
       
  2781     iKeyboardFlipStatus = (EPSHWRMFlipStatus)aValue;
       
  2782 
       
  2783     if ( iCurrentContainer )
       
  2784         {
       
  2785         if( iKeyboardFlipStatus == EPSHWRMFlipOpen )
       
  2786             {
       
  2787             TBool wasHighlightVisible = iCurrentContainer->IsHighlightVisible();
       
  2788             iCurrentContainer->SetFlipOpenL( ETrue );
       
  2789             if ( IsForeground() && !IsEditMode() && !wasHighlightVisible )
       
  2790                 {
       
  2791                 iCurrentContainer->SetDefaultHighlightL( ETrue );
       
  2792                 }
       
  2793             }
       
  2794         else if( iKeyboardFlipStatus == EPSHWRMFlipClosed )
       
  2795             {
       
  2796             iCurrentContainer->SetFlipOpenL( EFalse );
       
  2797             }
       
  2798         }
       
  2799     }
       
  2800 
       
  2801 // ---------------------------------------------------------------------------
       
  2802 //
       
  2803 // ---------------------------------------------------------------------------
       
  2804 //
       
  2805 TBool CMmAppUi::FlipOpen()
       
  2806     {
       
  2807     return iKeyboardFlipStatus == EPSHWRMFlipOpen;
       
  2808     }
       
  2809 
       
  2810 // ---------------------------------------------------------------------------
       
  2811 //
       
  2812 // ---------------------------------------------------------------------------
       
  2813 //
       
  2814 void CMmAppUi::SetZoom( TAknUiZoom aZoom )
       
  2815     {
       
  2816     if ( iZoom != aZoom)
       
  2817         {
       
  2818         if ( iCurrentContainer )
       
  2819             {
       
  2820             iCurrentContainer->HandleZoomChanged( aZoom );
       
  2821             }
       
  2822         }
       
  2823     iZoom = aZoom;
       
  2824     }
       
  2825 
       
  2826 // ---------------------------------------------------------------------------
       
  2827 //
       
  2828 // ---------------------------------------------------------------------------
       
  2829 //
       
  2830 TBool CMmAppUi::ResetToRootL()
  2750 TBool CMmAppUi::ResetToRootL()
  2831     {
  2751     {
  2832     TBool resetConsumed( EFalse );
  2752     TBool resetConsumed( EFalse );
  2833     if( iHNInterface && iCurrentSuiteModel &&
  2753     if( iHNInterface && iCurrentSuiteModel &&
  2834             !IsRootdisplayedL() )
  2754             !IsRootdisplayedL() )
  2840                 iHNInterface->GetSuiteModelsCountL() - 1 );
  2760                 iHNInterface->GetSuiteModelsCountL() - 1 );
  2841         ResetContainerMapToRootL();
  2761         ResetContainerMapToRootL();
  2842         if( iCurrentContainer )
  2762         if( iCurrentContainer )
  2843             {
  2763             {
  2844             iCurrentContainer->ResetWidgetPosition();
  2764             iCurrentContainer->ResetWidgetPosition();
  2845             iCurrentContainer->SetZoom( iZoom );
       
  2846             AddToStackL( iCurrentContainer );
  2765             AddToStackL( iCurrentContainer );
  2847             }
  2766             }
  2848         RefreshUiPanesL( ETrue );
  2767         RefreshUiPanesL( ETrue );
  2849         resetConsumed = ETrue;
  2768         resetConsumed = ETrue;
  2850         }
  2769         }
  3027 		//This is needed in case some popup is displayed
  2946 		//This is needed in case some popup is displayed
  3028 		//while touching item in grid. Highlight
  2947 		//while touching item in grid. Highlight
  3029 		//should be reset to normal then.
  2948 		//should be reset to normal then.
  3030 		if( AknLayoutUtils::PenEnabled() )
  2949 		if( AknLayoutUtils::PenEnabled() )
  3031 			{
  2950 			{
  3032 			if( iCurrentContainer->WidgetType() == EGridWidget
  2951 			if( iCurrentContainer->WidgetType() == EGridWidget && !IsEditMode() )
  3033 				&& !FlipOpen() && !IsEditMode() )
       
  3034 				{
  2952 				{
  3035 				iCurrentContainer->Widget()->View()->ItemDrawer()->
  2953 				iCurrentContainer->Widget()->View()->ItemDrawer()->
  3036 					SetFlags( CListItemDrawer::EDisableHighlight );
  2954 					SetFlags( CListItemDrawer::EDisableHighlight );
  3037 				}
  2955 				}
  3038 			iCurrentContainer->Widget()->View()->
  2956 			iCurrentContainer->Widget()->View()->