mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp
branchRCL_3
changeset 14 943ff5625028
parent 11 13afc0e517bd
child 15 171e07ac910f
equal deleted inserted replaced
11:13afc0e517bd 14:943ff5625028
   161 
   161 
   162 // Music collection browse type
   162 // Music collection browse type
   163 const TInt KMPXCollectionArtistAlbum( 3 );
   163 const TInt KMPXCollectionArtistAlbum( 3 );
   164 const TInt KMPXCollectionGenre( 5 );
   164 const TInt KMPXCollectionGenre( 5 );
   165 
   165 
   166 const TInt KMPXTimeoutTimer = 1000000; // 1 second
       
   167 
   166 
   168 // ======== MEMBER FUNCTIONS ========
   167 // ======== MEMBER FUNCTIONS ========
   169 
   168 
   170 // ---------------------------------------------------------------------------
   169 // ---------------------------------------------------------------------------
   171 // Two-phased constructor.
   170 // Two-phased constructor.
   269     if ( iMediaRecognizer )
   268     if ( iMediaRecognizer )
   270         {
   269         {
   271         delete iMediaRecognizer;
   270         delete iMediaRecognizer;
   272         }
   271         }
   273 
   272 
   274     if ( iTimer )
       
   275         {
       
   276         if ( iTimer->IsActive() )
       
   277 	        iTimer->Cancel();
       
   278 
       
   279 	    delete iTimer;
       
   280 	    iTimer = NULL;
       
   281         }
       
   282 #ifdef BACKSTEPPING_INCLUDED
   273 #ifdef BACKSTEPPING_INCLUDED
   283     if( iBackSteppingUtility )
   274     if( iBackSteppingUtility )
   284         {
   275         {
   285         iBackSteppingUtility->Close();
   276         iBackSteppingUtility->Close();
   286         }
   277         }
   295         {
   286         {
   296         AppUi()->RemoveFromStack( iContainer );
   287         AppUi()->RemoveFromStack( iContainer );
   297         delete iContainer;
   288         delete iContainer;
   298         }
   289         }
   299 
   290 
   300     delete iNaviDecorator;
       
   301     delete iUserPlaylists;
   291     delete iUserPlaylists;
   302     delete iCommonUiHelper;
   292     delete iCommonUiHelper;
   303     delete iSendUi;
   293     delete iSendUi;
   304     delete iTitle;
   294     delete iTitle;
   305     delete iDuration;
   295     delete iDuration;
   314     delete iOperatorMusicStoreName ;
   304     delete iOperatorMusicStoreName ;
   315     if ( iOperatorMusicStoreURI )
   305     if ( iOperatorMusicStoreURI )
   316         {
   306         {
   317         delete iOperatorMusicStoreURI;
   307         delete iOperatorMusicStoreURI;
   318         }
   308         }
       
   309     if (iStoredAlbum)
       
   310         delete iStoredAlbum;
   319     }
   311     }
   320 
   312 
   321 // ---------------------------------------------------------------------------
   313 // ---------------------------------------------------------------------------
   322 // C++ default constructor can NOT contain any code, that
   314 // C++ default constructor can NOT contain any code, that
   323 // might leave.
   315 // might leave.
   324 // ---------------------------------------------------------------------------
   316 // ---------------------------------------------------------------------------
   325 //
   317 //
   326 CMPXCollectionViewHgImp::CMPXCollectionViewHgImp() :
   318 CMPXCollectionViewHgImp::CMPXCollectionViewHgImp() :
   327     iLastDepth( 1 ), iPlayIndex( KErrNotFound ),
   319     iLastDepth( 1 ),
       
   320     iPlayIndex( KErrNotFound ),
   328     iSetMediaLCount( KErrNotFound ),
   321     iSetMediaLCount( KErrNotFound ),
   329     iCurrentHighlightedIndex( KErrNotFound ),
   322     iCurrentHighlightedIndex( KErrNotFound ),
   330     iCachedCommand( KErrNotFound ),
   323     iCachedCommand( KErrNotFound ),
   331     iNoteType( EMPXNoteNotDefined ),
   324     iNoteType( EMPXNoteNotDefined ),
   332 	iFirstIncrementalBatch( ETrue )
   325 	iFirstIncrementalBatch( ETrue )
   399     iPlaybackUtility->AddObserverL( *this );
   392     iPlaybackUtility->AddObserverL( *this );
   400     iViewUtility = MMPXViewUtility::UtilityL();
   393     iViewUtility = MMPXViewUtility::UtilityL();
   401     iViewUtility->AddObserverL( this );
   394     iViewUtility->AddObserverL( this );
   402     iBottomIndex = new (ELeave) CArrayFixFlat<TInt>( 1 );
   395     iBottomIndex = new (ELeave) CArrayFixFlat<TInt>( 1 );
   403 
   396 
   404     iTimer = CPeriodic::NewL( CActive::EPriorityIdle );
       
   405 
       
   406     iCommonUiHelper = CMPXCommonUiHelper::NewL( iCollectionUtility );
   397     iCommonUiHelper = CMPXCommonUiHelper::NewL( iCollectionUtility );
   407     iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
   398     iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
   408 
   399 
   409     // Monitor for view activation
   400     // Monitor for view activation
   410     AppUi()->AddViewActivationObserverL( this );
   401     AppUi()->AddViewActivationObserverL( this );
   439         }
   430         }
   440     MPX_DEBUG1("CMPXCollectionViewHgImp::ConstructL() Attaching 'use tone as' menu service...");
   431     MPX_DEBUG1("CMPXCollectionViewHgImp::ConstructL() Attaching 'use tone as' menu service...");
   441     MPX_TRAP( iErrorAttachAssignMenu, iServiceHandler->AttachMenuL( R_MPX_USE_AS_CASCADE,
   432     MPX_TRAP( iErrorAttachAssignMenu, iServiceHandler->AttachMenuL( R_MPX_USE_AS_CASCADE,
   442                                                R_MPX_AIW_ASSIGN_INTEREST ) );
   433                                                R_MPX_AIW_ASSIGN_INTEREST ) );
   443 
   434 
   444     iNaviPane =
       
   445         static_cast<CAknNavigationControlContainer*>
       
   446         ( iAvkonViewAppUi->StatusPane()->ControlL(
       
   447             TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   448     iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
       
   449     //Create label to change text in Navi pane
       
   450     iNaviLabel = static_cast<CAknNaviLabel*>
       
   451             ( iNaviDecorator->DecoratedControl() );
       
   452 
   435 
   453     TInt flags( 0 );
   436     TInt flags( 0 );
   454     CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
   437     CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
   455     repository->Get( KMPXMPLocalVariation, flags );
   438     repository->Get( KMPXMPLocalVariation, flags );
   456     delete repository;
   439     delete repository;
   642 
   625 
   643     if ( !isIgnore  && iCollectionReady )
   626     if ( !isIgnore  && iCollectionReady )
   644         {
   627         {
   645         CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
   628         CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
   646         const CMPXMedia& containerMedia( listboxArray->ContainerMedia() );
   629         const CMPXMedia& containerMedia( listboxArray->ContainerMedia() );
   647 
   630         
   648         TMPXGeneralType containerType(
       
   649             containerMedia.ValueTObjectL<TMPXGeneralType>(
       
   650                 KMPXMediaGeneralType ) );
       
   651         TMPXGeneralCategory containerCategory(
       
   652             containerMedia.ValueTObjectL<TMPXGeneralCategory>(
       
   653                 KMPXMediaGeneralCategory ) );
       
   654 
       
   655         const TMPXItemId containerId = containerMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
   631         const TMPXItemId containerId = containerMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
   656 
   632 
   657         HBufC* promptTxt( NULL );
   633         HBufC* promptTxt( NULL );
   658         HBufC* waitNoteText( NULL );
   634         HBufC* waitNoteText( NULL );
   659         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   635         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   660         
   636         
   661         // Create a copy of collection path
   637         // Create a copy of collection path
   662         CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
   638         CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
   663         CleanupStack::PushL( path );
   639         CleanupStack::PushL( path );
   664 
   640 
   665         if ( containerType == EMPXItem && containerCategory == EMPXAlbum )    
   641         if ( iContainer->IsTBoneView() )
   666             {             
   642             {
   667              //get the media object of the selected track in TBone View
   643              //get the media object of the selected track in TBone View
   668             CMPXMedia* albumTrack = iContainer->SelectedItemMediaL();
   644             CMPXMedia* albumTrack = iContainer->SelectedItemMediaL();
   669             
   645             
   670             TMPXGeneralType mediaType(
   646             TMPXGeneralType mediaType(
   671                     albumTrack->ValueTObjectL<TMPXGeneralType>(
   647                     albumTrack->ValueTObjectL<TMPXGeneralType>(
   678                 {
   654                 {
   679                 // tracks level in Tbone View
   655                 // tracks level in Tbone View
   680                 TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
   656                 TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
   681                 const TDesC& trackTitle( albumTrack->ValueText( KMPXMediaGeneralTitle ) );
   657                 const TDesC& trackTitle( albumTrack->ValueText( KMPXMediaGeneralTitle ) );
   682                 // create the item path to delete
   658                 // create the item path to delete
   683                  path->Back();
   659 
   684                  path->Back();
   660                  if ( path->Levels() == 3 )
       
   661 					{
       
   662 					path->Back();
       
   663 					}
       
   664 				 else if (path->Levels() == 4)
       
   665 					{
       
   666 					path->Back();
       
   667 					path->Back();
       
   668 					}
       
   669 
       
   670 
   685                  path->AppendL(containerId);
   671                  path->AppendL(containerId);
   686                  path->AppendL(trackId);
   672                  path->AppendL(trackId);
   687 
   673 
   688                 waitNoteText = StringLoader::LoadLC(
   674                 waitNoteText = StringLoader::LoadLC(
   689                     R_MPX_QTN_ALBUM_WAITING_DELETING, trackTitle );
   675                     R_MPX_QTN_ALBUM_WAITING_DELETING, trackTitle );
   715                     HandleCommandL( EMPXCmdIgnoreExternalCommand );
   701                     HandleCommandL( EMPXCmdIgnoreExternalCommand );
   716                     MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
   702                     MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
   717                     if(iCachedCommand != aCommand)
   703                     if(iCachedCommand != aCommand)
   718                         {
   704                         {
   719                         iIsWaitNoteCanceled = EFalse;
   705                         iIsWaitNoteCanceled = EFalse;
   720                         StartProgressNoteL();
       
   721                         TPtr buf = waitNoteText->Des();
       
   722                         UpdateProcessL(0, buf);
       
   723                         }
   706                         }
   724                     if ( !iIsWaitNoteCanceled )
   707                     if ( !iIsWaitNoteCanceled )
   725                         {
   708                         {
   726                         iIsDeleting = ETrue;
   709                         iIsDeleting = ETrue;
   727                         iCollectionUiHelper->DeleteL( *path, this );
   710                         iCollectionUiHelper->DeleteL( *path, this );
   818         HBufC* promptTxt( NULL );
   801         HBufC* promptTxt( NULL );
   819         HBufC* waitNoteText( NULL );
   802         HBufC* waitNoteText( NULL );
   820         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   803         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   821         MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array count = %d", arrayCount );
   804         MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array count = %d", arrayCount );
   822 
   805 
       
   806         // delete single song, not show wait note
       
   807         TBool singleSong( EFalse );
   823         TMPXGeneralType containerType(
   808         TMPXGeneralType containerType(
   824             containerMedia.ValueTObjectL<TMPXGeneralType>(
   809             containerMedia.ValueTObjectL<TMPXGeneralType>(
   825                 KMPXMediaGeneralType ) );
   810                 KMPXMediaGeneralType ) );
   826         TMPXGeneralCategory containerCategory(
   811         TMPXGeneralCategory containerCategory(
   827             containerMedia.ValueTObjectL<TMPXGeneralCategory>(
   812             containerMedia.ValueTObjectL<TMPXGeneralCategory>(
   919             else
   904             else
   920                 {
   905                 {
   921                 if ( ( type == EMPXItem && category == EMPXSong ) ||
   906                 if ( ( type == EMPXItem && category == EMPXSong ) ||
   922                     ( type == EMPXItem && category == EMPXPlaylist ) )
   907                     ( type == EMPXItem && category == EMPXPlaylist ) )
   923                     {
   908                     {
       
   909                     // delete single song
       
   910                     if ( type == EMPXItem && category == EMPXSong )
       
   911                         {
       
   912                         singleSong = ETrue;
       
   913                         }
   924                     // tracks level, or deleting a playlist
   914                     // tracks level, or deleting a playlist
   925                     waitNoteText = StringLoader::LoadLC(
   915                     waitNoteText = StringLoader::LoadLC(
   926                         R_MPX_QTN_ALBUM_WAITING_DELETING, title );
   916                         R_MPX_QTN_ALBUM_WAITING_DELETING, title );
   927                     promptTxt = StringLoader::LoadLC(
   917                     promptTxt = StringLoader::LoadLC(
   928                         R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
   918                         R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
  1037 // Cover UI end
  1027 // Cover UI end
  1038             MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
  1028             MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
  1039             if(iCachedCommand != aCommand)
  1029             if(iCachedCommand != aCommand)
  1040                 {
  1030                 {
  1041                 iIsWaitNoteCanceled = EFalse;
  1031                 iIsWaitNoteCanceled = EFalse;
  1042                 StartProgressNoteL();
  1032                 // If delete one song, don't show progress note.
  1043 				TPtr buf = waitNoteText->Des();
  1033                 if ( !singleSong )
  1044 				UpdateProcessL(0, buf);
  1034                     {
       
  1035                     StartProgressNoteL();
       
  1036                     TPtr buf = waitNoteText->Des();
       
  1037                     UpdateProcessL(0, buf);
       
  1038                     }
  1045                 }
  1039                 }
  1046 
  1040 
  1047                 if ( !iIsWaitNoteCanceled )
  1041                 if ( !iIsWaitNoteCanceled )
  1048                     {
  1042                     {
  1049                     iIsDeleting = ETrue;
  1043                     iIsDeleting = ETrue;
  1255 
  1249 
  1256     // only display error message if collection view is in the foreground
  1250     // only display error message if collection view is in the foreground
  1257     if ( iContainer )
  1251     if ( iContainer )
  1258         {
  1252         {
  1259         TRAP_IGNORE( iCommonUiHelper->HandleErrorL( aError ) );
  1253         TRAP_IGNORE( iCommonUiHelper->HandleErrorL( aError ) );
  1260         }
       
  1261     }
       
  1262 
       
  1263 // ---------------------------------------------------------------------------
       
  1264 // Updates the navi pane
       
  1265 // ---------------------------------------------------------------------------
       
  1266 //
       
  1267 void CMPXCollectionViewHgImp::UpdateNaviPaneL()
       
  1268     {
       
  1269     MPX_FUNC( "CMPXCollectionViewHgImp::UpdateNaviPaneL" );
       
  1270     if ( iContainer &&
       
  1271         (iViewUtility->ActiveViewType() !=
       
  1272                        TUid::Uid( KMPXPluginTypeAddSongsEditorUid )) &&
       
  1273         (iViewUtility->ActiveViewType() !=
       
  1274                       TUid::Uid( KMPXPluginTypeAlbumArtEditorUid )) &&
       
  1275         (iViewUtility->ActiveViewType() !=
       
  1276                       TUid::Uid( KMPXPluginTypeMetadataEditorUid ))
       
  1277        )
       
  1278         {
       
  1279         MPX_DEBUG2("CMPXCollectionViewHgImp::UpdateNaviPaneL updating %d", iDuration);
       
  1280         if ( iDuration )
       
  1281             {
       
  1282             iNaviLabel->SetTextL( *iDuration );
       
  1283             iNaviPane->PushL( *iNaviDecorator );
       
  1284             }
       
  1285         else
       
  1286             {
       
  1287             iNaviPane->Pop( iNaviDecorator );
       
  1288             }
       
  1289         iNaviPane->DrawNow();
       
  1290         }
  1254         }
  1291     }
  1255     }
  1292 
  1256 
  1293 // ---------------------------------------------------------------------------
  1257 // ---------------------------------------------------------------------------
  1294 // Updates the title pane
  1258 // Updates the title pane
  1494     // Total Number of items in lbx
  1458     // Total Number of items in lbx
  1495     params->AppendL( iContainer->TotalListItemCount() );
  1459     params->AppendL( iContainer->TotalListItemCount() );
  1496     iDuration = StringLoader::LoadL(
  1460     iDuration = StringLoader::LoadL(
  1497         R_MPX_CUI_POSITION_COUNTER_TXT, *params );
  1461         R_MPX_CUI_POSITION_COUNTER_TXT, *params );
  1498     CleanupStack::PopAndDestroy( params );
  1462     CleanupStack::PopAndDestroy( params );
  1499     UpdateNaviPaneL();
       
  1500     }
  1463     }
  1501 
  1464 
  1502 // ---------------------------------------------------------------------------
  1465 // ---------------------------------------------------------------------------
  1503 // Activates reorder mode
  1466 // Activates reorder mode
  1504 // ---------------------------------------------------------------------------
  1467 // ---------------------------------------------------------------------------
  1583         if ( iOriginalDuration )
  1546         if ( iOriginalDuration )
  1584             {
  1547             {
  1585             iDuration = iOriginalDuration->AllocL();
  1548             iDuration = iOriginalDuration->AllocL();
  1586             delete iOriginalDuration;
  1549             delete iOriginalDuration;
  1587             iOriginalDuration = NULL;
  1550             iOriginalDuration = NULL;
  1588             }
       
  1589         if ( iViewUtility->ActiveViewType() == TUid::Uid( KMPXPluginTypeCollectionUid ) )
       
  1590             {
       
  1591             UpdateNaviPaneL();
       
  1592             }
  1551             }
  1593         iContainer->ActivateReorderMode( EFalse );
  1552         iContainer->ActivateReorderMode( EFalse );
  1594         iContainer->EnableFindBox( ETrue );
  1553         iContainer->EnableFindBox( ETrue );
  1595         }
  1554         }
  1596     iContainer->HandleLbxItemAdditionPreserveIndexL();
  1555     iContainer->HandleLbxItemAdditionPreserveIndexL();
  1631     CleanupStack::PushL( list );
  1590     CleanupStack::PushL( list );
  1632     CAknPopupList* popupList = CAknPopupList::NewL(
  1591     CAknPopupList* popupList = CAknPopupList::NewL(
  1633         list, R_AVKON_SOFTKEYS_OK_EMPTY,
  1592         list, R_AVKON_SOFTKEYS_OK_EMPTY,
  1634         AknPopupLayouts::EMenuGraphicHeadingWindow);
  1593         AknPopupLayouts::EMenuGraphicHeadingWindow);
  1635     CleanupStack::PushL( popupList );
  1594     CleanupStack::PushL( popupList );
  1636     list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
  1595     list->ConstructL( popupList, EAknListBoxViewerFlags );
  1637     list->CreateScrollBarFrameL( ETrue );
  1596     list->CreateScrollBarFrameL( ETrue );
  1638     list->ScrollBarFrame()->SetScrollBarVisibilityL(
  1597     list->ScrollBarFrame()->SetScrollBarVisibilityL(
  1639         CEikScrollBarFrame::EOff,
  1598         CEikScrollBarFrame::EOff,
  1640         CEikScrollBarFrame::EAuto);
  1599         CEikScrollBarFrame::EAuto);
  1641 
  1600 
  2895     if ( !isHidden )
  2854     if ( !isHidden )
  2896         {
  2855         {
  2897         CMPXCollectionViewListBoxArray* array =
  2856         CMPXCollectionViewListBoxArray* array =
  2898             static_cast<CMPXCollectionViewListBoxArray*>(
  2857             static_cast<CMPXCollectionViewListBoxArray*>(
  2899             iContainer->ListBoxArray() );
  2858             iContainer->ListBoxArray() );
  2900         const CMPXMedia& media = array->MediaL(
  2859 
  2901             iContainer->CurrentLbxItemIndex() );
  2860         TInt currentItem = iContainer->CurrentLbxItemIndex();
  2902 
  2861         if ( currentItem > KErrNotFound )
  2903         if ( media.IsSupported( KMPXMediaGeneralFlags ) )
  2862             {
  2904             {
  2863             const CMPXMedia& media = array->MediaL( currentItem );
  2905             TUint flags( media.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
  2864 
  2906             if ( ( flags ) & ( KMPXMediaGeneralFlagsIsMissingDetails ) )
  2865             if ( media.IsSupported( KMPXMediaGeneralFlags ) )
  2907                 {
  2866                 {
  2908                 isHidden = ETrue;
  2867                 TUint flags( media.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
  2909                 }
  2868                 if ( ( flags ) & ( KMPXMediaGeneralFlagsIsMissingDetails ) )
  2910             }
  2869                     {
       
  2870                     isHidden = ETrue;
       
  2871                     }
       
  2872                 }
       
  2873             }
       
  2874         else
       
  2875             {
       
  2876             isHidden = ETrue;
       
  2877             }
       
  2878 
  2911         }
  2879         }
  2912     return isHidden;
  2880     return isHidden;
  2913     }
  2881     }
  2914 
  2882 
  2915 
  2883 
  3364     TMPXItemId id( path->Id( 0 ) );
  3332     TMPXItemId id( path->Id( 0 ) );
  3365     MPX_DEBUG2( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1 );
  3333     MPX_DEBUG2( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1 );
  3366     CleanupStack::PopAndDestroy( path );
  3334     CleanupStack::PopAndDestroy( path );
  3367     
  3335     
  3368     //support for TBone view add to playlist
  3336     //support for TBone view add to playlist
  3369     if ( aContainerCategory == EMPXAlbum && aContainerType == EMPXItem)
  3337     if ( iContainer->IsTBoneView() )
  3370         { 	 
  3338         {
  3371         CMPXMedia* media = iContainer->SelectedItemMediaL();
  3339         CMPXMedia* media = iContainer->SelectedItemMediaL();
  3372         if ( media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
  3340         if ( media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
  3373            {
  3341            {
  3374            // leave with special error code, this error
  3342            // leave with special error code, this error
  3375            // should not trigger any error message, the operation should
  3343            // should not trigger any error message, the operation should
  4012                 iCollectionCacheReady = EFalse;
  3980                 iCollectionCacheReady = EFalse;
  4013                 }
  3981                 }
  4014             // USB flags
  3982             // USB flags
  4015             //
  3983             //
  4016 	       CEikMenuBar* menuBar( MenuBar() );
  3984 	       CEikMenuBar* menuBar( MenuBar() );
  4017 #ifdef SINGLE_CLICK_INCLUDED
       
  4018             if(iContainer)
  3985             if(iContainer)
  4019                 {
  3986                 {
  4020                 iContainer->EnableMarking( EFalse );
  3987                 iContainer->EnableMarking( EFalse );
  4021                 }
  3988                 }
  4022             if(menuBar)
  3989             if(menuBar)
  4023                 {
  3990                 {
  4024                 menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
  3991                 menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
  4025                 }
  3992                 }
  4026 #else
       
  4027             if(iContainer)
       
  4028                 {
       
  4029             	iContainer->EnableMarking( ETrue );
       
  4030                 }
       
  4031             if(menuBar)
       
  4032                 {
       
  4033             menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR );
       
  4034                 }
       
  4035 #endif
       
  4036 	        TBool IsUSBEvent( EFalse );
  3993 	        TBool IsUSBEvent( EFalse );
  4037             if( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )
  3994             if( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )
  4038                 {
  3995                 {
  4039                 iUSBOnGoing = ETrue;
  3996                 iUSBOnGoing = ETrue;
  4040 		        IsUSBEvent = ETrue;
  3997 		        IsUSBEvent = ETrue;
  4271                     cba->MakeVisible( EFalse );
  4228                     cba->MakeVisible( EFalse );
  4272 					cba->DrawDeferred();
  4229 					cba->DrawDeferred();
  4273                     }
  4230                     }
  4274                 else if ( cba )
  4231                 else if ( cba )
  4275                     {
  4232                     {
  4276                     cba->SetCommandSetL(
  4233                     if ( iContainer->IsTBoneView() )
  4277                         ( cpath->Levels() == 3 && !iIsEmbedded ) ?
  4234                         {
  4278                         R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK );
  4235                         cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  4236                         }
       
  4237                     else
       
  4238                         {
       
  4239                         cba->SetCommandSetL(
       
  4240                             ( cpath->Levels() == 3 && !iIsEmbedded ) ?
       
  4241                             R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  4242                         }
  4279                     cba->MakeVisible( ETrue );
  4243                     cba->MakeVisible( ETrue );
  4280                     cba->DrawDeferred();
  4244                     cba->DrawDeferred();
  4281                     }
  4245                     }
  4282 
  4246 
  4283                 CleanupStack::PopAndDestroy(cpath);
  4247                 CleanupStack::PopAndDestroy(cpath);
  4414                         }
  4378                         }
  4415                     }
  4379                     }
  4416                 else
  4380                 else
  4417                     {
  4381                     {
  4418                     // tracks view
  4382                     // tracks view
  4419 #ifdef SINGLE_CLICK_INCLUDED
       
  4420                     iContainer->EnableMarking( EFalse );
  4383                     iContainer->EnableMarking( EFalse );
  4421                     menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
  4384                     menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
  4422 #else
       
  4423                     iContainer->EnableMarking( ETrue );
       
  4424                     menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR );
       
  4425 #endif
       
  4426                     resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT;
  4385                     resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT;
  4427 #ifdef __ENABLE_MSK
  4386 #ifdef __ENABLE_MSK
  4428                     mskId = R_QTN_MSK_PLAY;
  4387                     mskId = R_QTN_MSK_PLAY;
  4429 #endif // __ENABLE_MSK
  4388 #endif // __ENABLE_MSK
  4430                     }
  4389                     }
  4606             {
  4565             {
  4607             CloseWaitNoteL();
  4566             CloseWaitNoteL();
  4608             }
  4567             }
  4609         }
  4568         }
  4610 
  4569 
  4611 	MPX_DEBUG1( "HandleOpenL CheckingTimer" );
       
  4612     if ( iTimer && !iTimer->IsActive() )
       
  4613 		{
       
  4614 		MPX_DEBUG1( "HandleOpenL Starting" );
       
  4615 		iTimer->Start( KMPXTimeoutTimer, KMPXTimeoutTimer, TCallBack( IADCheckTimerCallBack, this));
       
  4616 		}
       
  4617 
       
  4618     MPX_PERF_CHECKPT("Collection View opened");
  4570     MPX_PERF_CHECKPT("Collection View opened");
  4619     }
  4571     }
  4620 
  4572 
  4621 // ---------------------------------------------------------------------------
  4573 // ---------------------------------------------------------------------------
  4622 // From MMPXCollectionObserver
  4574 // From MMPXCollectionObserver
  4660                         {
  4612                         {
  4661                         // only display duration when the list contains something
  4613                         // only display duration when the list contains something
  4662                         iDuration = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
  4614                         iDuration = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
  4663                         }
  4615                         }
  4664                     }
  4616                     }
  4665                 UpdateNaviPaneL();
       
  4666                 break;
  4617                 break;
  4667                 }
  4618                 }
  4668             case EMPXOpMediaLSend:
  4619             case EMPXOpMediaLSend:
  4669                 {
  4620                 {
  4670                 DoHandleSendL( aMedia );
  4621                 DoHandleSendL( aMedia );
  5243         case EMPXCmdGoToPodcasts:
  5194         case EMPXCmdGoToPodcasts:
  5244             {
  5195             {
  5245             OpenPodcastsL();
  5196             OpenPodcastsL();
  5246             break;
  5197             break;
  5247             }
  5198             }
  5248 #ifdef SINGLE_CLICK_INCLUDED
       
  5249         case EMPXCmdPlayItem:
  5199         case EMPXCmdPlayItem:
  5250             {
  5200             {
  5251             iContainer->HandleItemCommandL(EMPXCmdPlay);
  5201             iContainer->HandleItemCommandL(EMPXCmdPlay);
  5252             break;
  5202             break;
  5253             }
  5203             }
  5254 #endif
       
  5255         case EMPXCmdCreatePlaylist:
  5204         case EMPXCmdCreatePlaylist:
  5256             {
  5205             {
  5257             iCurrentPlaylistOp = EMPXOpPLCreating;
  5206             iCurrentPlaylistOp = EMPXOpPLCreating;
  5258             CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
  5207             CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
  5259             CleanupStack::PushL( mediaArray );
  5208             CleanupStack::PushL( mediaArray );
  5296 
  5245 
  5297             TMPXGeneralCategory containerCategory( EMPXNoCategory );
  5246             TMPXGeneralCategory containerCategory( EMPXNoCategory );
  5298             if ( containerMedia.IsSupported( KMPXMediaGeneralCategory ) )
  5247             if ( containerMedia.IsSupported( KMPXMediaGeneralCategory ) )
  5299                  {
  5248                  {
  5300                  containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
  5249                  containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
  5301                  } 
  5250                  }
  5302                             
  5251 
  5303             if ( mediaCategory == EMPXSong || (containerCategory == EMPXAlbum && containerType== EMPXItem) )
  5252             if ( mediaCategory == EMPXSong || iContainer->IsTBoneView() )
  5304                 {
  5253                 {
  5305                 CMPXMedia* tracks = CMPXMedia::NewL();
  5254                 CMPXMedia* tracks = CMPXMedia::NewL();
  5306                 CleanupStack::PushL( tracks );
  5255                 CleanupStack::PushL( tracks );
  5307 
  5256 
  5308                 MPX_TRAPD( err, PrepareMediaForSelectedItemsL( *tracks, containerCategory, containerType ) );
  5257                 MPX_TRAPD( err, PrepareMediaForSelectedItemsL( *tracks, containerCategory, containerType ) );
  5574             CleanupStack::PopAndDestroy( path );
  5523             CleanupStack::PopAndDestroy( path );
  5575             break;
  5524             break;
  5576             }
  5525             }
  5577         case EAknSoftkeyBack:
  5526         case EAknSoftkeyBack:
  5578             {
  5527             {
       
  5528 			if (iContainer->OfferCommandL(EAknSoftkeyBack))
       
  5529 				{
       
  5530 				CEikButtonGroupContainer* cba = Cba();
       
  5531 				if (cba)
       
  5532 					{
       
  5533 					cba->SetCommandSetL( R_MPX_OPTIONS_HIDE_CBA );
       
  5534 					cba->MakeVisible( ETrue );
       
  5535 					cba->DrawDeferred();
       
  5536 					}
       
  5537 				break;
       
  5538 				}
       
  5539 
  5579             iMarkedAll = EFalse;
  5540             iMarkedAll = EFalse;
  5580             if( iIsDeleting )
  5541             if( iIsDeleting )
  5581             	{
  5542             	{
  5582             	break;
  5543             	break;
  5583             	}
  5544             	}
  5878     StatusPane()->MakeVisible( ETrue );
  5839     StatusPane()->MakeVisible( ETrue );
  5879     StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT);
  5840     StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT);
  5880 
  5841 
  5881     if ( !iContainer )
  5842     if ( !iContainer )
  5882         {
  5843         {
  5883         iContainer = CMPXCollectionViewHgContainer::NewL( this, this, iIsEmbedded );
  5844         iContainer = CMPXCollectionViewHgContainer::NewL( this, this, this, iIsEmbedded );
  5884         iContainer->SetCbaHandler( this );
  5845         iContainer->SetCbaHandler( this );
  5885         }
  5846         }
  5886     iContainer->SetMopParent( this );
  5847     iContainer->SetMopParent( this );
  5887     AppUi()->AddToStackL( *this, iContainer );
  5848     AppUi()->AddToStackL( *this, iContainer );
  5888     iContainer->SetRect( ClientRect() );
  5849     iContainer->SetRect( ClientRect() );
  5911         cba->DrawDeferred();
  5872         cba->DrawDeferred();
  5912         }
  5873         }
  5913 #endif
  5874 #endif
  5914 
  5875 
  5915 	UpdateTitlePaneL();
  5876 	UpdateTitlePaneL();
  5916     UpdateNaviPaneL();
       
  5917 
  5877 
  5918 
  5878 
  5919     if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypePlaybackUid )
  5879     if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypePlaybackUid )
  5920         {
  5880         {
       
  5881 		// Set the previous view for animatin purposes.
       
  5882 		iContainer->SetPreviousViewId(TUid::Uid(KMPXPluginTypePlaybackUid));
       
  5883 
  5921 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
  5884 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
  5922         // If previous view is Playback view, it can only be normal playback view
  5885         // If previous view is Playback view, it can only be normal playback view
  5923         // Podcast shouldn't be highlighted in any case.
  5886         // Podcast shouldn't be highlighted in any case.
  5924         iPodcast = EFalse;
  5887         iPodcast = EFalse;
  5925 #endif
  5888 #endif
  6002 
  5965 
  6003     if (iDuration)
  5966     if (iDuration)
  6004         {
  5967         {
  6005         delete iDuration;
  5968         delete iDuration;
  6006         iDuration = NULL;
  5969         iDuration = NULL;
  6007         TRAP_IGNORE(UpdateNaviPaneL());
       
  6008         }
  5970         }
  6009 
  5971 
  6010     // Cleanup view deactivation observer
  5972     // Cleanup view deactivation observer
  6011     AppUi()->RemoveViewDeactivationObserver( this );
  5973     AppUi()->RemoveViewDeactivationObserver( this );
  6012     }
  5974     }
  6060     MPX_DEBUG3("CMPXCollectionViewHgImp::HandleBacksteppingActivation - viewId=0x%x, statusInfo=%d", viewId, statusInfo );
  6022     MPX_DEBUG3("CMPXCollectionViewHgImp::HandleBacksteppingActivation - viewId=0x%x, statusInfo=%d", viewId, statusInfo );
  6061     iActivateBackStepping = EFalse;
  6023     iActivateBackStepping = EFalse;
  6062 #endif // BACKSTEPPING_INCLUDED
  6024 #endif // BACKSTEPPING_INCLUDED
  6063    }
  6025    }
  6064 
  6026 
       
  6027 
       
  6028 
       
  6029 // -----------------------------------------------------------------------------
       
  6030 // checks if Now Playing option should be shown
       
  6031 // -----------------------------------------------------------------------------
       
  6032 //
       
  6033 TBool CMPXCollectionViewHgImp::NowPlayingOptionVisibilityL()
       
  6034     {
       
  6035     MPX_FUNC( "CMPXCollectionViewHgImp::SendOptionVisibilityL" );
       
  6036     TBool isHidden( iContainer->TotalListItemCount() < 1 );
       
  6037 
       
  6038 	// First check if there's a local playback source
       
  6039 	MMPXSource* source( iPlaybackUtility->Source() );
       
  6040 	if ( source == 0 )
       
  6041 		{
       
  6042 		// If no local playback, check if there's a progressive download playback source.
       
  6043 		MMPXPlaybackUtility* pdPlaybackUtility;
       
  6044 		pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
       
  6045 		isHidden = pdPlaybackUtility->Source() ? EFalse : ETrue;
       
  6046 		pdPlaybackUtility->Close();
       
  6047 		}
       
  6048 
       
  6049     return isHidden;
       
  6050     }
       
  6051 
       
  6052 
  6065 // ---------------------------------------------------------------------------
  6053 // ---------------------------------------------------------------------------
  6066 // Handle initialing a music menu pane.
  6054 // Handle initialing a music menu pane.
  6067 // ---------------------------------------------------------------------------
  6055 // ---------------------------------------------------------------------------
  6068 //
  6056 //
  6069 void CMPXCollectionViewHgImp::HandleInitMusicMenuPaneL(
  6057 void CMPXCollectionViewHgImp::HandleInitMusicMenuPaneL(
  6075 	const CMPXMedia& containerMedia = array->ContainerMedia();
  6063 	const CMPXMedia& containerMedia = array->ContainerMedia();
  6076 
  6064 
  6077 	TMPXGeneralCategory containerCategory(
  6065 	TMPXGeneralCategory containerCategory(
  6078 		containerMedia.ValueTObjectL<TMPXGeneralCategory>(
  6066 		containerMedia.ValueTObjectL<TMPXGeneralCategory>(
  6079 			KMPXMediaGeneralCategory ) );
  6067 			KMPXMediaGeneralCategory ) );
       
  6068 			
       
  6069 	TMPXGeneralType containerType(
       
  6070     	containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );			
  6080 
  6071 
  6081 	switch ( containerCategory )
  6072 	switch ( containerCategory )
  6082 		{
  6073 		{
  6083 		case EMPXPlaylist:
  6074 		case EMPXPlaylist:
  6084 			{
  6075 			{
  6085 			// playlist view
  6076 			// playlist view
  6086 			aMenuPane->SetItemDimmed( EMPXCmdGoToPlaylists, ETrue );
  6077 			aMenuPane->SetItemDimmed( EMPXCmdGoToPlaylists, ETrue );
  6087 			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
  6078             aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden );
  6088 			aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
  6079 	        if (containerType != EMPXGroup ) // EMPXItem -> playlist tracks level
       
  6080 			 {
       
  6081 			  aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue );
       
  6082 			  aMenuPane->SetItemDimmed( EMPXCmdGoToAllSongs, ETrue );
       
  6083 			  aMenuPane->SetItemDimmed( EMPXCmdGoToPodcasts, ETrue );
       
  6084 			  aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
       
  6085 			  aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
       
  6086               aMenuPane->SetItemDimmed( EMPXCmdMusicLibraryDetails, ETrue);
       
  6087 			  aMenuPane->SetItemDimmed( EMPXCmdGoToMusicShop, ETrue );
       
  6088 	          aMenuPane->SetItemDimmed( EMPXCmdGoToMultipleMusicShop, ETrue); 
       
  6089 			 }  
  6089 			break;
  6090 			break;
  6090 			}
  6091 			}
  6091 		case EMPXAlbum:
  6092 		case EMPXAlbum:
  6092 		case EMPXArtist:
  6093 		case EMPXArtist:
  6093 			{
  6094 			{
  6094 			// Artists & Albums view
  6095 			// Artists & Albums view
  6095 			aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue );
  6096 			aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue );
  6096 			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
  6097             aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden ); 
       
  6098 			if ( iContainer->IsTBoneView() ) //TBone View
       
  6099 			    {
       
  6100 			    aMenuPane->SetItemDimmed( EMPXCmdGoToAllSongs, ETrue );
       
  6101 			    aMenuPane->SetItemDimmed( EMPXCmdGoToPlaylists, ETrue );
       
  6102 			    aMenuPane->SetItemDimmed( EMPXCmdGoToPodcasts, ETrue );
       
  6103 			    aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
       
  6104 			    aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
       
  6105                 aMenuPane->SetItemDimmed( EMPXCmdMusicLibraryDetails, ETrue); 
       
  6106 			    }    
  6097 			break;
  6107 			break;
  6098 			}
  6108 			}
  6099 		case EMPXGenre:
  6109 		case EMPXGenre:
  6100 			{
  6110 			{
  6101 			// Genre view
  6111 			// Genre view
  6102 			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
  6112         	aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
  6103 			aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
  6113             aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden );    
       
  6114 			if ( containerType != EMPXGroup ) // EMPXItem -> tracks level
       
  6115 				{
       
  6116                 aMenuPane->SetItemDimmed( EMPXCmdGoToAllSongs, ETrue );
       
  6117                 aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue );
       
  6118                 aMenuPane->SetItemDimmed( EMPXCmdGoToPlaylists, ETrue );
       
  6119                 aMenuPane->SetItemDimmed( EMPXCmdGoToPodcasts, ETrue );
       
  6120                 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
       
  6121                 aMenuPane->SetItemDimmed( EMPXCmdMusicLibraryDetails, ETrue);
       
  6122 				aMenuPane->SetItemDimmed( EMPXCmdGoToMusicShop, ETrue );
       
  6123                 aMenuPane->SetItemDimmed( EMPXCmdGoToMultipleMusicShop, ETrue); 
       
  6124 				}
       
  6125 			
  6104 			break;
  6126 			break;
  6105 			}
  6127 			}
  6106 		case EMPXSong:
  6128 		case EMPXSong:
  6107 			{
  6129 			{
       
  6130 			// Song view and Genre Track view
  6108 			aMenuPane->SetItemDimmed( EMPXCmdGoToAllSongs, ETrue );
  6131 			aMenuPane->SetItemDimmed( EMPXCmdGoToAllSongs, ETrue );
  6109 			aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
  6132             aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden );
  6110 			break;
  6133 			break;
  6111 			}
  6134 			}
  6112 		default:
  6135 		default:
  6113 			{
  6136 			{
  6114 			break;
  6137 			break;
  6115 			}
  6138 			}
  6116 		}
  6139 		}
  6117    	}
  6140    	}
  6118 // ---------------------------------------------------------------------------
  6141 // ---------------------------------------------------------------------------
       
  6142 // Dynamically initialises a menu pane for the Album context
       
  6143 // ---------------------------------------------------------------------------
       
  6144 //
       
  6145 void CMPXCollectionViewHgImp::DynInitMenuPaneAlbumL(
       
  6146     TInt aResourceId,
       
  6147     CEikMenuPane* aMenuPane )
       
  6148     {
       
  6149     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneAlbumL" );
       
  6150     ASSERT( iContainer && aMenuPane != NULL);
       
  6151     TBool isListEmpty( iContainer->TotalListItemCount() == 0 );
       
  6152 
       
  6153     switch ( aResourceId )
       
  6154         {
       
  6155         case R_MPX_COLLECTION_VIEW_MENU_1:
       
  6156             {
       
  6157             HandleInitMusicMenuPaneL(aMenuPane);
       
  6158 			if ( isListEmpty )
       
  6159 				{
       
  6160 				aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
       
  6161 				aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6162 				aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6163 				aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6164 				aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6165 				aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6166 				aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6167 				aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6168 				aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6169 				aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6170 				aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6171 				aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6172 				aMenuPane->SetItemDimmed( EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6173 				}
       
  6174 			else
       
  6175 				{
       
  6176 				aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, NowPlayingOptionVisibilityL() );
       
  6177 				aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6178 				aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6179 				aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6180 
       
  6181 				TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
       
  6182 				if ( landscapeOrientation )
       
  6183 					{
       
  6184 					aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6185 					aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6186 					aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6187 					aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6188 					aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6189 					aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6190 					aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6191 					aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6192 					}
       
  6193 				else
       
  6194 					{
       
  6195 					aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6196                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6197 					aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6198 					aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6199 					aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6200                     aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6201 					aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6202 					aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6203 
       
  6204 					TInt usbUnblockingStatus;
       
  6205 					RProperty::Get( KMPXViewPSUid,
       
  6206 									KMPXUSBUnblockingPSStatus,
       
  6207 									usbUnblockingStatus);
       
  6208 
       
  6209 					if ( iContainer->CurrentLbxItemIndex() > KErrNotFound )
       
  6210 					    {
       
  6211                         if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6212                             {
       
  6213                             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6214                             aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6215                             }
       
  6216                         else
       
  6217                             {
       
  6218                             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6219                             aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6220                             aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6221                             aMenuPane->SetItemDimmed( EMPXCmdPlayItem,
       
  6222                                     iContainer->IsTBoneView() ? ETrue : EFalse );
       
  6223                             }
       
  6224 					    }
       
  6225 					if ( iContainer->IsSelectedItemASong() && iContainer->IsTBoneView() )
       
  6226 						{
       
  6227 						if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6228 							{
       
  6229 							aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6230 							aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6231 							}
       
  6232 						else
       
  6233 							{
       
  6234 							aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6235 							aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6236 							}
       
  6237 						}
       
  6238 					
       
  6239 					//If Operator Music store exist, show the cascade menu with Nokia and Operator music store.
       
  6240 					if ( iOperatorMusicStore )
       
  6241 					    {
       
  6242 					    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6243 					    }
       
  6244 					else
       
  6245 					    {
       
  6246 					    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6247 					    }
       
  6248 					}
       
  6249 				}
       
  6250 
       
  6251 			break;
       
  6252 			}
       
  6253 
       
  6254 		case R_MPX_COLLECTION_VIEW_MENU_2:
       
  6255             {
       
  6256 			aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6257 			aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6258 			aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6259  			aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6260 			aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6261 			aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6262 			if( !iContainer->IsTBoneView()&& (iContainer->CurrentLbxItemIndex() > KErrNotFound))
       
  6263 			    {  
       
  6264 			     aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, !iUsingNokiaService );
       
  6265 			    } 
       
  6266 		    break;
       
  6267 			}
       
  6268         case R_MPX_ADD_TO_PL_SUB_MENU:
       
  6269             {
       
  6270             aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() );
       
  6271             break;
       
  6272             }
       
  6273         default:
       
  6274             {
       
  6275             // Do nothing
       
  6276             break;
       
  6277             }
       
  6278 		}
       
  6279 	}
       
  6280 
       
  6281 // ---------------------------------------------------------------------------
       
  6282 // Dynamically initialises a menu pane for the Playlist context
       
  6283 // ---------------------------------------------------------------------------
       
  6284 //
       
  6285 void CMPXCollectionViewHgImp::DynInitMenuPanePlaylistL(
       
  6286     TInt aResourceId,
       
  6287     CEikMenuPane* aMenuPane )
       
  6288     {
       
  6289     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPanePlaylistL" );
       
  6290 
       
  6291     TBool isListEmpty( (iContainer->TotalListItemCount()) == 0 );
       
  6292 
       
  6293     switch ( aResourceId )
       
  6294         {
       
  6295         case R_MPX_COLLECTION_VIEW_MENU_1:
       
  6296             {
       
  6297             HandleInitMusicMenuPaneL(aMenuPane);
       
  6298 
       
  6299 			aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, NowPlayingOptionVisibilityL() );
       
  6300 			aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6301 			aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6302 			aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6303 			aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6304 			aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6305 			aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6306 			aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6307 			aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6308 			aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6309 
       
  6310 			TInt usbUnblockingStatus;
       
  6311 			RProperty::Get( KMPXViewPSUid,
       
  6312 							KMPXUSBUnblockingPSStatus,
       
  6313 							usbUnblockingStatus);
       
  6314 			if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6315 				{
       
  6316 				aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6317 				aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6318 				}
       
  6319 			else
       
  6320 				{
       
  6321 				aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, EFalse );
       
  6322 				aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6323 				}
       
  6324 
       
  6325 			TInt currentItem( iContainer->CurrentLbxItemIndex() );
       
  6326 
       
  6327 			CMPXCollectionViewListBoxArray* array =
       
  6328 				static_cast<CMPXCollectionViewListBoxArray*>(
       
  6329 				iContainer->ListBoxArray() );
       
  6330 			const CMPXMedia& media = array->MediaL( currentItem );
       
  6331 
       
  6332 			if ( media.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
       
  6333 				{
       
  6334 				// check for auto playlist, disable delete
       
  6335 				TMPXGeneralNonPermissibleActions attr(
       
  6336 					media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  6337 						KMPXMediaGeneralNonPermissibleActions ) );
       
  6338 				if ( attr & EMPXWrite )
       
  6339 					{
       
  6340 					aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6341 					}
       
  6342 				}
       
  6343 
       
  6344 			TInt trackCount (0);
       
  6345 			if( media.IsSupported(KMPXMediaGeneralCount) )
       
  6346 				{
       
  6347 				trackCount = media.ValueTObjectL<TInt>( KMPXMediaGeneralCount );
       
  6348 				}
       
  6349 			if( trackCount < 1 )
       
  6350 				{
       
  6351 				aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6352 				}
       
  6353 
       
  6354 			if ( iOperatorMusicStore )
       
  6355 			    {
       
  6356 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6357 			    }
       
  6358 			else
       
  6359 			    {
       
  6360 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6361 			    }
       
  6362 
       
  6363 			break;
       
  6364 			}
       
  6365 
       
  6366 		case R_MPX_COLLECTION_VIEW_MENU_2:
       
  6367             {
       
  6368 			aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6369 			aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6370 			aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6371 			aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6372 			aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6373 
       
  6374 			TInt currentItem( iContainer->CurrentLbxItemIndex() );
       
  6375 
       
  6376 			CMPXCollectionViewListBoxArray* array =
       
  6377 				static_cast<CMPXCollectionViewListBoxArray*>(
       
  6378 				iContainer->ListBoxArray() );
       
  6379 			const CMPXMedia& media = array->MediaL( currentItem );
       
  6380 
       
  6381 			TInt usbUnblockingStatus;
       
  6382 			RProperty::Get( KMPXViewPSUid,
       
  6383 							KMPXUSBUnblockingPSStatus,
       
  6384 							usbUnblockingStatus);
       
  6385 			if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6386 				{
       
  6387 				aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6388 				}
       
  6389 			else
       
  6390 				{
       
  6391 				aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );
       
  6392 				}
       
  6393 
       
  6394 			if ( media.IsSupported(
       
  6395 				KMPXMediaGeneralNonPermissibleActions ) )
       
  6396 				{
       
  6397 				// check for auto playlist, disable delete
       
  6398 				TMPXGeneralNonPermissibleActions attr(
       
  6399 					media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  6400 						KMPXMediaGeneralNonPermissibleActions ) );
       
  6401 				if ( attr & EMPXWrite )
       
  6402 					{
       
  6403 					aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6404 					// TODO: this should be an item specific command.
       
  6405 					aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6406 					}
       
  6407 				}
       
  6408 			if ( array->IsItemBrokenLinkL( currentItem ) ||
       
  6409 				array->IsItemCorruptedL( currentItem ) )
       
  6410 				{
       
  6411 				aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6412                 // TODO: this should be an item specific command.
       
  6413 				aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6414 				}
       
  6415 
       
  6416 			break;
       
  6417 			}
       
  6418         default:
       
  6419             {
       
  6420             // Do nothing
       
  6421             break;
       
  6422             }
       
  6423 		}
       
  6424 	}
       
  6425 
       
  6426 
       
  6427 
       
  6428 // ---------------------------------------------------------------------------
       
  6429 // Dynamically initialises a menu pane for the Genre context
       
  6430 // ---------------------------------------------------------------------------
       
  6431 //
       
  6432 void CMPXCollectionViewHgImp::DynInitMenuPaneGenreL(
       
  6433     TInt aResourceId,
       
  6434     CEikMenuPane* aMenuPane )
       
  6435     {
       
  6436     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPanePlaylistL" );
       
  6437 
       
  6438     switch ( aResourceId )
       
  6439         {
       
  6440         case R_MPX_COLLECTION_VIEW_MENU_1:
       
  6441             {
       
  6442             HandleInitMusicMenuPaneL(aMenuPane);
       
  6443 
       
  6444             aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, NowPlayingOptionVisibilityL() );
       
  6445             aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6446             aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6447             aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6448             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6449             aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6450             aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6451             aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6452             aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6453             aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6454             aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6455             aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6456 
       
  6457             if ( iContainer->CurrentLbxItemIndex() > KErrNotFound )
       
  6458                 {
       
  6459                 TInt usbUnblockingStatus;
       
  6460                 RProperty::Get( KMPXViewPSUid,
       
  6461                                 KMPXUSBUnblockingPSStatus,
       
  6462                                 usbUnblockingStatus);
       
  6463                 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6464                     {
       
  6465                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6466                    }
       
  6467                 else
       
  6468                     {
       
  6469                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6470                     aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
       
  6471                     }
       
  6472                 }
       
  6473             
       
  6474             if ( iOperatorMusicStore )
       
  6475                 {
       
  6476                 aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6477                 }
       
  6478             else
       
  6479                 {
       
  6480                 aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6481                 }
       
  6482 			break;
       
  6483 			}
       
  6484 
       
  6485 		case R_MPX_COLLECTION_VIEW_MENU_2:
       
  6486             {
       
  6487 			aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6488 			aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6489 			aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6490 			aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6491 			aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6492             
       
  6493             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, !iUsingNokiaService );
       
  6494 			break;
       
  6495 			}
       
  6496         case R_MPX_ADD_TO_PL_SUB_MENU:
       
  6497             {
       
  6498             aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() );
       
  6499             break;
       
  6500             }
       
  6501         default:
       
  6502             {
       
  6503             // Do nothing
       
  6504             break;
       
  6505             }
       
  6506 		}
       
  6507 	}
       
  6508 
       
  6509 
       
  6510 // ---------------------------------------------------------------------------
       
  6511 // Dynamically initialises a menu pane for the Songs context
       
  6512 // Handling for any tracks view except playlist tracks.
       
  6513 // ---------------------------------------------------------------------------
       
  6514 //
       
  6515 void CMPXCollectionViewHgImp::DynInitMenuPaneSongsL(
       
  6516     TInt aResourceId,
       
  6517     CEikMenuPane* aMenuPane )
       
  6518     {
       
  6519     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneAllSongsL" );
       
  6520 
       
  6521     TBool isListEmpty( iContainer->TotalListItemCount() == 0 );
       
  6522     TInt selectionCount( 0 );
       
  6523     iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned
       
  6524     switch ( aResourceId )
       
  6525         {
       
  6526         case R_MPX_COLLECTION_VIEW_MENU_1:
       
  6527             {
       
  6528             HandleInitMusicMenuPaneL(aMenuPane);
       
  6529 			if ( isListEmpty )
       
  6530 				{
       
  6531 				aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
       
  6532 				aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6533 				aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6534 				aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6535 				aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6536                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6537                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6538 				aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6539 				aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6540 				aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6541 				aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6542 				aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6543 				aMenuPane->SetItemDimmed( EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6544 				}
       
  6545 			else
       
  6546 				{
       
  6547 				aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, NowPlayingOptionVisibilityL() );
       
  6548 				aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6549                 aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6550                 aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6551                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6552                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6553 				aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6554 				aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6555 				aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6556 				aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6557                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6558 				aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6559 
       
  6560 				TInt usbUnblockingStatus;
       
  6561 				RProperty::Get( KMPXViewPSUid,
       
  6562 								KMPXUSBUnblockingPSStatus,
       
  6563 								usbUnblockingStatus);
       
  6564 
       
  6565 				if ( iContainer->IsSelectedItemASong() )
       
  6566 					{
       
  6567 					if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6568 						{
       
  6569 						aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6570 						aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6571 						aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6572 						}
       
  6573 					else
       
  6574 						{
       
  6575 						aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6576 						aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6577 						aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6578 						}
       
  6579 					}
       
  6580 				if ( iOperatorMusicStore )
       
  6581 				    {
       
  6582 				    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6583 				    }
       
  6584 				else
       
  6585 				    {
       
  6586 				    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6587 				    }
       
  6588 				}
       
  6589 
       
  6590 			break;
       
  6591 			}
       
  6592 
       
  6593 		case R_MPX_COLLECTION_VIEW_MENU_2:
       
  6594             {
       
  6595 
       
  6596 		
       
  6597 			if ( iSelectionIndexCache)
       
  6598 				{
       
  6599 				selectionCount = iSelectionIndexCache->Count();
       
  6600 				}
       
  6601 			if ( selectionCount > 0 )
       
  6602 				{
       
  6603 				// multiple selection
       
  6604 				aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6605 				aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6606 				aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6607 				aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6608 				}
       
  6609 			else
       
  6610 				{
       
  6611 				aMenuPane->SetItemDimmed( EMPXCmdSongDetails,
       
  6612 				        FileDetailsOptionVisibilityL() );
       
  6613 				aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6614 				aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6615                 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6616 
       
  6617 				TInt currentItem( iContainer->CurrentLbxItemIndex() );
       
  6618 				if ( currentItem > KErrNotFound )
       
  6619 					{
       
  6620 					CMPXCollectionViewListBoxArray* array =
       
  6621 						static_cast<CMPXCollectionViewListBoxArray*>(
       
  6622 						iContainer->ListBoxArray() );
       
  6623 
       
  6624 					if ( array->IsItemBrokenLinkL( currentItem ) ||
       
  6625 						array->IsItemCorruptedL( currentItem ) )
       
  6626 						{
       
  6627 						aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6628 						aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6629 						aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6630 						aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6631 						}
       
  6632 					aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, !iUsingNokiaService );
       
  6633 					}
       
  6634 				}
       
  6635 			aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6636 			aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6637 			if (iServiceHandler->HandleSubmenuL(*aMenuPane))
       
  6638 				{
       
  6639 				return;
       
  6640 				}
       
  6641 
       
  6642 			break;
       
  6643 			}
       
  6644         case R_MPX_ADD_TO_PL_SUB_MENU:
       
  6645             {
       
  6646             aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() );
       
  6647             break;
       
  6648             }
       
  6649         default:
       
  6650             {
       
  6651             // Do nothing
       
  6652             break;
       
  6653             }
       
  6654 		}
       
  6655 	}
       
  6656 
       
  6657 
       
  6658 
       
  6659 // ---------------------------------------------------------------------------
       
  6660 // Dynamically initialises a menu pane for the playlist Songs context
       
  6661 // ---------------------------------------------------------------------------
       
  6662 //
       
  6663 void CMPXCollectionViewHgImp::DynInitMenuPanePlaylistSongsL(
       
  6664     TInt aResourceId,
       
  6665     CEikMenuPane* aMenuPane )
       
  6666     {
       
  6667     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPanePlaylistSongsL" );
       
  6668 
       
  6669     TBool isListEmpty( iContainer->TotalListItemCount() == 0 );
       
  6670 
       
  6671     switch ( aResourceId )
       
  6672         {
       
  6673         case R_MPX_COLLECTION_VIEW_MENU_1:
       
  6674             {
       
  6675             HandleInitMusicMenuPaneL(aMenuPane);
       
  6676 
       
  6677 			if ( isListEmpty )
       
  6678 				{
       
  6679 				aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
       
  6680 				aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6681 				aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6682 				aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6683 				aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6684 				aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6685 				aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6686 				aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6687 				aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6688 				aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6689 				aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6690 				aMenuPane->SetItemDimmed( EMPXCmdAddSongs, EFalse );
       
  6691 				}
       
  6692 			else
       
  6693 				{
       
  6694                 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, NowPlayingOptionVisibilityL() );
       
  6695                 aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6696                 aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6697                 aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6698                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6699 				aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6700 				aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6701 				aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6702                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6703                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6704 				aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6705 				
       
  6706 				TInt usbUnblockingStatus;
       
  6707 				RProperty::Get( KMPXViewPSUid,
       
  6708 								KMPXUSBUnblockingPSStatus,
       
  6709 								usbUnblockingStatus);
       
  6710 
       
  6711 				if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6712 					{
       
  6713 					aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6714 					aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6715 					aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6716 					}
       
  6717 				else
       
  6718 					{
       
  6719 					TInt selectionCount( 0 );
       
  6720 					iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned
       
  6721 					if ( iSelectionIndexCache)
       
  6722 						{
       
  6723 						selectionCount = iSelectionIndexCache->Count();
       
  6724 						}
       
  6725 					// do not display add songs option when marking is on
       
  6726 					aMenuPane->SetItemDimmed( EMPXCmdAddSongs, selectionCount > 0 );
       
  6727 
       
  6728 					if ( iContainer->CurrentLbxItemIndex() > KErrNotFound )
       
  6729 						{
       
  6730 						aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6731 						aMenuPane->SetItemDimmed( EMPXCmdRemove, EFalse );
       
  6732 						}
       
  6733 					}
       
  6734 
       
  6735 				CMPXCollectionViewListBoxArray* array =
       
  6736 					static_cast<CMPXCollectionViewListBoxArray*>(
       
  6737 					iContainer->ListBoxArray() );
       
  6738 				const CMPXMedia& containerMedia = array->ContainerMedia();
       
  6739 
       
  6740 				if ( containerMedia.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
       
  6741 					{
       
  6742 					// check for auto playlist, disable add, remove and reorder
       
  6743 					TMPXGeneralNonPermissibleActions attr(
       
  6744 						containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  6745 							KMPXMediaGeneralNonPermissibleActions ) );
       
  6746 					if ( attr & EMPXWrite )
       
  6747 						{
       
  6748 						aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6749 						aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6750 						aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6751 						}
       
  6752 					}
       
  6753 				}
       
  6754 
       
  6755 			break;
       
  6756 			}
       
  6757 
       
  6758 		case R_MPX_COLLECTION_VIEW_MENU_2:
       
  6759             {
       
  6760             aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6761             aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6762             aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6763             aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6764             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6765 
       
  6766 			TInt selectionCount( 0 );
       
  6767 			iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned
       
  6768 			if ( iSelectionIndexCache)
       
  6769 				{
       
  6770 				selectionCount = iSelectionIndexCache->Count();
       
  6771 				}
       
  6772 			if ( selectionCount > 0 )
       
  6773 				{
       
  6774 				// multiple selection
       
  6775 				aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6776 				aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6777 				}
       
  6778 			else
       
  6779 				{
       
  6780 				aMenuPane->SetItemDimmed( EMPXCmdSongDetails,
       
  6781 					FileDetailsOptionVisibilityL() );
       
  6782 
       
  6783 				TInt currentItem( iContainer->CurrentLbxItemIndex() );
       
  6784 
       
  6785 				if ( currentItem > KErrNotFound )
       
  6786 					{
       
  6787 					CMPXCollectionViewListBoxArray* array =
       
  6788 						static_cast<CMPXCollectionViewListBoxArray*>(
       
  6789 						iContainer->ListBoxArray() );
       
  6790 					if ( array->IsItemBrokenLinkL( currentItem ) ||
       
  6791 						array->IsItemCorruptedL( currentItem ) )
       
  6792 						{
       
  6793 						aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6794 						}
       
  6795 					aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, !iUsingNokiaService );
       
  6796 					}
       
  6797 				}
       
  6798 			if (iServiceHandler->HandleSubmenuL(*aMenuPane))
       
  6799 				{
       
  6800 				return;
       
  6801 				}
       
  6802 
       
  6803 			break;
       
  6804 			}
       
  6805         default:
       
  6806             {
       
  6807             // Do nothing
       
  6808             break;
       
  6809             }
       
  6810 		}
       
  6811 	}
       
  6812 
       
  6813 // ---------------------------------------------------------------------------
  6119 // From MEikMenuObserver
  6814 // From MEikMenuObserver
  6120 // Dynamically initialises a menu pane.
  6815 // Dynamically initialises a menu pane.
  6121 // ---------------------------------------------------------------------------
  6816 // ---------------------------------------------------------------------------
  6122 //
  6817 //
  6123 void CMPXCollectionViewHgImp::DynInitMenuPaneL(
  6818 void CMPXCollectionViewHgImp::DynInitMenuPaneL(
  6124     TInt aResourceId,
  6819     TInt aResourceId,
  6125     CEikMenuPane* aMenuPane )
  6820     CEikMenuPane* aMenuPane )
  6126     {
  6821     {
  6127     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneL" );
  6822     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneL" );
       
  6823 
  6128     CMPXCollectionViewListBoxArray* array =
  6824     CMPXCollectionViewListBoxArray* array =
  6129         static_cast<CMPXCollectionViewListBoxArray*>(
  6825         static_cast<CMPXCollectionViewListBoxArray*>(
  6130         iContainer->ListBoxArray() );
  6826         iContainer->ListBoxArray() );
  6131     TInt currentItem( iContainer->CurrentLbxItemIndex() );
  6827 	const CMPXMedia& containerMedia = array->ContainerMedia();
  6132     TBool isListEmpty( currentItem < 0 );
  6828 	TMPXGeneralType containerType(
  6133     TInt selectionCount( 0 );
  6829 		containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
  6134 	
  6830 	TMPXGeneralCategory containerCategory(
  6135     iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned
  6831 		containerMedia.ValueTObjectL<TMPXGeneralCategory>(
  6136     if ( iSelectionIndexCache)
  6832 			KMPXMediaGeneralCategory ) );
  6137         {
       
  6138         selectionCount = iSelectionIndexCache->Count();
       
  6139         }
       
  6140 
  6833 
  6141     TInt usbUnblockingStatus;
  6834     TInt usbUnblockingStatus;
  6142     RProperty::Get( KMPXViewPSUid,
  6835     RProperty::Get( KMPXViewPSUid,
  6143                     KMPXUSBUnblockingPSStatus,
  6836                     KMPXUSBUnblockingPSStatus,
  6144                     usbUnblockingStatus);
  6837                     usbUnblockingStatus);
  6145 
  6838 
       
  6839 	// We first construct options menu based on collection browsing context.
       
  6840 	// For resource R_MPX_COLLECTION_VIEW_MENU_1, R_MPX_COLLECTION_VIEW_MENU_2.
       
  6841 	if ( containerType == EMPXGroup )
       
  6842 		{
       
  6843 		switch (containerCategory)
       
  6844 			{
       
  6845 			case EMPXCollection:
       
  6846 				break;
       
  6847 			case EMPXArtist:
       
  6848 				break;
       
  6849 			case EMPXAlbum:
       
  6850 			    // Artist & Album view
       
  6851 				DynInitMenuPaneAlbumL(aResourceId, aMenuPane);
       
  6852 				break;
       
  6853 			case EMPXPlaylist:
       
  6854 			    // Playlist view
       
  6855 				DynInitMenuPanePlaylistL(aResourceId, aMenuPane);
       
  6856 				break;
       
  6857 			case EMPXSong:
       
  6858 			    // Songs (All Songs) View
       
  6859 				DynInitMenuPaneSongsL(aResourceId, aMenuPane);
       
  6860 				break;
       
  6861 			case EMPXGenre:
       
  6862 			    // Genre View
       
  6863 				DynInitMenuPaneGenreL(aResourceId, aMenuPane);
       
  6864 				break;
       
  6865 			case EMPXComposer:
       
  6866 				break;
       
  6867 			default:
       
  6868 				User::Leave(KErrNotSupported);
       
  6869 				break;
       
  6870 			}
       
  6871 		}
       
  6872 	else if ( containerType == EMPXItem )
       
  6873 		{
       
  6874 		switch (containerCategory)
       
  6875 			{
       
  6876 			case EMPXSong:
       
  6877 				break;
       
  6878 			case EMPXArtist:
       
  6879 				break;
       
  6880 			case EMPXPlaylist:
       
  6881 			    // Playlist tracks view
       
  6882 				DynInitMenuPanePlaylistSongsL(aResourceId, aMenuPane);
       
  6883 				break;
       
  6884 			case EMPXAlbum:
       
  6885 			case EMPXGenre:
       
  6886 			case EMPXComposer:
       
  6887 			    // Other tracks view
       
  6888 				DynInitMenuPaneSongsL(aResourceId, aMenuPane);
       
  6889 				break;
       
  6890 			default:
       
  6891 				User::Leave(KErrNotSupported);
       
  6892 				break;
       
  6893 			}
       
  6894 		}
       
  6895 
       
  6896 	// Handle other menu resources.
  6146     switch ( aResourceId )
  6897     switch ( aResourceId )
  6147         {
  6898         {
  6148         case R_MPX_COLLECTION_VIEW_MENU_1:
       
  6149             {
       
  6150             const CMPXMedia& containerMedia = array->ContainerMedia();
       
  6151             TMPXGeneralType containerType(
       
  6152                 containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
       
  6153             TMPXGeneralCategory containerCategory(
       
  6154                 containerMedia.ValueTObjectL<TMPXGeneralCategory>(
       
  6155                     KMPXMediaGeneralCategory ) );
       
  6156 
       
  6157             HandleInitMusicMenuPaneL(aMenuPane);
       
  6158 
       
  6159             MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
       
  6160 
       
  6161             // Always dim the find in hg implementation
       
  6162             aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
       
  6163 
       
  6164 			// Determine if we should hide "Goto now playing" option.
       
  6165             TBool hideNowPlaying(EFalse);
       
  6166 			MMPXSource* source( iPlaybackUtility->Source() );
       
  6167             if ( source == 0 )
       
  6168 				{
       
  6169 				MMPXPlaybackUtility* pdPlaybackUtility;
       
  6170 				pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
       
  6171 				hideNowPlaying = pdPlaybackUtility->Source() ? EFalse : ETrue;
       
  6172 				pdPlaybackUtility->Close();
       
  6173 				}
       
  6174             if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
       
  6175                 {
       
  6176                 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
       
  6177                 }
       
  6178 
       
  6179 			aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, hideNowPlaying );
       
  6180 
       
  6181             if ( !isListEmpty )
       
  6182                 {
       
  6183                 const CMPXMedia& media = array->MediaL( currentItem );
       
  6184                 TMPXGeneralType type(
       
  6185                     media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
       
  6186                 TMPXGeneralCategory category(
       
  6187                     media.ValueTObjectL<TMPXGeneralCategory>(
       
  6188                         KMPXMediaGeneralCategory ) );
       
  6189                 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
       
  6190 #ifdef SINGLE_CLICK_INCLUDED
       
  6191                 if ( containerType == EMPXGroup && containerCategory == EMPXAlbum )
       
  6192                     {
       
  6193                     // Artists & Albums view
       
  6194                     switch ( category )
       
  6195                         {
       
  6196                         case EMPXAlbum:
       
  6197                             {
       
  6198                             TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
       
  6199                             if ( landscapeOrientation )
       
  6200                                 {
       
  6201                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6202                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6203                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6204                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6205                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6206                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6207                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6208                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );                            
       
  6209                                 }
       
  6210                             else
       
  6211                                 {
       
  6212                                 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6213                                     {
       
  6214                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6215                                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6216                                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6217                                     aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6218                                     aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6219                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6220                                     aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6221                                     aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
       
  6222                                     }
       
  6223                                 else
       
  6224                                     {
       
  6225                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6226                                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6227                                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6228                                     aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6229                                     aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6230                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6231                                     aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6232                                     aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
       
  6233                                     }
       
  6234                                 }
       
  6235                             break;
       
  6236                             }
       
  6237                         case EMPXCommand:
       
  6238                             {
       
  6239                             aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6240                             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6241                             aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6242                             aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6243                             aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6244                             aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6245                             aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6246                             aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6247                             break;
       
  6248                             }
       
  6249                         }
       
  6250                     }
       
  6251                 else
       
  6252 #endif
       
  6253                 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
       
  6254                     {
       
  6255                     // in playlist tracks view
       
  6256                     // enable reordering and add songs in playlist view
       
  6257                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6258                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6259                     if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6260                         {
       
  6261                         aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6262                         aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6263                         aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6264                         aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6265                         aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6266 #ifdef SINGLE_CLICK_INCLUDED
       
  6267                         aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6268 #endif
       
  6269 
       
  6270                         }
       
  6271                     else
       
  6272                         {
       
  6273                         // do not display add songs option when marking is on
       
  6274                         aMenuPane->SetItemDimmed( EMPXCmdAddSongs, selectionCount > 0 );
       
  6275                         TInt totalItemCount( iContainer->TotalListItemCount() );
       
  6276                         // display reorder option only when more than 1 item is visible
       
  6277                         // do not display reorder option when marking is on
       
  6278 #ifdef SINGLE_CLICK_INCLUDED
       
  6279                         aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6280 #else
       
  6281                         aMenuPane->SetItemDimmed( EMPXCmdReorder,
       
  6282                             ( totalItemCount > 1 && selectionCount == 0 ) ?
       
  6283                             EFalse : ETrue );
       
  6284 #endif
       
  6285                         aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6286                         aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6287                         aMenuPane->SetItemDimmed( EMPXCmdRemove, EFalse );
       
  6288 #ifdef SINGLE_CLICK_INCLUDED
       
  6289                         aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6290 #endif
       
  6291 						}
       
  6292 
       
  6293                     if ( containerMedia.IsSupported(
       
  6294                         KMPXMediaGeneralNonPermissibleActions ) )
       
  6295                         {
       
  6296                         // check for auto playlist, disable add, remove and reorder
       
  6297                         TMPXGeneralNonPermissibleActions attr(
       
  6298                             containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  6299                                 KMPXMediaGeneralNonPermissibleActions ) );
       
  6300                         if ( attr & EMPXWrite )
       
  6301                             {
       
  6302                             aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6303                             aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6304                             aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6305                             }
       
  6306                         }
       
  6307                     }
       
  6308                 else if ( type == EMPXItem )
       
  6309                     {
       
  6310                     switch ( category )
       
  6311                         {
       
  6312                         case EMPXPlaylist:
       
  6313                             {
       
  6314                             // playlist view
       
  6315                             if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6316                                 {
       
  6317                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6318                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6319                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6320                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6321                                 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6322                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6323                                 }
       
  6324                             else
       
  6325                                 {
       
  6326                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, EFalse );
       
  6327                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6328                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6329                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6330                                 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6331                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6332                                 }
       
  6333                             if ( media.IsSupported(
       
  6334                                 KMPXMediaGeneralNonPermissibleActions ) )
       
  6335                                 {
       
  6336                                 // check for auto playlist, disable delete
       
  6337                                 TMPXGeneralNonPermissibleActions attr(
       
  6338                                     media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  6339                                         KMPXMediaGeneralNonPermissibleActions ) );
       
  6340                                 if ( attr & EMPXWrite )
       
  6341                                     {
       
  6342                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6343                                     }
       
  6344                                 }
       
  6345                             aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6346                             TInt trackCount (0);                   
       
  6347                             if(media.IsSupported(KMPXMediaGeneralCount))
       
  6348                                 {
       
  6349                                 trackCount = media.ValueTObjectL<TInt>( KMPXMediaGeneralCount );
       
  6350                                 } 
       
  6351                             if( trackCount < 1 )
       
  6352                                 {
       
  6353                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6354                                 }   
       
  6355                             break;
       
  6356                             }
       
  6357 #ifdef SINGLE_CLICK_INCLUDED
       
  6358                         case EMPXAlbum:
       
  6359                             {
       
  6360                             // Album > Tracks view
       
  6361                             if ( iContainer->IsSelectedItemASong() )
       
  6362                                 {                            
       
  6363                                 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6364                                     {
       
  6365                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6366                                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6367                                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6368                                     aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6369                                     aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6370                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6371                                     aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6372                                     aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6373                                     }
       
  6374                                 else
       
  6375                                     {
       
  6376                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6377                                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6378                                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6379                                     aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6380                                     aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6381                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6382                                     aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6383                                     aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6384                                     }
       
  6385                                 }
       
  6386                             else
       
  6387                                 {
       
  6388                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6389                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6390                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6391                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6392                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6393                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6394                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6395                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );                                
       
  6396                                 }
       
  6397                             break;
       
  6398                             }
       
  6399                         case EMPXGenre:
       
  6400                             {
       
  6401                             // genre view
       
  6402                             if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6403                                 {
       
  6404                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6405                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6406                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6407                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6408                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6409                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6410                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6411                                 }
       
  6412                             else
       
  6413                                 {
       
  6414                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6415                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6416                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6417                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6418                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6419                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6420                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6421                                 }
       
  6422                             break;
       
  6423                             }
       
  6424 #endif
       
  6425                             
       
  6426 #ifdef SINGLE_CLICK_INCLUDED
       
  6427                         case EMPXArtist:  
       
  6428                         case EMPXComposer:
       
  6429 #else
       
  6430                         case EMPXAlbum:
       
  6431                         case EMPXArtist:
       
  6432                         case EMPXGenre:
       
  6433                         case EMPXComposer:
       
  6434 #endif
       
  6435                             {
       
  6436                             // artist, album, genre, composer view
       
  6437                             if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6438                                 {
       
  6439                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6440                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6441                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6442                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6443                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6444                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6445                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6446                                 }
       
  6447                             else
       
  6448                                 {
       
  6449                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6450                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6451                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6452                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6453                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6454                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6455                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6456                                 }
       
  6457                             break;
       
  6458                             }
       
  6459                         case EMPXSong:
       
  6460                             {
       
  6461                             // any tracks view except playlist tracks
       
  6462                             if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6463                                 {
       
  6464                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6465                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6466                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6467                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6468                                 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6469                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6470                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6471 #ifdef SINGLE_CLICK_INCLUDED
       
  6472                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6473 #endif
       
  6474                                 }
       
  6475                             else
       
  6476                                 {
       
  6477                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6478                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6479                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6480                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6481                                 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
       
  6482                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6483                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6484 #ifdef SINGLE_CLICK_INCLUDED
       
  6485                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6486 #endif
       
  6487                                 }
       
  6488                             break;
       
  6489                             }
       
  6490                         case EMPXCommand:
       
  6491                             {
       
  6492 							aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6493 							aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6494 							aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6495 							aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6496 							aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6497 							aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6498 							aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6499 #ifdef SINGLE_CLICK_INCLUDED
       
  6500                             aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6501 #endif
       
  6502 							
       
  6503                             }
       
  6504                             break;
       
  6505                         default:
       
  6506                             {
       
  6507                             ASSERT( 0 );
       
  6508                             break;
       
  6509                             }
       
  6510                         }
       
  6511                     }
       
  6512 
       
  6513                 if ( iUpnpFrameworkSupport )
       
  6514                     {
       
  6515                     HandleDynInitUpnpL( aResourceId, *aMenuPane );
       
  6516                     }
       
  6517                 else
       
  6518                     {
       
  6519                     aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6520                     aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6521                     }
       
  6522                 }
       
  6523             else
       
  6524                 {
       
  6525                 // list empty
       
  6526 
       
  6527                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist,
       
  6528                     ( containerType == EMPXGroup && containerCategory == EMPXPlaylist) ? // in playlist view?
       
  6529                     EFalse : ETrue );
       
  6530                 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist)
       
  6531                     {
       
  6532                     // in playlist tracks view
       
  6533                     if ( containerMedia.IsSupported(
       
  6534                         KMPXMediaGeneralNonPermissibleActions ) )
       
  6535                         {
       
  6536                         // check for auto playlist, disable add songs
       
  6537                         TMPXGeneralNonPermissibleActions attr(
       
  6538                             containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  6539                                 KMPXMediaGeneralNonPermissibleActions ) );
       
  6540                         if ( attr & EMPXWrite )
       
  6541                             {
       
  6542                             aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6543                             }
       
  6544                         }
       
  6545                     }
       
  6546                 else
       
  6547                     {
       
  6548                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6549                     }
       
  6550                 aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
       
  6551                 aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6552                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6553                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6554                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6555                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6556                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6557                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6558                 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
       
  6559                 }
       
  6560             break;
       
  6561             }
       
  6562         case R_MPX_COLLECTION_VIEW_MENU_2:
       
  6563             {
       
  6564             if ( !isListEmpty )
       
  6565                 {
       
  6566                 const CMPXMedia& media = array->MediaL( currentItem );
       
  6567                 TMPXGeneralType type(
       
  6568                     media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
       
  6569                 TMPXGeneralCategory category(
       
  6570                     media.ValueTObjectL<TMPXGeneralCategory>(
       
  6571                         KMPXMediaGeneralCategory ) );
       
  6572                 const CMPXMedia& containerMedia = array->ContainerMedia();
       
  6573                 TMPXGeneralType containerType(
       
  6574                     containerMedia.ValueTObjectL<TMPXGeneralType>(
       
  6575                         KMPXMediaGeneralType ) );
       
  6576                 TMPXGeneralCategory containerCategory(
       
  6577                     containerMedia.ValueTObjectL<TMPXGeneralCategory>(
       
  6578                         KMPXMediaGeneralCategory ) );
       
  6579                 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
       
  6580                 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
       
  6581                 if ( type == EMPXItem)
       
  6582                     {
       
  6583                     switch ( category )
       
  6584                         {
       
  6585                         case EMPXPlaylist:
       
  6586                             {
       
  6587                             // playlist view
       
  6588                             aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6589                             aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6590                             if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6591                                 {
       
  6592                                 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6593                                 }
       
  6594                             else
       
  6595                                 {
       
  6596                                 aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );
       
  6597                                 }
       
  6598                             aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6599                             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6600                             aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, EFalse );
       
  6601                             if ( media.IsSupported(
       
  6602                                 KMPXMediaGeneralNonPermissibleActions ) )
       
  6603                                 {
       
  6604                                 // check for auto playlist, disable delete
       
  6605                                 TMPXGeneralNonPermissibleActions attr(
       
  6606                                     media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
       
  6607                                         KMPXMediaGeneralNonPermissibleActions ) );
       
  6608                                 if ( attr & EMPXWrite )
       
  6609                                     {
       
  6610                                     aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6611                                     aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6612                                     }
       
  6613                                 }
       
  6614                             if ( array->IsItemBrokenLinkL( currentItem ) ||
       
  6615                                 array->IsItemCorruptedL( currentItem ) )
       
  6616                                 {
       
  6617                                 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6618                                 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6619                                 }
       
  6620                             break;
       
  6621                             }
       
  6622                         case EMPXAlbum:
       
  6623                         case EMPXArtist:
       
  6624                         case EMPXGenre:
       
  6625                         case EMPXComposer:
       
  6626                             {
       
  6627                             // artist, album, genre, composer view
       
  6628                             aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6629                             aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6630                             if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
       
  6631                                 {
       
  6632                                 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6633                                 }
       
  6634                             else
       
  6635                                 {
       
  6636 #ifdef SINGLE_CLICK_INCLUDED
       
  6637                                 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6638 #else
       
  6639                                 aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );                              
       
  6640 #endif
       
  6641                                 }
       
  6642 #ifndef SINGLE_CLICK_INCLUDED
       
  6643                             if ( category == EMPXAlbum )
       
  6644                                 {
       
  6645                                 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, EFalse );
       
  6646                                 // if unknown entry exist in album level, disable album art
       
  6647                                 // for last item, if unknown exist it'll be at this
       
  6648                                 // location
       
  6649                                 if ( array->IsCategoryUnknownExist() &&
       
  6650                                     category == EMPXAlbum &&
       
  6651                                     currentItem == iContainer->TotalListItemCount() - 1 )
       
  6652                                     {
       
  6653                                     aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6654                                     }
       
  6655                                 if ( containerCategory == EMPXArtist )
       
  6656                                     {
       
  6657                                     // in artist/album view, do not display album art/rename
       
  6658                                     // option on All ( first item in list )
       
  6659                                     if ( currentItem == 0 )
       
  6660                                         {
       
  6661                                         aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6662                                         aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6663                                         }
       
  6664                                     }
       
  6665                                 }
       
  6666                             else
       
  6667 #endif
       
  6668                                 {
       
  6669                                 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6670                                 }
       
  6671 #ifdef SINGLE_CLICK_INCLUDED
       
  6672                             if ( category == EMPXComposer )
       
  6673 #else
       
  6674                             if ( ( category == EMPXGenre ) || ( category == EMPXComposer ) )
       
  6675 #endif
       
  6676                                 {
       
  6677                                 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6678                                 }
       
  6679 #ifdef SINGLE_CLICK_INCLUDED
       
  6680                             else if ( category == EMPXGenre )
       
  6681                                 {
       
  6682                                 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
       
  6683                                 }
       
  6684 #endif
       
  6685                             else
       
  6686                                 {
       
  6687                                 if ( array->IsCategoryUnknownExist() &&
       
  6688                                     ( category == EMPXAlbum || category == EMPXArtist ) &&
       
  6689                                     currentItem == iContainer->TotalListItemCount() - 1 )
       
  6690                                     {
       
  6691                                     // if unknown entry exist in artist or album level
       
  6692                                     aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6693                                     }
       
  6694                                 else
       
  6695                                     {
       
  6696 #ifdef SINGLE_CLICK_INCLUDED
       
  6697                                     aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6698 #else
       
  6699                                     aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
       
  6700 #endif
       
  6701                                     }
       
  6702                                 }
       
  6703                             aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6704 
       
  6705                             if ( !iUsingNokiaService )
       
  6706                                 {
       
  6707                                 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6708                                 }
       
  6709                             break;
       
  6710                             }
       
  6711                         case EMPXSong:
       
  6712                             {
       
  6713                             // any tracks view
       
  6714 #ifdef __ENABLE_MSK
       
  6715                             // show context menu if MSK selected and there are
       
  6716                             // multiple selections; otherwise, show options menu
       
  6717                             if ( ( selectionCount > 0 ) && iShowContextMenu )
       
  6718                                 {
       
  6719                                 MenuBar()->SetMenuType(CEikMenuBar::EMenuContext);
       
  6720                                 iShowContextMenu = EFalse;
       
  6721                                 }
       
  6722                             else
       
  6723                                 {
       
  6724                                 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions);
       
  6725                                 }
       
  6726 #endif //__ENABLE_MSK
       
  6727 
       
  6728                             if ( selectionCount > 0 )
       
  6729                                 {
       
  6730                                 // multiple selection
       
  6731                                 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6732                                 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6733                                 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6734                                 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6735                                 }
       
  6736                             else
       
  6737                                 {
       
  6738                                 TBool fileDetailVisibility( FileDetailsOptionVisibilityL() );
       
  6739                                 // use the same criteria for showing/hiding song details
       
  6740                                 // and album art
       
  6741                                 aMenuPane->SetItemDimmed( EMPXCmdSongDetails,
       
  6742                                     fileDetailVisibility );
       
  6743                                 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6744 #ifdef SINGLE_CLICK_INCLUDED
       
  6745                                 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );  
       
  6746 #else
       
  6747                                 TBool vis = ETrue;
       
  6748                                 TRAPD( err, vis = SetAsRingToneOptionVisibilityL() );
       
  6749 
       
  6750                                 if ( err )
       
  6751                                     {
       
  6752                                     aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade,
       
  6753                                         ETrue); // dim the option if any sql error.
       
  6754                                     }
       
  6755                                 else
       
  6756                                     {
       
  6757                                     aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade,
       
  6758                                         vis);
       
  6759                                     }
       
  6760 #endif
       
  6761                                 
       
  6762                                 if ( array->IsItemBrokenLinkL( currentItem ) ||
       
  6763                                     array->IsItemCorruptedL( currentItem ) )
       
  6764                                     {
       
  6765                                     aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6766                                     aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6767                                     aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6768                                     aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); 
       
  6769                                     }
       
  6770                                 else // Show this option even when song is DRM protected
       
  6771                                     {
       
  6772 #ifdef SINGLE_CLICK_INCLUDED
       
  6773                                     aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6774 #else                                    
       
  6775                                     aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
       
  6776 #endif
       
  6777                                     }
       
  6778                                 }
       
  6779                             aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6780                             aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6781                             if ( !iUsingNokiaService )
       
  6782                                 {
       
  6783                                 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6784                                 }
       
  6785                             if (iServiceHandler->HandleSubmenuL(*aMenuPane))
       
  6786                                 {
       
  6787                                 return;
       
  6788                                 }
       
  6789                             break;
       
  6790                             }
       
  6791                         case EMPXCommand:
       
  6792                             {
       
  6793                             aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6794                             aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6795                             aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6796                             aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6797                             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6798                             aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6799 
       
  6800                             }
       
  6801                             break;
       
  6802                         default:
       
  6803                             {
       
  6804                             // other types, not handled
       
  6805                             break;
       
  6806                             }
       
  6807                         }
       
  6808                     }
       
  6809                 }
       
  6810             else
       
  6811                 {
       
  6812                 // list empty
       
  6813                 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
       
  6814                 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
       
  6815                 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
       
  6816                 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
       
  6817                 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
       
  6818                 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6819                 }
       
  6820             aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
       
  6821             break;
       
  6822             }
       
  6823         case R_MPX_ADD_TO_PL_SUB_MENU:
  6899         case R_MPX_ADD_TO_PL_SUB_MENU:
  6824             {
  6900             {
  6825             aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() );
  6901             aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() );
  6826             break;
  6902             break;
  6827             }
  6903             }
  6829             {
  6905             {
  6830             if ( iUpnpFrameworkSupport )
  6906             if ( iUpnpFrameworkSupport )
  6831                 {
  6907                 {
  6832                 AddPlayersNamesToMenuL( *aMenuPane );
  6908                 AddPlayersNamesToMenuL( *aMenuPane );
  6833                 }
  6909                 }
  6834             break;
       
  6835             }
       
  6836         case R_MPX_COLLECTION_VIEW_MUSIC_MENU:
       
  6837             {
       
  6838             MMPXPlaybackUtility* pdPlaybackUtility;
       
  6839             pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
       
  6840             MMPXSource* pdsource( pdPlaybackUtility->Source() );
       
  6841             MMPXSource* source( iPlaybackUtility->Source() );
       
  6842             TBool hideNowPlaying;
       
  6843             hideNowPlaying = ( (pdsource == 0)
       
  6844                            &&  (source == 0));
       
  6845             pdPlaybackUtility->Close();
       
  6846             if ( hideNowPlaying )
       
  6847                 {
       
  6848                 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
       
  6849                 }
       
  6850             if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
       
  6851                 {
       
  6852                 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
       
  6853                 }
       
  6854             aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
       
  6855             aMenuPane->SetItemDimmed(
       
  6856                 EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden );
       
  6857             if (iOperatorMusicStore)
       
  6858             	{
       
  6859             	aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6860             	}
       
  6861             else
       
  6862             	{
       
  6863             	aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6864           		}
       
  6865             break;
  6910             break;
  6866             }
  6911             }
  6867         case R_MPX_COLLECTION_VIEW_EMBEDDED_PLAYLIST_VIEW:
  6912         case R_MPX_COLLECTION_VIEW_EMBEDDED_PLAYLIST_VIEW:
  6868             {
  6913             {
  6869             // if it's from browser/messaging, display save option if
  6914             // if it's from browser/messaging, display save option if
  6870             // it has not been saved
  6915             // it has not been saved
  6871             aMenuPane->SetItemDimmed( EMPXCmdSavePlaylist,
  6916             aMenuPane->SetItemDimmed( EMPXCmdSavePlaylist,
  6872                 ( !iCommonUiHelper->IsHostMessagingBrowserL() || !MPXTlsHelper::NeedSave() ) );
  6917                 ( !iCommonUiHelper->IsHostMessagingBrowserL() || !MPXTlsHelper::NeedSave() ) );
       
  6918             TBool isListEmpty( iContainer->TotalListItemCount() == 0 );
  6873             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, isListEmpty );
  6919             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, isListEmpty );
  6874 
  6920 
  6875             break;
  6921             break;
  6876             }
  6922             }
  6877         case R_MPX_PLAYBACK_COLLECTION_MUSICSHOP_SUB_MENU:
  6923         case R_MPX_PLAYBACK_COLLECTION_MUSICSHOP_SUB_MENU:
  6894             // Do nothing
  6940             // Do nothing
  6895             break;
  6941             break;
  6896             }
  6942             }
  6897         }
  6943         }
  6898 
  6944 
  6899 #ifndef SINGLE_CLICK_INCLUDED
       
  6900 		if ( iServiceHandler->IsAiwMenu(aResourceId) && aResourceId == R_MPX_USE_AS_CASCADE )
       
  6901             {
       
  6902             MPX_DEBUG1( "CMPXCollectionViewHgImp::DynInitMenuPaneL(): Aiw menu for assign" );
       
  6903             CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
       
  6904             FillAiwParametersL(paramList);
       
  6905             iServiceHandler->InitializeMenuPaneL(*aMenuPane,
       
  6906                                                 aResourceId,
       
  6907                                                 EMPXCmdAiwCmdAssign,
       
  6908                                                 paramList);
       
  6909             MPX_DEBUG1( "CMPXCollectionViewHgImp::DynInitMenuPaneL(): Aiw menu for assign end" );
       
  6910             }
       
  6911 #endif
       
  6912 
       
  6913     if (!(aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST && usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive))
  6945     if (!(aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST && usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive))
  6914         {
  6946         {
  6915         // Custom handling of menu pane for markable lists
  6947         // Custom handling of menu pane for markable lists
  6916         iContainer->HandleMarkableListDynInitMenuPane(
  6948         iContainer->HandleMarkableListDynInitMenuPane(
  6917             aResourceId,
  6949             aResourceId,
  6932     MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleListBoxEventL iLastDepth = %d", iLastDepth );
  6964     MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleListBoxEventL iLastDepth = %d", iLastDepth );
  6933     MPX_PERF_CHECKPT( "Select collection item to open" );
  6965     MPX_PERF_CHECKPT( "Select collection item to open" );
  6934     if ( iContainer )
  6966     if ( iContainer )
  6935         {
  6967         {
  6936         //to keep/change focus on right song in rename/remove
  6968         //to keep/change focus on right song in rename/remove
  6937 #ifdef SINGLE_CLICK_INCLUDED
       
  6938         if ( aEventType == EEventItemSingleClicked )         
  6969         if ( aEventType == EEventItemSingleClicked )         
  6939 #else
       
  6940         if ( aEventType == EEventItemClicked )
       
  6941 #endif
       
  6942             {
  6970             {
  6943             if ( !iHandlingKeyEvent && iCollectionCacheReady )
  6971             if ( !iHandlingKeyEvent && iCollectionCacheReady )
  6944                 {
  6972                 {
  6945                 CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
  6973                 CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
  6946                 TInt currentIndex( iContainer->CurrentLbxItemIndex() );
  6974                 TInt currentIndex( iContainer->CurrentLbxItemIndex() );
  6955                 CleanupStack::PopAndDestroy( command );
  6983                 CleanupStack::PopAndDestroy( command );
  6956                 }
  6984                 }
  6957             }
  6985             }
  6958 
  6986 
  6959         if ( aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked
  6987         if ( aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked
  6960 #ifdef SINGLE_CLICK_INCLUDED
       
  6961             || aEventType == EEventItemSingleClicked
  6988             || aEventType == EEventItemSingleClicked
  6962 #endif
       
  6963            )
  6989            )
  6964             {
  6990             {
  6965             if ( iContainer->IsInReorderMode() )
  6991             if ( iContainer->IsInReorderMode() )
  6966                 {
  6992                 {
  6967                 ProcessCommandL( iContainer->IsInReorderMode() ?
  6993                 ProcessCommandL( iContainer->IsInReorderMode() ?
  7744         {
  7770         {
  7745         if( iAddingSong )
  7771         if( iAddingSong )
  7746             {
  7772             {
  7747             iAddingSong = EFalse;
  7773             iAddingSong = EFalse;
  7748             TRAP_IGNORE( GetDurationL() );
  7774             TRAP_IGNORE( GetDurationL() );
  7749             TRAP_IGNORE( UpdateNaviPaneL() );
       
  7750             }
  7775             }
  7751         if( iInAlbumArtDialog )
  7776         if( iInAlbumArtDialog )
  7752             {
  7777             {
  7753             iInAlbumArtDialog = EFalse;
  7778             iInAlbumArtDialog = EFalse;
  7754             TRAP_IGNORE( UpdateTitlePaneL() );
  7779             TRAP_IGNORE( UpdateTitlePaneL() );
  7778 // -----------------------------------------------------------------------------
  7803 // -----------------------------------------------------------------------------
  7779 //
  7804 //
  7780 void CMPXCollectionViewHgImp::HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,
  7805 void CMPXCollectionViewHgImp::HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,
  7781                                                  const TVwsViewId& /*aViewIdToBeDeactivated */)
  7806                                                  const TVwsViewId& /*aViewIdToBeDeactivated */)
  7782     {
  7807     {
  7783     if( aNewlyActivatedViewId.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
       
  7784         aNewlyActivatedViewId.iViewUid == Id() )
       
  7785         {
       
  7786         TRAP_IGNORE( UpdateNaviPaneL() );
       
  7787         }
       
  7788     }
  7808     }
  7789 
  7809 
  7790 // -----------------------------------------------------------------------------
  7810 // -----------------------------------------------------------------------------
  7791 // CMPXCollectionViewHgImp::HandleViewDeactivation
  7811 // CMPXCollectionViewHgImp::HandleViewDeactivation
  7792 // -----------------------------------------------------------------------------
  7812 // -----------------------------------------------------------------------------
  7793 //
  7813 //
  7794 void CMPXCollectionViewHgImp::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
  7814 void CMPXCollectionViewHgImp::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
  7795                                                    const TVwsViewId& /*aNewlyActivatedViewId*/)
  7815                                                    const TVwsViewId& /*aNewlyActivatedViewId*/)
  7796     {
  7816     {
  7797     if( aViewIdToBeDeactivated.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
       
  7798         aViewIdToBeDeactivated.iViewUid == Id() )
       
  7799         {
       
  7800         if( iContainer )
       
  7801             {
       
  7802             if ( iNaviPane && iNaviDecorator )
       
  7803                 {
       
  7804                 if (iNaviPane->Top() == iNaviDecorator) // Only pop if it's the top, don't pop when it's behind a dialog
       
  7805                     iNaviPane->Pop( iNaviDecorator );
       
  7806                 }
       
  7807             }
       
  7808         }
       
  7809     }
  7817     }
  7810 
  7818 
  7811 // -----------------------------------------------------------------------------
  7819 // -----------------------------------------------------------------------------
  7812 // CMPXCollectionViewHgImp::FillAiwParameters
  7820 // CMPXCollectionViewHgImp::FillAiwParameters
  7813 // -----------------------------------------------------------------------------
  7821 // -----------------------------------------------------------------------------
  8046             cba->MakeVisible( EFalse );
  8054             cba->MakeVisible( EFalse );
  8047             cba->DrawDeferred();
  8055             cba->DrawDeferred();
  8048             }
  8056             }
  8049         else if ( cba )
  8057         else if ( cba )
  8050             {
  8058             {
  8051             cba->SetCommandSetL(
  8059 			if ( iContainer->IsTBoneView() )
  8052                 ( cpath->Levels() == 3 && !iIsEmbedded ) ?
  8060 				{
  8053                 R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK );
  8061             	cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  8062 				}
       
  8063 			else
       
  8064 				{
       
  8065 				cba->SetCommandSetL(
       
  8066 					( cpath->Levels() == 3 && !iIsEmbedded ) ?
       
  8067 					R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK );
       
  8068 				}
  8054             cba->MakeVisible( ETrue );
  8069             cba->MakeVisible( ETrue );
  8055             cba->DrawDeferred();
  8070             cba->DrawDeferred();
  8056             }
  8071             }
  8057         CleanupStack::PopAndDestroy(cpath);
  8072         CleanupStack::PopAndDestroy(cpath);
  8058         });
  8073         });
  8124 	CleanupStack::PushL( path );
  8139 	CleanupStack::PushL( path );
  8125 	iCollectionUtility->Collection().OpenL( *path );
  8140 	iCollectionUtility->Collection().OpenL( *path );
  8126 	CleanupStack::PopAndDestroy( path );
  8141 	CleanupStack::PopAndDestroy( path );
  8127 	}
  8142 	}
  8128 
  8143 
  8129 // -----------------------------------------------------------------------------
  8144 
  8130 // CMPXCollectionViewHgImp::IADCheckTimerCallBack
  8145 
  8131 // -----------------------------------------------------------------------------
  8146 // -----------------------------------------------------------------------------
  8132 //
  8147 // CMPXCollectionViewHgImp::SaveSelectedAlbum
  8133 TInt CMPXCollectionViewHgImp::IADCheckTimerCallBack(TAny* aHgViewObject)
  8148 // -----------------------------------------------------------------------------
  8134 	{
  8149 //
  8135 	MPX_FUNC( "CMPXCollectionViewHgImp::IADCheckTimerCallBack" );
  8150 void CMPXCollectionViewHgImp::SaveSelectedAlbum (CMPXMedia &aMedia)
  8136 
  8151     {
  8137 	if (aHgViewObject)
  8152     MPX_FUNC( "CMPXCollectionViewHgImp::SaveSelectedAlbum" );
  8138 	   {
  8153     if (iStoredAlbum)
  8139 	   CMPXCollectionViewHgImp* hgViewObject = static_cast<CMPXCollectionViewHgImp*>(aHgViewObject);
  8154 		{
  8140 	   hgViewObject->StartCheckingforIADUpdates();
  8155 		delete iStoredAlbum;
  8141 	   }
  8156 		}
  8142 
  8157     iStoredAlbum = CMPXMedia::NewL(aMedia);
  8143 	return KErrNone;
  8158     }
  8144 	}
  8159 
  8145 
  8160 
  8146 // -----------------------------------------------------------------------------
  8161 // -----------------------------------------------------------------------------
  8147 // CMPXCollectionViewHgImp::StartCheckingforIADUpdates
  8162 // CMPXCollectionViewHgImp::RestoreSelectedAlbum
  8148 // -----------------------------------------------------------------------------
  8163 // -----------------------------------------------------------------------------
  8149 //
  8164 //
  8150 void CMPXCollectionViewHgImp::StartCheckingforIADUpdates()
  8165 const CMPXMedia* CMPXCollectionViewHgImp::RestoreSelectedAlbum ()
  8151 	{
  8166     {
  8152 	MPX_FUNC( "CMPXCollectionViewHgImp::StartCheckingforIADUpdates" );
  8167     MPX_FUNC( "CMPXCollectionViewHgImp::RestoreSelectedAlbum" );
  8153 
  8168 
  8154 	if ( iTimer )
  8169 	return iStoredAlbum;
  8155     	{
  8170     }
  8156      	iTimer->Cancel();
       
  8157 	    delete iTimer;
       
  8158 	    iTimer = NULL;
       
  8159        	}
       
  8160 
       
  8161 	AppUi()->HandleCommandL(EMPXCmdCheckIADUpdates);
       
  8162 	}
       
  8163 	
       
  8164 
  8171 
  8165 //  End of File
  8172 //  End of File