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