appinstaller/AppMngr2/src/appmngr2listview.cpp
branchRCL_3
changeset 15 51c0f5edf5ef
parent 0 ba25891c3a9e
child 61 cd189dac02f7
equal deleted inserted replaced
6:aba6b8104af3 15:51c0f5edf5ef
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 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".
    43 
    43 
    44 
    44 
    45 // ======== MEMBER FUNCTIONS ========
    45 // ======== MEMBER FUNCTIONS ========
    46 
    46 
    47 // ---------------------------------------------------------------------------
    47 // ---------------------------------------------------------------------------
    48 // CAppMngr2ListView::ConstructL() 
    48 // CAppMngr2ListView::ConstructL()
    49 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    50 //
    50 //
    51 void CAppMngr2ListView::ConstructL( TInt aResourceId )
    51 void CAppMngr2ListView::ConstructL( TInt aResourceId )
    52     {
    52     {
    53     FLOG( "CAppMngr2ListView::ConstructL( 0x%08x )", aResourceId );
    53     FLOG( "CAppMngr2ListView::ConstructL( 0x%08x )", aResourceId );
    54     
    54 
    55     BaseConstructL( aResourceId );
    55     BaseConstructL( aResourceId );
    56     }
    56     }
    57 
    57 
    58 // ---------------------------------------------------------------------------
    58 // ---------------------------------------------------------------------------
    59 // CAppMngr2ListView::~CAppMngr2ListView() 
    59 // CAppMngr2ListView::~CAppMngr2ListView()
    60 // ---------------------------------------------------------------------------
    60 // ---------------------------------------------------------------------------
    61 //
    61 //
    62 CAppMngr2ListView::~CAppMngr2ListView()
    62 CAppMngr2ListView::~CAppMngr2ListView()
    63     {
    63     {
    64     FLOG( "CAppMngr2ListView::~CAppMngr2ListView" );
    64     FLOG( "CAppMngr2ListView::~CAppMngr2ListView" );
    65     
    65 
    66     if( iContainer )
    66     if( iContainer )
    67         {
    67         {
    68         AppUi()->RemoveFromViewStack( *this, iContainer );
    68         AppUi()->RemoveFromViewStack( *this, iContainer );
    69         delete iContainer;
    69         delete iContainer;
    70         }
    70         }
    77 //
    77 //
    78 void CAppMngr2ListView::RefreshL( TInt aMoreRefreshesExpected )
    78 void CAppMngr2ListView::RefreshL( TInt aMoreRefreshesExpected )
    79     {
    79     {
    80     if( iContainer )
    80     if( iContainer )
    81         {
    81         {
       
    82         FLOG( "CAppMngr2ListView::RefreshL( %d ) begin", aMoreRefreshesExpected );
       
    83 
    82         TBool selectedItemChanged = EFalse;
    84         TBool selectedItemChanged = EFalse;
    83         iContainer->RefreshL( iMaintainFocus, selectedItemChanged, aMoreRefreshesExpected );
    85         iContainer->RefreshL( iMaintainFocus, selectedItemChanged, aMoreRefreshesExpected );
    84         if( selectedItemChanged )
    86         if( selectedItemChanged )
    85             {
    87             {
    86             UpdateMiddleSoftkeyCommandL();
    88             UpdateMiddleSoftkeyCommandL();
    93             {
    95             {
    94             iInfoPopup->HideInfoPopupNote();
    96             iInfoPopup->HideInfoPopupNote();
    95             delete iInfoPopup;
    97             delete iInfoPopup;
    96             iInfoPopup = NULL;
    98             iInfoPopup = NULL;
    97             }
    99             }
       
   100 
       
   101         FLOG( "CAppMngr2ListView::RefreshL() end" );
    98         }
   102         }
    99     }
   103     }
   100 
   104 
   101 // ---------------------------------------------------------------------------
   105 // ---------------------------------------------------------------------------
   102 // CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
   106 // CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
   103 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
   104 //
   108 //
   105 void CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
   109 void CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
   106     {
   110     {
   107     FLOG_PERF_STATIC_BEGIN( UpdateMiddleSoftkeyCommandL );
   111     FLOG_PERF_STATIC_BEGIN( UpdateMiddleSoftkeyCommandL );
   108     
   112 
   109     if( iContainer && !iContainer->IsListEmpty() )
   113     if( iContainer && !iContainer->IsListEmpty() )
   110         {
   114         {
   111         // add item-specific MSK if the current item has one
   115         // add item-specific MSK if the current item has one
   112         CAppMngr2InfoBase& currentItem = iContainer->CurrentItem();
   116         CAppMngr2InfoBase& currentItem = iContainer->CurrentItem();
   113         TInt resourceId = 0;
   117         TInt resourceId = 0;
   131             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   135             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   132                     iMiddleSoftkeyCommandId );
   136                     iMiddleSoftkeyCommandId );
   133             }
   137             }
   134         SetDefaultMiddleSoftkeyCommandL();
   138         SetDefaultMiddleSoftkeyCommandL();
   135         }
   139         }
   136     
   140 
   137     FLOG_PERF_STATIC_END( UpdateMiddleSoftkeyCommandL )
   141     FLOG_PERF_STATIC_END( UpdateMiddleSoftkeyCommandL )
   138     }
   142     }
   139 
   143 
   140 // ---------------------------------------------------------------------------
   144 // ---------------------------------------------------------------------------
   141 // CAppMngr2ListView::CurrentItemSelectedByUser()
   145 // CAppMngr2ListView::CurrentItemSelectedByUser()
   163 // ---------------------------------------------------------------------------
   167 // ---------------------------------------------------------------------------
   164 //
   168 //
   165 void CAppMngr2ListView::HandleCommandL( TInt aCommand )
   169 void CAppMngr2ListView::HandleCommandL( TInt aCommand )
   166     {
   170     {
   167     FLOG( "CAppMngr2ListView::HandleCommandL( %d )", aCommand );
   171     FLOG( "CAppMngr2ListView::HandleCommandL( %d )", aCommand );
   168     
   172 
   169     switch( aCommand )
   173     switch( aCommand )
   170         {
   174         {
   171         case EAknSoftkeyBack:
   175         case EAknSoftkeyBack:
   172             AppUi()->HandleCommandL( EAknSoftkeyExit );
   176             AppUi()->HandleCommandL( EAknSoftkeyExit );
   173             break;
   177             break;
   199         CEikMenuPane* aMenuPane )
   203         CEikMenuPane* aMenuPane )
   200     {
   204     {
   201     if( aResourceId == R_APPMNGR2_INSTALLED_MENU
   205     if( aResourceId == R_APPMNGR2_INSTALLED_MENU
   202             || aResourceId == R_APPMNGR2_PACKAGES_MENU )
   206             || aResourceId == R_APPMNGR2_PACKAGES_MENU )
   203         {
   207         {
   204         if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) 
   208         if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   205             {
   209             {
   206             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
   210             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
   207             }
   211             }
   208 
   212 
   209         // Keep the currently selected item focused in forthcoming list refreshes. 
   213         // Keep the currently selected item focused in forthcoming list refreshes.
   210         iMaintainFocus = ETrue;
   214         iMaintainFocus = ETrue;
   211         }
   215         }
   212     }
   216     }
   213 
   217 
   214 // ---------------------------------------------------------------------------
   218 // ---------------------------------------------------------------------------
   217 //
   221 //
   218 void CAppMngr2ListView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
   222 void CAppMngr2ListView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
   219         TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ )
   223         TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ )
   220     {
   224     {
   221     FLOG( "CAppMngr2ListView::DoActivateL, id 0x%08x", Id().iUid );
   225     FLOG( "CAppMngr2ListView::DoActivateL, id 0x%08x", Id().iUid );
   222     
   226 
   223     CAknTitlePane* titlePane = NULL;
   227     CAknTitlePane* titlePane = NULL;
   224     titlePane = static_cast<CAknTitlePane*>( StatusPane()->ControlL( KStatusPaneUid ) );
   228     titlePane = static_cast<CAknTitlePane*>( StatusPane()->ControlL( KStatusPaneUid ) );
   225     SetTitleL( *titlePane );
   229     SetTitleL( *titlePane );
   226     
   230 
   227     if( iContainer == NULL )
   231     if( iContainer == NULL )
   228         {
   232         {
   229         iContainer = CreateContainerL();
   233         iContainer = CreateContainerL();
   230         iContainer->SetMopParent( this );
   234         iContainer->SetMopParent( this );
   231         AppUi()->AddToViewStackL( *this, iContainer );
   235         AppUi()->AddToViewStackL( *this, iContainer );
   250 // ---------------------------------------------------------------------------
   254 // ---------------------------------------------------------------------------
   251 //
   255 //
   252 void CAppMngr2ListView::DoDeactivate()
   256 void CAppMngr2ListView::DoDeactivate()
   253     {
   257     {
   254     FLOG( "CAppMngr2ListView::DoDeactivate, id 0x%08x", Id().iUid );
   258     FLOG( "CAppMngr2ListView::DoDeactivate, id 0x%08x", Id().iUid );
   255     
   259 
   256     if( iContainer )
   260     if( iContainer )
   257         {
   261         {
   258         AppUi()->RemoveFromViewStack( *this, iContainer );
   262         AppUi()->RemoveFromViewStack( *this, iContainer );
   259         delete iContainer;
   263         delete iContainer;
   260         iContainer = NULL;
   264         iContainer = NULL;
   283         CEikMenuPane* aMenuPane )
   287         CEikMenuPane* aMenuPane )
   284     {
   288     {
   285     if( aMenuPane )
   289     if( aMenuPane )
   286         {
   290         {
   287         FLOG_PERF_STATIC_BEGIN( AddDynamicMenuItemsL );
   291         FLOG_PERF_STATIC_BEGIN( AddDynamicMenuItemsL );
   288         
   292 
   289         TInt position = 0;
   293         TInt position = 0;
   290         if( aMenuPane->MenuItemExists( EAppMngr2PlaceForPluginSpecificCmds, position ) )
   294         if( aMenuPane->MenuItemExists( EAppMngr2PlaceForPluginSpecificCmds, position ) )
   291             {
   295             {
   292             aMenuPane->DeleteMenuItem( EAppMngr2PlaceForPluginSpecificCmds );
   296             aMenuPane->DeleteMenuItem( EAppMngr2PlaceForPluginSpecificCmds );
   293     
   297 
   294             RPointerArray<CEikMenuPaneItem::SData> menuItems;
   298             RPointerArray<CEikMenuPaneItem::SData> menuItems;
   295             CleanupResetAndDestroyPushL( menuItems );
   299             CleanupResetAndDestroyPushL( menuItems );
   296 
   300 
   297             TRAPD( err, aCurrentItem.GetMenuItemsL( menuItems ) );
   301             TRAPD( err, aCurrentItem.GetMenuItemsL( menuItems ) );
   298             if( !err )
   302             if( !err )
   305                     }
   309                     }
   306                 }
   310                 }
   307 
   311 
   308             CleanupStack::PopAndDestroy( &menuItems );
   312             CleanupStack::PopAndDestroy( &menuItems );
   309             }
   313             }
   310         
   314 
   311         FLOG_PERF_STATIC_END( AddDynamicMenuItemsL )
   315         FLOG_PERF_STATIC_END( AddDynamicMenuItemsL )
   312         }
   316         }
   313     }
   317     }
   314 
   318 
   315 // ---------------------------------------------------------------------------
   319 // ---------------------------------------------------------------------------
   326             {
   330             {
   327             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   331             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   328                     iMiddleSoftkeyCommandId );
   332                     iMiddleSoftkeyCommandId );
   329             }
   333             }
   330         HBufC* middleSoftkeyLabel = StringLoader::LoadLC( aResourceId );
   334         HBufC* middleSoftkeyLabel = StringLoader::LoadLC( aResourceId );
   331         cba->AddCommandToStackL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 
   335         cba->AddCommandToStackL( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   332                 aCommandId, *middleSoftkeyLabel );
   336                 aCommandId, *middleSoftkeyLabel );
   333         CleanupStack::PopAndDestroy( middleSoftkeyLabel );
   337         CleanupStack::PopAndDestroy( middleSoftkeyLabel );
   334         iMiddleSoftkeyCommandId = aCommandId;
   338         iMiddleSoftkeyCommandId = aCommandId;
   335         }
   339         }
   336     }
   340     }