menufw/menufwui/matrixmenu/src/mmappui.cpp
branchRCL_3
changeset 25 137ebc85284b
parent 23 7be2816dbabd
child 26 1b758917cafc
equal deleted inserted replaced
23:7be2816dbabd 25:137ebc85284b
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Application UI class
    14 * Description:  Application UI class
    15 *  Version     : %version: MM_176.1.28.1.75 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_176.1.28.1.78 % << Don't touch! Updated by Synergy at check-out.
    16 *  Version     : %version: MM_176.1.28.1.75 % << Don't touch! Updated by Synergy at check-out.
    16 *  Version     : %version: MM_176.1.28.1.78 % << Don't touch! Updated by Synergy at check-out.
    17 *
    17 *
    18 */
    18 */
    19 
    19 
    20 #include <e32base.h>
    20 #include <e32base.h>
    21 #include <e32cmn.h>
    21 #include <e32cmn.h>
    44 #include <apgcli.h>
    44 #include <apgcli.h>
    45 #include <AknDef.hrh>
    45 #include <AknDef.hrh>
    46 #include <AknDlgShut.h>
    46 #include <AknDlgShut.h>
    47 #include <mmenuinternalPSkeys.h>
    47 #include <mmenuinternalPSkeys.h>
    48 #include <aknstyluspopupmenu.h> //stylus popup for long tap event
    48 #include <aknstyluspopupmenu.h> //stylus popup for long tap event
    49 #include <APGWGNAM.H>
    49 #include <apgwgnam.h>
    50 
    50 
    51 #include "mmgui.hrh"
    51 #include "mmgui.hrh"
    52 #include "mmguiconstants.h"
    52 #include "mmguiconstants.h"
    53 #include "mmappui.h"
    53 #include "mmappui.h"
    54 #include "menudebug.h"
    54 #include "menudebug.h"
   330         {
   330         {
   331         if ( !iAppkeyHandler->IsActive() )
   331         if ( !iAppkeyHandler->IsActive() )
   332             {
   332             {
   333             //make dummy container visible when returning
   333             //make dummy container visible when returning
   334             //to menu by AppKey
   334             //to menu by AppKey
   335             iDummyContainer->MakeVisible( ETrue );
   335             if( iDummyContainer && iCurrentContainer )
   336             RefreshUiPanesL( ETrue );
   336                 {
   337             iCurrentContainer->MakeVisible( EFalse );
   337                 iDummyContainer->MakeVisible( ETrue );
   338             iDummyContainer->DrawNow();
   338                 RefreshUiPanesL( ETrue );
       
   339                 iCurrentContainer->MakeVisible( EFalse );
       
   340                 iDummyContainer->DrawNow();
       
   341                 }
   339             CleanupForExitL( EExitKeyApplication );
   342             CleanupForExitL( EExitKeyApplication );
   340             User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition(
   343             User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition(
   341             CEikonEnv::Static()->RootWin().Identifier(), 0 ) );
   344             CEikonEnv::Static()->RootWin().Identifier(), 0 ) );
   342             iAppkeyHandler->StartL();
   345             iAppkeyHandler->StartL();
   343             }
   346             }
  1446         RemoveFromStack( iCurrentContainer );
  1449         RemoveFromStack( iCurrentContainer );
  1447         iDummyContainer->MakeVisible( ETrue );
  1450         iDummyContainer->MakeVisible( ETrue );
  1448         RefreshCbaL();
  1451         RefreshCbaL();
  1449         iGarbage.ResetAndDestroy();
  1452         iGarbage.ResetAndDestroy();
  1450         ResetContainerMap();
  1453         ResetContainerMap();
  1451       iCurrentSuiteModel = NULL;
  1454         iCurrentSuiteModel = NULL;
  1452       iCurrentContainer = NULL;
  1455         iCurrentContainer = NULL;
  1453       }
  1456         }
  1454 
  1457 
  1455     TRAPD( err, iHNInterface->LoadSuitesFromUriL( aMessage ) );
  1458     TRAPD( err, iHNInterface->LoadSuitesFromUriL( aMessage ) );
  1456 
  1459 
  1457     if ( err && iCurrentContainer && ( aMessage.Find( KSetFocusWithPref ) == KErrNotFound ) )
  1460     if ( err && iCurrentContainer && ( aMessage.Find( KSetFocusWithPref ) == KErrNotFound ) )
  1458         {
  1461         {
  1804     if ( iToolbar && iToolbar->IsShown() )
  1807     if ( iToolbar && iToolbar->IsShown() )
  1805         {
  1808         {
  1806         iToolbar->SetToolbarVisibility( EFalse );
  1809         iToolbar->SetToolbarVisibility( EFalse );
  1807         }
  1810         }
  1808 
  1811 
       
  1812     TBool scrollView( EFalse );
  1809     if( iCurrentContainer != aWidgetContainer )
  1813     if( iCurrentContainer != aWidgetContainer )
  1810         {
  1814         {
  1811         // During open new folder cancel longTap. 
  1815         // During open new folder cancel longTap.
  1812         if( iCurrentContainer && iCurrentContainer->IsEditMode() )
  1816         if( iCurrentContainer && iCurrentContainer->IsEditMode() )
  1813             iCurrentContainer->EnableLongTapAnimation( EFalse );
  1817             iCurrentContainer->EnableLongTapAnimation( EFalse );
  1814 
  1818 
  1815         // We want a highlight to be visible while switching between
  1819         // We want a highlight to be visible while switching between
  1816         // grid and list views but no highlight should be visible
  1820         // grid and list views but no highlight should be visible
  1825 
  1829 
  1826         if ( highlightVisibleBefore )
  1830         if ( highlightVisibleBefore )
  1827             {
  1831             {
  1828             iCurrentContainer->SetHighlightVisibilityL( ETrue );
  1832             iCurrentContainer->SetHighlightVisibilityL( ETrue );
  1829             }
  1833             }
  1830 
  1834         scrollView = ETrue;
  1831         // force scroll view to highlighted item in case we've been backing back
       
  1832         // and change presentation mode (to list view) had been done.
       
  1833         if( iCurrentContainer->WidgetType() == EListWidget )
       
  1834             {
       
  1835             TInt offsetBottom =
       
  1836                     iCurrentContainer->Widget()->View()->ItemPos(
       
  1837                         iCurrentSuiteModel->GetSuiteHighlight() ).iY
       
  1838                         + iCurrentContainer->Widget()->ItemHeight()
       
  1839                         - iCurrentContainer->Widget()->View()->ViewRect().Height();
       
  1840             TInt offsetTop = iCurrentContainer->Widget()->View()->ItemPos(
       
  1841                     iCurrentSuiteModel->GetSuiteHighlight() ).iY;
       
  1842             TBool takeTop = Abs( offsetTop ) < Abs( offsetBottom );
       
  1843             TInt offset = ( takeTop ) ? offsetTop : offsetBottom;
       
  1844             if( offset != 0 )
       
  1845                 {
       
  1846                 iCurrentContainer->Widget()->HandlePhysicsScrollEventL(
       
  1847                         offset );
       
  1848                 }
       
  1849             }
       
  1850         }
  1835         }
  1851     else
  1836     else
  1852         {
  1837         {
  1853         HandleNoWidgetChangeRefreshL();
  1838         HandleNoWidgetChangeRefreshL();
  1854         }
  1839         }
  1894                 iCurrentContainer->Widget()->View()->SetDisableRedraw(EFalse);
  1879                 iCurrentContainer->Widget()->View()->SetDisableRedraw(EFalse);
  1895                 iDummyContainer->MakeVisible(EFalse);
  1880                 iDummyContainer->MakeVisible(EFalse);
  1896 
  1881 
  1897                 // restore the correct widget position
  1882                 // restore the correct widget position
  1898                 iCurrentContainer->RestoreWidgetPosition();
  1883                 iCurrentContainer->RestoreWidgetPosition();
       
  1884                 // force scroll view to highlighted item in case we've been backing back
       
  1885                 // and change presentation mode (to list view) had been done.
       
  1886                 if( scrollView && iCurrentContainer->WidgetType() == EListWidget
       
  1887                         && iCurrentSuiteModel->GetSuiteHighlight() > KErrNotFound
       
  1888                         && !iCurrentContainer->ItemIsFullyVisible(
       
  1889                                 iCurrentSuiteModel->GetSuiteHighlight() ))
       
  1890                     {
       
  1891                     iCurrentContainer->ScrollToItemL(
       
  1892                             iCurrentSuiteModel->GetSuiteHighlight() );
       
  1893                     }
  1899                 }
  1894                 }
  1900 
  1895 
  1901             // refresh changed items only
  1896             // refresh changed items only
  1902             iCurrentContainer->DrawView();
  1897             iCurrentContainer->DrawView();
  1903             RefreshUiPanesL();
  1898             RefreshUiPanesL();