appinstaller/AppMngr2/src/appmngr2listview.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     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".
    34 #include <aknViewAppUi.h>               // CAknViewAppUi
    34 #include <aknViewAppUi.h>               // CAknViewAppUi
    35 #include <eikmenub.h>                   // CEikMenuBar, CEikMenuPane
    35 #include <eikmenub.h>                   // CEikMenuBar, CEikMenuPane
    36 #include <eikmenup.h>                   // CEikMenuPaneItem
    36 #include <eikmenup.h>                   // CEikMenuPaneItem
    37 #include <akntitle.h>                   // CAknTitlePane
    37 #include <akntitle.h>                   // CAknTitlePane
    38 #include <StringLoader.h>               // StringLoader
    38 #include <StringLoader.h>               // StringLoader
    39 #include <AknInfoPopupNoteController.h> // CAknInfoPopupNoteController
       
    40 #include <appmngr2.rsg>                 // Resource IDs
    39 #include <appmngr2.rsg>                 // Resource IDs
    41 
    40 
    42 const TUid KStatusPaneUid = { EEikStatusPaneUidTitle };
    41 const TUid KStatusPaneUid = { EEikStatusPaneUidTitle };
    43 
    42 
    44 
    43 
    45 // ======== MEMBER FUNCTIONS ========
    44 // ======== MEMBER FUNCTIONS ========
    46 
    45 
    47 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    48 // CAppMngr2ListView::ConstructL() 
    47 // CAppMngr2ListView::ConstructL()
    49 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    50 //
    49 //
    51 void CAppMngr2ListView::ConstructL( TInt aResourceId )
    50 void CAppMngr2ListView::ConstructL( TInt aResourceId )
    52     {
    51     {
    53     FLOG( "CAppMngr2ListView::ConstructL( 0x%08x )", aResourceId );
    52     FLOG( "CAppMngr2ListView::ConstructL( 0x%08x )", aResourceId );
    54     
    53 
    55     BaseConstructL( aResourceId );
    54     BaseConstructL( aResourceId );
    56     }
    55     }
    57 
    56 
    58 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    59 // CAppMngr2ListView::~CAppMngr2ListView() 
    58 // CAppMngr2ListView::~CAppMngr2ListView()
    60 // ---------------------------------------------------------------------------
    59 // ---------------------------------------------------------------------------
    61 //
    60 //
    62 CAppMngr2ListView::~CAppMngr2ListView()
    61 CAppMngr2ListView::~CAppMngr2ListView()
    63     {
    62     {
    64     FLOG( "CAppMngr2ListView::~CAppMngr2ListView" );
    63     FLOG( "CAppMngr2ListView::~CAppMngr2ListView" );
    65     
    64 
    66     if( iContainer )
    65     if( iContainer )
    67         {
    66         {
    68         AppUi()->RemoveFromViewStack( *this, iContainer );
    67         AppUi()->RemoveFromViewStack( *this, iContainer );
    69         delete iContainer;
    68         delete iContainer;
    70         }
    69         }
    71     delete iInfoPopup;
       
    72     }
    70     }
    73 
    71 
    74 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    75 // CAppMngr2ListView::RefreshL()
    73 // CAppMngr2ListView::RefreshL()
    76 // ---------------------------------------------------------------------------
    74 // ---------------------------------------------------------------------------
    77 //
    75 //
    78 void CAppMngr2ListView::RefreshL( TInt aMoreRefreshesExpected )
    76 void CAppMngr2ListView::RefreshL( TInt aMoreRefreshesExpected )
    79     {
    77     {
    80     if( iContainer )
    78     if( iContainer )
    81         {
    79         {
       
    80         FLOG( "CAppMngr2ListView::RefreshL( %d ) begin", aMoreRefreshesExpected );
       
    81 
    82         TBool selectedItemChanged = EFalse;
    82         TBool selectedItemChanged = EFalse;
    83         iContainer->RefreshL( iMaintainFocus, selectedItemChanged, aMoreRefreshesExpected );
    83         iContainer->RefreshL( iMaintainFocus, selectedItemChanged, aMoreRefreshesExpected );
    84         if( selectedItemChanged )
    84         if( selectedItemChanged )
    85             {
    85             {
    86             UpdateMiddleSoftkeyCommandL();
    86             UpdateMiddleSoftkeyCommandL();
    87             StopDisplayingMenuBar();
    87             StopDisplayingMenuBar();
    88             iMaintainFocus = EFalse;
    88             iMaintainFocus = EFalse;
    89             }
    89             }
    90 
    90             
    91         // Close progress note used in application startup
    91         FLOG( "CAppMngr2ListView::RefreshL() end" );
    92         if( iInfoPopup && !aMoreRefreshesExpected )
       
    93             {
       
    94             iInfoPopup->HideInfoPopupNote();
       
    95             delete iInfoPopup;
       
    96             iInfoPopup = NULL;
       
    97             }
       
    98         }
    92         }
    99     }
    93     }
   100 
    94 
   101 // ---------------------------------------------------------------------------
    95 // ---------------------------------------------------------------------------
   102 // CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
    96 // CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
   103 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
   104 //
    98 //
   105 void CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
    99 void CAppMngr2ListView::UpdateMiddleSoftkeyCommandL()
   106     {
   100     {
   107     FLOG_PERF_STATIC_BEGIN( UpdateMiddleSoftkeyCommandL );
   101     FLOG_PERF_STATIC_BEGIN( UpdateMiddleSoftkeyCommandL );
   108     
   102 
   109     if( iContainer && !iContainer->IsListEmpty() )
   103     if( iContainer && !iContainer->IsListEmpty() )
   110         {
   104         {
   111         // add item-specific MSK if the current item has one
   105         // add item-specific MSK if the current item has one
   112         CAppMngr2InfoBase& currentItem = iContainer->CurrentItem();
   106         CAppMngr2InfoBase& currentItem = iContainer->CurrentItem();
   113         TInt resourceId = 0;
   107         TInt resourceId = 0;
   131             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   125             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   132                     iMiddleSoftkeyCommandId );
   126                     iMiddleSoftkeyCommandId );
   133             }
   127             }
   134         SetDefaultMiddleSoftkeyCommandL();
   128         SetDefaultMiddleSoftkeyCommandL();
   135         }
   129         }
   136     
   130 
   137     FLOG_PERF_STATIC_END( UpdateMiddleSoftkeyCommandL )
   131     FLOG_PERF_STATIC_END( UpdateMiddleSoftkeyCommandL )
   138     }
   132     }
   139 
   133 
   140 // ---------------------------------------------------------------------------
   134 // ---------------------------------------------------------------------------
   141 // CAppMngr2ListView::CurrentItemSelectedByUser()
   135 // CAppMngr2ListView::CurrentItemSelectedByUser()
   163 // ---------------------------------------------------------------------------
   157 // ---------------------------------------------------------------------------
   164 //
   158 //
   165 void CAppMngr2ListView::HandleCommandL( TInt aCommand )
   159 void CAppMngr2ListView::HandleCommandL( TInt aCommand )
   166     {
   160     {
   167     FLOG( "CAppMngr2ListView::HandleCommandL( %d )", aCommand );
   161     FLOG( "CAppMngr2ListView::HandleCommandL( %d )", aCommand );
   168     
   162 
   169     switch( aCommand )
   163     switch( aCommand )
   170         {
   164         {
   171         case EAknSoftkeyBack:
   165         case EAknSoftkeyBack:
   172             AppUi()->HandleCommandL( EAknSoftkeyExit );
   166             AppUi()->HandleCommandL( EAknSoftkeyExit );
   173             break;
   167             break;
   199         CEikMenuPane* aMenuPane )
   193         CEikMenuPane* aMenuPane )
   200     {
   194     {
   201     if( aResourceId == R_APPMNGR2_INSTALLED_MENU
   195     if( aResourceId == R_APPMNGR2_INSTALLED_MENU
   202             || aResourceId == R_APPMNGR2_PACKAGES_MENU )
   196             || aResourceId == R_APPMNGR2_PACKAGES_MENU )
   203         {
   197         {
   204         if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) 
   198         if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   205             {
   199             {
   206             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
   200             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
   207             }
   201             }
   208 
   202 
   209         // Keep the currently selected item focused in forthcoming list refreshes. 
   203         // Keep the currently selected item focused in forthcoming list refreshes.
   210         iMaintainFocus = ETrue;
   204         iMaintainFocus = ETrue;
   211         }
   205         }
   212     }
   206     }
   213 
   207 
   214 // ---------------------------------------------------------------------------
   208 // ---------------------------------------------------------------------------
   217 //
   211 //
   218 void CAppMngr2ListView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
   212 void CAppMngr2ListView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
   219         TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ )
   213         TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ )
   220     {
   214     {
   221     FLOG( "CAppMngr2ListView::DoActivateL, id 0x%08x", Id().iUid );
   215     FLOG( "CAppMngr2ListView::DoActivateL, id 0x%08x", Id().iUid );
   222     
   216 
   223     CAknTitlePane* titlePane = NULL;
   217     CAknTitlePane* titlePane = NULL;
   224     titlePane = static_cast<CAknTitlePane*>( StatusPane()->ControlL( KStatusPaneUid ) );
   218     titlePane = static_cast<CAknTitlePane*>( StatusPane()->ControlL( KStatusPaneUid ) );
   225     SetTitleL( *titlePane );
   219     SetTitleL( *titlePane );
   226     
   220 
   227     if( iContainer == NULL )
   221     if( iContainer == NULL )
   228         {
   222         {
   229         iContainer = CreateContainerL();
   223         iContainer = CreateContainerL();
   230         iContainer->SetMopParent( this );
   224         iContainer->SetMopParent( this );
   231         AppUi()->AddToViewStackL( *this, iContainer );
   225         AppUi()->AddToViewStackL( *this, iContainer );
   232         iContainer->ActivateL();
   226         iContainer->ActivateL();
   233         }
   227         }
   234     UpdateMiddleSoftkeyCommandL();
   228     UpdateMiddleSoftkeyCommandL();
   235 
   229 
   236     if( iInfoPopup == NULL )
   230     // Note Infopopup is removed and replaced with wait dialog.         
   237         {
       
   238         iInfoPopup = CAknInfoPopupNoteController::NewL();
       
   239         iInfoPopup->SetTimePopupInView( 0 );
       
   240         iInfoPopup->HideWhenAppFaded( EFalse );
       
   241         HBufC* noteText = StringLoader::LoadLC( R_QTN_AM_SCANNING_MEMORY );
       
   242         iInfoPopup->SetTextL( *noteText );
       
   243         CleanupStack::PopAndDestroy( noteText );
       
   244         iInfoPopup->ShowInfoPopupNote();
       
   245         }
       
   246     }
   231     }
   247 
   232 
   248 // ---------------------------------------------------------------------------
   233 // ---------------------------------------------------------------------------
   249 // CAppMngr2ListView::DoDeactivate()
   234 // CAppMngr2ListView::DoDeactivate()
   250 // ---------------------------------------------------------------------------
   235 // ---------------------------------------------------------------------------
   251 //
   236 //
   252 void CAppMngr2ListView::DoDeactivate()
   237 void CAppMngr2ListView::DoDeactivate()
   253     {
   238     {
   254     FLOG( "CAppMngr2ListView::DoDeactivate, id 0x%08x", Id().iUid );
   239     FLOG( "CAppMngr2ListView::DoDeactivate, id 0x%08x", Id().iUid );
   255     
   240 
   256     if( iContainer )
   241     if( iContainer )
   257         {
   242         {
   258         AppUi()->RemoveFromViewStack( *this, iContainer );
   243         AppUi()->RemoveFromViewStack( *this, iContainer );
   259         delete iContainer;
   244         delete iContainer;
   260         iContainer = NULL;
   245         iContainer = NULL;
   261         }
   246         }
   262     if( iInfoPopup )
       
   263         {
       
   264         delete iInfoPopup;
       
   265         iInfoPopup = NULL;
       
   266         }
       
   267     }
   247     }
   268 
   248 
   269 // ---------------------------------------------------------------------------
   249 // ---------------------------------------------------------------------------
   270 // CAppMngr2ListView::Model()
   250 // CAppMngr2ListView::Model()
   271 // ---------------------------------------------------------------------------
   251 // ---------------------------------------------------------------------------
   283         CEikMenuPane* aMenuPane )
   263         CEikMenuPane* aMenuPane )
   284     {
   264     {
   285     if( aMenuPane )
   265     if( aMenuPane )
   286         {
   266         {
   287         FLOG_PERF_STATIC_BEGIN( AddDynamicMenuItemsL );
   267         FLOG_PERF_STATIC_BEGIN( AddDynamicMenuItemsL );
   288         
   268 
   289         TInt position = 0;
   269         TInt position = 0;
   290         if( aMenuPane->MenuItemExists( EAppMngr2PlaceForPluginSpecificCmds, position ) )
   270         if( aMenuPane->MenuItemExists( EAppMngr2PlaceForPluginSpecificCmds, position ) )
   291             {
   271             {
   292             aMenuPane->DeleteMenuItem( EAppMngr2PlaceForPluginSpecificCmds );
   272             aMenuPane->DeleteMenuItem( EAppMngr2PlaceForPluginSpecificCmds );
   293     
   273 
   294             RPointerArray<CEikMenuPaneItem::SData> menuItems;
   274             RPointerArray<CEikMenuPaneItem::SData> menuItems;
   295             CleanupResetAndDestroyPushL( menuItems );
   275             CleanupResetAndDestroyPushL( menuItems );
   296 
   276 
   297             TRAPD( err, aCurrentItem.GetMenuItemsL( menuItems ) );
   277             TRAPD( err, aCurrentItem.GetMenuItemsL( menuItems ) );
   298             if( !err )
   278             if( !err )
   305                     }
   285                     }
   306                 }
   286                 }
   307 
   287 
   308             CleanupStack::PopAndDestroy( &menuItems );
   288             CleanupStack::PopAndDestroy( &menuItems );
   309             }
   289             }
   310         
   290 
   311         FLOG_PERF_STATIC_END( AddDynamicMenuItemsL )
   291         FLOG_PERF_STATIC_END( AddDynamicMenuItemsL )
   312         }
   292         }
   313     }
   293     }
   314 
   294 
   315 // ---------------------------------------------------------------------------
   295 // ---------------------------------------------------------------------------
   326             {
   306             {
   327             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   307             cba->RemoveCommandFromStack( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   328                     iMiddleSoftkeyCommandId );
   308                     iMiddleSoftkeyCommandId );
   329             }
   309             }
   330         HBufC* middleSoftkeyLabel = StringLoader::LoadLC( aResourceId );
   310         HBufC* middleSoftkeyLabel = StringLoader::LoadLC( aResourceId );
   331         cba->AddCommandToStackL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 
   311         cba->AddCommandToStackL( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   332                 aCommandId, *middleSoftkeyLabel );
   312                 aCommandId, *middleSoftkeyLabel );
   333         CleanupStack::PopAndDestroy( middleSoftkeyLabel );
   313         CleanupStack::PopAndDestroy( middleSoftkeyLabel );
   334         iMiddleSoftkeyCommandId = aCommandId;
   314         iMiddleSoftkeyCommandId = aCommandId;
   335         }
   315         }
   336     }
   316     }