mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp
branchRCL_3
changeset 15 171e07ac910f
parent 14 943ff5625028
child 17 c8156a91d13c
equal deleted inserted replaced
14:943ff5625028 15:171e07ac910f
    35 #include <avkon.rsg>
    35 #include <avkon.rsg>
    36 #include <avkon.mbg>
    36 #include <avkon.mbg>
    37 #include <sendui.h>
    37 #include <sendui.h>
    38 #include <CMessageData.h>
    38 #include <CMessageData.h>
    39 #include <centralrepository.h>
    39 #include <centralrepository.h>
    40 #include <mprofileengine.h>
    40 #include <MProfileEngine.h>
    41 #include <akndlgshut.h>
    41 #include <AknDlgShut.h>
    42 #ifdef RD_MULTIPLE_DRIVE
    42 #ifdef RD_MULTIPLE_DRIVE
    43 #include <driveinfo.h>
    43 #include <driveinfo.h>
    44 #endif //RD_MULTIPLE_DRIVE
    44 #endif //RD_MULTIPLE_DRIVE
    45 
    45 
    46 #include <upnpcopycommand.h>
    46 #include <upnpcopycommand.h>
    47 #include <AiwServiceHandler.h>  //Copy to remote feature
    47 #include <AiwServiceHandler.h>  //Copy to remote feature
    48 
    48 
    49 #include <mediarecognizer.h>
    49 #include <mediarecognizer.h>
    50 #include <featmgr.h>
    50 #include <featmgr.h>
    51 #include <aknmediatorfacade.h>
    51 #include <AknMediatorFacade.h>
    52 #include <MediatorCommandInitiator.h>
    52 #include <MediatorCommandInitiator.h>
    53 #include <mediatordomainuids.h>
    53 #include <MediatorDomainUIDs.h>
    54 
    54 
    55 #include <mplayersecondarydisplayapi.h>
    55 #include <mplayersecondarydisplayapi.h>
    56 #include <data_caging_path_literals.hrh>
    56 #include <data_caging_path_literals.hrh>
    57 #include <layoutmetadata.cdl.h>
    57 #include <layoutmetadata.cdl.h>
    58 #include <mpxplaybackframeworkdefs.h>
    58 #include <mpxplaybackframeworkdefs.h>
   128 
   128 
   129 const TInt KIncrementalDelayNone = 0;
   129 const TInt KIncrementalDelayNone = 0;
   130 const TInt KIncrementalDelayHalfSecond = 1000000;
   130 const TInt KIncrementalDelayHalfSecond = 1000000;
   131 const TInt KIncrementalFetchBlockSize = 400;
   131 const TInt KIncrementalFetchBlockSize = 400;
   132 const TInt KIncrementalDirectionCount = 8;
   132 const TInt KIncrementalDirectionCount = 8;
   133 const TInt KProgressBarMaxValue = 100;  // Max Value for the Progress Info bar
       
   134 const TInt KWaitNoteImpUid = 0x101FFC6C; // refresh wait note UID
   133 const TInt KWaitNoteImpUid = 0x101FFC6C; // refresh wait note UID
   135 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
   134 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
   136 const TInt KMusicMenuPodcastMenuItemIndex = 4; // podcast menu item index
   135 const TInt KMusicMenuPodcastMenuItemIndex = 4; // podcast menu item index
   137 #define KPodcastCollectionUid 0x101FFC3C
   136 #define KPodcastCollectionUid 0x101FFC3C
   138 #endif
   137 #endif
   285     if ( iContainer )
   284     if ( iContainer )
   286         {
   285         {
   287         AppUi()->RemoveFromStack( iContainer );
   286         AppUi()->RemoveFromStack( iContainer );
   288         delete iContainer;
   287         delete iContainer;
   289         }
   288         }
   290 
   289     if( iTitleWait )
       
   290 	    {
       
   291 	    delete iTitleWait;
       
   292 		}
   291     delete iUserPlaylists;
   293     delete iUserPlaylists;
   292     delete iCommonUiHelper;
   294     delete iCommonUiHelper;
   293     delete iSendUi;
   295     delete iSendUi;
   294     delete iTitle;
   296     delete iTitle;
   295     delete iDuration;
   297     delete iDuration;
   320     iPlayIndex( KErrNotFound ),
   322     iPlayIndex( KErrNotFound ),
   321     iSetMediaLCount( KErrNotFound ),
   323     iSetMediaLCount( KErrNotFound ),
   322     iCurrentHighlightedIndex( KErrNotFound ),
   324     iCurrentHighlightedIndex( KErrNotFound ),
   323     iCachedCommand( KErrNotFound ),
   325     iCachedCommand( KErrNotFound ),
   324     iNoteType( EMPXNoteNotDefined ),
   326     iNoteType( EMPXNoteNotDefined ),
   325 	iFirstIncrementalBatch( ETrue )
   327 	iFirstIncrementalBatch( ETrue ),
       
   328 	iDialogDismissed( EFalse ),
       
   329 	iTitleWait( NULL )
   326 	{
   330 	{
   327     MPX_FUNC( "CMPXCollectionViewHgImp::CMPXCollectionViewHgImp" );
   331     MPX_FUNC( "CMPXCollectionViewHgImp::CMPXCollectionViewHgImp" );
   328     iUsingNokiaService = EFalse;
   332     iUsingNokiaService = EFalse;
   329 #ifdef __ENABLE_MSK
   333 #ifdef __ENABLE_MSK
   330     iCurrentMskId = KErrNotFound;
   334     iCurrentMskId = KErrNotFound;
   624     TBool isIgnore( iContainer->IsInReorderMode() || iIsDeleting );
   628     TBool isIgnore( iContainer->IsInReorderMode() || iIsDeleting );
   625 
   629 
   626     if ( !isIgnore  && iCollectionReady )
   630     if ( !isIgnore  && iCollectionReady )
   627         {
   631         {
   628         CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
   632         CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
   629         const CMPXMedia& containerMedia( listboxArray->ContainerMedia() );
       
   630         
       
   631         const TMPXItemId containerId = containerMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
   632 
   633 
   633         HBufC* promptTxt( NULL );
   634         HBufC* promptTxt( NULL );
   634         HBufC* waitNoteText( NULL );
   635         HBufC* waitNoteText( NULL );
   635         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   636         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   636         
   637         
   655                 // tracks level in Tbone View
   656                 // tracks level in Tbone View
   656                 TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
   657                 TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
   657                 const TDesC& trackTitle( albumTrack->ValueText( KMPXMediaGeneralTitle ) );
   658                 const TDesC& trackTitle( albumTrack->ValueText( KMPXMediaGeneralTitle ) );
   658                 // create the item path to delete
   659                 // create the item path to delete
   659 
   660 
   660                  if ( path->Levels() == 3 )
   661                 if ( 2 == path->Levels() )
       
   662                     {
       
   663                     path->Back();
       
   664                     path->AppendL(3);
       
   665                     }
       
   666                  else if ( path->Levels() == 3 )
   661 					{
   667 					{
   662 					path->Back();
   668 					path->Back();
   663 					}
   669 					}
   664 				 else if (path->Levels() == 4)
   670 				 else if (path->Levels() == 4)
   665 					{
   671 					{
   666 					path->Back();
   672 					path->Back();
   667 					path->Back();
   673 					path->Back();
   668 					}
   674 					}
   669 
   675 
   670 
   676                 TInt currentIndex( iContainer->CurrentLbxItemIndex() );
   671                  path->AppendL(containerId);
   677                 const CMPXMediaArray& albums = listboxArray->MediaArray();
   672                  path->AppendL(trackId);
   678                 CMPXMedia* album( albums.AtL( currentIndex ) );
       
   679                 const TMPXItemId albumId = album->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
   680 
       
   681                 path->AppendL(albumId);
       
   682                 path->AppendL(trackId);
       
   683                  
       
   684                 MPX_DEBUG_PATH(*path);
   673 
   685 
   674                 waitNoteText = StringLoader::LoadLC(
   686                 waitNoteText = StringLoader::LoadLC(
   675                     R_MPX_QTN_ALBUM_WAITING_DELETING, trackTitle );
   687                     R_MPX_QTN_ALBUM_WAITING_DELETING, trackTitle );
   676                 promptTxt = StringLoader::LoadLC(
   688                 promptTxt = StringLoader::LoadLC(
   677                     R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
   689                     R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
   701                     HandleCommandL( EMPXCmdIgnoreExternalCommand );
   713                     HandleCommandL( EMPXCmdIgnoreExternalCommand );
   702                     MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
   714                     MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
   703                     if(iCachedCommand != aCommand)
   715                     if(iCachedCommand != aCommand)
   704                         {
   716                         {
   705                         iIsWaitNoteCanceled = EFalse;
   717                         iIsWaitNoteCanceled = EFalse;
       
   718                         StartDeleteWaitNoteL();
       
   719                         TPtr buf = waitNoteText->Des();
       
   720                         UpdateProcessL( buf );
   706                         }
   721                         }
   707                     if ( !iIsWaitNoteCanceled )
   722                     if ( !iIsWaitNoteCanceled )
   708                         {
   723                         {
   709                         iIsDeleting = ETrue;
   724                         iIsDeleting = ETrue;
   710                         iCollectionUiHelper->DeleteL( *path, this );
   725                         iCollectionUiHelper->DeleteL( *path, this );
   796     if ( !isIgnore )
   811     if ( !isIgnore )
   797         {
   812         {
   798         // Create a copy of collection path
   813         // Create a copy of collection path
   799         CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
   814         CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
   800         CleanupStack::PushL( path );
   815         CleanupStack::PushL( path );
       
   816         
       
   817         if ( 2 == path->Levels() )
       
   818              {
       
   819              path->Back();
       
   820              path->AppendL(3);
       
   821              
       
   822              const CMPXMediaArray& albums = listboxArray->MediaArray();
       
   823              
       
   824              RArray<TMPXItemId> ids;
       
   825              CleanupClosePushL(ids);
       
   826 
       
   827              TInt albumCount = albums.Count();
       
   828               for (TInt i=0; i<albumCount; ++i)
       
   829                   {
       
   830                   CMPXMedia* album = albums.AtL(i);
       
   831                   const TMPXItemId id = album->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
   832                   ids.AppendL(id);
       
   833                   }
       
   834               path->AppendL(ids.Array()); // top level items
       
   835               ids.Reset();
       
   836               path->Set(currentIndex);
       
   837               CleanupStack::PopAndDestroy(&ids);             
       
   838              }
       
   839         MPX_DEBUG_PATH(*path);
       
   840         
   801         HBufC* promptTxt( NULL );
   841         HBufC* promptTxt( NULL );
   802         HBufC* waitNoteText( NULL );
   842         HBufC* waitNoteText( NULL );
   803         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   843         TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
   804         MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array count = %d", arrayCount );
   844         MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array count = %d", arrayCount );
   805 
   845 
   806         // delete single song, not show wait note
       
   807         TBool singleSong( EFalse );
       
   808         TMPXGeneralType containerType(
   846         TMPXGeneralType containerType(
   809             containerMedia.ValueTObjectL<TMPXGeneralType>(
   847             containerMedia.ValueTObjectL<TMPXGeneralType>(
   810                 KMPXMediaGeneralType ) );
   848                 KMPXMediaGeneralType ) );
   811         TMPXGeneralCategory containerCategory(
   849         TMPXGeneralCategory containerCategory(
   812             containerMedia.ValueTObjectL<TMPXGeneralCategory>(
   850             containerMedia.ValueTObjectL<TMPXGeneralCategory>(
   904             else
   942             else
   905                 {
   943                 {
   906                 if ( ( type == EMPXItem && category == EMPXSong ) ||
   944                 if ( ( type == EMPXItem && category == EMPXSong ) ||
   907                     ( type == EMPXItem && category == EMPXPlaylist ) )
   945                     ( type == EMPXItem && category == EMPXPlaylist ) )
   908                     {
   946                     {
   909                     // delete single song
       
   910                     if ( type == EMPXItem && category == EMPXSong )
       
   911                         {
       
   912                         singleSong = ETrue;
       
   913                         }
       
   914                     // tracks level, or deleting a playlist
   947                     // tracks level, or deleting a playlist
   915                     waitNoteText = StringLoader::LoadLC(
   948                     waitNoteText = StringLoader::LoadLC(
   916                         R_MPX_QTN_ALBUM_WAITING_DELETING, title );
   949                         R_MPX_QTN_ALBUM_WAITING_DELETING, title );
   917                     promptTxt = StringLoader::LoadLC(
   950                     promptTxt = StringLoader::LoadLC(
   918                         R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
   951                         R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
  1027 // Cover UI end
  1060 // Cover UI end
  1028             MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
  1061             MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
  1029             if(iCachedCommand != aCommand)
  1062             if(iCachedCommand != aCommand)
  1030                 {
  1063                 {
  1031                 iIsWaitNoteCanceled = EFalse;
  1064                 iIsWaitNoteCanceled = EFalse;
  1032                 // If delete one song, don't show progress note.
  1065                 StartDeleteWaitNoteL();
  1033                 if ( !singleSong )
  1066 				TPtr buf = waitNoteText->Des();
  1034                     {
  1067 				UpdateProcessL( buf );
  1035                     StartProgressNoteL();
       
  1036                     TPtr buf = waitNoteText->Des();
       
  1037                     UpdateProcessL(0, buf);
       
  1038                     }
       
  1039                 }
  1068                 }
  1040 
  1069 
  1041                 if ( !iIsWaitNoteCanceled )
  1070                 if ( !iIsWaitNoteCanceled )
  1042                     {
  1071                     {
  1043                     iIsDeleting = ETrue;
  1072                     iIsDeleting = ETrue;
  1388         CleanupStack::PopAndDestroy( arg );
  1417         CleanupStack::PopAndDestroy( arg );
  1389         }
  1418         }
  1390     }
  1419     }
  1391 
  1420 
  1392 // ---------------------------------------------------------------------------
  1421 // ---------------------------------------------------------------------------
  1393 // Start a Progress note
  1422 // Start a Wait note
  1394 // ---------------------------------------------------------------------------
  1423 // ---------------------------------------------------------------------------
  1395 //
  1424 //
  1396 void CMPXCollectionViewHgImp::StartProgressNoteL()
  1425 void CMPXCollectionViewHgImp::StartDeleteWaitNoteL()
  1397     {
  1426     {
  1398     iProgressDialog = new (ELeave) CAknProgressDialog(
  1427     iWaitDialog = new (ELeave) CAknWaitDialog(
  1399         (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)),
  1428         (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)),
  1400         ETrue);
  1429         ETrue);
  1401     iProgressDialog->PrepareLC(R_MPX_PROGRESS_NOTE);
  1430     iWaitDialog->PrepareLC(R_MPX_WAIT_NOTE);
  1402     iProgressInfo = iProgressDialog->GetProgressInfoL();
  1431 
  1403     iProgressDialog->SetCallback(this);
  1432     iWaitDialog->SetCallback(this);
  1404     iProgressDialog->RunLD();
  1433     iWaitDialog->RunLD();
  1405     iProgressInfo->SetFinalValue(KProgressBarMaxValue);
       
  1406     }
  1434     }
  1407 
  1435 
  1408 // ---------------------------------------------------------------------------
  1436 // ---------------------------------------------------------------------------
  1409 // Update the Progress note
  1437 // Update the Progress note
  1410 // ---------------------------------------------------------------------------
  1438 // ---------------------------------------------------------------------------
  1411 //
  1439 //
  1412 void CMPXCollectionViewHgImp::UpdateProcessL( TInt aProgress, const TDesC& aProgressText )
  1440 void CMPXCollectionViewHgImp::UpdateProcessL( const TDesC& aProgressText )
  1413     {
  1441     {
  1414     if ( iProgressDialog )
  1442     if ( iWaitDialog )
  1415         {
  1443         {
  1416         iProgressDialog->SetTextL(aProgressText);
  1444         iWaitDialog->SetTextL(aProgressText);
  1417         iProgressInfo->SetAndDraw(aProgress);
       
  1418         }
  1445         }
  1419     }
  1446     }
  1420 
  1447 
  1421 // ---------------------------------------------------------------------------
  1448 // ---------------------------------------------------------------------------
  1422 // Close waitnote dialog
  1449 // Close waitnote dialog
  2741             isHidden = !isValid;
  2768             isHidden = !isValid;
  2742             }
  2769             }
  2743         else
  2770         else
  2744             {
  2771             {
  2745             //single selection
  2772             //single selection
  2746             isHidden = array->IsItemBrokenLinkL(
  2773             TInt currentIndex( iContainer->CurrentLbxItemIndex() );
  2747                 iContainer->CurrentLbxItemIndex() );
  2774             if( currentIndex > KErrNotFound )
  2748             isHidden = isHidden ||
  2775                 {   
  2749                 array->IsItemCorruptedL(
  2776                 isHidden = array->IsItemBrokenLinkL( currentIndex );
  2750                 iContainer->CurrentLbxItemIndex() );
  2777                 isHidden = isHidden || array->IsItemCorruptedL( currentIndex );
       
  2778                 }
       
  2779 			else
       
  2780                 {
       
  2781                 isHidden = ETrue;
       
  2782                 }	
  2751             }
  2783             }
  2752         }
  2784         }
  2753 
  2785 
  2754     return isHidden;
  2786     return isHidden;
  2755     }
  2787     }
  2894     CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
  2926     CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
  2895     CleanupStack::PushL( path );
  2927     CleanupStack::PushL( path );
  2896     
  2928     
  2897     CMPXMedia* albumTrack = iContainer->SelectedItemMediaL();
  2929     CMPXMedia* albumTrack = iContainer->SelectedItemMediaL();
  2898     TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
  2930     TMPXItemId trackId = albumTrack->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
  2899 
  2931     // create the item path to send
  2900     path->Back();
  2932 
  2901     path->Back();
  2933     if ( path->Levels() == 3 ) //TBone album level
       
  2934         {
       
  2935         path->Back();  
       
  2936         }
       
  2937     else if (path->Levels() == 4) //TBone Song Node level
       
  2938         {
       
  2939         path->Back();
       
  2940         path->Back();
       
  2941         }
  2902     path->AppendL(aContainerId);
  2942     path->AppendL(aContainerId);
  2903     path->AppendL(trackId); 
  2943     path->AppendL(trackId); 
  2904 
  2944 
  2905     RArray<TMPXAttribute> attrs;
  2945     RArray<TMPXAttribute> attrs;
  2906     CleanupClosePushL(attrs);
  2946     CleanupClosePushL(attrs);
  3672 void CMPXCollectionViewHgImp::HandleAddCompletedL(
  3712 void CMPXCollectionViewHgImp::HandleAddCompletedL(
  3673     CMPXMedia* aPlaylist, TInt aError )
  3713     CMPXMedia* aPlaylist, TInt aError )
  3674     {
  3714     {
  3675     MPX_FUNC( "CMPXCollectionViewHgImp::HandleAddCompletedL" );
  3715     MPX_FUNC( "CMPXCollectionViewHgImp::HandleAddCompletedL" );
  3676     iAddingToNewPlaylist = EFalse;
  3716     iAddingToNewPlaylist = EFalse;
       
  3717     iDialogDismissed = EFalse;
  3677     iCommonUiHelper->DismissWaitNoteL();
  3718     iCommonUiHelper->DismissWaitNoteL();
  3678     HandleCommandL( EMPXCmdHandleExternalCommand );
  3719     HandleCommandL( EMPXCmdHandleExternalCommand );
  3679     if ( aError == KErrNone )
  3720     if ( aError == KErrNone )
  3680         {
  3721         {
  3681         // Show confirmation note
  3722         // Show confirmation note
  3684             iPlaylistId = aPlaylist->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
  3725             iPlaylistId = aPlaylist->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
  3685             }
  3726             }
  3686         MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleAddCompletedL iPlaylistId = 0x%x", iPlaylistId.iId1 );
  3727         MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleAddCompletedL iPlaylistId = 0x%x", iPlaylistId.iId1 );
  3687         if ( iCurrentPlaylistOp != EMPXOpPLCreating )
  3728         if ( iCurrentPlaylistOp != EMPXOpPLCreating )
  3688             {
  3729             {
  3689             HBufC* confirmTxt( NULL );
  3730             if( !iTitleWait )
  3690             const TDesC& title( aPlaylist->ValueText( KMPXMediaGeneralTitle ) );
  3731                 {
  3691             TMPlayerSecondaryDisplayNote noteId( EMPlayerNoteNone );
  3732                 delete iTitleWait;
  3692             if ( iNumSongAddedToPlaylist > 1 )
  3733                 iTitleWait = NULL;
  3693                 {
  3734                 }
  3694                 confirmTxt = StringLoader::LoadLC(
  3735             iTitleWait = aPlaylist->ValueText( KMPXMediaGeneralTitle ).AllocL();
  3695                     R_MPX_QTN_MUS_MULTIPLE_TRACKS_ADDED_TO_PL,
  3736             if( iDialogDismissed )
  3696                     title, iNumSongAddedToPlaylist );
  3737                 {
  3697                 noteId = EMPlayerNoteAddManySongToPlaylist;
  3738                 ShowAddedItemsDialogL();
  3698                 }
  3739                 }
  3699             else
       
  3700                 {
       
  3701                 confirmTxt = StringLoader::LoadLC(
       
  3702                     R_MPX_QTN_MUS_NOTE_TRACK_ADDED_TO_PL, title );
       
  3703                 noteId = EMPlayerNoteAddSongToPlaylist;
       
  3704                 }
       
  3705 
       
  3706             CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote();
       
  3707 
       
  3708             note->PublishDialogL(
       
  3709                 noteId,
       
  3710                 KMPlayerNoteCategory );
       
  3711 
       
  3712             if ( iCoverDisplay )
       
  3713                 {
       
  3714                 CAknMediatorFacade* covercl = AknMediatorFacade( note );
       
  3715                 if ( covercl )
       
  3716                     {
       
  3717                     covercl->BufStream() << title;
       
  3718                     if ( iNumSongAddedToPlaylist > 1 )
       
  3719                         {
       
  3720                         covercl->BufStream().WriteInt32L( iNumSongAddedToPlaylist );
       
  3721                         }
       
  3722                     }
       
  3723                 }
       
  3724 
       
  3725             note->ExecuteLD( *confirmTxt );
       
  3726             CleanupStack::PopAndDestroy( confirmTxt );
       
  3727 
       
  3728             }
  3740             }
  3729         else // iCurrentPlaylistOp == EMPXOpPLCreating
  3741         else // iCurrentPlaylistOp == EMPXOpPLCreating
  3730             {
  3742             {
  3731             // Re-open the collection, because we cannot
  3743             // Re-open the collection, because we cannot
  3732             // depend on the change events that could be a race condition
  3744             // depend on the change events that could be a race condition
  3743     delete aPlaylist;
  3755     delete aPlaylist;
  3744     if ( iContainer )
  3756     if ( iContainer )
  3745         {
  3757         {
  3746         iContainer->ClearLbxSelection();
  3758         iContainer->ClearLbxSelection();
  3747         }
  3759         }
       
  3760     }
       
  3761 
       
  3762 // ---------------------------------------------------------------------------
       
  3763 // Shows the added items dialog
       
  3764 // ---------------------------------------------------------------------------
       
  3765 //
       
  3766 void CMPXCollectionViewHgImp::ShowAddedItemsDialogL()
       
  3767     {
       
  3768     HBufC* confirmTxt( NULL );
       
  3769     
       
  3770     TMPlayerSecondaryDisplayNote noteId( EMPlayerNoteNone );
       
  3771     if ( iNumSongAddedToPlaylist > 1 )
       
  3772         {
       
  3773         
       
  3774         confirmTxt = StringLoader::LoadLC(
       
  3775             R_MPX_QTN_MUS_MULTIPLE_TRACKS_ADDED_TO_PL,
       
  3776             iTitleWait->Des(), iNumSongAddedToPlaylist );
       
  3777         noteId = EMPlayerNoteAddManySongToPlaylist;
       
  3778         }
       
  3779     else
       
  3780         {
       
  3781         confirmTxt = StringLoader::LoadLC(
       
  3782             R_MPX_QTN_MUS_NOTE_TRACK_ADDED_TO_PL, iTitleWait->Des() );
       
  3783         noteId = EMPlayerNoteAddSongToPlaylist;
       
  3784         }
       
  3785     
       
  3786     CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote();
       
  3787 
       
  3788     note->PublishDialogL(
       
  3789         noteId,
       
  3790         KMPlayerNoteCategory );
       
  3791 
       
  3792     if ( iCoverDisplay )
       
  3793         {
       
  3794         CAknMediatorFacade* covercl = AknMediatorFacade( note );
       
  3795         if ( covercl )
       
  3796             {
       
  3797             covercl->BufStream() << iTitleWait;
       
  3798             if ( iNumSongAddedToPlaylist > 1 )
       
  3799                 {
       
  3800                 covercl->BufStream().WriteInt32L( iNumSongAddedToPlaylist );
       
  3801                 }
       
  3802             }
       
  3803         }
       
  3804     note->ExecuteLD( *confirmTxt );
       
  3805     CleanupStack::PopAndDestroy( confirmTxt );
       
  3806 	if( iTitleWait )
       
  3807 	    {
       
  3808 	    delete iTitleWait;
       
  3809 	    iTitleWait = NULL;
       
  3810 		}
  3748     }
  3811     }
  3749 
  3812 
  3750 // -----------------------------------------------------------------------------
  3813 // -----------------------------------------------------------------------------
  3751 // Handles the completion of setting a media event.
  3814 // Handles the completion of setting a media event.
  3752 // -----------------------------------------------------------------------------
  3815 // -----------------------------------------------------------------------------
  4090 // Callback method. Get's called when a dialog is dismissed
  4153 // Callback method. Get's called when a dialog is dismissed
  4091 // ---------------------------------------------------------------------------
  4154 // ---------------------------------------------------------------------------
  4092 //
  4155 //
  4093 void CMPXCollectionViewHgImp::DialogDismissedL( TInt aButtonId )
  4156 void CMPXCollectionViewHgImp::DialogDismissedL( TInt aButtonId )
  4094     {
  4157     {
       
  4158     iDialogDismissed = ETrue;
  4095     MPX_FUNC( "CMPXCollectionViewHgImp::DialogDismissedL" );
  4159     MPX_FUNC( "CMPXCollectionViewHgImp::DialogDismissedL" );
  4096     if ( iCommandInitiator )
  4160     if ( iCommandInitiator )
  4097         {
  4161         {
  4098         iCommandInitiator->CancelCommand( KMediatorSecondaryDisplayDomain,
  4162         iCommandInitiator->CancelCommand( KMediatorSecondaryDisplayDomain,
  4099                                       KMPlayerNoteCategory,
  4163                                       KMPlayerNoteCategory,
  4122             else if ( iIsAddingToPlaylist )
  4186             else if ( iIsAddingToPlaylist )
  4123                 {
  4187                 {
  4124                 // cancel incremental adding of songs
  4188                 // cancel incremental adding of songs
  4125                 iCommonUiHelper->CancelCollectionOperation();
  4189                 iCommonUiHelper->CancelCollectionOperation();
  4126                 iIsAddingToPlaylist = EFalse;
  4190                 iIsAddingToPlaylist = EFalse;
       
  4191                 }
       
  4192             break;
       
  4193             }
       
  4194         case EAknSoftkeyDone:
       
  4195             {
       
  4196             // Double check that we should be showing the dialog
       
  4197             if( iTitleWait )
       
  4198                 {
       
  4199                 ShowAddedItemsDialogL();
  4127                 }
  4200                 }
  4128             break;
  4201             break;
  4129             }
  4202             }
  4130         default:
  4203         default:
  4131             {
  4204             {
  4513         }
  4586         }
  4514     if ( iIsDeleting )
  4587     if ( iIsDeleting )
  4515         {
  4588         {
  4516         // nothing else to delete
  4589         // nothing else to delete
  4517         iIsDeleting = EFalse;
  4590         iIsDeleting = EFalse;
  4518         if ( iProgressDialog )
  4591         if ( iWaitDialog )
  4519             {
  4592             {
  4520             iProgressDialog->ProcessFinishedL();
  4593             iWaitDialog->ProcessFinishedL();
  4521             }
  4594             }
  4522         HandleCommandL( EMPXCmdHandleExternalCommand );
  4595         HandleCommandL( EMPXCmdHandleExternalCommand );
  4523         }
  4596         }
  4524     if ( iPlayIndex > KErrNotFound )
  4597     if ( iPlayIndex > KErrNotFound )
  4525         {
  4598         {
  4889                 {
  4962                 {
  4890                 if ( !iIsWaitNoteCanceled )
  4963                 if ( !iIsWaitNoteCanceled )
  4891                     {
  4964                     {
  4892                     // only dismiss wait note if the wait note is not
  4965                     // only dismiss wait note if the wait note is not
  4893                     // canceled
  4966                     // canceled
  4894                     if ( iProgressDialog )
  4967                     if ( iWaitDialog )
  4895                         {
  4968                         {
  4896                         iProgressDialog->ProcessFinishedL();
  4969                         iWaitDialog->ProcessFinishedL();
  4897                         }
  4970                         }
  4898                     HandleCommandL( EMPXCmdHandleExternalCommand );
  4971                     HandleCommandL( EMPXCmdHandleExternalCommand );
  4899                     iIsWaitNoteCanceled = EFalse;
  4972                     iIsWaitNoteCanceled = EFalse;
  4900                     }
  4973                     }
  4901                 if ( iIsDeleting )
  4974                 if ( iIsDeleting )
  4914             else if ( aErr != KErrNone )
  4987             else if ( aErr != KErrNone )
  4915                 {
  4988                 {
  4916                 iIsDeleting = EFalse;
  4989                 iIsDeleting = EFalse;
  4917                 if ( !iIsWaitNoteCanceled )
  4990                 if ( !iIsWaitNoteCanceled )
  4918                     {
  4991                     {
  4919                     if ( iProgressDialog )
  4992                     if ( iWaitDialog )
  4920                     	{
  4993                     	{
  4921 						iProgressDialog->ProcessFinishedL();
  4994 						iWaitDialog->ProcessFinishedL();
  4922 						}
  4995 						}
  4923                     HandleCommandL( EMPXCmdHandleExternalCommand );
  4996                     HandleCommandL( EMPXCmdHandleExternalCommand );
  4924                     iIsWaitNoteCanceled = EFalse;
  4997                     iIsWaitNoteCanceled = EFalse;
  4925                     }
  4998                     }
  4926                 HandleError( aErr );
  4999                 HandleError( aErr );
  5023         case ERenameOp:
  5096         case ERenameOp:
  5024             {
  5097             {
  5025             if ( aErr != KErrNone )
  5098             if ( aErr != KErrNone )
  5026                 {
  5099                 {
  5027                 iCommonUiHelper->HandleErrorL( aErr );
  5100                 iCommonUiHelper->HandleErrorL( aErr );
  5028                 }
       
  5029             break;
       
  5030             }
       
  5031         case EDeleteStatusOp:
       
  5032             {
       
  5033             if ( aArgument )
       
  5034                 {
       
  5035                 CMPXMedia* media = (CMPXMedia*)aArgument;
       
  5036                 CleanupStack::PushL( media );
       
  5037                 if ( media->IsSupported( KMPXMediaGeneralCount ) )
       
  5038                     {
       
  5039                     TInt deletePercent = media->ValueTObjectL<TInt>( KMPXMediaGeneralCount );
       
  5040                     MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL % Files Deleted: %d", deletePercent );
       
  5041                     // update WaitNote dialog.
       
  5042                     HBufC* string = StringLoader::LoadLC(R_MPX_QTN_NMP_DEL_BATCH_SONGS_WAIT_NOTE, deletePercent);
       
  5043                     TPtr buf = string->Des();
       
  5044                     UpdateProcessL(deletePercent, buf);
       
  5045                     CleanupStack::PopAndDestroy( string );
       
  5046                     }
       
  5047                 CleanupStack::PopAndDestroy( media );
       
  5048                 aArgument = NULL;
       
  5049                 }
  5101                 }
  5050             break;
  5102             break;
  5051             }
  5103             }
  5052         default:
  5104         default:
  5053             {
  5105             {
  5445                     {
  5497                     {
  5446                     iCurrentMediaLOp = EMPXOpMediaLFindInMusicShopSongDetails;
  5498                     iCurrentMediaLOp = EMPXOpMediaLFindInMusicShopSongDetails;
  5447                     }
  5499                     }
  5448                 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
  5500                 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
  5449                 CleanupStack::PushL( path );
  5501                 CleanupStack::PushL( path );
       
  5502                 
       
  5503                 if ( 2 == path->Levels() )
       
  5504                      {
       
  5505                      path->Back();
       
  5506                      path->AppendL(3);
       
  5507                      
       
  5508                      const CMPXMediaArray& albums = listboxArray->MediaArray();
       
  5509                      
       
  5510                      RArray<TMPXItemId> ids;
       
  5511                      CleanupClosePushL(ids);
       
  5512 
       
  5513                      TInt albumCount = albums.Count();
       
  5514                       for (TInt i=0; i<albumCount; ++i)
       
  5515                           {
       
  5516                           CMPXMedia* album = albums.AtL(i);
       
  5517                           const TMPXItemId id = album->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
  5518                           ids.AppendL(id);
       
  5519                           }
       
  5520                       path->AppendL(ids.Array()); // top level items
       
  5521                       ids.Reset();
       
  5522                       CleanupStack::PopAndDestroy(&ids);             
       
  5523                      }
  5450                 path->Set( iContainer->CurrentLbxItemIndex() );
  5524                 path->Set( iContainer->CurrentLbxItemIndex() );
  5451                 RArray<TMPXAttribute> attrs;
  5525                 RArray<TMPXAttribute> attrs;
  5452                 CleanupClosePushL( attrs );
  5526                 CleanupClosePushL( attrs );
  5453                 attrs.Append(
  5527                 attrs.Append(
  5454                     TMPXAttribute( KMPXMediaIdGeneral,
  5528                     TMPXAttribute( KMPXMediaIdGeneral,
  6066 		containerMedia.ValueTObjectL<TMPXGeneralCategory>(
  6140 		containerMedia.ValueTObjectL<TMPXGeneralCategory>(
  6067 			KMPXMediaGeneralCategory ) );
  6141 			KMPXMediaGeneralCategory ) );
  6068 			
  6142 			
  6069 	TMPXGeneralType containerType(
  6143 	TMPXGeneralType containerType(
  6070     	containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );			
  6144     	containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );			
  6071 
  6145     
       
  6146 	TInt usbUnblockingStatus;
       
  6147     RProperty::Get( KMPXViewPSUid,
       
  6148                     KMPXUSBUnblockingPSStatus,
       
  6149                     usbUnblockingStatus);
       
  6150    
       
  6151    if(usbUnblockingStatus)
       
  6152        {
       
  6153        aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
       
  6154        }
       
  6155    
  6072 	switch ( containerCategory )
  6156 	switch ( containerCategory )
  6073 		{
  6157 		{
  6074 		case EMPXPlaylist:
  6158 		case EMPXPlaylist:
  6075 			{
  6159 			{
  6076 			// playlist view
  6160 			// playlist view
  6175 				{
  6259 				{
  6176 				aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, NowPlayingOptionVisibilityL() );
  6260 				aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, NowPlayingOptionVisibilityL() );
  6177 				aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
  6261 				aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
  6178 				aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
  6262 				aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
  6179 				aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
  6263 				aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
       
  6264                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6265                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
       
  6266                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6267                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6268                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6269                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6270                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6271                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
  6180 
  6272 
  6181 				TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
  6273 				TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
  6182 				if ( landscapeOrientation )
  6274 				if ( !landscapeOrientation )
  6183 					{
  6275 					{
  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;
  6276 					TInt usbUnblockingStatus;
  6205 					RProperty::Get( KMPXViewPSUid,
  6277 					RProperty::Get( KMPXViewPSUid,
  6206 									KMPXUSBUnblockingPSStatus,
  6278 									KMPXUSBUnblockingPSStatus,
  6207 									usbUnblockingStatus);
  6279 									usbUnblockingStatus);
  6208 
  6280 
  6209 					if ( iContainer->CurrentLbxItemIndex() > KErrNotFound )
  6281 					if ( iContainer->CurrentLbxItemIndex() > KErrNotFound && !iContainer->IsTBoneView())
  6210 					    {
  6282 					    {
  6211                         if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6283                         if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6212                             {
  6284                             {
  6213                             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
  6285                             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
  6214                             aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6286                             aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6215                             }
  6287                             }
  6216                         else
  6288                         else
  6217                             {
  6289                             {
  6218                             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6290                             aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6219                             aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6291                             aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6220                             aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
  6292                             aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
  6221                             aMenuPane->SetItemDimmed( EMPXCmdPlayItem,
       
  6222                                     iContainer->IsTBoneView() ? ETrue : EFalse );
       
  6223                             }
  6293                             }
  6224 					    }
  6294 					    }
  6225 					if ( iContainer->IsSelectedItemASong() && iContainer->IsTBoneView() )
  6295 					if ( iContainer->IsSelectedItemASong() && iContainer->IsTBoneView() )
  6226 						{
  6296 						{
  6227 						if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6297 						if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6231 							}
  6301 							}
  6232 						else
  6302 						else
  6233 							{
  6303 							{
  6234 							aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6304 							aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6235 							aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6305 							aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6306 							aMenuPane->SetItemDimmed( EMPXCmdSend, EFalse );
  6236 							}
  6307 							}
  6237 						}
  6308 						}
       
  6309 					}
  6238 					
  6310 					
  6239 					//If Operator Music store exist, show the cascade menu with Nokia and Operator music store.
  6311 				//If Operator Music store exist, show the cascade menu with Nokia and Operator music store.
  6240 					if ( iOperatorMusicStore )
  6312 				if ( iOperatorMusicStore )
  6241 					    {
  6313 				    {
  6242 					    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
  6314 				    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
  6243 					    }
  6315 				    }
  6244 					else
  6316 				else
  6245 					    {
  6317 				    {
  6246 					    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
  6318 				    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
  6247 					    }
  6319 				    }
  6248 					}
       
  6249 				}
  6320 				}
  6250 
  6321 
  6251 			break;
  6322 			break;
  6252 			}
  6323 			}
  6253 
  6324 
  6321 				aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, EFalse );
  6392 				aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, EFalse );
  6322 				aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6393 				aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6323 				}
  6394 				}
  6324 
  6395 
  6325 			TInt currentItem( iContainer->CurrentLbxItemIndex() );
  6396 			TInt currentItem( iContainer->CurrentLbxItemIndex() );
  6326 
  6397 			if(currentItem > KErrNotFound )
  6327 			CMPXCollectionViewListBoxArray* array =
  6398 			    {  
  6328 				static_cast<CMPXCollectionViewListBoxArray*>(
  6399 			    CMPXCollectionViewListBoxArray* array =
  6329 				iContainer->ListBoxArray() );
  6400 			    static_cast<CMPXCollectionViewListBoxArray*>(
  6330 			const CMPXMedia& media = array->MediaL( currentItem );
  6401 			            iContainer->ListBoxArray() );
  6331 
  6402 			    const CMPXMedia& media = array->MediaL( currentItem );
  6332 			if ( media.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
  6403 
  6333 				{
  6404 			    if ( media.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
  6334 				// check for auto playlist, disable delete
  6405 			        {
  6335 				TMPXGeneralNonPermissibleActions attr(
  6406 			        // check for auto playlist, disable delete
  6336 					media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
  6407 			        TMPXGeneralNonPermissibleActions attr(
  6337 						KMPXMediaGeneralNonPermissibleActions ) );
  6408 			                media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
  6338 				if ( attr & EMPXWrite )
  6409 			                        KMPXMediaGeneralNonPermissibleActions ) );
  6339 					{
  6410 			        if ( attr & EMPXWrite )
  6340 					aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6411 			            {
  6341 					}
  6412 			            aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6342 				}
  6413 			            }
  6343 
  6414 			        }
  6344 			TInt trackCount (0);
  6415 
  6345 			if( media.IsSupported(KMPXMediaGeneralCount) )
  6416 			    TInt trackCount (0);
  6346 				{
  6417 			    if( media.IsSupported(KMPXMediaGeneralCount) )
  6347 				trackCount = media.ValueTObjectL<TInt>( KMPXMediaGeneralCount );
  6418 			        {
  6348 				}
  6419 			        trackCount = media.ValueTObjectL<TInt>( KMPXMediaGeneralCount );
  6349 			if( trackCount < 1 )
  6420 			        }
  6350 				{
  6421 			    if( trackCount < 1 )
  6351 				aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
  6422 			        {
  6352 				}
  6423 			        aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
  6353 
  6424 			        }
       
  6425 			    } 
  6354 			if ( iOperatorMusicStore )
  6426 			if ( iOperatorMusicStore )
  6355 			    {
  6427 			    {
  6356 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
  6428 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
  6357 			    }
  6429 			    }
  6358 			else
  6430 			else
  6370 			aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
  6442 			aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
  6371 			aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
  6443 			aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
  6372 			aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
  6444 			aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
  6373 
  6445 
  6374 			TInt currentItem( iContainer->CurrentLbxItemIndex() );
  6446 			TInt currentItem( iContainer->CurrentLbxItemIndex() );
  6375 
  6447             
  6376 			CMPXCollectionViewListBoxArray* array =
  6448 			if(currentItem > KErrNotFound )
  6377 				static_cast<CMPXCollectionViewListBoxArray*>(
  6449 			    {  
  6378 				iContainer->ListBoxArray() );
  6450 			    CMPXCollectionViewListBoxArray* array =
  6379 			const CMPXMedia& media = array->MediaL( currentItem );
  6451 			    static_cast<CMPXCollectionViewListBoxArray*>(
  6380 
  6452 			            iContainer->ListBoxArray() );
  6381 			TInt usbUnblockingStatus;
  6453 			    const CMPXMedia& media = array->MediaL( currentItem );
  6382 			RProperty::Get( KMPXViewPSUid,
  6454 
  6383 							KMPXUSBUnblockingPSStatus,
  6455 			    TInt usbUnblockingStatus;
  6384 							usbUnblockingStatus);
  6456 			    RProperty::Get( KMPXViewPSUid,
  6385 			if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6457 			            KMPXUSBUnblockingPSStatus,
  6386 				{
  6458 			            usbUnblockingStatus);
  6387 				aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  6459 			    if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6388 				}
  6460 			        {
  6389 			else
  6461 			        aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  6390 				{
  6462 			        }
  6391 				aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );
  6463 			    else
  6392 				}
  6464 			        {
  6393 
  6465 			        aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );
  6394 			if ( media.IsSupported(
  6466 			        }
  6395 				KMPXMediaGeneralNonPermissibleActions ) )
  6467 
  6396 				{
  6468 			    if ( media.IsSupported(
  6397 				// check for auto playlist, disable delete
  6469 			            KMPXMediaGeneralNonPermissibleActions ) )
  6398 				TMPXGeneralNonPermissibleActions attr(
  6470 			        {
  6399 					media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
  6471 			        // check for auto playlist, disable delete
  6400 						KMPXMediaGeneralNonPermissibleActions ) );
  6472 			        TMPXGeneralNonPermissibleActions attr(
  6401 				if ( attr & EMPXWrite )
  6473 			                media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
  6402 					{
  6474 			                        KMPXMediaGeneralNonPermissibleActions ) );
  6403 					aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  6475 			        if ( attr & EMPXWrite )
  6404 					// TODO: this should be an item specific command.
  6476 			            {
  6405 					aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
  6477 			            aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  6406 					}
  6478 			            // TODO: this should be an item specific command.
  6407 				}
  6479 			            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
  6408 			if ( array->IsItemBrokenLinkL( currentItem ) ||
  6480 			            }
  6409 				array->IsItemCorruptedL( currentItem ) )
  6481 			        }
  6410 				{
  6482 			    if ( array->IsItemBrokenLinkL( currentItem ) ||
  6411 				aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  6483 			            array->IsItemCorruptedL( currentItem ) )
  6412                 // TODO: this should be an item specific command.
  6484 			        {
  6413 				aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
  6485 			        aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  6414 				}
  6486 			        // TODO: this should be an item specific command.
  6415 
  6487 			        aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
       
  6488 			        }
       
  6489 			    } 
  6416 			break;
  6490 			break;
  6417 			}
  6491 			}
  6418         default:
  6492         default:
  6419             {
  6493             {
  6420             // Do nothing
  6494             // Do nothing
  6729 						{
  6803 						{
  6730 						aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
  6804 						aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
  6731 						aMenuPane->SetItemDimmed( EMPXCmdRemove, EFalse );
  6805 						aMenuPane->SetItemDimmed( EMPXCmdRemove, EFalse );
  6732 						}
  6806 						}
  6733 					}
  6807 					}
  6734 
  6808 				} 
  6735 				CMPXCollectionViewListBoxArray* array =
  6809 
  6736 					static_cast<CMPXCollectionViewListBoxArray*>(
  6810             CMPXCollectionViewListBoxArray* array =
  6737 					iContainer->ListBoxArray() );
  6811             static_cast<CMPXCollectionViewListBoxArray*>(
  6738 				const CMPXMedia& containerMedia = array->ContainerMedia();
  6812                     iContainer->ListBoxArray() );
  6739 
  6813             const CMPXMedia& containerMedia = array->ContainerMedia();
  6740 				if ( containerMedia.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
  6814 
  6741 					{
  6815             if ( containerMedia.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
  6742 					// check for auto playlist, disable add, remove and reorder
  6816                 {
  6743 					TMPXGeneralNonPermissibleActions attr(
  6817                 // check for auto playlist, disable add, remove and reorder
  6744 						containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
  6818                 TMPXGeneralNonPermissibleActions attr(
  6745 							KMPXMediaGeneralNonPermissibleActions ) );
  6819                         containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
  6746 					if ( attr & EMPXWrite )
  6820                                 KMPXMediaGeneralNonPermissibleActions ) );
  6747 						{
  6821                 if ( attr & EMPXWrite )
  6748 						aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
  6822                     {
  6749 						aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
  6823                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
  6750 						aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
  6824                     aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
  6751 						}
  6825                     aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
  6752 					}
  6826                     }
  6753 				}
  6827                 }
  6754 
       
  6755 			break;
  6828 			break;
  6756 			}
  6829 			}
  6757 
  6830 
  6758 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6831 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6759             {
  6832             {