emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp
changeset 1 12c456ceeff2
parent 0 8466d47a6819
child 2 5253a20d2a1e
equal deleted inserted replaced
0:8466d47a6819 1:12c456ceeff2
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    25 #include <AknsSkinInstance.h>
    25 #include <AknsSkinInstance.h>
    26 #include <apgcli.h> // RApaLsSession
    26 #include <apgcli.h> // RApaLsSession
    27 #include <e32math.h>
    27 #include <e32math.h>
    28 #include <FreestyleEmailUi.rsg>
    28 #include <FreestyleEmailUi.rsg>
    29 #include <touchlogicalfeedback.h>
    29 #include <touchlogicalfeedback.h>
    30 // <cmail> SF path changes
       
    31 #include <alf/alfutil.h>
    30 #include <alf/alfutil.h>
    32 #include <alf/alfenv.h>
    31 #include <alf/alfenv.h>
    33 #include <alf/alfevent.h>
    32 #include <alf/alfevent.h>
    34 #include <alf/alftextvisual.h>
    33 #include <alf/alftextvisual.h>
    35 //</cmail>
    34 #include <aknnotewrappers.h>
    36 #include <aknnotewrappers.h>  
       
    37 #include <freestyleemailui.mbg>
    35 #include <freestyleemailui.mbg>
    38 #include <gulicon.h>
    36 #include <gulicon.h>
    39 //<cmail>
    37 #include <akntoolbar.h>
    40 #include "CFSMailMessage.h"
    38 #include "CFSMailMessage.h"
    41 #include <alf/alfframebrush.h>
    39 #include <alf/alfframebrush.h>
    42 #include "CFSMailBox.h"
    40 #include "CFSMailBox.h"
    43 #include "CFSMailClient.h"
    41 #include "CFSMailClient.h"
    44 //</cmail>
       
    45 #include <hlplch.h>
    42 #include <hlplch.h>
    46 #include <akntitle.h>
    43 #include <akntitle.h>
    47 #include <centralrepository.h>
    44 #include <centralrepository.h>
    48 //<cmail>
       
    49 #include <alf/alfanchorlayout.h>
    45 #include <alf/alfanchorlayout.h>
    50 #include <alf/alfbrusharray.h>
    46 #include <alf/alfbrusharray.h>
    51 #include <alf/alfstatic.h>
    47 #include <alf/alfstatic.h>
    52 #include <alf/alfgencomponent.h>
    48 #include <alf/alfgencomponent.h>
    53 #include <alf/alfconstants.h>
    49 #include <alf/alfconstants.h>
    54 #include "fsalfscrollbarlayout.h"
    50 #include "fsalfscrollbarlayout.h"
    55 #include <csxhelp/cmail.hlp.hrh>
    51 #include <csxhelp/cmail.hlp.hrh>
    56 //</cmail>
       
    57 #include <featmgr.h>
    52 #include <featmgr.h>
    58 //</cmail>
       
    59 
    53 
    60 #include <aknmessagequerydialog.h>
    54 #include <aknmessagequerydialog.h>
    61 // <cmail> Use layout data instead of hard-coded values
    55 #include <aknstyluspopupmenu.h>
    62 #include <aknlayoutscalable_avkon.cdl.h>
    56 #include <aknlayoutscalable_avkon.cdl.h>
    63 #include <aknlayoutscalable_apps.cdl.h>
    57 #include <aknlayoutscalable_apps.cdl.h>
    64 #include <layoutmetadata.cdl.h>
    58 #include <layoutmetadata.cdl.h>
    65 // </cmail>
       
    66 
    59 
    67 // INTERNAL INCLUDE FILES
    60 // INTERNAL INCLUDE FILES
    68 #include "FSEmailBuildFlags.h"
    61 #include "FSEmailBuildFlags.h"
    69 #include "FreestyleEmailUiConstants.h"
    62 #include "FreestyleEmailUiConstants.h"
    70 #include "FreestyleEmailUiLiterals.h"
    63 #include "FreestyleEmailUiLiterals.h"
    86 const TInt KSelectTransitionTimeMs = 300;
    79 const TInt KSelectTransitionTimeMs = 300;
    87 const TInt KIconScalingTransitionTimeMs = 350;
    80 const TInt KIconScalingTransitionTimeMs = 350;
    88 const TInt KStartupAnimationTime = 0;
    81 const TInt KStartupAnimationTime = 0;
    89 const TReal KScaleSelected = 1.0;
    82 const TReal KScaleSelected = 1.0;
    90 const TReal KScaleNotSelected = 0.77;
    83 const TReal KScaleNotSelected = 0.77;
    91 // <cmail> Use layout data instead of hard-coded values
       
    92 // </cmail>
       
    93 
    84 
    94 
    85 
    95 CFSEmailUiLauncherGridVisualiser* CFSEmailUiLauncherGridVisualiser::NewL(CAlfEnv& aEnv,
    86 CFSEmailUiLauncherGridVisualiser* CFSEmailUiLauncherGridVisualiser::NewL(CAlfEnv& aEnv,
    96 												 CFSEmailUiLauncherGrid* aControl, 
    87 												 CFSEmailUiLauncherGrid* aControl,
    97 												 CFreestyleEmailUiAppUi* aAppUi,
    88 												 CFreestyleEmailUiAppUi* aAppUi,
    98 												 CAlfControlGroup& aControlGroup, 
    89 												 CAlfControlGroup& aControlGroup,
    99 												 TInt aColumns, TInt aRows)
    90 												 TInt aColumns, TInt aRows)
   100     {
    91     {
   101     FUNC_LOG;
    92     FUNC_LOG;
   102     CFSEmailUiLauncherGridVisualiser* self = CFSEmailUiLauncherGridVisualiser::NewLC(aEnv, aControl, aAppUi, aControlGroup, aRows, aColumns);
    93     CFSEmailUiLauncherGridVisualiser* self = CFSEmailUiLauncherGridVisualiser::NewLC(aEnv, aControl, aAppUi, aControlGroup, aRows, aColumns);
   103     CleanupStack::Pop(self);
    94     CleanupStack::Pop(self);
   104     return self;
    95     return self;
   105     }
    96     }
   106 
    97 
   107 CFSEmailUiLauncherGridVisualiser* CFSEmailUiLauncherGridVisualiser::NewLC(CAlfEnv& aEnv, 
    98 CFSEmailUiLauncherGridVisualiser* CFSEmailUiLauncherGridVisualiser::NewLC(CAlfEnv& aEnv,
   108 												  CFSEmailUiLauncherGrid* aControl, 
    99 												  CFSEmailUiLauncherGrid* aControl,
   109 												  CFreestyleEmailUiAppUi* aAppUi,
   100 												  CFreestyleEmailUiAppUi* aAppUi,
   110 												  CAlfControlGroup& aControlGroup, 
   101 												  CAlfControlGroup& aControlGroup,
   111 												  TInt aColumns, TInt aRows)
   102 												  TInt aColumns, TInt aRows)
   112     {
   103     {
   113     FUNC_LOG;
   104     FUNC_LOG;
   114     CFSEmailUiLauncherGridVisualiser* self = new (ELeave) CFSEmailUiLauncherGridVisualiser(aEnv, aControl, aAppUi, aControlGroup);
   105     CFSEmailUiLauncherGridVisualiser* self = new (ELeave) CFSEmailUiLauncherGridVisualiser(aEnv, aControl, aAppUi, aControlGroup);
   115     CleanupStack::PushL(self);
   106     CleanupStack::PushL(self);
   116     self->ConstructL(aColumns, aRows);
   107     self->ConstructL(aColumns, aRows);
   117     return self;
   108     return self;
   118     }
   109     }
   119 
   110 
   120 CFSEmailUiLauncherGridVisualiser::CFSEmailUiLauncherGridVisualiser(CAlfEnv& aEnv, 
   111 CFSEmailUiLauncherGridVisualiser::CFSEmailUiLauncherGridVisualiser(CAlfEnv& aEnv,
   121 											 CFSEmailUiLauncherGrid* aControl, 
   112 											 CFSEmailUiLauncherGrid* aControl,
   122 										     CFreestyleEmailUiAppUi* aAppUi,
   113 										     CFreestyleEmailUiAppUi* aAppUi,
   123 										     CAlfControlGroup& aControlGroup)
   114 										     CAlfControlGroup& aControlGroup)
   124     : CFsEmailUiViewBase(aControlGroup, *aAppUi),
   115     : CFsEmailUiViewBase(aControlGroup, *aAppUi),
   125     iEnv( aEnv ), 
   116     iEnv( aEnv ),
   126     iVisibleRows( 0 ),
   117     iVisibleRows( 0 ),
   127     iVisibleColumns( 0 ),
   118     iVisibleColumns( 0 ),
   128     iRowCount( 0 ),
   119     iRowCount( 0 ),
   129     iFirstVisibleRow( 0 ),
   120     iFirstVisibleRow( 0 ),
   130     iRowHeight( 0 ),
   121     iRowHeight( 0 ),
   147     iVisibleRows = aRows;
   138     iVisibleRows = aRows;
   148     iVisibleColumns = aColumns;
   139     iVisibleColumns = aColumns;
   149     iConstructionCompleted = EFalse;
   140     iConstructionCompleted = EFalse;
   150     iDoubleClickLock = EFalse;
   141     iDoubleClickLock = EFalse;
   151     iUiOperationLaunched = EFalse;
   142     iUiOperationLaunched = EFalse;
   152     
   143 
   153     iMailboxDeleter = CFSEmailUiMailboxDeleter::NewL( *iAppUi.GetMailClient(), *this );
   144     iMailboxDeleter = CFSEmailUiMailboxDeleter::NewL( *iAppUi.GetMailClient(), *this );
   154     }
   145     }
   155 
   146 
       
   147 // ----------------------------------------------------------------------------
   156 // CFSEmailUiLauncherGridVisualiser::DoFirstStartL()
   148 // CFSEmailUiLauncherGridVisualiser::DoFirstStartL()
   157 // Purpose of this function is to do first start only when grid is
   149 // Purpose of this function is to do first start only when grid is really
   158 // really needed to be shown. Implemented to make app startuo faster.
   150 // needed to be shown. Implemented to make app startup faster.
       
   151 // ----------------------------------------------------------------------------
       
   152 //
   159 void CFSEmailUiLauncherGridVisualiser::DoFirstStartL()
   153 void CFSEmailUiLauncherGridVisualiser::DoFirstStartL()
   160     {
   154     {
   161     FUNC_LOG;
   155     FUNC_LOG;
   162     iPluginIdIconIdPairs.Reset();
   156     iPluginIdIconIdPairs.Reset();
   163 
   157 
   164 // <cmail> Use layout data instead of hard-coded values
       
   165     TRect mainPaneRect;
   158     TRect mainPaneRect;
   166     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
   159     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
   167     
   160 									   mainPaneRect );
       
   161 
   168     TAknLayoutRect scrollBarRect;
   162     TAknLayoutRect scrollBarRect;
   169     scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
   163     scrollBarRect.LayoutRect( mainPaneRect,
       
   164     	AknLayoutScalable_Avkon::aid_size_touch_scroll_bar() );
   170     TRect gridRect = mainPaneRect;
   165     TRect gridRect = mainPaneRect;
   171     gridRect.iBr.iX -= scrollBarRect.Rect().Width();
   166     gridRect.iBr.iX -= scrollBarRect.Rect().Width();
   172     
   167 
   173     TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   168     TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   174     iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastRow() + 1;
   169     iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits( var ).LastRow() + 1;
   175     iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastColumn() + 1;
   170     iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits( var ).LastColumn() + 1;
   176 // </cmail>
   171 
   177     
       
   178     iStartupAnimation = ETrue;
   172     iStartupAnimation = ETrue;
   179     iCurrentLevel.iSelected = KDefaultSelection;
   173     iCurrentLevel.iSelected = KDefaultSelection;
   180     CAlfTextureManager& manager = iEnv.TextureManager();
   174     CAlfTextureManager& manager = iEnv.TextureManager();
   181 
   175 
   182     iParentLayout = CAlfDeckLayout::AddNewL(*iControl);
   176     iParentLayout = CAlfDeckLayout::AddNewL( *iControl );
   183     iParentLayout->SetFlags(EAlfVisualFlagLayoutUpdateNotification);
   177     iParentLayout->SetFlags( EAlfVisualFlagLayoutUpdateNotification );
   184 
   178 
   185     // Widget layout divides the screen between grid and scroll bar
   179     // Widget layout divides the screen between grid and scroll bar
   186     iWidgetLayout = CAlfAnchorLayout::AddNewL( *iControl, iParentLayout );
   180     iWidgetLayout = CAlfAnchorLayout::AddNewL( *iControl, iParentLayout );
   187     //<cmail>
   181 	TSize displaySize = mainPaneRect.Size();
   188 	TSize displaySize = mainPaneRect.Size(); //iControl->DisplayArea().Size();
       
   189     //</cmail>    
       
   190     iWidgetLayout->SetSize( displaySize );
   182     iWidgetLayout->SetSize( displaySize );
   191      
   183 
   192     // Constructed here, updated later, #0 item in iWidgetLayout
   184     // Constructed here, updated later, #0 item in iWidgetLayout
   193     ConstructScrollbarL( iWidgetLayout );
   185     ConstructScrollbarL( iWidgetLayout );
   194 
   186 
   195     // Grid layout is constructed here, #1 item in iWidgetLayout    
   187     // Grid layout is constructed here, #1 item in iWidgetLayout
   196     iCurrentLevel.iGridLayout = CAlfGridLayout::AddNewL( *iControl, iVisibleColumns, iVisibleRows, iWidgetLayout );
   188     iCurrentLevel.iGridLayout =
       
   189 		CAlfGridLayout::AddNewL( *iControl, iVisibleColumns, iVisibleRows,
       
   190 								 iWidgetLayout );
   197     iCurrentLevel.iGridLayout->EnableScrollingL( ETrue );
   191     iCurrentLevel.iGridLayout->EnableScrollingL( ETrue );
   198     iCurrentLevel.iGridLayout->SetFlags( EAlfVisualFlagAutomaticLocaleMirroringEnabled );
   192     iCurrentLevel.iGridLayout->SetFlags( EAlfVisualFlagAutomaticLocaleMirroringEnabled );
   199      
   193 
   200     // Selector is added to iGridLayout
   194     // Selector is added to iGridLayout
   201     iSelector = iControl->AppendLayoutL( EAlfLayoutTypeLayout, iCurrentLevel.iGridLayout );
   195     iSelector = iControl->AppendLayoutL( EAlfLayoutTypeLayout,
       
   196 										 iCurrentLevel.iGridLayout );
   202     iSelector->SetFlags( EAlfVisualFlagManualLayout );
   197     iSelector->SetFlags( EAlfVisualFlagManualLayout );
   203      
   198 
   204     iRingMovementXFunc = CAlfTableMappingFunction::NewL(iEnv);
   199     iRingMovementXFunc = CAlfTableMappingFunction::NewL( iEnv );
   205     iRingMovementYFunc = CAlfTableMappingFunction::NewL(iEnv);
   200     iRingMovementYFunc = CAlfTableMappingFunction::NewL( iEnv );
   206 
   201 
   207     TAlfTimedPoint selectorPos = iSelector->Pos();
   202     TAlfTimedPoint selectorPos = iSelector->Pos();
   208     selectorPos.iX.SetMappingFunctionIdentifier( iRingMovementXFunc->MappingFunctionIdentifier() );
   203     selectorPos.iX.SetMappingFunctionIdentifier( iRingMovementXFunc->MappingFunctionIdentifier() );
   209     selectorPos.iY.SetMappingFunctionIdentifier( iRingMovementYFunc->MappingFunctionIdentifier() ); 
   204     selectorPos.iY.SetMappingFunctionIdentifier( iRingMovementYFunc->MappingFunctionIdentifier() );
   210     iSelector->SetPos( selectorPos );
   205     iSelector->SetPos( selectorPos );
   211      
   206 
   212     UpdateFocusVisibility();
   207     UpdateFocusVisibility();
   213     iSelectorImageVisual = CAlfImageVisual::AddNewL( *iControl, iSelector );
   208     iSelectorImageVisual = CAlfImageVisual::AddNewL( *iControl, iSelector );
   214     iSelectorImageVisual->SetScaleMode( CAlfImageVisual::EScaleFit );
   209     iSelectorImageVisual->SetScaleMode( CAlfImageVisual::EScaleFit );
   215 // <cmail> Use layout data instead of hard-coded values 
   210 
       
   211     // Use layout data instead of hard-coded values
   216     iSelectorImageVisual->SetSize( iAppUi.LayoutHandler()->SelectorVisualSizeInThisResolution() );
   212     iSelectorImageVisual->SetSize( iAppUi.LayoutHandler()->SelectorVisualSizeInThisResolution() );
   217     TAknLayoutRect itemRect;
   213     TAknLayoutRect itemRect;
   218     itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var,0,0));
   214     itemRect.LayoutRect( gridRect,
       
   215     	AknLayoutScalable_Apps::cell_cmail_l_pane( var, 0, 0 ) );
   219     iSelectorImageVisual->SetSize( itemRect.Rect().Size() );
   216     iSelectorImageVisual->SetSize( itemRect.Rect().Size() );
   220 // </cmail>
       
   221      
       
   222     iSelectorImageVisual->EnableBrushesL();
   217     iSelectorImageVisual->EnableBrushesL();
   223     CAlfFrameBrush* brush = iAppUi.FsTextureManager()->GridSelectorBrushL();
   218     CAlfFrameBrush* brush = iAppUi.FsTextureManager()->GridSelectorBrushL();
   224     iSelectorImageVisual->Brushes()->AppendL( brush, EAlfDoesNotHaveOwnership );
   219     iSelectorImageVisual->Brushes()->AppendL( brush, EAlfDoesNotHaveOwnership );
   225     iStartupEffectStyle = EFalse;
   220     iStartupEffectStyle = EFalse;
   226   
   221 
   227     iAiwSHandler = CAiwServiceHandler::NewL();
   222     iAiwSHandler = CAiwServiceHandler::NewL();
   228     iAiwSHandler->AttachL( R_AIW_INTEREST_LAUNCH_SETUP_WIZARD );
   223     iAiwSHandler->AttachL( R_AIW_INTEREST_LAUNCH_SETUP_WIZARD );
       
   224 
       
   225     if( !iStylusPopUpMenu )
       
   226         {
       
   227         // Construct the long tap pop-up menu.
       
   228         TPoint point( 0, 0 );
       
   229         iStylusPopUpMenu = CAknStylusPopUpMenu::NewL( this , point );
       
   230 		TResourceReader reader;
       
   231 		iCoeEnv->CreateResourceReaderLC( reader,
       
   232 			R_STYLUS_POPUP_MENU_LAUNCHER_GRID_VIEW );
       
   233 		iStylusPopUpMenu->ConstructFromResourceL( reader );
       
   234 		CleanupStack::PopAndDestroy(); // reader
       
   235         }
   229 
   236 
   230     // Initial visual layout update is done when the view gets activated.
   237     // Initial visual layout update is done when the view gets activated.
   231     iRefreshNeeded = ETrue;
   238     iRefreshNeeded = ETrue;
   232 
   239 
   233     // First start toggle
   240     // First start toggle
   244     {
   251     {
   245     iItemIdInButtonDownEvent.iItemId = KErrNotFound;
   252     iItemIdInButtonDownEvent.iItemId = KErrNotFound;
   246     iItemIdInButtonDownEvent.iLaunchSelection = EFalse;
   253     iItemIdInButtonDownEvent.iLaunchSelection = EFalse;
   247 
   254 
   248     UpdateFocusVisibility();
   255     UpdateFocusVisibility();
   249     
   256 
   250 	if( !IsFocusShown() )
   257 	if( !IsFocusShown() )
   251 		{
   258 		{
   252         // No items are focused anymore. Shrink the icon.
   259         // No items are focused anymore. Shrink the icon.
   253 		ResizeItemIcon( ETrue );
   260 		ResizeItemIcon( ETrue );
   254 		}
   261 		}
   294     DetachSelectorMappingFunctions();
   301     DetachSelectorMappingFunctions();
   295     delete iRingMovementXFunc;
   302     delete iRingMovementXFunc;
   296     delete iRingMovementYFunc;
   303     delete iRingMovementYFunc;
   297     delete iModel;
   304     delete iModel;
   298     delete iAiwSHandler;
   305     delete iAiwSHandler;
   299     // <cmail>
       
   300     delete iScrollbar;
   306     delete iScrollbar;
   301     // </cmail> 
       
   302     delete iMailboxDeleter;
   307     delete iMailboxDeleter;
       
   308     delete iStylusPopUpMenu;
   303     }
   309     }
   304 
   310 
   305 void CFSEmailUiLauncherGridVisualiser::CreateModelL()
   311 void CFSEmailUiLauncherGridVisualiser::CreateModelL()
   306     {
   312     {
   307     FUNC_LOG;
   313     FUNC_LOG;
   308     
   314 
   309     RArray<TBool> itemInModel;
   315     RArray<TBool> itemInModel;
   310     CleanupClosePushL( itemInModel );    
   316     CleanupClosePushL( itemInModel );
   311     iIconArray.Reset();
   317     iIconArray.Reset();
   312 
   318 
   313 	iPluginTextureId = EGridPluginIconFirst;
   319 	iPluginTextureId = EGridPluginIconFirst;
   314 	iPluginIdIconIdPairs.Reset();
   320 	iPluginIdIconIdPairs.Reset();
   315 
   321 
   316     delete iModel;
   322     delete iModel;
   317     iModel = NULL;
   323     iModel = NULL;
   318     iModel = new (ELeave) CFSEmailUiLauncherGridModel();
   324     iModel = new (ELeave) CFSEmailUiLauncherGridModel();
   319     iModel->ConstructL();   
   325     iModel->ConstructL();
   320 	CAlfTexture* iconTexture = 0;
   326 	CAlfTexture* iconTexture = 0;
   321 
   327 
   322 	// Get item ordering from resources
   328 	// Get item ordering from resources
   323     TResourceReader reader;
   329     TResourceReader reader;
   324     iEikonEnv->CreateResourceReaderLC( reader, R_FSEMAILUI_LAUNCHER_GRID );
   330     iEikonEnv->CreateResourceReaderLC( reader, R_FSEMAILUI_LAUNCHER_GRID );
   331         itemInModel.Append( EFalse );
   337         itemInModel.Append( EFalse );
   332         }
   338         }
   333 
   339 
   334     TInt count = reader.ReadInt16();
   340     TInt count = reader.ReadInt16();
   335 
   341 
   336 // <cmail> Use layout data instead of hard-coded values    
   342 // <cmail> Use layout data instead of hard-coded values
   337     TRect mainPaneRect;
   343     TRect mainPaneRect;
   338     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
   344     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
   339     
   345 
   340     TAknLayoutRect scrollBarRect;
   346     TAknLayoutRect scrollBarRect;
   341     scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
   347     scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
   342     TRect gridRect = mainPaneRect;
   348     TRect gridRect = mainPaneRect;
   343     gridRect.iBr.iX -= scrollBarRect.Rect().Width();
   349     gridRect.iBr.iX -= scrollBarRect.Rect().Width();
   344     
   350 
   345     TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   351     TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   346     TAknLayoutRect itemRect;
   352     TAknLayoutRect itemRect;
   347     itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var,0,0));
   353     itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var,0,0));
   348     
   354 
   349     TAknLayoutRect gridIconLRect;
   355     TAknLayoutRect gridIconLRect;
   350     gridIconLRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
   356     gridIconLRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
   351     TSize iconSize = gridIconLRect.Rect().Size();
   357     TSize iconSize = gridIconLRect.Rect().Size();
   352 // </cmail>
   358 // </cmail>
   353     
   359 
   354     for ( TInt itemIndex = 0; itemIndex < count; itemIndex++ )
   360     for ( TInt itemIndex = 0; itemIndex < count; itemIndex++ )
   355         {
   361         {
   356         TInt itemId = reader.ReadInt16();
   362         TInt itemId = reader.ReadInt16();
   357         switch ( itemId )
   363         switch ( itemId )
   358             {
   364             {
   359             case EDefaultMailboxItem:
   365             case EDefaultMailboxItem:
   360                 {
   366                 {
   361                 
   367 
   362                 RPointerArray<CFSMailBox> mailBoxes;
   368                 RPointerArray<CFSMailBox> mailBoxes;
   363                 CleanupResetAndDestroyClosePushL( mailBoxes );
   369                 CleanupResetAndDestroyClosePushL( mailBoxes );
   364                 TFSMailMsgId id; 
   370                 TFSMailMsgId id;
   365                 TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   371                 TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   366                     id,
   372                     id,
   367                     mailBoxes );
   373                     mailBoxes );
   368 
   374 
   369                 if ( mailBoxes.Count() > 0 )
   375                 if ( mailBoxes.Count() > 0 )
   370                     {
   376                     {
   371                     // Try to get branded graphic
   377                     // Try to get branded graphic
   372                     CGulIcon* mbIcon(0);
   378                     CGulIcon* mbIcon(0);
   373 		         	TRAPD( err, mbIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailBoxes[0]->GetId() ) ); 
   379 		         	TRAPD( err, mbIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailBoxes[0]->GetId() ) );
   374 					if ( err == KErrNone && mbIcon )
   380 					if ( err == KErrNone && mbIcon )
   375 						{
   381 						{
   376 						CleanupStack::PushL( mbIcon );
   382 						CleanupStack::PushL( mbIcon );
   377 				    	AknIconUtils::SetSize(mbIcon->Bitmap(), iconSize);
   383 				    	AknIconUtils::SetSize(mbIcon->Bitmap(), iconSize);
   378 					    AknIconUtils::SetSize(mbIcon->Mask(), iconSize);				
   384 					    AknIconUtils::SetSize(mbIcon->Mask(), iconSize);
   379 		
   385 
   380 					    // Create texture into TextureManager, If not already existing
   386 					    // Create texture into TextureManager, If not already existing
   381 					    // Note: size(0,0) means original icon size
   387 					    // Note: size(0,0) means original icon size
   382 					    iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mbIcon,
   388 					    iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mbIcon,
   383 					    		                                                 mailBoxes[0]->GetId().PluginId(),
   389 					    		                                                 mailBoxes[0]->GetId().PluginId(),
   384 					    		                                                 mailBoxes[0]->GetId().Id(),
   390 					    		                                                 mailBoxes[0]->GetId().Id(),
   388 					    		                                                        mailBoxes[0]->GetId().Id(),
   394 					    		                                                        mailBoxes[0]->GetId().Id(),
   389 					    		                                                        TSize(0,0));
   395 					    		                                                        TSize(0,0));
   390 
   396 
   391 						CleanupStack::PopAndDestroy( mbIcon );
   397 						CleanupStack::PopAndDestroy( mbIcon );
   392 						}
   398 						}
   393 					else 
   399 					else
   394 						{
   400 						{
   395 	                    iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture );									
   401 	                    iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture );
   396 						}					                 	
   402 						}
   397 
   403 
   398    			        iIconArray.AppendL( iconTexture );
   404    			        iIconArray.AppendL( iconTexture );
   399 
   405 
   400    			        // Branded mailbox name is nowadays set in new mailbox event
   406    			        // Branded mailbox name is nowadays set in new mailbox event
   401    			        // handling, so we don't need to use brand manager here anymore.
   407    			        // handling, so we don't need to use brand manager here anymore.
   403                         EShortcut,
   409                         EShortcut,
   404                         EDefaultMailboxItem,
   410                         EDefaultMailboxItem,
   405                         mailBoxes[0]->GetName(),
   411                         mailBoxes[0]->GetName(),
   406                         *iconTexture,
   412                         *iconTexture,
   407                         mailBoxes[0]->GetId(),
   413                         mailBoxes[0]->GetId(),
   408                         mailBoxes[0]->GetStandardFolderId( EFSInbox ) ); 						
   414                         mailBoxes[0]->GetStandardFolderId( EFSInbox ) );
   409    			        
   415 
   410    			        iAppUi.SubscribeMailboxL( mailBoxes[0]->GetId() );
   416    			        iAppUi.SubscribeMailboxL( mailBoxes[0]->GetId() );
   411                     }
   417                     }
   412 
   418 
   413                 CleanupStack::PopAndDestroy( &mailBoxes );
   419                 CleanupStack::PopAndDestroy( &mailBoxes );
   414                 }
   420                 }
   415                 break;
   421                 break;
   416             case EOtherMailboxItems:
   422             case EOtherMailboxItems:
   417                 {
   423                 {
   418                 RPointerArray<CFSMailBox> mailBoxes;
   424                 RPointerArray<CFSMailBox> mailBoxes;
   419                 CleanupResetAndDestroyClosePushL( mailBoxes );
   425                 CleanupResetAndDestroyClosePushL( mailBoxes );
   420                 TFSMailMsgId id; 
   426                 TFSMailMsgId id;
   421                 TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   427                 TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   422                     id,
   428                     id,
   423                     mailBoxes );
   429                     mailBoxes );
   424                 
   430 
   425                 for ( TInt i = 1; i < mailBoxes.Count(); i++ )
   431                 for ( TInt i = 1; i < mailBoxes.Count(); i++ )
   426                     {
   432                     {
   427                    // Try to get branded graphic
   433                    // Try to get branded graphic
   428                     CGulIcon* mbIcon(0);
   434                     CGulIcon* mbIcon(0);
   429 		         	TRAPD( err, mbIcon = brandManager.GetGraphicL( EFSMailboxIcon,  mailBoxes[i]->GetId() ) ); 
   435 		         	TRAPD( err, mbIcon = brandManager.GetGraphicL( EFSMailboxIcon,  mailBoxes[i]->GetId() ) );
   430 					if ( err == KErrNone && mbIcon )
   436 					if ( err == KErrNone && mbIcon )
   431 						{
   437 						{
   432 						CleanupStack::PushL( mbIcon );
   438 						CleanupStack::PushL( mbIcon );
   433 				    	AknIconUtils::SetSize(mbIcon->Bitmap(), iconSize);
   439 				    	AknIconUtils::SetSize(mbIcon->Bitmap(), iconSize);
   434 					    AknIconUtils::SetSize(mbIcon->Mask(), iconSize);				
   440 					    AknIconUtils::SetSize(mbIcon->Mask(), iconSize);
   435 					    
   441 
   436 					    // Create texture into TextureManager, If not already existing
   442 					    // Create texture into TextureManager, If not already existing
   437 					    iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mbIcon,
   443 					    iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mbIcon,
   438 					    		                                                 mailBoxes[i]->GetId().PluginId(),
   444 					    		                                                 mailBoxes[i]->GetId().PluginId(),
   439 					    		                                                 mailBoxes[i]->GetId().Id(),
   445 					    		                                                 mailBoxes[i]->GetId().Id(),
   440 					    		                                                 TSize(0,0));
   446 					    		                                                 TSize(0,0));
   442 					    iconTexture = &iAppUi.FsTextureManager()->TextureByMailboxIdL( mailBoxes[i]->GetId().PluginId(),
   448 					    iconTexture = &iAppUi.FsTextureManager()->TextureByMailboxIdL( mailBoxes[i]->GetId().PluginId(),
   443 					    		                                                        mailBoxes[i]->GetId().Id(),
   449 					    		                                                        mailBoxes[i]->GetId().Id(),
   444 					    		                                                        TSize(0,0));
   450 					    		                                                        TSize(0,0));
   445 						CleanupStack::PopAndDestroy( mbIcon );
   451 						CleanupStack::PopAndDestroy( mbIcon );
   446 						}
   452 						}
   447 					else 
   453 					else
   448 						{
   454 						{
   449 	                    iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture );				
   455 	                    iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture );
   450 						}
   456 						}
   451   	                iIconArray.AppendL( iconTexture );	          
   457   	                iIconArray.AppendL( iconTexture );
   452                     // Branded mailbox name is nowadays set in new mailbox event
   458                     // Branded mailbox name is nowadays set in new mailbox event
   453                     // handling, so we don't need to use brand manager here anymore.
   459                     // handling, so we don't need to use brand manager here anymore.
   454                     iModel->AddL(
   460                     iModel->AddL(
   455                         EShortcut,
   461                         EShortcut,
   456                         EDefaultMailboxItem,
   462                         EDefaultMailboxItem,
   457                         mailBoxes[i]->GetName(),
   463                         mailBoxes[i]->GetName(),
   458                         *iconTexture,
   464                         *iconTexture,
   459                         mailBoxes[i]->GetId(),
   465                         mailBoxes[i]->GetId(),
   460                         mailBoxes[i]->GetStandardFolderId( EFSInbox ) );
   466                         mailBoxes[i]->GetStandardFolderId( EFSInbox ) );
   461                     
   467 
   462                     iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() );
   468                     iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() );
   463                     }
   469                     }
   464                     
   470 
   465                 CleanupStack::PopAndDestroy( &mailBoxes );
   471                 CleanupStack::PopAndDestroy( &mailBoxes );
   466                 }
   472                 }
   467                 break;
   473                 break;
   468             case EDirectoryItem:
   474             case EDirectoryItem:
   469                 {
   475                 {
   470                 RPointerArray<CFSMailBox> mailBoxes;
   476                 RPointerArray<CFSMailBox> mailBoxes;
   471                 CleanupResetAndDestroyClosePushL( mailBoxes );
   477                 CleanupResetAndDestroyClosePushL( mailBoxes );
   472                 TFSMailMsgId id; 
   478                 TFSMailMsgId id;
   473                 TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   479                 TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   474                     id,
   480                     id,
   475                     mailBoxes );
   481                     mailBoxes );
   476                 
   482 
   477                 for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   483                 for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   478                     {
   484                     {
   479                     if ( TFsEmailUiUtility::IsRemoteLookupSupported( *mailBoxes[i] ) )
   485                     if ( TFsEmailUiUtility::IsRemoteLookupSupported( *mailBoxes[i] ) )
   480                         {
   486                         {
   481                         HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_DIRECTORY );
   487                         HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_DIRECTORY );
   494                 {
   500                 {
   495                 HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_SETTINGS );
   501                 HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_SETTINGS );
   496                 iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridSettingsTexture );
   502                 iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridSettingsTexture );
   497                 iModel->AddL(EShortcut, ESettingsItem, *text, *iconTexture );
   503                 iModel->AddL(EShortcut, ESettingsItem, *text, *iconTexture );
   498                 CleanupStack::PopAndDestroy( text );
   504                 CleanupStack::PopAndDestroy( text );
   499                 iIconArray.AppendL( iconTexture );		
   505                 iIconArray.AppendL( iconTexture );
   500                 }
   506                 }
   501                 break;
   507                 break;
   502             case EAddNewMailboxItem:
   508             case EAddNewMailboxItem:
   503                 {
   509                 {
   504                 HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_ADD_NEW_MAILBOX );
   510                 HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_ADD_NEW_MAILBOX );
   505                 iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridAddNewBoxTexture );
   511                 iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridAddNewBoxTexture );
   506                 iModel->AddL(EShortcut, EAddNewMailboxItem, *text, *iconTexture );
   512                 iModel->AddL(EShortcut, EAddNewMailboxItem, *text, *iconTexture );
   507                 CleanupStack::PopAndDestroy( text );
   513                 CleanupStack::PopAndDestroy( text );
   508                 iIconArray.AppendL( iconTexture );		
   514                 iIconArray.AppendL( iconTexture );
   509                 }
   515                 }
   510                 break;
   516                 break;
   511             case EHelpItem:
   517             case EHelpItem:
   512                 {
   518                 {
   513      		   // remove help support in pf5250                
   519      		   // remove help support in pf5250
   514         	    if (! FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
   520         	    if (! FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
   515         		   {
   521         		   {
   516                    HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_HELP );
   522                    HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_HELP );
   517                    iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridHelpTexture );
   523                    iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridHelpTexture );
   518                    iModel->AddL(EShortcut, EHelpItem, *text, *iconTexture );
   524                    iModel->AddL(EShortcut, EHelpItem, *text, *iconTexture );
   519                    CleanupStack::PopAndDestroy( text );
   525                    CleanupStack::PopAndDestroy( text );
   520                    iIconArray.AppendL( iconTexture );        		   
   526                    iIconArray.AppendL( iconTexture );
   521         		   }
   527         		   }
   522                 }
   528                 }
   523                 break;
   529                 break;
   524             case EIntellisyncFileSyncItem:
   530             case EIntellisyncFileSyncItem:
   525             case EIntellisyncTravelInfoItem:
   531             case EIntellisyncTravelInfoItem:
   531                 for ( TInt i = 0; i < iLauncherItems.Count(); i++ )
   537                 for ( TInt i = 0; i < iLauncherItems.Count(); i++ )
   532                     {
   538                     {
   533                     if ( iLauncherItems[i]->Id() == itemId )
   539                     if ( iLauncherItems[i]->Id() == itemId )
   534                         {
   540                         {
   535                         itemInModel[i] = ETrue;
   541                         itemInModel[i] = ETrue;
   536                         AddItemToModelL( iLauncherItems[i], i );                      
   542                         AddItemToModelL( iLauncherItems[i], i );
   537                         break;
   543                         break;
   538                         }
   544                         }
   539                     }
   545                     }
   540                 }
   546                 }
   541                 break;
   547                 break;
   552         if ( ! itemInModel[i] )
   558         if ( ! itemInModel[i] )
   553             {
   559             {
   554             AddItemToModelL( iLauncherItems[i], i );
   560             AddItemToModelL( iLauncherItems[i], i );
   555             }
   561             }
   556         }
   562         }
   557     
   563 
   558     CleanupStack::PopAndDestroy( &itemInModel );
   564     CleanupStack::PopAndDestroy( &itemInModel );
   559 	}
   565 	}
   560 
   566 
   561 void CFSEmailUiLauncherGridVisualiser::CreateCaptionForApplicationL(TUid aUid,
   567 void CFSEmailUiLauncherGridVisualiser::CreateCaptionForApplicationL(TUid aUid,
   562                                                 TDes& aCaption,
   568                                                 TDes& aCaption,
   583 
   589 
   584 
   590 
   585 TUid CFSEmailUiLauncherGridVisualiser::Id() const
   591 TUid CFSEmailUiLauncherGridVisualiser::Id() const
   586 	{
   592 	{
   587     FUNC_LOG;
   593     FUNC_LOG;
   588 	return AppGridId;	
   594 	return AppGridId;
   589 	}			   
   595 	}
   590 
   596 
   591 // <cmail> Toolbar
       
   592 /*
       
   593 void CFSEmailUiLauncherGridVisualiser::DoActivateL(const TVwsViewId& aPrevViewId,
       
   594                      TUid aCustomMessageId,
       
   595                      const TDesC8& aCustomMessage)*/
       
   596 void CFSEmailUiLauncherGridVisualiser::ChildDoActivateL(const TVwsViewId& aPrevViewId,
   597 void CFSEmailUiLauncherGridVisualiser::ChildDoActivateL(const TVwsViewId& aPrevViewId,
   597                      TUid /*aCustomMessageId*/,
   598                      TUid /*aCustomMessageId*/,
   598                      const TDesC8& /*aCustomMessage*/)
   599                      const TDesC8& /*aCustomMessage*/)
   599     {
   600     {
   600     FUNC_LOG;
   601     FUNC_LOG;
   601     if ( !iConstructionCompleted )
   602     if ( !iConstructionCompleted )
   602         {
   603         {
   603         DoFirstStartL();
   604         DoFirstStartL();
   604         }
   605         }
   605     
   606 
       
   607     if( iAppUi.CurrentFixedToolbar() )
       
   608         {
       
   609         iAppUi.CurrentFixedToolbar()->SetToolbarVisibility( EFalse );
       
   610         }
       
   611 
   606     // For initial mailbox query
   612     // For initial mailbox query
   607 	TBool startedFromOds = EFalse;
   613 	TBool startedFromOds = EFalse;
   608 	// NULL wizard started parameter every time when activated again.
   614 	// NULL wizard started parameter every time when activated again.
   609 	iDoubleClickLock = EFalse;
   615 	iDoubleClickLock = EFalse;
   610 
   616 
   632             }
   638             }
   633         else
   639         else
   634             {
   640             {
   635             iAppUi.EnterFsEmailViewL( iAppUi.CurrentActiveView()->Id() );
   641             iAppUi.EnterFsEmailViewL( iAppUi.CurrentActiveView()->Id() );
   636             }
   642             }
   637         
   643 
   638         return;
   644         return;
   639         }
   645         }
   640 
   646 
   641     if ( iRefreshNeeded )
   647     if ( iRefreshNeeded )
   642         {
   648         {
   649         // scroll bar needs to be updated manually anyway
   655         // scroll bar needs to be updated manually anyway
   650         UpdateScrollBarRangeL();
   656         UpdateScrollBarRangeL();
   651         }
   657         }
   652 
   658 
   653     SetDefaultStatusPaneTextL();
   659     SetDefaultStatusPaneTextL();
   654     
   660 
   655     // Mailbox query is called here but shown only once in appui if needed
   661     // Mailbox query is called here but shown only once in appui if needed
   656     // doNotshowQuery is ETrue when started from wizard
   662     // doNotshowQuery is ETrue when started from wizard
   657   	if ( !iFirstStartComplete )
   663   	if ( !iFirstStartComplete )
   658   		{
   664   		{
   659   		iFirstStartComplete = ETrue;
   665   		iFirstStartComplete = ETrue;
   660 	  	iAppUi.GridStarted( startedFromOds );
   666 	  	iAppUi.GridStarted( startedFromOds );
   661 	    iAppUi.ShowMailboxQueryL();  		
   667 	    iAppUi.ShowMailboxQueryL();
   662   		}
   668   		}
   663   	// <cmail>    
   669   	// <cmail>
   664   	else
   670   	else
   665   	    {
   671   	    {
   666   	    // Ensure that FSMailServer is running, but don't do it on first
   672   	    // Ensure that FSMailServer is running, but don't do it on first
   667   	    // activation, as it's done anyway in AppUi's ConstructL
   673   	    // activation, as it's done anyway in AppUi's ConstructL
   668   	    TFsEmailUiUtility::EnsureFsMailServerIsRunning( iEikonEnv->WsSession() );
   674   	    TFsEmailUiUtility::EnsureFsMailServerIsRunning( iEikonEnv->WsSession() );
   669   	    }
   675   	    }
   670     
   676 
   671     if( iRowCount > iVisibleRows )
   677     if( iRowCount > iVisibleRows )
   672         {
   678         {
   673         iScrollbar->MakeVisible(ETrue);
   679         iScrollbar->MakeVisible(ETrue);
   674         }
   680         }
   675     else
   681     else
   676         {
   682         {
   677         iScrollbar->MakeVisible(EFalse);
   683         iScrollbar->MakeVisible(EFalse);
   678         }
   684         }
   679     
   685 
   680     iAppUi.HideTitlePaneConnectionStatus();
   686     iAppUi.HideTitlePaneConnectionStatus();
   681   	
   687 
   682   	// Erase the navigation history when main grid activated. This is the default view
   688   	// Erase the navigation history when main grid activated. This is the default view
   683   	// of the application and back navigation is never possible from here. The view stack
   689   	// of the application and back navigation is never possible from here. The view stack
   684   	// might be in inconsistent state because of some unexpected error in view switching.
   690   	// might be in inconsistent state because of some unexpected error in view switching.
   685   	// Erasing the history helps recovering from such situations.
   691   	// Erasing the history helps recovering from such situations.
   686   	iAppUi.EraseViewHistory();
   692   	iAppUi.EraseViewHistory();
   687 
   693   	FocusVisibilityChange( iAppUi.IsFocusShown() );
   688   	UpdateFocusVisibility();
   694   	UpdateFocusVisibility();
   689     }
   695     }
   690 // </cmail> Toolbar
       
   691 
   696 
   692 void CFSEmailUiLauncherGridVisualiser::ChildDoDeactivate()
   697 void CFSEmailUiLauncherGridVisualiser::ChildDoDeactivate()
   693     {
   698     {
   694     FUNC_LOG;
   699     FUNC_LOG;
   695     iScrollbar->MakeVisible(EFalse);
   700     iScrollbar->MakeVisible(EFalse);
   696     // </cmail>
   701     }
   697     }
       
   698 
       
   699 
   702 
   700 void CFSEmailUiLauncherGridVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
   703 void CFSEmailUiLauncherGridVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
   701 	{
   704 	{
   702     FUNC_LOG;
   705     FUNC_LOG;
   703     
   706 
   704 	if ( aResourceId == R_FSEMAILUI_MAINUIGRID_MENUPANE )
   707 	if ( aResourceId == R_FSEMAILUI_MAINUIGRID_MENUPANE )
   705 		{
   708 		{
   706 	    if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
   709 	    if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
   707 		   {
   710 		   {
   708 		   // remove help support in pf5250
   711 		   // remove help support in pf5250
   709 		   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);      
   712 		   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
   710 		   }
   713 		   }
   711 	    
   714 
   712 	    TFSLauncherGridMailboxStatus mbStatus = CheckMailboxStatusL();
   715 	    TFSLauncherGridMailboxStatus mbStatus = CheckMailboxStatusL();
   713 	    
   716 
   714 	    // Checks if a device has a keyboard or not.
   717 	    // Checks if a device has a keyboard or not.
   715 		if( !iKeyboardFlipOpen )
   718 		if( !iKeyboardFlipOpen )
   716 			{
   719 			{
   717 			if( mbStatus.iMailboxCount <= 0 )
   720 			if( mbStatus.iMailboxCount <= 0 )
   718 				{
   721 				{
   719 				// If no mailboxes configured, dim all mailbox related items.
   722 				// If no mailboxes configured, dim all mailbox related items.
   720 				aMenuPane->SetItemDimmed( EFsEmailUiCmdDeleteMailbox, ETrue );
   723 				aMenuPane->SetItemDimmed( EFsEmailUiCmdDeleteMailbox, ETrue );
   721 				}
   724 				}
   722 			
   725 
   723 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdOpen, ETrue );
   726 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdOpen, ETrue );
   724 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   727 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   725 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue );
   728 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue );
   726 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue );
   729 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue );
   727 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue );
   730 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue );
   730 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue );
   733 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue );
   731 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdAbout, ETrue );
   734 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdAbout, ETrue );
   732 			}
   735 			}
   733 		else
   736 		else
   734 			{
   737 			{
   735 		    // <cmail>	    
   738 		    // <cmail>
   736 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdAbout, ETrue ); 
   739 		   	aMenuPane->SetItemDimmed( EFsEmailUiCmdAbout, ETrue );
   737 		   	// </cmail>
   740 		   	// </cmail>
   738 		   	
   741 
   739 		   	if( mbStatus.iMailboxCount <= 0 )
   742 		   	if( mbStatus.iMailboxCount <= 0 )
   740 		   	    {
   743 		   	    {
   741 		   	    // If no mailboxes configured, dimm all mailbox related items
   744 		   	    // If no mailboxes configured, dimm all mailbox related items
   742 		   	    aMenuPane->SetItemDimmed( EFsEmailUiCmdDeleteMailbox, ETrue );
   745 		   	    aMenuPane->SetItemDimmed( EFsEmailUiCmdDeleteMailbox, ETrue );
   743 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue);      
   746 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue);
   744 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   747 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   745 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue );
   748 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue );
   746 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue );
   749 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue );
   747 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue );
   750 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue );
   748 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue );
   751 	            aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue );
   754 		   	    if( mbStatus.iMailboxesSyncing == 0 )
   757 		   	    if( mbStatus.iMailboxesSyncing == 0 )
   755 		   	        {
   758 		   	        {
   756 		   	        // All mailboxes are already not syncing
   759 		   	        // All mailboxes are already not syncing
   757 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue );
   760 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue );
   758 		   	        }
   761 		   	        }
   759 		   	    
   762 
   760 	            // Handle items related to sync starting
   763 	            // Handle items related to sync starting
   761 		   	    if( mbStatus.iMailboxesSyncing == mbStatus.iMailboxCount )
   764 		   	    if( mbStatus.iMailboxesSyncing == mbStatus.iMailboxCount )
   762 		   	        {
   765 		   	        {
   763 		   	        // All mailboxes are already syncing
   766 		   	        // All mailboxes are already syncing
   764 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   767 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   772 		   	    else
   775 		   	    else
   773 		   	        {
   776 		   	        {
   774 		   	        // Several mailboxes configured, dimm "Synchronise"
   777 		   	        // Several mailboxes configured, dimm "Synchronise"
   775 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   778 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   776 		   	        }
   779 		   	        }
   777 		   	        
   780 
   778 	            // Handle items related to online
   781 	            // Handle items related to online
   779 		   	    if( mbStatus.iMailboxesOnline == mbStatus.iMailboxCount )
   782 		   	    if( mbStatus.iMailboxesOnline == mbStatus.iMailboxCount )
   780 		   	        {
   783 		   	        {
   781 		   	        // All mailboxes are already online
   784 		   	        // All mailboxes are already online
   782 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue );
   785 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue );
   790 		   	    else
   793 		   	    else
   791 		   	        {
   794 		   	        {
   792 	                // Several mailboxes configured, dimm "Connect"
   795 	                // Several mailboxes configured, dimm "Connect"
   793 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue );
   796 	                aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue );
   794 		   	        }
   797 		   	        }
   795 		   	    
   798 
   796 	            // Handle pop accounts that can't sync
   799 	            // Handle pop accounts that can't sync
   797 	            RPointerArray<CFSMailBox> mailBoxes;
   800 	            RPointerArray<CFSMailBox> mailBoxes;
   798 	            CleanupResetAndDestroyClosePushL( mailBoxes );
   801 	            CleanupResetAndDestroyClosePushL( mailBoxes );
   799 	            TFSMailMsgId id; 
   802 	            TFSMailMsgId id;
   800 	            bool onlyPop = true;
   803 	            bool onlyPop = true;
   801 	            TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   804 	            TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   802 	                id,
   805 	                id,
   803 	                mailBoxes );
   806 	                mailBoxes );
   804 
   807 
   813                 if (onlyPop)
   816                 if (onlyPop)
   814                     {
   817                     {
   815                     aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   818                     aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
   816                     aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue );
   819                     aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue );
   817                     }
   820                     }
   818                 
   821 
   819                 CleanupStack::PopAndDestroy( &mailBoxes );
   822                 CleanupStack::PopAndDestroy( &mailBoxes );
   820 
   823 
   821                 // Handle items related to offline
   824                 // Handle items related to offline
   822                 if( mbStatus.iMailboxesOffline == mbStatus.iMailboxCount )
   825                 if( mbStatus.iMailboxesOffline == mbStatus.iMailboxCount )
   823                     {
   826                     {
   836                     aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue );
   839                     aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue );
   837                     }
   840                     }
   838                 }
   841                 }
   839 
   842 
   840             // Add shortcut hints
   843             // Add shortcut hints
   841             iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, 
   844             iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane,
   842     	                             CFSEmailUiShortcutBinding::EContextMainGrid );	
   845     	                             CFSEmailUiShortcutBinding::EContextMainGrid );
   843             }
   846             }
   844         }
   847         }
   845 	}
   848 	}
   846 
   849 
   847 void CFSEmailUiLauncherGridVisualiser::HandleCommandL(TInt aCommand)
   850 void CFSEmailUiLauncherGridVisualiser::HandleCommandL( TInt aCommand )
   848     {
   851     {
   849     FUNC_LOG;
   852     FUNC_LOG;
       
   853 
   850     switch ( aCommand )
   854     switch ( aCommand )
   851         {
   855         {
   852 		case EAknSoftkeyOpen:
   856 		case EAknSoftkeyOpen:
   853 			{
   857 			{
   854 			if (!iAppUi.IsTimerFocusShown())
   858 			if( !iAppUi.IsFocusShown() )
   855 				{
   859 				{
   856 				int wasActive = iAppUi.StartFocusRemovalTimer();
   860 				// No need to handle return value
   857 
   861                 iAppUi.SetFocusVisibility( ETrue );
   858 	        	if (!wasActive)
   862                 UpdateFocusVisibility();
   859 	        		{
   863                 ResizeItemIcon( EFalse );
   860 					UpdateFocusVisibility();
       
   861 					ResizeItemIcon( EFalse );
       
   862 	        		}
       
   863 				
       
   864 				break;
   864 				break;
   865 				}
   865 				}
   866 			}
   866 			}
   867        	case EFsEmailUiCmdOpen:
   867        	case EFsEmailUiCmdOpen:
   868 			{
   868 			{
   869 			SelectL();
   869 			SelectL();
       
   870 			break;
   870 			}
   871 			}
   871 			break;
       
   872 // <cmail> Hiding is disabled in Cmail
       
   873 //       	case EFsEmailUiCmdHide:
       
   874 //        	{     	
       
   875 //			TApaTaskList taskList( iEikonEnv->WsSession() );
       
   876 //			TApaTask task = taskList.FindApp( KFSEmailUiUid );
       
   877 //			if ( task.Exists() )
       
   878 //			    {
       
   879 //			    task.SendToBackground(); // Send self to background				
       
   880 //			    }
       
   881 //			}
       
   882 //			break;   
       
   883 // </cmail>
       
   884 		case EFsEmailUiCmdDeleteMailbox:
   872 		case EFsEmailUiCmdDeleteMailbox:
   885 			{
   873 			{
       
   874 			// Deletion by using the option menu.
   886 			iMailboxDeleter->DeleteMailboxL();
   875 			iMailboxDeleter->DeleteMailboxL();
   887 			break;
   876 			break;
   888 			}		
   877 			}
       
   878 		case EFsEmailUiCmdDeleteSelectedMailbox:
       
   879 			{
       
   880 			// Deletion by using the long tap pop-up menu.
       
   881 			iMailboxDeleter->DeleteMailboxL( iMailboxToDelete );
       
   882 
       
   883 	    	// Hide the focus.
       
   884 	        iAppUi.SetFocusVisibility( EFalse );
       
   885 	        HandleButtonReleaseEvent(); // Finishes the focus removal.
       
   886 			break;
       
   887 			}
   889 		case EFsEmailUiCmdSync:
   888 		case EFsEmailUiCmdSync:
   890         case EFsEmailUiCmdSyncAll:
   889         case EFsEmailUiCmdSyncAll:
   891 			{
   890 			{
   892 			if (aCommand == EFsEmailUiCmdSyncAll) 
   891 			if (aCommand == EFsEmailUiCmdSyncAll)
   893 				{
   892 				{
   894 			   	iAppUi.ManualMailBoxSyncAll(ETrue);
   893 			   	iAppUi.ManualMailBoxSyncAll(ETrue);
   895 				}
   894 				}
   896 			else
   895 			else
   897 			    {
   896 			    {
   898 			    iAppUi.ManualMailBoxSync(ETrue);
   897 			    iAppUi.ManualMailBoxSync(ETrue);
   899 			    }
   898 			    }
   900             RPointerArray<CFSMailBox> mailBoxes;
   899             RPointerArray<CFSMailBox> mailBoxes;
   901             CleanupResetAndDestroyClosePushL( mailBoxes );
   900             CleanupResetAndDestroyClosePushL( mailBoxes );
   902             TFSMailMsgId id; 
   901             TFSMailMsgId id;
   903             TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   902             TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   904                 id,
   903                 id,
   905                 mailBoxes );
   904                 mailBoxes );
   906 
   905 
   907             for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   906             for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   908                 {
   907                 {
   909                 iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() );
   908                 iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() );
   910                 // <cmail> 
       
   911                 mailBoxes[i]->GetMailBoxStatus();
   909                 mailBoxes[i]->GetMailBoxStatus();
   912                 // </cmail>
       
   913                 mailBoxes[i]->RefreshNowL( iAppUi );
   910                 mailBoxes[i]->RefreshNowL( iAppUi );
   914                 }
   911                 }
   915 
   912 
   916             CleanupStack::PopAndDestroy( &mailBoxes );
   913             CleanupStack::PopAndDestroy( &mailBoxes );
   917 			}
   914 			}
   918             break;
   915             break;
   919 		case EFsEmailUiCmdCancelSync:
   916 		case EFsEmailUiCmdCancelSync:
   920 			{
   917 			{
   921             RPointerArray<CFSMailBox> mailBoxes;
   918             RPointerArray<CFSMailBox> mailBoxes;
   922             CleanupResetAndDestroyClosePushL( mailBoxes );
   919             CleanupResetAndDestroyClosePushL( mailBoxes );
   923             TFSMailMsgId id; 
   920             TFSMailMsgId id;
   924             TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   921             TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   925                 id,
   922                 id,
   926                 mailBoxes );
   923                 mailBoxes );
   927 
   924 
   928             for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   925             for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   936             break;
   933             break;
   937 
   934 
   938 		case EFsEmailUiCmdGoOffline:
   935 		case EFsEmailUiCmdGoOffline:
   939         case EFsEmailUiCmdGoOfflineAll:
   936         case EFsEmailUiCmdGoOfflineAll:
   940 			{
   937 			{
   941             if (aCommand == EFsEmailUiCmdGoOfflineAll) 
   938             if (aCommand == EFsEmailUiCmdGoOfflineAll)
   942             	{
   939             	{
   943                 iAppUi.ManualMailBoxDisconnectAll(ETrue);
   940                 iAppUi.ManualMailBoxDisconnectAll(ETrue);
   944             	}
   941             	}
   945             RPointerArray<CFSMailBox> mailBoxes;
   942             RPointerArray<CFSMailBox> mailBoxes;
   946             CleanupResetAndDestroyClosePushL( mailBoxes );
   943             CleanupResetAndDestroyClosePushL( mailBoxes );
   947             TFSMailMsgId id; 
   944             TFSMailMsgId id;
   948             TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   945             TInt err = iAppUi.GetMailClient()->ListMailBoxes(
   949                 id,
   946                 id,
   950                 mailBoxes );
   947                 mailBoxes );
   951 
   948 
   952             for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   949             for ( TInt i = 0; i < mailBoxes.Count(); i++ )
   959 			}
   956 			}
   960             break;
   957             break;
   961 		case EFsEmailUiCmdGoOnline:
   958 		case EFsEmailUiCmdGoOnline:
   962         case EFsEmailUiCmdGoOnlineAll:
   959         case EFsEmailUiCmdGoOnlineAll:
   963 			{
   960 			{
   964             if (aCommand == EFsEmailUiCmdGoOnlineAll) 
   961             if (aCommand == EFsEmailUiCmdGoOnlineAll)
   965             	{
   962             	{
   966                	iAppUi.ManualMailBoxConnectAll(ETrue);
   963                	iAppUi.ManualMailBoxConnectAll(ETrue);
   967             	}
   964             	}
   968             RPointerArray<CFSMailBox> mailBoxes;
   965             RPointerArray<CFSMailBox> mailBoxes;
   969             CleanupResetAndDestroyClosePushL( mailBoxes );
   966             CleanupResetAndDestroyClosePushL( mailBoxes );
   981             CleanupStack::PopAndDestroy( &mailBoxes );
   978             CleanupStack::PopAndDestroy( &mailBoxes );
   982 			}
   979 			}
   983             break;
   980             break;
   984        	case EFsEmailUiCmdAbout:
   981        	case EFsEmailUiCmdAbout:
   985 			{
   982 			{
   986 			DisplayProductInfoL();	
   983 			DisplayProductInfoL();
   987 			}
   984 			}
   988 			break;
   985 			break;
   989        	case EFsEmailUiCmdHelp:
   986        	case EFsEmailUiCmdHelp:
   990 			{
   987 			{
   991             TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
   988             TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
   992 			}
   989 			}
   993 			break;
   990 			break;
   994         // <cmail>
   991        	case KErrCancel:
       
   992        		{
       
   993         	// The pop-up menu was closed. Hide the focus.
       
   994             iAppUi.SetFocusVisibility( EFalse );
       
   995             HandleButtonReleaseEvent(); // Finishes the focus removal.
       
   996        		break;
       
   997        		}
   995         case EFsEmailUiCmdHide:
   998         case EFsEmailUiCmdHide:
   996         // </cmail>
       
   997         case EEikCmdExit:
   999         case EEikCmdExit:
   998         case EAknSoftkeyExit:
  1000         case EAknSoftkeyExit:
   999         case EFsEmailUiCmdExit:
  1001         case EFsEmailUiCmdExit:
  1000             {
  1002             {
  1001             iAppUi.Exit();
  1003             iAppUi.Exit();
  1002             }
  1004             }
  1003             break;
  1005             break;
  1004         default:
  1006         default:
  1005             break;
  1007             break;
  1006         }
  1008         } // switch ( aCommand )
  1007     }
  1009     }
  1008  
  1010 
  1009 TBool CFSEmailUiLauncherGridVisualiser::OfferEventL(const TAlfEvent& aEvent)
  1011 TBool CFSEmailUiLauncherGridVisualiser::OfferEventL(const TAlfEvent& aEvent)
  1010     {
  1012     {
  1011     FUNC_LOG;
  1013     FUNC_LOG;
  1012     if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey )
  1014     if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey )
  1013         {       
  1015         {
  1014         // If wait note is being shown while a mailbox is being created,
  1016         // If wait note is being shown while a mailbox is being created,
  1015         // then do not react to key presses.
  1017         // then do not react to key presses.
  1016         if ( iWizardWaitnoteShown )
  1018         if ( iWizardWaitnoteShown )
  1017             {
  1019             {
  1018             return ETrue; // key consumed
  1020             return ETrue; // key consumed
  1019             }
  1021             }
  1020         
  1022 
  1021         // Swap right and left controls in mirrored layout
  1023         // Swap right and left controls in mirrored layout
  1022         TInt scanCode = aEvent.KeyEvent().iScanCode;
  1024         TInt scanCode = aEvent.KeyEvent().iScanCode;
  1023         if ( AknLayoutUtils::LayoutMirrored() )
  1025         if ( AknLayoutUtils::LayoutMirrored() )
  1024             {
  1026             {
  1025             if (scanCode == EStdKeyRightArrow) scanCode = EStdKeyLeftArrow;
  1027             if (scanCode == EStdKeyRightArrow) scanCode = EStdKeyLeftArrow;
  1026             else if (scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow;
  1028             else if (scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow;
  1027             }
  1029             }
  1028         
  1030 
  1029         if ((scanCode == EStdKeyRightArrow) 
  1031         if ((scanCode == EStdKeyRightArrow)
  1030         		|| (scanCode == EStdKeyLeftArrow) 
  1032         		|| (scanCode == EStdKeyLeftArrow)
  1031         		|| (scanCode == EStdKeyUpArrow) 
  1033         		|| (scanCode == EStdKeyUpArrow)
  1032         		|| (scanCode == EStdKeyDownArrow)
  1034         		|| (scanCode == EStdKeyDownArrow)
  1033         		|| (scanCode == EStdKeyEnter)
  1035         		|| (scanCode == EStdKeyEnter)
  1034         		|| (scanCode == EStdKeyDeviceA)
  1036         		|| (scanCode == EStdKeyDeviceA)
  1035         		|| (scanCode ==EStdKeyDevice3))
  1037         		|| (scanCode ==EStdKeyDevice3))
  1036         	{
  1038         	{
  1037 			TBool wasActive = iAppUi.StartFocusRemovalTimer();
  1039 
  1038         	if (!wasActive)
  1040         	if ( !iAppUi.SetFocusVisibility( ETrue ) )
  1039         		{
  1041         		{
  1040 				// focus is now activated. ignore key press.
  1042 				// focus is now activated. ignore key press.
  1041 				UpdateFocusVisibility();
  1043 				UpdateFocusVisibility();
  1042 				ResizeItemIcon( EFalse );
  1044 				ResizeItemIcon( EFalse );
  1043 				return ETrue;
  1045 				return ETrue;
  1044         		}
  1046         		}
  1045         	}
  1047         	}
  1046                 
  1048 
  1047         switch(scanCode)
  1049         switch(scanCode)
  1048             {
  1050             {
  1049             case EStdKeyRightArrow:
  1051             case EStdKeyRightArrow:
  1050                 MoveSelection(EDirectionRight);
  1052                 MoveSelection(EDirectionRight);
  1051                 return ETrue;
  1053                 return ETrue;
  1060                 return ETrue;
  1062                 return ETrue;
  1061             case EStdKeyEnter:
  1063             case EStdKeyEnter:
  1062             case EStdKeyDeviceA:
  1064             case EStdKeyDeviceA:
  1063             case EStdKeyDevice3:
  1065             case EStdKeyDevice3:
  1064             	HandleButtonReleaseEvent();
  1066             	HandleButtonReleaseEvent();
  1065                 SelectL();                
  1067                 SelectL();
  1066                 return ETrue;
  1068                 return ETrue;
  1067             default:
  1069             default:
  1068 	       	    // Check keyboard shortcuts.
  1070 	       	    // Check keyboard shortcuts.
  1069 	       	    TInt shortcutCommand = 
  1071 	       	    TInt shortcutCommand =
  1070 	       	        iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(),
  1072 	       	        iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(),
  1071 	       	                                                         CFSEmailUiShortcutBinding::EContextMainGrid );
  1073 	       	                                                         CFSEmailUiShortcutBinding::EContextMainGrid );
  1072 	       	    if ( shortcutCommand != KErrNotFound )
  1074 	       	    if ( shortcutCommand != KErrNotFound )
  1073 	       	        {
  1075 	       	        {
  1074        	            HandleCommandL( shortcutCommand );
  1076        	            HandleCommandL( shortcutCommand );
  1078             }
  1080             }
  1079         }
  1081         }
  1080     return EFalse; // was not consumed
  1082     return EFalse; // was not consumed
  1081     }
  1083     }
  1082 
  1084 
  1083 // <cmail>
  1085 
  1084 // ---------------------------------------------------------------------------
  1086 // ---------------------------------------------------------------------------
  1085 // CFSEmailUiLauncherGridVisualiser::HandlePointerEventL
  1087 // CFSEmailUiLauncherGridVisualiser::HandlePointerEventL
  1086 //
  1088 //
  1087 // ---------------------------------------------------------------------------
  1089 // ---------------------------------------------------------------------------
  1088 //      
  1090 //
  1089 TBool CFSEmailUiLauncherGridVisualiser::HandlePointerEventL(const TAlfEvent& aEvent)
  1091 TBool CFSEmailUiLauncherGridVisualiser::HandlePointerEventL(
       
  1092 	const TAlfEvent& aEvent )
  1090     {
  1093     {
  1091     FUNC_LOG;
  1094     FUNC_LOG;
  1092     TBool result( EFalse );
  1095     TBool result( EFalse );
  1093     TInt currentlyFocused( iCurrentLevel.iSelected );
  1096     TInt currentlyFocused( iCurrentLevel.iSelected );
  1094     TPointerEvent::TType type = aEvent.PointerEvent().iType;
  1097     TPointerEvent::TType type = aEvent.PointerEvent().iType;
  1095     TInt id = FindPointedItem( aEvent );
  1098     TInt id = FindPointedItem( aEvent );
       
  1099 
  1096     if( KErrNotFound != id )
  1100     if( KErrNotFound != id )
  1097         {
  1101         {
       
  1102         // The event coordinates correspond with an item.
  1098         switch( type )
  1103         switch( type )
  1099             {
  1104             {
  1100             case TPointerEvent::EButton1Down:
  1105             case TPointerEvent::EButton1Down:
  1101                 {
  1106                 {
  1102                 iItemIdInButtonDownEvent.iItemId = id;
  1107                 iItemIdInButtonDownEvent.iItemId = id;
  1103                 iItemIdInButtonDownEvent.iLaunchSelection = ETrue;
  1108                 iItemIdInButtonDownEvent.iLaunchSelection = ETrue;
  1104 				UpdateFocusVisibility();
       
  1105 				
       
  1106                 SetFocusedItemL( id );
  1109                 SetFocusedItemL( id );
       
  1110                 UpdateFocusVisibility();
  1107                 break;
  1111                 break;
  1108                 }
  1112                 }
  1109             case TPointerEvent::EButton1Up:
  1113             case TPointerEvent::EButton1Up:
  1110                 {
  1114                 {
       
  1115                 if ( iStylusPopUpMenuLaunched )
       
  1116                 	{
       
  1117                 	// A pop-up menu was launched. Do not open the selected
       
  1118                 	// item.
       
  1119                 	iStylusPopUpMenuLaunched = EFalse;
       
  1120                 	break;
       
  1121                 	}
       
  1122 
       
  1123                 // Hide focus always after pointer up event.
       
  1124                 iAppUi.SetFocusVisibility( EFalse );
       
  1125 
  1111                 // If key was released on item that had focus
  1126                 // If key was released on item that had focus
  1112                 // trigger selection.
  1127                 // trigger selection.
  1113                 if( iItemIdInButtonDownEvent.iItemId == id &&
  1128                 if( iItemIdInButtonDownEvent.iItemId == id &&
  1114                     iItemIdInButtonDownEvent.iLaunchSelection )
  1129                     iItemIdInButtonDownEvent.iLaunchSelection )
  1115                     {
  1130                     {
  1116                     // keyboard focus is now hidden 
       
  1117                     iAppUi.CancelFocusRemovalTimer();
       
  1118 
       
  1119                     HandleButtonReleaseEvent();
  1131                     HandleButtonReleaseEvent();
  1120 
  1132                     // LAUNCH OPENING. This may leave if user cancels the
  1121                     // LAUNCH OPENING. This may leave if user cancels the operation
  1133                     // operation
  1122                     SelectL();
  1134                     SelectL();
  1123                     }
  1135                     }
  1124                 else
  1136                 else
  1125                     {
  1137                     {
  1126                     HandleButtonReleaseEvent();
  1138                     HandleButtonReleaseEvent();
  1144                     iItemIdInButtonDownEvent.iLaunchSelection = ETrue;
  1156                     iItemIdInButtonDownEvent.iLaunchSelection = ETrue;
  1145                     ResizeItemIcon( EFalse );
  1157                     ResizeItemIcon( EFalse );
  1146                     }
  1158                     }
  1147                 break;
  1159                 break;
  1148                 }
  1160                 }
       
  1161             case TPointerEvent::EButtonRepeat:
       
  1162             	{
       
  1163             	// Long tap.
       
  1164             	// Check the type of the currently selected item.
       
  1165     			TInt itemType = iCurrentLevel.iItems[id].iId;
       
  1166 
       
  1167 				if ( itemType == EDefaultMailboxItem ||
       
  1168 					 itemType == EOtherMailboxItems )
       
  1169     				{
       
  1170     				// The selected item is a mail box. Launch the pop-up
       
  1171     				// menu.
       
  1172     	            LaunchStylusPopupMenu( id );
       
  1173     				}
       
  1174 
       
  1175             	break;
       
  1176             	}
  1149             default:
  1177             default:
  1150                 {
  1178                 {
  1151                 break;
  1179                 break;
  1152                 }
  1180                 }
  1153             }
  1181             }
       
  1182 
  1154         result = ETrue;
  1183         result = ETrue;
  1155         }
  1184         }
  1156     // if event do not concern any of items.
  1185     // if event do not concern any of items.
  1157     else if( iItemIdInButtonDownEvent.iItemId != KErrNotFound )
  1186     else if( iItemIdInButtonDownEvent.iItemId != KErrNotFound )
  1158         {
  1187         {
  1159         iItemIdInButtonDownEvent.iLaunchSelection = EFalse;
  1188         iItemIdInButtonDownEvent.iLaunchSelection = EFalse;
  1160         ResizeItemIcon( ETrue );
  1189         ResizeItemIcon( ETrue );
       
  1190 
  1161         switch( type )
  1191         switch( type )
  1162             {
  1192             {
  1163             case TPointerEvent::EButton1Down:
  1193             case TPointerEvent::EButton1Down:
  1164                 {
  1194                 {
  1165                 // ask if focus is on (flip open)
  1195                 // ask if focus is on (flip open)
  1166                 // iItemIdInButtonDownEvent.iItemId = currentlyFocused
  1196                 // iItemIdInButtonDownEvent.iItemId = currentlyFocused
  1167                 break;
  1197                 break;
  1168                 }
  1198                 }
  1169             case TPointerEvent::EButton1Up:
  1199             case TPointerEvent::EButton1Up:
  1170                 {
  1200                 {
       
  1201                 // Hide focus always after pointer up event.
       
  1202                 iAppUi.SetFocusVisibility( EFalse );
  1171                 iItemIdInButtonDownEvent.iItemId = KErrNotFound;
  1203                 iItemIdInButtonDownEvent.iItemId = KErrNotFound;
  1172                 HandleButtonReleaseEvent();
  1204                 HandleButtonReleaseEvent();
  1173                 break;
  1205                 break;
  1174                 }
  1206                 }
  1175             default:
  1207             default:
  1176                 {
  1208                 {
  1177                 break;
  1209                 break;
  1178                 }
  1210                 }
  1179             }
  1211             }
  1180         }
  1212         }
       
  1213     else
       
  1214         {
       
  1215         if( aEvent.IsPointerEvent() && aEvent.PointerUp() )
       
  1216             {
       
  1217             // Hide focus always after pointer up event.
       
  1218             iAppUi.SetFocusVisibility( EFalse );
       
  1219             }
       
  1220         }
       
  1221 
  1181     return result;
  1222     return result;
  1182     }
  1223     }
  1183 
  1224 
  1184 // ---------------------------------------------------------------------------
  1225 // ---------------------------------------------------------------------------
  1185 // CFSEmailUiLauncherGridVisualiser::FindPointedItem
  1226 // CFSEmailUiLauncherGridVisualiser::FindPointedItem
  1186 //
  1227 //
  1187 // ---------------------------------------------------------------------------
  1228 // ---------------------------------------------------------------------------
  1188 //      
  1229 //
  1189 TInt CFSEmailUiLauncherGridVisualiser::FindPointedItem( const TAlfEvent& aEvent )
  1230 TInt CFSEmailUiLauncherGridVisualiser::FindPointedItem( const TAlfEvent& aEvent )
  1190     {
  1231     {
  1191     FUNC_LOG;
  1232     FUNC_LOG;
  1192     TInt result = KErrNotFound; 
  1233     TInt result = KErrNotFound;
  1193             
  1234 
  1194     TInt count = iCurrentLevel.iItemVisualData.Count();         
  1235     TInt count = iCurrentLevel.iItemVisualData.Count();
  1195     const TPoint pos = aEvent.PointerEvent().iParentPosition;
  1236     const TPoint pos = aEvent.PointerEvent().iParentPosition;
  1196     
  1237 
  1197     for(TInt a = 0; count > a; a++)
  1238     for(TInt a = 0; count > a; a++)
  1198         {
  1239         {
  1199         const TRect rect(iCurrentLevel.iItemVisualData[a].iBase->DisplayRect());                 
  1240         const TRect rect(iCurrentLevel.iItemVisualData[a].iBase->DisplayRect());
  1200         if(rect.Contains( pos ))
  1241         if(rect.Contains( pos ))
  1201             {
  1242             {
  1202             result = a;
  1243             result = a;
  1203             break; 
  1244             break;
  1204             }        
  1245             }
  1205         }                
  1246         }
  1206     return result;
  1247     return result;
  1207     }
  1248     }
  1208 
  1249 
  1209 // ---------------------------------------------------------------------------
  1250 // ---------------------------------------------------------------------------
  1210 // CFSEmailUiLauncherGridVisualiser::SetFocusedItemL
  1251 // CFSEmailUiLauncherGridVisualiser::SetFocusedItemL
  1211 //
  1252 //
  1212 // ---------------------------------------------------------------------------
  1253 // ---------------------------------------------------------------------------
  1213 //      
  1254 //
  1214 void CFSEmailUiLauncherGridVisualiser::SetFocusedItemL( TInt aId )
  1255 void CFSEmailUiLauncherGridVisualiser::SetFocusedItemL( TInt aId )
  1215     {
  1256     {
  1216     FUNC_LOG;
  1257     FUNC_LOG;
  1217     TInt oldSelection = iCurrentLevel.iSelected;
  1258     TInt oldSelection = iCurrentLevel.iSelected;
  1218     
  1259 
  1219     HandleRowMovement( EDirectionTouch, aId );
  1260     HandleRowMovement( EDirectionTouch, aId );
  1220     
  1261 
  1221     FocusItem( EFalse, oldSelection );             
  1262     FocusItem( EFalse, oldSelection );
  1222 //    iCurrentLevel.iSelected = aId; 
       
  1223     FocusItem( ETrue, iCurrentLevel.iSelected );
  1263     FocusItem( ETrue, iCurrentLevel.iSelected );
  1224     MoveSelectorToCurrentItem( EDirectionTouch );
  1264     MoveSelectorToCurrentItem( EDirectionTouch );
  1225     }
  1265     }
  1226 
  1266 
  1227 void CFSEmailUiLauncherGridVisualiser::MoveSelection( TDirection aDir )
  1267 void CFSEmailUiLauncherGridVisualiser::MoveSelection( TDirection aDir )
  1228     {
  1268     {
  1229     FUNC_LOG;
  1269     FUNC_LOG;
  1230     // NULL double click flag just be sure that the UI does not
  1270     // NULL double click flag just be sure that the UI does not
  1231     // go into state that wizard cannot be started.
  1271     // go into state that wizard cannot be started.
  1232     iDoubleClickLock = EFalse; 
  1272     iDoubleClickLock = EFalse;
  1233     // Store old selection
  1273     // Store old selection
  1234     TInt oldSelection = iCurrentLevel.iSelected;
  1274     TInt oldSelection = iCurrentLevel.iSelected;
  1235     TInt itemCount = iCurrentLevel.iItemVisualData.Count();
  1275     TInt itemCount = iCurrentLevel.iItemVisualData.Count();
  1236     
  1276 
  1237     HandleRowMovement( aDir, iCurrentLevel.iSelected );
  1277     HandleRowMovement( aDir, iCurrentLevel.iSelected );
  1238 
  1278 
  1239     // Set the correct icon focuses (i.e. enlarged)
  1279     // Set the correct icon focuses (i.e. enlarged)
  1240     if ( aDir != EDirectionNone && oldSelection >= 0 && oldSelection < itemCount )
  1280     if ( aDir != EDirectionNone && oldSelection >= 0 && oldSelection < itemCount )
  1241         {
  1281         {
  1251 void CFSEmailUiLauncherGridVisualiser::HandleRowMovement( TDirection aDir, TInt aSelected )
  1291 void CFSEmailUiLauncherGridVisualiser::HandleRowMovement( TDirection aDir, TInt aSelected )
  1252     {
  1292     {
  1253     FUNC_LOG;
  1293     FUNC_LOG;
  1254     // NULL double click flag just be sure that the UI does not
  1294     // NULL double click flag just be sure that the UI does not
  1255     // go into state that wizard cannot be started.
  1295     // go into state that wizard cannot be started.
  1256     iDoubleClickLock = EFalse; 
  1296     iDoubleClickLock = EFalse;
  1257     // Store old selection
  1297     // Store old selection
  1258     TInt oldSelection = iCurrentLevel.iSelected;
  1298     TInt oldSelection = iCurrentLevel.iSelected;
  1259     TInt itemCount = iCurrentLevel.iItemVisualData.Count();
  1299     TInt itemCount = iCurrentLevel.iItemVisualData.Count();
  1260     TInt oldX = 0;
  1300     TInt oldX = 0;
  1261     TInt oldY = 0;
  1301     TInt oldY = 0;
  1289             case EDirectionUp:
  1329             case EDirectionUp:
  1290                 iCurrentLevel.iSelected -= iVisibleColumns; // one row up
  1330                 iCurrentLevel.iSelected -= iVisibleColumns; // one row up
  1291                 if ( iCurrentLevel.iSelected < 0 )
  1331                 if ( iCurrentLevel.iSelected < 0 )
  1292                     {
  1332                     {
  1293                     iCurrentLevel.iSelected += (iRowCount*iVisibleColumns);
  1333                     iCurrentLevel.iSelected += (iRowCount*iVisibleColumns);
  1294                     if ( iCurrentLevel.iSelected >= itemCount ) 
  1334                     if ( iCurrentLevel.iSelected >= itemCount )
  1295                         {
  1335                         {
  1296                         // Wrapping is about to move the cursor on empty spot.
  1336                         // Wrapping is about to move the cursor on empty spot.
  1297                         // To be consistent with S60 app grid, move selection to the last item.
  1337                         // To be consistent with S60 app grid, move selection to the last item.
  1298                         iCurrentLevel.iSelected = itemCount-1;
  1338                         iCurrentLevel.iSelected = itemCount-1;
  1299                         }
  1339                         }
  1319                 iCurrentLevel.iSelected = KDefaultSelection;
  1359                 iCurrentLevel.iSelected = KDefaultSelection;
  1320                 break;
  1360                 break;
  1321 
  1361 
  1322             case EDirectionNone:
  1362             case EDirectionNone:
  1323                 break;
  1363                 break;
  1324                 
  1364 
  1325             case EDirectionTouch:
  1365             case EDirectionTouch:
  1326                 iCurrentLevel.iSelected = aSelected; 
  1366                 iCurrentLevel.iSelected = aSelected;
  1327                 break;
  1367                 break;
  1328                             
  1368 
  1329             }
  1369             }
  1330 
  1370 
  1331         if ( iCurrentLevel.iSelected < 0 )
  1371         if ( iCurrentLevel.iSelected < 0 )
  1332             {
  1372             {
  1333             iCurrentLevel.iSelected = 0;
  1373             iCurrentLevel.iSelected = 0;
  1342     TInt y = (iCurrentLevel.iSelected-x) / iVisibleColumns;
  1382     TInt y = (iCurrentLevel.iSelected-x) / iVisibleColumns;
  1343 
  1383 
  1344     ScrollToRow( y );
  1384     ScrollToRow( y );
  1345 
  1385 
  1346     }
  1386     }
  1347 // </cmail>
  1387 
  1348 
  1388 
  1349 void CFSEmailUiLauncherGridVisualiser::MoveSelectorToCurrentItem( TDirection aDir )
  1389 void CFSEmailUiLauncherGridVisualiser::MoveSelectorToCurrentItem( TDirection aDir )
  1350     {
  1390     {
  1351     FUNC_LOG;
  1391     FUNC_LOG;
  1352     TAlfRealPoint curPos = iSelector->Pos().ValueNow(); // this is the wrapped value of the current position
  1392     TAlfRealPoint curPos = iSelector->Pos().ValueNow(); // this is the wrapped value of the current position
  1361 
  1401 
  1362     // Check if we need to wrap the selector over the edge of the screen
  1402     // Check if we need to wrap the selector over the edge of the screen
  1363     TPoint ringWrapOffset( 0, 0 );
  1403     TPoint ringWrapOffset( 0, 0 );
  1364     const TInt KGridWrapWidth = (iVisibleColumns+2)*iColumnWidth;
  1404     const TInt KGridWrapWidth = (iVisibleColumns+2)*iColumnWidth;
  1365     const TInt KGridWrapHeight = (iRowCount+2)*iRowHeight;
  1405     const TInt KGridWrapHeight = (iRowCount+2)*iRowHeight;
  1366     
  1406 
  1367     if ( aDir == EDirectionRight && ( targetPos.iX <= curPos.iX || iCurrentLevel.iSelected == 0 ) )
  1407     if ( aDir == EDirectionRight && ( targetPos.iX <= curPos.iX || iCurrentLevel.iSelected == 0 ) )
  1368         {
  1408         {
  1369         ringWrapOffset.iX = KGridWrapWidth;
  1409         ringWrapOffset.iX = KGridWrapWidth;
  1370         }
  1410         }
  1371     else if ( aDir == EDirectionLeft && ( targetPos.iX >= curPos.iX  || iCurrentLevel.iSelected == iCurrentLevel.iItems.Count()-1 ) )
  1411     else if ( aDir == EDirectionLeft && ( targetPos.iX >= curPos.iX  || iCurrentLevel.iSelected == iCurrentLevel.iItems.Count()-1 ) )
  1400          aItem < 0 )
  1440          aItem < 0 )
  1401         {
  1441         {
  1402         // Invalid item index
  1442         // Invalid item index
  1403         return;
  1443         return;
  1404         }
  1444         }
  1405     
  1445 
  1406     if( aHasFocus && ( IsFocusShown() || iItemIdInButtonDownEvent.iItemId >= 0 ) )
  1446     if( aHasFocus && ( IsFocusShown() || iItemIdInButtonDownEvent.iItemId >= 0 ) )
  1407         {
  1447         {
  1408         TAlfTimedValue scaleValue;
  1448         TAlfTimedValue scaleValue;
  1409         scaleValue.SetTarget( KScaleSelected, KIconScalingTransitionTimeMs );
  1449         scaleValue.SetTarget( KScaleSelected, KIconScalingTransitionTimeMs );
  1410         iCurrentLevel.iItemVisualData[aItem].iImage->SetScale( scaleValue );
  1450         iCurrentLevel.iItemVisualData[aItem].iImage->SetScale( scaleValue );
  1456             }
  1496             }
  1457         }
  1497         }
  1458 
  1498 
  1459 
  1499 
  1460     offset = iFirstVisibleRow * iRowHeight;
  1500     offset = iFirstVisibleRow * iRowHeight;
  1461     
  1501 
  1462     TAlfTimedPoint alfScrollOffset;
  1502     TAlfTimedPoint alfScrollOffset;
  1463     alfScrollOffset.iY.SetTarget( offset , KScrollTransitionTimeMs );
  1503     alfScrollOffset.iY.SetTarget( offset , KScrollTransitionTimeMs );
  1464     iCurrentLevel.iGridLayout->SetScrollOffset(alfScrollOffset);
  1504     iCurrentLevel.iGridLayout->SetScrollOffset(alfScrollOffset);
  1465 // <cmail>
  1505 // <cmail>
  1466     iScrollbarModel.SetFocusPosition(iFirstVisibleRow);
  1506     iScrollbarModel.SetFocusPosition(iFirstVisibleRow);
  1467     TRAP_IGNORE( iScrollbar->SetModelL(&iScrollbarModel) );
  1507     TRAP_IGNORE( iScrollbar->SetModelL(&iScrollbarModel) );
  1468     iScrollbar->DrawNow();
  1508     iScrollbar->DrawNow();
  1469 // </cmail>    
  1509 // </cmail>
  1470     }
  1510     }
  1471 
  1511 
  1472 void CFSEmailUiLauncherGridVisualiser::RefreshLauncherViewL()
  1512 void CFSEmailUiLauncherGridVisualiser::RefreshLauncherViewL()
  1473     {
  1513     {
  1474     FUNC_LOG;
  1514     FUNC_LOG;
  1487         else
  1527         else
  1488             {
  1528             {
  1489             FocusItem( ETrue, iCurrentLevel.iSelected );
  1529             FocusItem( ETrue, iCurrentLevel.iSelected );
  1490             }
  1530             }
  1491         UpdateScrollBarRangeL();
  1531         UpdateScrollBarRangeL();
  1492         }  
  1532         }
  1493     }
  1533     }
  1494 
  1534 
  1495 TBool CFSEmailUiLauncherGridVisualiser::UiOperationLaunched()
  1535 TBool CFSEmailUiLauncherGridVisualiser::UiOperationLaunched()
  1496     {
  1536     {
  1497     FUNC_LOG;
  1537     FUNC_LOG;
  1498     return iUiOperationLaunched;  
  1538     return iUiOperationLaunched;
  1499     }
  1539     }
  1500 
  1540 
  1501 void CFSEmailUiLauncherGridVisualiser::PopulateL( TLevel& aLevel )
  1541 void CFSEmailUiLauncherGridVisualiser::PopulateL( TLevel& aLevel )
  1502     {
  1542     {
  1503     FUNC_LOG;
  1543     FUNC_LOG;
  1504     if ( iConstructionCompleted )
  1544     if ( iConstructionCompleted )
  1505         {
  1545         {
  1506         for( TInt i = 0; i < aLevel.iItemVisualData.Count(); i++ )
  1546         for( TInt i = 0; i < aLevel.iItemVisualData.Count(); i++ )
  1507             {
  1547             {
  1508             aLevel.iItemVisualData[i].iBase->RemoveAndDestroyAllD();
  1548             aLevel.iItemVisualData[i].iBase->RemoveAndDestroyAllD();
  1509             }        
  1549             }
  1510         aLevel.iItemVisualData.Reset();
  1550         aLevel.iItemVisualData.Reset();
  1511         aLevel.iItems.Reset();
  1551         aLevel.iItems.Reset();
  1512 	    
  1552 
  1513 // <cmail> Use layout data instead of hard-coded values    
  1553 // <cmail> Use layout data instead of hard-coded values
  1514 	    TRect mainPaneRect;
  1554 	    TRect mainPaneRect;
  1515 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  1555 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  1516 	    
  1556 
  1517 	    TAknLayoutRect scrollBarRect;
  1557 	    TAknLayoutRect scrollBarRect;
  1518 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  1558 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  1519 	    TRect gridRect = mainPaneRect;
  1559 	    TRect gridRect = mainPaneRect;
  1520 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  1560 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  1521 	    
  1561 
  1522 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  1562 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  1523 	    
  1563 
  1524 	    TAknLayoutRect itemRect;
  1564 	    TAknLayoutRect itemRect;
  1525 	    itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  1565 	    itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  1526 
  1566 
  1527 	    TRect itemrc = itemRect.Rect();
  1567 	    TRect itemrc = itemRect.Rect();
  1528 	    itemrc.SetRect(TPoint(0,0), itemRect.Rect().Size());
  1568 	    itemrc.SetRect(TPoint(0,0), itemRect.Rect().Size());
  1529 	    
  1569 
  1530 	    TAknLayoutRect gridIconRect;
  1570 	    TAknLayoutRect gridIconRect;
  1531 	    gridIconRect.LayoutRect(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1571 	    gridIconRect.LayoutRect(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1532 	    
  1572 
  1533 	    TAknLayoutText gridText;
  1573 	    TAknLayoutText gridText;
  1534 	    gridText.LayoutText(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var));
  1574 	    gridText.LayoutText(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var));
  1535 // </cmail>
  1575 // </cmail>
  1536 
  1576 
  1537         if( aLevel.iParent >= 0 )
  1577         if( aLevel.iParent >= 0 )
  1538             {
  1578             {
  1539             iModel->FindChildren( aLevel.iParent, aLevel.iItems );
  1579             iModel->FindChildren( aLevel.iParent, aLevel.iItems );
  1540             
  1580 
  1541             for( TInt i = 0; i < aLevel.iItems.Count(); i++ )
  1581             for( TInt i = 0; i < aLevel.iItems.Count(); i++ )
  1542                 {
  1582                 {
  1543                 TItemVisualData newItem;
  1583                 TItemVisualData newItem;
  1544 
  1584 
  1545                 newItem.iBase = CAlfAnchorLayout::AddNewL( *iControl, aLevel.iGridLayout );
  1585                 newItem.iBase = CAlfAnchorLayout::AddNewL( *iControl, aLevel.iGridLayout );
  1546                 newItem.iBase->SetTactileFeedbackL( ETouchEventStylusDown,  ETouchFeedbackBasic );
  1586                 newItem.iBase->SetTactileFeedbackL( ETouchEventStylusDown,  ETouchFeedbackBasic );
  1547 
  1587 
  1548 // <cmail> Use layout data instead of hard-coded values    
  1588 // <cmail> Use layout data instead of hard-coded values
  1549                 // Set anchors for text
  1589                 // Set anchors for text
  1550                 newItem.iBase->SetAnchor(
  1590                 newItem.iBase->SetAnchor(
  1551                     EAlfAnchorTopLeft,
  1591                     EAlfAnchorTopLeft,
  1552                     0,
  1592                     0,
  1553                     EAlfAnchorOriginLeft,
  1593                     EAlfAnchorOriginLeft,
  1587                 newItem.iText->EnableShadow( EFalse );
  1627                 newItem.iText->EnableShadow( EFalse );
  1588 // <cmail> Use layout data instead of hard-coded values
  1628 // <cmail> Use layout data instead of hard-coded values
  1589 				TRgb itemColor (KRgbGray);
  1629 				TRgb itemColor (KRgbGray);
  1590 			    // text #9 application grid unfocused application title texts #215
  1630 			    // text #9 application grid unfocused application title texts #215
  1591 				if( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
  1631 				if( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
  1592 					itemColor, KAknsIIDQsnTextColors, 
  1632 					itemColor, KAknsIIDQsnTextColors,
  1593 					EAknsCIQsnTextColorsCG9 ) != KErrNone )
  1633 					EAknsCIQsnTextColorsCG9 ) != KErrNone )
  1594 					{
  1634 					{
  1595 				itemColor = gridText.Color();//iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); 
  1635 				itemColor = gridText.Color();//iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
  1596 					}
  1636 					}
  1597 				newItem.iText->SetColor(itemColor);
  1637 				newItem.iText->SetColor(itemColor);
  1598 // </cmail>
  1638 // </cmail>
  1599 					
  1639 
  1600                 newItem.iText->SetTextL( *aLevel.iItems[i].iCaption );      
  1640                 newItem.iText->SetTextL( *aLevel.iItems[i].iCaption );
  1601                 
  1641 
  1602                 TAlfTimedValue opacity;
  1642                 TAlfTimedValue opacity;
  1603                 opacity.SetValueNow ( KDefaultCaptionOpacity );
  1643                 opacity.SetValueNow ( KDefaultCaptionOpacity );
  1604                 newItem.iText->SetOpacity( opacity );
  1644                 newItem.iText->SetOpacity( opacity );
  1605                 
  1645 
  1606                 newItem.iText->SetTextStyle( iAppUi.LayoutHandler()->FSTextStyleFromLayoutL(AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var)).Id() );//FSTextStyleFromIdL( EFSFontTypeSmall )->Id() );
  1646                 newItem.iText->SetTextStyle( iAppUi.LayoutHandler()->FSTextStyleFromLayoutL(AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var)).Id() );//FSTextStyleFromIdL( EFSFontTypeSmall )->Id() );
  1607                 newItem.iText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
  1647                 newItem.iText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
  1608                 newItem.iText->SetAlign( EAlfAlignHCenter, EAlfAlignVTop );
  1648                 newItem.iText->SetAlign( EAlfAlignHCenter, EAlfAlignVTop );
  1609 
  1649 
  1610                 newItem.iImage = CAlfImageVisual::AddNewL( *iControl, newItem.iBase );
  1650                 newItem.iImage = CAlfImageVisual::AddNewL( *iControl, newItem.iBase );
  1611                 newItem.iImage->SetScaleMode( CAlfImageVisual::EScaleFit );
  1651                 newItem.iImage->SetScaleMode( CAlfImageVisual::EScaleFit );
  1612                 newItem.iImage->SetImage( TAlfImage( *aLevel.iItems[i].iIconTexture ) );
  1652                 newItem.iImage->SetImage( TAlfImage( *aLevel.iItems[i].iIconTexture ) );
  1613                 newItem.iImage->SetFlag( EAlfVisualFlagManualSize );
  1653                 newItem.iImage->SetFlag( EAlfVisualFlagManualSize );
  1614 
  1654 
  1615 // <cmail> Use layout data instead of hard-coded values  
  1655 // <cmail> Use layout data instead of hard-coded values
  1616                 newItem.iImage->SetSize( gridIconRect.Rect().Size() );
  1656                 newItem.iImage->SetSize( gridIconRect.Rect().Size() );
  1617                 newItem.iImage->SetScale( KScaleNotSelected );
  1657                 newItem.iImage->SetScale( KScaleNotSelected );
  1618 // </cmail>
  1658 // </cmail>
  1619 
  1659 
  1620                 User::LeaveIfError( aLevel.iItemVisualData.Append( newItem ) );
  1660                 User::LeaveIfError( aLevel.iItemVisualData.Append( newItem ) );
  1621                 }
  1661                 }
  1622             }
  1662             }
  1623 
  1663 
  1624 // <cmail> Use layout data instead of hard-coded values  
  1664 // <cmail> Use layout data instead of hard-coded values
  1625         // Set columns and rows
  1665         // Set columns and rows
  1626         //iVisibleColumns = iAppUi.LayoutHandler()->GridColumnsInThisResolution();
  1666         //iVisibleColumns = iAppUi.LayoutHandler()->GridColumnsInThisResolution();
  1627         //iVisibleRows = iAppUi.LayoutHandler()->GridRowsInThisResolution();
  1667         //iVisibleRows = iAppUi.LayoutHandler()->GridRowsInThisResolution();
  1628         iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastRow() + 1;
  1668         iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastRow() + 1;
  1629         iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastColumn() + 1;
  1669         iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastColumn() + 1;
  1639     FUNC_LOG;
  1679     FUNC_LOG;
  1640 	if ( !iAppUi.ViewSwitchingOngoing() )
  1680 	if ( !iAppUi.ViewSwitchingOngoing() )
  1641 		{
  1681 		{
  1642         iItemIdInButtonDownEvent.iItemId = KErrNotFound;
  1682         iItemIdInButtonDownEvent.iItemId = KErrNotFound;
  1643         UpdateFocusVisibility();
  1683         UpdateFocusVisibility();
  1644 	
  1684 
  1645 		CFSEmailLauncherItem* launcherItem =
  1685 		CFSEmailLauncherItem* launcherItem =
  1646 		    iCurrentLevel.iItems[iCurrentLevel.iSelected].iLauncherItem;
  1686 		    iCurrentLevel.iItems[iCurrentLevel.iSelected].iLauncherItem;
  1647 		if ( launcherItem )
  1687 		if ( launcherItem )
  1648 		    {
  1688 		    {
  1649 	        launcherItem->ExecuteActionL();
  1689 	        launcherItem->ExecuteActionL();
  1655 				{
  1695 				{
  1656 				case EDefaultMailboxItem:
  1696 				case EDefaultMailboxItem:
  1657 				case EOtherMailboxItems:
  1697 				case EOtherMailboxItems:
  1658 					{
  1698 					{
  1659 					TMailListActivationData tmp;
  1699 					TMailListActivationData tmp;
  1660 					tmp.iFolderId = iCurrentLevel.iItems[iCurrentLevel.iSelected].iMailBoxInboxId; 
  1700 					tmp.iFolderId = iCurrentLevel.iItems[iCurrentLevel.iSelected].iMailBoxInboxId;
  1661 					tmp.iMailBoxId = iCurrentLevel.iItems[iCurrentLevel.iSelected].iMailBoxId; 
  1701 					tmp.iMailBoxId = iCurrentLevel.iItems[iCurrentLevel.iSelected].iMailBoxId;
  1662 					const TPckgBuf<TMailListActivationData> pkgOut( tmp );
  1702 					const TPckgBuf<TMailListActivationData> pkgOut( tmp );
  1663 					iAppUi.ShowTitlePaneConnectionStatus();
  1703 					iAppUi.ShowTitlePaneConnectionStatus();
  1664 					iAppUi.EnterFsEmailViewL( MailListId, KStartListWithFolderId, pkgOut );
  1704 					iAppUi.EnterFsEmailViewL( MailListId, KStartListWithFolderId, pkgOut );
  1665 					}				
  1705 					}
  1666 					break;
  1706 					break;
  1667 				case EDirectoryItem:
  1707 				case EDirectoryItem:
  1668 				    {
  1708 				    {
  1669 				    // TO prevent accidental double clicks of the directory item,
  1709 				    // TO prevent accidental double clicks of the directory item,
  1670 				    // prevents multiple RCL windows to be seen
  1710 				    // prevents multiple RCL windows to be seen
  1671                     if ( !iDoubleClickLock )
  1711                     if ( !iDoubleClickLock )
  1672                         {
  1712                         {
  1673                         // Lock to make sure that wizard is not started twice in a row
  1713                         // Lock to make sure that wizard is not started twice in a row
  1674                         iDoubleClickLock = ETrue; 
  1714                         iDoubleClickLock = ETrue;
  1675                         RPointerArray<CFSMailBox> mailBoxes;
  1715                         RPointerArray<CFSMailBox> mailBoxes;
  1676                         CleanupResetAndDestroyClosePushL( mailBoxes );
  1716                         CleanupResetAndDestroyClosePushL( mailBoxes );
  1677                         TFSMailMsgId id; 
  1717                         TFSMailMsgId id;
  1678                         TInt err = iAppUi.GetMailClient()->ListMailBoxes(
  1718                         TInt err = iAppUi.GetMailClient()->ListMailBoxes(
  1679                             id,
  1719                             id,
  1680                             mailBoxes );
  1720                             mailBoxes );
  1681                         
  1721 
  1682                         // Remove mailboxes that doesn't support RCL
  1722                         // Remove mailboxes that doesn't support RCL
  1683                         for ( TInt i = mailBoxes.Count()-1; i >= 0 ; i-- )
  1723                         for ( TInt i = mailBoxes.Count()-1; i >= 0 ; i-- )
  1684                             {
  1724                             {
  1685                             if ( !TFsEmailUiUtility::IsRemoteLookupSupported( *mailBoxes[i] ) )
  1725                             if ( !TFsEmailUiUtility::IsRemoteLookupSupported( *mailBoxes[i] ) )
  1686                                 {
  1726                                 {
  1703                             }
  1743                             }
  1704 
  1744 
  1705                         if ( mailBox )
  1745                         if ( mailBox )
  1706                             {
  1746                             {
  1707                             CFsDelayedLoader::InstanceL()->GetContactHandlerL()->LaunchRemoteLookupL( *mailBox );
  1747                             CFsDelayedLoader::InstanceL()->GetContactHandlerL()->LaunchRemoteLookupL( *mailBox );
  1708                             }                    
  1748                             }
  1709                         iDoubleClickLock = EFalse;
  1749                         iDoubleClickLock = EFalse;
  1710                         CleanupStack::PopAndDestroy( &mailBoxes );                  
  1750                         CleanupStack::PopAndDestroy( &mailBoxes );
  1711                         }
  1751                         }
  1712 				    }
  1752 				    }
  1713 					break;
  1753 					break;
  1714 	            case ESettingsItem:
  1754 	            case ESettingsItem:
  1715 	                {
  1755 	                {
  1716 	                TInt tmp = 0;
  1756 	                TInt tmp = 0;
  1717 	                const TPckgBuf<TInt> pkgBuf( tmp );
  1757 	                const TPckgBuf<TInt> pkgBuf( tmp );
  1718 	      			iAppUi.EnterFsEmailViewL(  
  1758 	      			iAppUi.EnterFsEmailViewL(
  1719 	      					SettingsViewId,
  1759 	      					SettingsViewId,
  1720 	      					TUid::Uid(KMailSettingsOpenMainList),
  1760 	      					TUid::Uid(KMailSettingsOpenMainList),
  1721 	      					pkgBuf );
  1761 	      					pkgBuf );
  1722 	                }
  1762 	                }
  1723 	            	break;
  1763 	            	break;
  1725 	                {
  1765 	                {
  1726                     // To prevent accidental double clicks of the wizard item
  1766                     // To prevent accidental double clicks of the wizard item
  1727 	                // wizard would crash without this
  1767 	                // wizard would crash without this
  1728 	                if ( !iDoubleClickLock )
  1768 	                if ( !iDoubleClickLock )
  1729 	                    {
  1769 	                    {
  1730 	                    iDoubleClickLock = ETrue; 
  1770 	                    iDoubleClickLock = ETrue;
  1731 	                    LaunchWizardL();
  1771 	                    LaunchWizardL();
  1732     	                }
  1772     	                }
  1733 	                }
  1773 	                }
  1734 	            	break;
  1774 	            	break;
  1735 	            case EHelpItem:
  1775 	            case EHelpItem:
  1742 	                    TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
  1782 	                    TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
  1743 	                    }
  1783 	                    }
  1744 	                }
  1784 	                }
  1745 	            	break;
  1785 	            	break;
  1746 				default:
  1786 				default:
  1747 					return;	
  1787 					return;
  1748 				}
  1788 				}
  1749 		    }		
  1789 		    }
  1750 		}
  1790 		}
  1751 	}
  1791 	}
  1752 
  1792 
  1753 
  1793 
  1754 void CFSEmailUiLauncherGridVisualiser::HandleForegroundEventL()
  1794 void CFSEmailUiLauncherGridVisualiser::HandleForegroundEventL()
  1758     UpdateFocusVisibility();
  1798     UpdateFocusVisibility();
  1759 
  1799 
  1760     // Toggle safety lock always when receiving foreground back.
  1800     // Toggle safety lock always when receiving foreground back.
  1761     if ( iFirstStartComplete && iDoubleClickLock )
  1801     if ( iFirstStartComplete && iDoubleClickLock )
  1762         {
  1802         {
  1763         iDoubleClickLock = EFalse;        
  1803         iDoubleClickLock = EFalse;
  1764         }
  1804         }
  1765     }
  1805     }
  1766 
  1806 
  1767 void CFSEmailUiLauncherGridVisualiser::GetParentLayoutsL(
  1807 void CFSEmailUiLauncherGridVisualiser::GetParentLayoutsL(
  1768         RPointerArray<CAlfVisual>& aLayoutArray ) const
  1808         RPointerArray<CAlfVisual>& aLayoutArray ) const
  1786         }
  1826         }
  1787 
  1827 
  1788     TInt selectedOption;
  1828     TInt selectedOption;
  1789     CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &selectedOption );
  1829     CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &selectedOption );
  1790     dlg->PrepareLC( R_FSEMAILUI_LAUNCHER_GRID_MAILBOX_SELECTION_DIALOG  );
  1830     dlg->PrepareLC( R_FSEMAILUI_LAUNCHER_GRID_MAILBOX_SELECTION_DIALOG  );
  1791     
  1831 
  1792     dlg->SetItemTextArray( array );
  1832     dlg->SetItemTextArray( array );
  1793     dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
  1833     dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
  1794     
  1834 
  1795     CFSMailBox* mailbox = NULL;
  1835     CFSMailBox* mailbox = NULL;
  1796     if( dlg->RunLD() )
  1836     if( dlg->RunLD() )
  1797         {
  1837         {
  1798         // safety check.
  1838         // safety check.
  1799         if( selectedOption >= 0 &&
  1839         if( selectedOption >= 0 &&
  1800             selectedOption < aMailBoxes.Count() )
  1840             selectedOption < aMailBoxes.Count() )
  1801             {
  1841             {
  1802             mailbox = aMailBoxes[selectedOption];
  1842             mailbox = aMailBoxes[selectedOption];
  1803             }
  1843             }
  1804         }
  1844         }
  1805     
  1845 
  1806     CleanupStack::PopAndDestroy( array );
  1846     CleanupStack::PopAndDestroy( array );
  1807     return mailbox;
  1847     return mailbox;
  1808     }
  1848     }
  1809 
  1849 
  1810 void CFSEmailUiLauncherGridVisualiser::LaunchWizardL()
  1850 void CFSEmailUiLauncherGridVisualiser::LaunchWizardL()
  1823         {
  1863         {
  1824         DoFirstStartL();
  1864         DoFirstStartL();
  1825         }
  1865         }
  1826 
  1866 
  1827     iAiwSHandler->ExecuteServiceCmdL( KAiwCmdSettingWizardFsEmail.iUid,
  1867     iAiwSHandler->ExecuteServiceCmdL( KAiwCmdSettingWizardFsEmail.iUid,
  1828                                       iAiwSHandler->InParamListL(), 
  1868                                       iAiwSHandler->InParamListL(),
  1829                                       iAiwSHandler->OutParamListL() );
  1869                                       iAiwSHandler->OutParamListL() );
  1830     }
  1870     }
  1831 
  1871 
  1832 void CFSEmailUiLauncherGridVisualiser::GoToInboxL( TFSMailMsgId& aMailboxId, TFSMailMsgId& aMailboxInboxId )
  1872 void CFSEmailUiLauncherGridVisualiser::GoToInboxL( TFSMailMsgId& aMailboxId, TFSMailMsgId& aMailboxInboxId )
  1833     {
  1873     {
  1834     FUNC_LOG;
  1874     FUNC_LOG;
  1835 	TMailListActivationData tmp;	
  1875 	TMailListActivationData tmp;
  1836 	
  1876 
  1837 	tmp.iMailBoxId = aMailboxId;
  1877 	tmp.iMailBoxId = aMailboxId;
  1838 	tmp.iFolderId = aMailboxInboxId;
  1878 	tmp.iFolderId = aMailboxInboxId;
  1839 		
  1879 
  1840 	const TPckgBuf<TMailListActivationData> pkgOut( tmp );	
  1880 	const TPckgBuf<TMailListActivationData> pkgOut( tmp );
  1841 	
  1881 
  1842 	iAppUi.EnterFsEmailViewL( MailListId, KStartListWithFolderId, pkgOut );
  1882 	iAppUi.EnterFsEmailViewL( MailListId, KStartListWithFolderId, pkgOut );
  1843     }
  1883     }
  1844 
  1884 
  1845 void CFSEmailUiLauncherGridVisualiser::RescaleIconsL()
  1885 void CFSEmailUiLauncherGridVisualiser::RescaleIconsL()
  1846 	{
  1886 	{
  1849         {
  1889         {
  1850 	// <cmail> Use layout data instead of hard-coded values
  1890 	// <cmail> Use layout data instead of hard-coded values
  1851 		TRect mainPaneRect;
  1891 		TRect mainPaneRect;
  1852 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  1892 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  1853 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  1893 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  1854 	    
  1894 
  1855 	    TAknLayoutRect scrollBarRect;
  1895 	    TAknLayoutRect scrollBarRect;
  1856 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  1896 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  1857 	    TRect gridRect = mainPaneRect;
  1897 	    TRect gridRect = mainPaneRect;
  1858 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  1898 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  1859 	    
  1899 
  1860 	    TAknLayoutRect itemRect;
  1900 	    TAknLayoutRect itemRect;
  1861 	    itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  1901 	    itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  1862 	    
  1902 
  1863 	    TAknLayoutRect gridIconRect;
  1903 	    TAknLayoutRect gridIconRect;
  1864 	    gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1904 	    gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1865 		
  1905 
  1866 	   	//TInt gridIconSize = iAppUi.LayoutHandler()->GridIconSize();
  1906 	   	//TInt gridIconSize = iAppUi.LayoutHandler()->GridIconSize();
  1867 		TSize iconSize = gridIconRect.Rect().Size();
  1907 		TSize iconSize = gridIconRect.Rect().Size();
  1868 		//iconSize.SetSize( gridIconSize, gridIconSize );
  1908 		//iconSize.SetSize( gridIconSize, gridIconSize );
  1869 	// </cmail>
  1909 	// </cmail>
  1870 		
  1910 
  1871         // Scale bitmaps
  1911         // Scale bitmaps
  1872         for( TInt i = 0 ; i < iIconArray.Count() ; i++ )
  1912         for( TInt i = 0 ; i < iIconArray.Count() ; i++ )
  1873             {
  1913             {
  1874             iIconArray[i]->Size().SetSize( iconSize.iWidth, iconSize.iHeight );
  1914             iIconArray[i]->Size().SetSize( iconSize.iWidth, iconSize.iHeight );
  1875             }
  1915             }
  1876         // Scale visuals
  1916         // Scale visuals
  1877         for ( TInt item = 0; item < iCurrentLevel.iItemVisualData.Count() ; item++ )
  1917         for ( TInt item = 0; item < iCurrentLevel.iItemVisualData.Count() ; item++ )
  1878             {
  1918             {
  1879             iCurrentLevel.iItemVisualData[item].iImage->SetSize( iconSize );
  1919             iCurrentLevel.iItemVisualData[item].iImage->SetSize( iconSize );
  1880             }        
  1920             }
  1881         }
  1921         }
  1882 	}
  1922 	}
  1883 
  1923 
  1884 void CFSEmailUiLauncherGridVisualiser::AddItemToModelL( CFSEmailLauncherItem* aItem, TInt aPluginArrayIndex )
  1924 void CFSEmailUiLauncherGridVisualiser::AddItemToModelL( CFSEmailLauncherItem* aItem, TInt aPluginArrayIndex )
  1885     {
  1925     {
  1892         if ( launcherItemIcon )
  1932         if ( launcherItemIcon )
  1893             {
  1933             {
  1894 // <cmail> Use layout data instead of hard-coded values
  1934 // <cmail> Use layout data instead of hard-coded values
  1895             TRect mainPaneRect;
  1935             TRect mainPaneRect;
  1896             AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  1936             AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  1897             
  1937 
  1898             TAknLayoutRect scrollBarRect;
  1938             TAknLayoutRect scrollBarRect;
  1899             scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  1939             scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  1900             TRect gridRect = mainPaneRect;
  1940             TRect gridRect = mainPaneRect;
  1901             gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  1941             gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  1902             
  1942 
  1903             TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  1943             TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  1904             
  1944 
  1905             TAknLayoutRect itemRect;
  1945             TAknLayoutRect itemRect;
  1906             itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  1946             itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  1907             
  1947 
  1908             TAknLayoutRect gridIconRect;
  1948             TAknLayoutRect gridIconRect;
  1909             gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1949             gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1910             
  1950 
  1911             TSize iconSize = gridIconRect.Rect().Size();
  1951             TSize iconSize = gridIconRect.Rect().Size();
  1912 // </cmail>
  1952 // </cmail>
  1913                
  1953 
  1914             const CFbsBitmap* bitmap = launcherItemIcon->Bitmap();
  1954             const CFbsBitmap* bitmap = launcherItemIcon->Bitmap();
  1915             const CFbsBitmap* mask = launcherItemIcon->Mask();    
  1955             const CFbsBitmap* mask = launcherItemIcon->Mask();
  1916 
  1956 
  1917 			// First add plugin id and icon id pair to array, needed in provide bitmap
  1957 			// First add plugin id and icon id pair to array, needed in provide bitmap
  1918 			TPluginIdIconIdPair idPair;
  1958 			TPluginIdIconIdPair idPair;
  1919 			idPair.iPluginArrayIndex = aPluginArrayIndex;
  1959 			idPair.iPluginArrayIndex = aPluginArrayIndex;
  1920 			idPair.iIconId = iPluginTextureId;	
  1960 			idPair.iIconId = iPluginTextureId;
  1921 			iPluginIdIconIdPairs.Append( idPair );	
  1961 			iPluginIdIconIdPairs.Append( idPair );
  1922 
  1962 
  1923 			// Create texture, goes to provide bitmap
  1963 			// Create texture, goes to provide bitmap
  1924 			CAlfTexture* texture = &CAlfStatic::Env().TextureManager().CreateTextureL( iPluginTextureId, this, EAlfTextureFlagDefault );		
  1964 			CAlfTexture* texture = &CAlfStatic::Env().TextureManager().CreateTextureL( iPluginTextureId, this, EAlfTextureFlagDefault );
  1925 			// Update texture id 
  1965 			// Update texture id
  1926 			iPluginTextureId++; // Id is updated dynamically					
  1966 			iPluginTextureId++; // Id is updated dynamically
  1927 			// Set initiel size
  1967 			// Set initiel size
  1928 // <cmail> Use layout data instead of hard-coded values
  1968 // <cmail> Use layout data instead of hard-coded values
  1929 			//TSize iconSize(iAppUi.LayoutHandler()->GridIconSize(), iAppUi.LayoutHandler()->GridIconSize() );
  1969 			//TSize iconSize(iAppUi.LayoutHandler()->GridIconSize(), iAppUi.LayoutHandler()->GridIconSize() );
  1930 // <cmail>
  1970 // <cmail>
  1931   			texture->Size().SetSize( iconSize.iHeight, iconSize.iWidth );  
  1971   			texture->Size().SetSize( iconSize.iHeight, iconSize.iWidth );
  1932            iModel->AddL(
  1972            iModel->AddL(
  1933                 EShortcut,
  1973                 EShortcut,
  1934                 aItem->Id(),
  1974                 aItem->Id(),
  1935                 *launcherItemText,
  1975                 *launcherItemText,
  1936                 *texture,
  1976                 *texture,
  1937                 0,
  1977                 0,
  1938                 aItem );        
  1978                 aItem );
  1939 	        iIconArray.AppendL( texture ); 
  1979 	        iIconArray.AppendL( texture );
  1940             }
  1980             }
  1941         else
  1981         else
  1942             {
  1982             {
  1943             CAlfTexture* texture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture );
  1983             CAlfTexture* texture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture );
  1944             
  1984 
  1945             iModel->AddL(
  1985             iModel->AddL(
  1946                 EShortcut,
  1986                 EShortcut,
  1947                 aItem->Id(),
  1987                 aItem->Id(),
  1948                 *launcherItemText,
  1988                 *launcherItemText,
  1949                 *texture,
  1989                 *texture,
  1950                 0,
  1990                 0,
  1951                 aItem );         
  1991                 aItem );
  1952             iIconArray.AppendL( texture );
  1992             iIconArray.AppendL( texture );
  1953             }
  1993             }
  1954 
  1994 
  1955         CleanupStack::PopAndDestroy( launcherItemText );
  1995         CleanupStack::PopAndDestroy( launcherItemText );
  1956         }
  1996         }
  1960     {
  2000     {
  1961     FUNC_LOG;
  2001     FUNC_LOG;
  1962     if ( iConstructionCompleted )
  2002     if ( iConstructionCompleted )
  1963         {
  2003         {
  1964 	    iCurrentLevel.iParent = 0;
  2004 	    iCurrentLevel.iParent = 0;
  1965 	    
  2005 
  1966 	// <cmail> Use layout data instead of hard-coded values
  2006 	// <cmail> Use layout data instead of hard-coded values
  1967 	    TRect mainPaneRect;
  2007 	    TRect mainPaneRect;
  1968 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  2008 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  1969 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  2009 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  1970 	    
  2010 
  1971 	    TAknLayoutRect scrollBarRect;
  2011 	    TAknLayoutRect scrollBarRect;
  1972 	    // <cmail>
  2012 	    // <cmail>
  1973 //	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  2013 //	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  1974 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Apps::scroll_pane_cp03());
  2014 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Apps::scroll_pane_cp03());
  1975 	    // </cmail>
  2015 	    // </cmail>
  1976 	    TRect gridRect = mainPaneRect;
  2016 	    TRect gridRect = mainPaneRect;
  1977 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  2017 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  1978 	    
  2018 
  1979 	    TAknLayoutRect cellRect;
  2019 	    TAknLayoutRect cellRect;
  1980 	    cellRect.LayoutRect(gridRect, AknLayoutScalable_Apps::aid_size_cell_cmail_l(var, 0, 0));
  2020 	    cellRect.LayoutRect(gridRect, AknLayoutScalable_Apps::aid_size_cell_cmail_l(var, 0, 0));
  1981 	    
  2021 
  1982 	    TAknLayoutRect itemRect;
  2022 	    TAknLayoutRect itemRect;
  1983 	    itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  2023 	    itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  1984 	    
  2024 
  1985 	    TAknLayoutRect gridIconRect;
  2025 	    TAknLayoutRect gridIconRect;
  1986 	    gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  2026 	    gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  1987 	    
  2027 
  1988 	    TAknLayoutRect selectorRect;
  2028 	    TAknLayoutRect selectorRect;
  1989 	    selectorRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::grid_highlight_pane_cp018(var));
  2029 	    selectorRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::grid_highlight_pane_cp018(var));
  1990 
  2030 
  1991 	    CFSEmailUiLayoutHandler* layoutHandler = iAppUi.LayoutHandler();
  2031 	    CFSEmailUiLayoutHandler* layoutHandler = iAppUi.LayoutHandler();
  1992 	    iSelectorImageVisual->SetSize( selectorRect.Rect().Size() ); // layoutHandler->SelectorVisualSizeInThisResolution() );
  2032 	    iSelectorImageVisual->SetSize( selectorRect.Rect().Size() ); // layoutHandler->SelectorVisualSizeInThisResolution() );
  1993 
  2033 
  1994 	    TSize displaySize = mainPaneRect.Size();//iControl->DisplayArea().Size();
  2034 	    TSize displaySize = mainPaneRect.Size();//iControl->DisplayArea().Size();
  1995 	    
  2035 
  1996 	    TInt columns = iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastColumn() + 1; //layoutHandler->GridColumnsInThisResolution();
  2036 	    TInt columns = iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastColumn() + 1; //layoutHandler->GridColumnsInThisResolution();
  1997 	    TInt rows = iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastRow() + 1; //layoutHandler->GridRowsInThisResolution();
  2037 	    TInt rows = iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastRow() + 1; //layoutHandler->GridRowsInThisResolution();
  1998 	    
  2038 
  1999 	// </cmail>
  2039 	// </cmail>
  2000 
  2040 
  2001         iCurrentLevel.iGridLayout->SetSize( gridRect.Size() );
  2041         iCurrentLevel.iGridLayout->SetSize( gridRect.Size() );
  2002         iCurrentLevel.iGridLayout->SetColumnsL( columns );
  2042         iCurrentLevel.iGridLayout->SetColumnsL( columns );
  2003         iCurrentLevel.iGridLayout->SetRowsL( rows );
  2043         iCurrentLevel.iGridLayout->SetRowsL( rows );
  2014         else
  2054         else
  2015             {
  2055             {
  2016             iScrollbar->MakeVisible(EFalse);
  2056             iScrollbar->MakeVisible(EFalse);
  2017             }
  2057             }
  2018         // </cmail>
  2058         // </cmail>
  2019 	    
  2059 
  2020         TInt scrollbarTopLeftX = displaySize.iWidth - scrollbarWidth;
  2060         TInt scrollbarTopLeftX = displaySize.iWidth - scrollbarWidth;
  2021         TInt scrollbarTopLeftY = 0;
  2061         TInt scrollbarTopLeftY = 0;
  2022         TInt scrollbarBottomRightX = displaySize.iWidth;
  2062         TInt scrollbarBottomRightX = displaySize.iWidth;
  2023         TInt scrollbarBottomRightY = displaySize.iHeight;
  2063         TInt scrollbarBottomRightY = displaySize.iHeight;
  2024         TInt gridTopLeftX = 0;
  2064         TInt gridTopLeftX = 0;
  2048             EAlfAnchorMetricAbsolute,
  2088             EAlfAnchorMetricAbsolute,
  2049             EAlfAnchorMetricAbsolute,
  2089             EAlfAnchorMetricAbsolute,
  2050             TAlfTimedPoint( scrollbarTopLeftX, scrollbarTopLeftY ) );
  2090             TAlfTimedPoint( scrollbarTopLeftX, scrollbarTopLeftY ) );
  2051         iWidgetLayout->SetAnchor(
  2091         iWidgetLayout->SetAnchor(
  2052             EAlfAnchorBottomRight,
  2092             EAlfAnchorBottomRight,
  2053             0, 
  2093             0,
  2054             EAlfAnchorOriginLeft,
  2094             EAlfAnchorOriginLeft,
  2055             EAlfAnchorOriginTop,
  2095             EAlfAnchorOriginTop,
  2056             EAlfAnchorMetricAbsolute,
  2096             EAlfAnchorMetricAbsolute,
  2057             EAlfAnchorMetricAbsolute,
  2097             EAlfAnchorMetricAbsolute,
  2058             TAlfTimedPoint( scrollbarBottomRightX, scrollbarBottomRightY ) );
  2098             TAlfTimedPoint( scrollbarBottomRightX, scrollbarBottomRightY ) );
  2059           
  2099 
  2060         // Set anchors for the grid
  2100         // Set anchors for the grid
  2061         iWidgetLayout->SetAnchor(
  2101         iWidgetLayout->SetAnchor(
  2062             EAlfAnchorTopLeft,
  2102             EAlfAnchorTopLeft,
  2063             1, 
  2103             1,
  2064             EAlfAnchorOriginLeft,
  2104             EAlfAnchorOriginLeft,
  2065             EAlfAnchorOriginTop,
  2105             EAlfAnchorOriginTop,
  2066             EAlfAnchorMetricAbsolute,
  2106             EAlfAnchorMetricAbsolute,
  2067             EAlfAnchorMetricAbsolute,
  2107             EAlfAnchorMetricAbsolute,
  2068             TAlfTimedPoint( gridTopLeftX, gridTopLeftY ) );
  2108             TAlfTimedPoint( gridTopLeftX, gridTopLeftY ) );
  2069         iWidgetLayout->SetAnchor(
  2109         iWidgetLayout->SetAnchor(
  2070             EAlfAnchorBottomRight,
  2110             EAlfAnchorBottomRight,
  2071             1, 
  2111             1,
  2072             EAlfAnchorOriginLeft,
  2112             EAlfAnchorOriginLeft,
  2073             EAlfAnchorOriginTop,
  2113             EAlfAnchorOriginTop,
  2074             EAlfAnchorMetricAbsolute,
  2114             EAlfAnchorMetricAbsolute,
  2075             EAlfAnchorMetricAbsolute,
  2115             EAlfAnchorMetricAbsolute,
  2076             TAlfTimedPoint( gridBottomRightX, gridBottomRightY ) );
  2116             TAlfTimedPoint( gridBottomRightX, gridBottomRightY ) );
  2077 
  2117 
  2078         iParentLayout->UpdateChildrenLayout();
  2118         iParentLayout->UpdateChildrenLayout();
  2079           
  2119 
  2080         TSize gridSize = iCurrentLevel.iGridLayout->Size().IntTarget().AsSize();
  2120         TSize gridSize = iCurrentLevel.iGridLayout->Size().IntTarget().AsSize();
  2081         iColumnWidth = gridSize.iWidth / iVisibleColumns; 
  2121         iColumnWidth = gridSize.iWidth / iVisibleColumns;
  2082         iRowHeight = gridSize.iHeight / iVisibleRows;
  2122         iRowHeight = gridSize.iHeight / iVisibleRows;
  2083 
  2123 
  2084         // Selector ring wrap limits can be calculated when row and column sizes are known.
  2124         // Selector ring wrap limits can be calculated when row and column sizes are known.
  2085         SetRingWrapLimits();
  2125         SetRingWrapLimits();
  2086         MoveSelection( EDirectionNone );
  2126         MoveSelection( EDirectionNone );
  2102         {
  2142         {
  2103         iRingMovementXFuncMappingDataProvider.SetStart(-iColumnWidth);
  2143         iRingMovementXFuncMappingDataProvider.SetStart(-iColumnWidth);
  2104         iRingMovementXFuncMappingDataProvider.SetEnd((iVisibleColumns+1)*iColumnWidth);
  2144         iRingMovementXFuncMappingDataProvider.SetEnd((iVisibleColumns+1)*iColumnWidth);
  2105         iRingMovementYFuncMappingDataProvider.SetStart(-iRowHeight);
  2145         iRingMovementYFuncMappingDataProvider.SetStart(-iRowHeight);
  2106         iRingMovementYFuncMappingDataProvider.SetEnd((iRowCount+1)*iRowHeight);
  2146         iRingMovementYFuncMappingDataProvider.SetEnd((iRowCount+1)*iRowHeight);
  2107         
  2147 
  2108         iRingMovementXFunc->SetMappingTableValues( -(iVisibleColumns+2)*iColumnWidth, (iVisibleColumns*2+2)*iColumnWidth, &iRingMovementXFuncMappingDataProvider );
  2148         iRingMovementXFunc->SetMappingTableValues( -(iVisibleColumns+2)*iColumnWidth, (iVisibleColumns*2+2)*iColumnWidth, &iRingMovementXFuncMappingDataProvider );
  2109         iRingMovementYFunc->SetMappingTableValues( -(iRowCount+2)*iRowHeight, (iRowCount*2+2)*iRowHeight, &iRingMovementYFuncMappingDataProvider );      
  2149         iRingMovementYFunc->SetMappingTableValues( -(iRowCount+2)*iRowHeight, (iRowCount*2+2)*iRowHeight, &iRingMovementYFuncMappingDataProvider );
  2110         }
  2150         }
  2111     }
  2151     }
  2112 
  2152 
  2113 void CFSEmailUiLauncherGridVisualiser::DisplayProductInfoL()
  2153 void CFSEmailUiLauncherGridVisualiser::DisplayProductInfoL()
  2114 	{
  2154 	{
  2121     HBufC* text_5 = StringLoader::LoadLC( R_DISCLAIMER_PART_5 );
  2161     HBufC* text_5 = StringLoader::LoadLC( R_DISCLAIMER_PART_5 );
  2122     HBufC* text_6 = StringLoader::LoadLC( R_DISCLAIMER_PART_6 );
  2162     HBufC* text_6 = StringLoader::LoadLC( R_DISCLAIMER_PART_6 );
  2123     HBufC* text_7 = StringLoader::LoadLC( R_DISCLAIMER_PART_7 );
  2163     HBufC* text_7 = StringLoader::LoadLC( R_DISCLAIMER_PART_7 );
  2124     HBufC* text_8 = StringLoader::LoadLC( R_DISCLAIMER_PART_8 );
  2164     HBufC* text_8 = StringLoader::LoadLC( R_DISCLAIMER_PART_8 );
  2125     HBufC* text_9 = StringLoader::LoadLC( R_DISCLAIMER_PART_9 );
  2165     HBufC* text_9 = StringLoader::LoadLC( R_DISCLAIMER_PART_9 );
  2126     HBufC* text_10 = StringLoader::LoadLC( R_DISCLAIMER_PART_10 );    
  2166     HBufC* text_10 = StringLoader::LoadLC( R_DISCLAIMER_PART_10 );
  2127     HBufC* text_11 = StringLoader::LoadLC( R_DISCLAIMER_PART_11 );
  2167     HBufC* text_11 = StringLoader::LoadLC( R_DISCLAIMER_PART_11 );
  2128     
  2168 
  2129     //Create a buffer for dialog content
  2169     //Create a buffer for dialog content
  2130     HBufC* text = HBufC::NewLC( text_1->Length() + text_2->Length() + text_3->Length() + 
  2170     HBufC* text = HBufC::NewLC( text_1->Length() + text_2->Length() + text_3->Length() +
  2131                                 text_4->Length() + text_5->Length() + text_6->Length() + 
  2171                                 text_4->Length() + text_5->Length() + text_6->Length() +
  2132                                 text_7->Length() + text_8->Length() + text_9->Length() + 
  2172                                 text_7->Length() + text_8->Length() + text_9->Length() +
  2133                                 text_10->Length() + text_11->Length() );
  2173                                 text_10->Length() + text_11->Length() );
  2134     //Copy the disclaimer text parts to dialog content
  2174     //Copy the disclaimer text parts to dialog content
  2135     text->Des() += *text_1;
  2175     text->Des() += *text_1;
  2136     text->Des() += *text_2;
  2176     text->Des() += *text_2;
  2137     text->Des() += *text_3;
  2177     text->Des() += *text_3;
  2140     text->Des() += *text_6;
  2180     text->Des() += *text_6;
  2141     text->Des() += *text_7;
  2181     text->Des() += *text_7;
  2142     text->Des() += *text_8;
  2182     text->Des() += *text_8;
  2143     text->Des() += *text_9;
  2183     text->Des() += *text_9;
  2144     text->Des() += *text_10;
  2184     text->Des() += *text_10;
  2145     text->Des() += *text_11;    
  2185     text->Des() += *text_11;
  2146     
  2186 
  2147     CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *text );
  2187     CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *text );
  2148     CleanupStack::PopAndDestroy( text );
  2188     CleanupStack::PopAndDestroy( text );
  2149     CleanupStack::PopAndDestroy( text_11 );
  2189     CleanupStack::PopAndDestroy( text_11 );
  2150     CleanupStack::PopAndDestroy( text_10 );
  2190     CleanupStack::PopAndDestroy( text_10 );
  2151     CleanupStack::PopAndDestroy( text_9 );
  2191     CleanupStack::PopAndDestroy( text_9 );
  2156     CleanupStack::PopAndDestroy( text_4 );
  2196     CleanupStack::PopAndDestroy( text_4 );
  2157     CleanupStack::PopAndDestroy( text_3 );
  2197     CleanupStack::PopAndDestroy( text_3 );
  2158     CleanupStack::PopAndDestroy( text_2 );
  2198     CleanupStack::PopAndDestroy( text_2 );
  2159     CleanupStack::PopAndDestroy( text_1 );
  2199     CleanupStack::PopAndDestroy( text_1 );
  2160     dlg->PrepareLC( R_DISCLAIMER_MESSAGE );
  2200     dlg->PrepareLC( R_DISCLAIMER_MESSAGE );
  2161     
  2201 
  2162     //Create heading for the dialog, load and create the heading text
  2202     //Create heading for the dialog, load and create the heading text
  2163     CAknPopupHeadingPane* headingPane = dlg->Heading();
  2203     CAknPopupHeadingPane* headingPane = dlg->Heading();
  2164     HBufC* appName = StringLoader::LoadLC(R_FSEMAIL_APP_NAME );
  2204     HBufC* appName = StringLoader::LoadLC(R_FSEMAIL_APP_NAME );
  2165     HBufC* version = StringLoader::LoadLC( R_DISCLAIMER_FSEMAIL_VERSION );
  2205     HBufC* version = StringLoader::LoadLC( R_DISCLAIMER_FSEMAIL_VERSION );
  2166     HBufC* title = HBufC::NewLC(version->Length() + appName->Length() + 1);
  2206     HBufC* title = HBufC::NewLC(version->Length() + appName->Length() + 1);
  2167     title->Des() += *appName;    
  2207     title->Des() += *appName;
  2168     title->Des() += KSpace;
  2208     title->Des() += KSpace;
  2169     title->Des() += *version;
  2209     title->Des() += *version;
  2170     headingPane->SetTextL( *title );
  2210     headingPane->SetTextL( *title );
  2171     CleanupStack::PopAndDestroy( title );
  2211     CleanupStack::PopAndDestroy( title );
  2172     CleanupStack::PopAndDestroy( version );
  2212     CleanupStack::PopAndDestroy( version );
  2173     CleanupStack::PopAndDestroy( appName );  
  2213     CleanupStack::PopAndDestroy( appName );
  2174     dlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY );
  2214     dlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY );
  2175     //show dialog  
  2215     //show dialog
  2176     TInt ret = dlg->RunLD();
  2216     TInt ret = dlg->RunLD();
  2177 	}
  2217 	}
  2178 
  2218 
  2179 void CFSEmailUiLauncherGridVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType )
  2219 void CFSEmailUiLauncherGridVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType )
  2180 	{
  2220 	{
  2183 	CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType );
  2223 	CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType );
  2184 
  2224 
  2185     if ( iConstructionCompleted )
  2225     if ( iConstructionCompleted )
  2186         {
  2226         {
  2187         iItemIdInButtonDownEvent.iItemId = KErrNotFound;
  2227         iItemIdInButtonDownEvent.iItemId = KErrNotFound;
  2188     
  2228 
  2189 	// <cmail> Use layout data instead of hard-coded values
       
  2190 	    TRect mainPaneRect;
  2229 	    TRect mainPaneRect;
  2191 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  2230 	    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  2192 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  2231 	    TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  2193 	    
  2232 
  2194 	    TAknLayoutRect scrollBarRect;
  2233 	    TAknLayoutRect scrollBarRect;
  2195 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  2234 	    scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  2196 	    TRect gridRect = mainPaneRect;
  2235 	    TRect gridRect = mainPaneRect;
  2197 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  2236 	    gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  2198 	    
  2237 
  2199 	    TAknLayoutRect cellRect;
  2238 	    TAknLayoutRect cellRect;
  2200 	    cellRect.LayoutRect(gridRect, AknLayoutScalable_Apps::aid_size_cell_cmail_l(var, 0, 0));
  2239 	    cellRect.LayoutRect(gridRect, AknLayoutScalable_Apps::aid_size_cell_cmail_l(var, 0, 0));
  2201 	    
  2240 
  2202 		TSize displaySize = cellRect.Rect().Size();
  2241 		TSize displaySize = cellRect.Rect().Size();
  2203 	// </cmail>
       
  2204         iParentLayout->SetSize( displaySize );
  2242         iParentLayout->SetSize( displaySize );
  2205         RescaleIconsL(); 
  2243         RescaleIconsL();
  2206         VisualLayoutUpdatedL();        
  2244         VisualLayoutUpdatedL();
  2207 
  2245 
  2208         UpdateFocusVisibility();
  2246         UpdateFocusVisibility();
  2209         }
  2247         }
  2210  	}
  2248  	}
  2211 
  2249 
  2212 void CFSEmailUiLauncherGridVisualiser::HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType )
  2250 void CFSEmailUiLauncherGridVisualiser::HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType )
  2213     {
  2251     {
  2214     FUNC_LOG;
  2252     FUNC_LOG;
  2215     iRefreshNeeded = ETrue;
  2253     iRefreshNeeded = ETrue;
  2216     
  2254 
  2217     CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( aType );
  2255     CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( aType );
  2218     }
  2256     }
  2219 
  2257 
  2220 void CFSEmailUiLauncherGridVisualiser::HandleContentChangeL()
  2258 void CFSEmailUiLauncherGridVisualiser::HandleContentChangeL()
  2221     {
  2259     {
  2243     TRect mainPaneRect;
  2281     TRect mainPaneRect;
  2244     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  2282     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  2245     TRect scrollbarRect = aParent->DisplayRectTarget();
  2283     TRect scrollbarRect = aParent->DisplayRectTarget();
  2246     scrollbarRect.Move(mainPaneRect.iTl);
  2284     scrollbarRect.Move(mainPaneRect.iTl);
  2247     iScrollbar->SetRect(scrollbarRect);
  2285     iScrollbar->SetRect(scrollbarRect);
  2248     
  2286 
  2249     iScrollbar->MakeVisible(EFalse);
  2287     iScrollbar->MakeVisible(EFalse);
  2250     iScrollbar->SetModelL(&iScrollbarModel);
  2288     iScrollbar->SetModelL(&iScrollbarModel);
  2251 	}
  2289 	}
  2252 
  2290 
  2253 void CFSEmailUiLauncherGridVisualiser::UpdateScrollBarRangeL()
  2291 void CFSEmailUiLauncherGridVisualiser::UpdateScrollBarRangeL()
  2254 	{
  2292 	{
  2255     FUNC_LOG;
  2293     FUNC_LOG;
  2256 	
  2294 
  2257 	iScrollbarModel.SetScrollSpan(iRowCount);
  2295 	iScrollbarModel.SetScrollSpan(iRowCount);
  2258 	iScrollbarModel.SetWindowSize(iVisibleRows);
  2296 	iScrollbarModel.SetWindowSize(iVisibleRows);
  2259 	iScrollbarModel.SetFocusPosition(iFirstVisibleRow);
  2297 	iScrollbarModel.SetFocusPosition(iFirstVisibleRow);
  2260 	iScrollbar->SetModelL(&iScrollbarModel);
  2298 	iScrollbar->SetModelL(&iScrollbarModel);
  2261 	iScrollbar->DrawNow();
  2299 	iScrollbar->DrawNow();
  2265     {
  2303     {
  2266     FUNC_LOG;
  2304     FUNC_LOG;
  2267     const TInt KScrollTransitionTimeMs = KSelectTransitionTimeMs;
  2305     const TInt KScrollTransitionTimeMs = KSelectTransitionTimeMs;
  2268     if (aScrollBar == iScrollbar)
  2306     if (aScrollBar == iScrollbar)
  2269          {
  2307          {
  2270          
  2308 
  2271          switch( aEventType )
  2309          switch( aEventType )
  2272              {
  2310              {
  2273              case EEikScrollHome :
  2311              case EEikScrollHome :
  2274                  //Jump to beginning
  2312                  //Jump to beginning
  2275                  break;
  2313                  break;
  2288     }
  2326     }
  2289 // </cmail>
  2327 // </cmail>
  2290 void CFSEmailUiLauncherGridVisualiser::UpdateLauncherItemListL()
  2328 void CFSEmailUiLauncherGridVisualiser::UpdateLauncherItemListL()
  2291     {
  2329     {
  2292     FUNC_LOG;
  2330     FUNC_LOG;
  2293     
  2331 
  2294     // Read info about all implementations into infoArray
  2332     // Read info about all implementations into infoArray
  2295     RImplInfoPtrArray infoArray;
  2333     RImplInfoPtrArray infoArray;
  2296     CleanupResetAndDestroyClosePushL( infoArray );
  2334     CleanupResetAndDestroyClosePushL( infoArray );
  2297     CFSEmailLauncherItem::ListAllImplementationsL( infoArray );
  2335     CFSEmailLauncherItem::ListAllImplementationsL( infoArray );
  2298 
  2336 
  2308     // Iterate through all launcher item implementations in info array
  2346     // Iterate through all launcher item implementations in info array
  2309     TInt const infoCount = infoArray.Count();
  2347     TInt const infoCount = infoArray.Count();
  2310     for ( TInt infoIndex = 0; infoIndex < infoCount; infoIndex++ )
  2348     for ( TInt infoIndex = 0; infoIndex < infoCount; infoIndex++ )
  2311         {
  2349         {
  2312         TUid implementationUid = infoArray[infoIndex]->ImplementationUid();
  2350         TUid implementationUid = infoArray[infoIndex]->ImplementationUid();
  2313         
  2351 
  2314         // Check whether item can be found from current laucher items
  2352         // Check whether item can be found from current laucher items
  2315         TBool itemFound = EFalse;
  2353         TBool itemFound = EFalse;
  2316         for ( TInt itemIndex = 0; itemIndex < iLauncherItemUids.Count(); itemIndex++ )
  2354         for ( TInt itemIndex = 0; itemIndex < iLauncherItemUids.Count(); itemIndex++ )
  2317             {
  2355             {
  2318             if ( iLauncherItemUids[itemIndex] == implementationUid )
  2356             if ( iLauncherItemUids[itemIndex] == implementationUid )
  2351     CleanupStack::Pop( &itemsFoundArray );
  2389     CleanupStack::Pop( &itemsFoundArray );
  2352     itemsFoundArray.Close();
  2390     itemsFoundArray.Close();
  2353     CleanupStack::PopAndDestroy( &infoArray );
  2391     CleanupStack::PopAndDestroy( &infoArray );
  2354     }
  2392     }
  2355 
  2393 
  2356 /** 
  2394 /**
  2357  * Sets application title when leaving this view
  2395  * Sets application title when leaving this view
  2358  */
  2396  */
  2359 void CFSEmailUiLauncherGridVisualiser::SetDefaultStatusPaneTextL()
  2397 void CFSEmailUiLauncherGridVisualiser::SetDefaultStatusPaneTextL()
  2360 	{
  2398 	{
  2361     FUNC_LOG;
  2399     FUNC_LOG;
  2366     {
  2404     {
  2367     FUNC_LOG;
  2405     FUNC_LOG;
  2368     iWizardWaitnoteShown = aWaitnoteShown;
  2406     iWizardWaitnoteShown = aWaitnoteShown;
  2369     }
  2407     }
  2370 
  2408 
  2371 /** 
  2409 /**
  2372  * Check status of all configured mailboxes
  2410  * Check status of all configured mailboxes
  2373  */
  2411  */
  2374 TFSLauncherGridMailboxStatus CFSEmailUiLauncherGridVisualiser::CheckMailboxStatusL()
  2412 TFSLauncherGridMailboxStatus CFSEmailUiLauncherGridVisualiser::CheckMailboxStatusL()
  2375     {
  2413     {
  2376     FUNC_LOG;
  2414     FUNC_LOG;
  2377     RPointerArray<CFSMailBox> mailBoxes;
  2415     RPointerArray<CFSMailBox> mailBoxes;
  2378     CleanupResetAndDestroyClosePushL( mailBoxes );
  2416     CleanupResetAndDestroyClosePushL( mailBoxes );
  2379     TFSMailMsgId id; 
  2417     TFSMailMsgId id;
  2380     TInt err = iAppUi.GetMailClient()->ListMailBoxes(
  2418     TInt err = iAppUi.GetMailClient()->ListMailBoxes(
  2381         id,
  2419         id,
  2382         mailBoxes );
  2420         mailBoxes );
  2383 
  2421 
  2384     TFSLauncherGridMailboxStatus returnStatus;
  2422     TFSLauncherGridMailboxStatus returnStatus;
  2385     returnStatus.iMailboxCount = mailBoxes.Count();
  2423     returnStatus.iMailboxCount = mailBoxes.Count();
  2386     // Reset counters
  2424     // Reset counters
  2387     returnStatus.iMailboxesOnline = returnStatus.iMailboxesOffline = returnStatus.iMailboxesSyncing = 0;
  2425     returnStatus.iMailboxesOnline = returnStatus.iMailboxesOffline = returnStatus.iMailboxesSyncing = 0;
  2388     
  2426 
  2389     for ( TInt i = 0; i < mailBoxes.Count(); i++ )
  2427     for ( TInt i = 0; i < mailBoxes.Count(); i++ )
  2390         {
  2428         {
  2391         // First check online/offline status
  2429         // First check online/offline status
  2392         TFSMailBoxStatus onOffStatus = mailBoxes[i]->GetMailBoxStatus();
  2430         TFSMailBoxStatus onOffStatus = mailBoxes[i]->GetMailBoxStatus();
  2393         if( onOffStatus == EFSMailBoxOffline )
  2431         if( onOffStatus == EFSMailBoxOffline )
  2396             }
  2434             }
  2397         else if( onOffStatus == EFSMailBoxOnline )
  2435         else if( onOffStatus == EFSMailBoxOnline )
  2398             {
  2436             {
  2399             returnStatus.iMailboxesOnline++;
  2437             returnStatus.iMailboxesOnline++;
  2400             }
  2438             }
  2401         
  2439 
  2402         // Then check sync state
  2440         // Then check sync state
  2403         TSSMailSyncState latestSyncstate = mailBoxes[i]->CurrentSyncState();
  2441         TSSMailSyncState latestSyncstate = mailBoxes[i]->CurrentSyncState();
  2404         if( latestSyncstate == InboxSyncing ||
  2442         if( latestSyncstate == InboxSyncing ||
  2405             latestSyncstate == StartingSync ||
  2443             latestSyncstate == StartingSync ||
  2406             latestSyncstate == EmailSyncing )
  2444             latestSyncstate == EmailSyncing )
  2407             {
  2445             {
  2408             returnStatus.iMailboxesSyncing++;
  2446             returnStatus.iMailboxesSyncing++;
  2409             }
  2447             }
  2410         }
  2448         }
  2411     
  2449 
  2412     CleanupStack::PopAndDestroy( &mailBoxes );
  2450     CleanupStack::PopAndDestroy( &mailBoxes );
  2413     return returnStatus;
  2451     return returnStatus;
  2414     }
  2452     }
  2415 
  2453 
  2416 // Bitmap provider for grid ecom plugins icons 
  2454 // Bitmap provider for grid ecom plugins icons
  2417 void CFSEmailUiLauncherGridVisualiser::ProvideBitmapL(TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap)
  2455 void CFSEmailUiLauncherGridVisualiser::ProvideBitmapL(TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap)
  2418 	{
  2456 	{
  2419     FUNC_LOG;
  2457     FUNC_LOG;
  2420 // <cmail> Use layout data instead of hard-coded values
  2458 // <cmail> Use layout data instead of hard-coded values
  2421     TRect mainPaneRect;
  2459     TRect mainPaneRect;
  2422     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  2460     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
  2423     TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  2461     TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  2424     
  2462 
  2425     TAknLayoutRect scrollBarRect;
  2463     TAknLayoutRect scrollBarRect;
  2426     scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  2464     scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar());
  2427     TRect gridRect = mainPaneRect;
  2465     TRect gridRect = mainPaneRect;
  2428     gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  2466     gridRect.iBr.iX -= scrollBarRect.Rect().Width();
  2429     
  2467 
  2430     TAknLayoutRect itemRect;
  2468     TAknLayoutRect itemRect;
  2431     itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  2469     itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0));
  2432     
  2470 
  2433     TAknLayoutRect gridIconRect;
  2471     TAknLayoutRect gridIconRect;
  2434     gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  2472     gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
  2435 // </cmail> 
  2473 // </cmail>
  2436     
  2474 
  2437 	CAknIcon* launcherItemIcon(0);	
  2475 	CAknIcon* launcherItemIcon(0);
  2438 	for ( TInt i=0; i<iPluginIdIconIdPairs.Count(); i++ )
  2476 	for ( TInt i=0; i<iPluginIdIconIdPairs.Count(); i++ )
  2439 		{
  2477 		{
  2440 		if ( aId == iPluginIdIconIdPairs[i].iIconId )
  2478 		if ( aId == iPluginIdIconIdPairs[i].iIconId )
  2441 			{
  2479 			{
  2442 			launcherItemIcon = iLauncherItems[iPluginIdIconIdPairs[i].iPluginArrayIndex]->Icon();
  2480 			launcherItemIcon = iLauncherItems[iPluginIdIconIdPairs[i].iPluginArrayIndex]->Icon();
  2443 			}		
  2481 			}
  2444 		}
  2482 		}
  2445 		
  2483 
  2446 	if ( launcherItemIcon )
  2484 	if ( launcherItemIcon )
  2447 		{
  2485 		{
  2448 // <cmail> Use layout data instead of hard-coded values		
  2486 // <cmail> Use layout data instead of hard-coded values
  2449 		// Set bitmap size
  2487 		// Set bitmap size
  2450 	    //TSize iconSize(iAppUi.LayoutHandler()->GridIconSize(), iAppUi.LayoutHandler()->GridIconSize() );
  2488 	    //TSize iconSize(iAppUi.LayoutHandler()->GridIconSize(), iAppUi.LayoutHandler()->GridIconSize() );
  2451 
  2489 
  2452 		TSize iconSize = gridIconRect.Rect().Size();
  2490 		TSize iconSize = gridIconRect.Rect().Size();
  2453 // </cmail>
  2491 // </cmail>
  2458             }
  2496             }
  2459         if( launcherItemIcon->Mask() )
  2497         if( launcherItemIcon->Mask() )
  2460             {
  2498             {
  2461             AknIconUtils::DisableCompression( launcherItemIcon->Mask());
  2499             AknIconUtils::DisableCompression( launcherItemIcon->Mask());
  2462             AknIconUtils::SetSize( launcherItemIcon->Mask(), iconSize, EAspectRatioPreserved );
  2500             AknIconUtils::SetSize( launcherItemIcon->Mask(), iconSize, EAspectRatioPreserved );
  2463             }       
  2501             }
  2464         // Create duplicate sof original for alf
  2502         // Create duplicate sof original for alf
  2465         CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
  2503         CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
  2466      	bitmap->Duplicate( launcherItemIcon->Bitmap()->Handle() );	    
  2504      	bitmap->Duplicate( launcherItemIcon->Bitmap()->Handle() );
  2467 	    CFbsBitmap* mask = new (ELeave) CFbsBitmap;
  2505 	    CFbsBitmap* mask = new (ELeave) CFbsBitmap;
  2468      	mask->Duplicate( launcherItemIcon->Mask()->Handle() );	    
  2506      	mask->Duplicate( launcherItemIcon->Mask()->Handle() );
  2469 	
  2507 
  2470         aBitmap = bitmap;
  2508         aBitmap = bitmap;
  2471   		aMaskBitmap = mask; 
  2509   		aMaskBitmap = mask;
  2472 		}
  2510 		}
  2473 	else
  2511 	else
  2474 		{
  2512 		{
  2475 		User::Leave(KErrNotFound); // Leave as icon is not found, should not go here
  2513 		User::Leave(KErrNotFound); // Leave as icon is not found, should not go here
  2476 		}
  2514 		}
  2481     FUNC_LOG;
  2519     FUNC_LOG;
  2482 	iRefreshNeeded = ETrue;
  2520 	iRefreshNeeded = ETrue;
  2483 	iDoubleClickLock = EFalse;
  2521 	iDoubleClickLock = EFalse;
  2484 	}
  2522 	}
  2485 
  2523 
  2486 TReal32 CFSEmailUiLauncherGridVisualiser::TRingMovementFuncMappingDataProvider::MapValue(TReal32 aValue, TInt /*aMode*/) const   
  2524 TReal32 CFSEmailUiLauncherGridVisualiser::TRingMovementFuncMappingDataProvider::MapValue(TReal32 aValue, TInt /*aMode*/) const
  2487     {
  2525     {
  2488     FUNC_LOG;
  2526     FUNC_LOG;
  2489     AlfUtil::WrapValue(aValue, iStart, iEnd);
  2527     AlfUtil::WrapValue(aValue, iStart, iEnd);
  2490     return aValue;
  2528     return aValue;
  2491     }
  2529     }
  2495     FUNC_LOG;
  2533     FUNC_LOG;
  2496     if ( iSelector )
  2534     if ( iSelector )
  2497         {
  2535         {
  2498         TAlfTimedPoint selectorPos;
  2536         TAlfTimedPoint selectorPos;
  2499         selectorPos.iX.SetMappingFunctionIdentifier( 0 );
  2537         selectorPos.iX.SetMappingFunctionIdentifier( 0 );
  2500         selectorPos.iY.SetMappingFunctionIdentifier( 0 ); 
  2538         selectorPos.iY.SetMappingFunctionIdentifier( 0 );
  2501         iSelector->SetPos( selectorPos );
  2539         iSelector->SetPos( selectorPos );
  2502         }
  2540         }
  2503     }
  2541     }
  2504 
  2542 
  2505 void CFSEmailUiLauncherGridVisualiser::UpdateFocusVisibility()
  2543 void CFSEmailUiLauncherGridVisualiser::UpdateFocusVisibility()
  2506     {
  2544     {
  2507     if( iSelector )
  2545     if( iSelector )
  2508         {
  2546         {
  2509         TAlfTimedValue selectorOpacity;
  2547         TAlfTimedValue selectorOpacity;
  2510         if( IsFocusShown() || iItemIdInButtonDownEvent.iItemId >= 0 ) 
  2548         if( IsFocusShown() || iItemIdInButtonDownEvent.iItemId >= 0 )
  2511             {
  2549             {
  2512             selectorOpacity.SetValueNow( 1 );
  2550             selectorOpacity.SetValueNow( 1 );
  2513             }
  2551             }
  2514         else
  2552         else
  2515             {
  2553             {
  2525     UpdateFocusVisibility();
  2563     UpdateFocusVisibility();
  2526     }
  2564     }
  2527 
  2565 
  2528 void CFSEmailUiLauncherGridVisualiser::MailboxDeletionComplete()
  2566 void CFSEmailUiLauncherGridVisualiser::MailboxDeletionComplete()
  2529     {
  2567     {
  2530     TRAP_IGNORE( HandleContentChangeL() );    
  2568     TRAP_IGNORE( HandleContentChangeL() );
  2531     }
  2569     }
  2532 
  2570 
  2533 void CFSEmailUiLauncherGridVisualiser::HandleTimerFocusStateChange( TBool aShow )
  2571 void CFSEmailUiLauncherGridVisualiser::FocusVisibilityChange( TBool aVisible )
  2534 	{
  2572 	{
  2535     CFsEmailUiViewBase::HandleTimerFocusStateChange( aShow );
  2573     CFsEmailUiViewBase::FocusVisibilityChange( aVisible );
  2536 	if (!aShow)
  2574     UpdateFocusVisibility();
  2537 		{
  2575     ResizeItemIcon( !aVisible );
  2538 		UpdateFocusVisibility();
       
  2539 		ResizeItemIcon( ETrue );
       
  2540 		}
       
  2541 	}
  2576 	}
  2542 // End of file
  2577 
       
  2578 
       
  2579 // ----------------------------------------------------------------------------
       
  2580 // LaunchStylusPopupMenuL()
       
  2581 // Launches and displays the pop-up menu invoked by a long tap event.
       
  2582 // ----------------------------------------------------------------------------
       
  2583 //
       
  2584 void CFSEmailUiLauncherGridVisualiser::LaunchStylusPopupMenu(
       
  2585 	const TInt aItemId )
       
  2586 	{
       
  2587 	// Get the ID of the mailbox in case the user wants to delete it.
       
  2588 	iMailboxToDelete = iCurrentLevel.iItems[aItemId].iMailBoxId;
       
  2589 
       
  2590 	// Get the item position and use it to determine the position of the menu.
       
  2591 	const TRect rect(
       
  2592 		iCurrentLevel.iItemVisualData[aItemId].iBase->DisplayRect() );
       
  2593 	TPoint position( rect.iTl.iX + rect.Width() / 2,
       
  2594 					 rect.iTl.iY + rect.Height() / 2 );
       
  2595 	iStylusPopUpMenu->SetPosition( position );
       
  2596 
       
  2597 	// Display the menu.
       
  2598 	iStylusPopUpMenu->ShowMenu();
       
  2599 	iStylusPopUpMenuLaunched = ETrue;
       
  2600 	}
       
  2601 
       
  2602 
       
  2603 // End of file.