mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp
changeset 2 b70d77332e66
parent 1 8118492f1bdf
child 4 beaa16f65879
equal deleted inserted replaced
1:8118492f1bdf 2:b70d77332e66
    33 #include <hlplch.h>
    33 #include <hlplch.h>
    34 #include <avkon.hrh>
    34 #include <avkon.hrh>
    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>
  3339 
  3339 
  3340 // -----------------------------------------------------------------------------
  3340 // -----------------------------------------------------------------------------
  3341 // Prepares media object for selected items
  3341 // Prepares media object for selected items
  3342 // -----------------------------------------------------------------------------
  3342 // -----------------------------------------------------------------------------
  3343 //
  3343 //
  3344 void CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL( CMPXMedia& aMedia )
  3344 void CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL( CMPXMedia& aMedia, TMPXGeneralCategory aContainerCategory, TMPXGeneralType aContainerType  )
  3345     {
  3345     {
  3346     MPX_FUNC( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL" );
  3346     MPX_FUNC( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL" );
  3347     CMPXMediaArray* mediaArray( CMPXMediaArray::NewL() );
  3347     CMPXMediaArray* mediaArray( CMPXMediaArray::NewL() );
  3348     CleanupStack::PushL( mediaArray );
  3348     CleanupStack::PushL( mediaArray );
  3349     CMPXCommonListBoxArrayBase* listBoxArray =
       
  3350         iContainer->ListBoxArray();
       
  3351     TInt count( iSelectionIndexCache->Count() );
       
  3352 
  3349 
  3353     CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
  3350     CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
  3354     CleanupStack::PushL( path );
  3351     CleanupStack::PushL( path );
  3355     TMPXItemId id( path->Id( 0 ) );
  3352     TMPXItemId id( path->Id( 0 ) );
  3356     MPX_DEBUG2( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1 );
  3353     MPX_DEBUG2( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1 );
  3357     CleanupStack::PopAndDestroy( path );
  3354     CleanupStack::PopAndDestroy( path );
  3358 
  3355     
  3359     if ( count > 0 )
  3356     //support for TBone view add to playlist
  3360         {
  3357     if ( aContainerCategory == EMPXAlbum && aContainerType == EMPXItem)
  3361         if ( count == 1 )
  3358         { 	 
  3362             {
  3359         CMPXMedia* media = iContainer->SelectedItemMediaL();
  3363             // marked one item, if it's not valid, ignore the command
  3360         if ( media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
  3364             const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(0) );
  3361            {
       
  3362            // leave with special error code, this error
       
  3363            // should not trigger any error message, the operation should
       
  3364            // be terminated silently
       
  3365            User::Leave( KMPXErrDataNotReady );
       
  3366            }
       
  3367         else
       
  3368            {
       
  3369            CMPXMedia* entry( PopulateMediaLC( *media, id ) );
       
  3370            mediaArray->AppendL( entry );
       
  3371            CleanupStack::Pop( entry );
       
  3372            }      	
       
  3373        }
       
  3374 
       
  3375     else
       
  3376         {
       
  3377         TInt count( iSelectionIndexCache->Count() );   
       
  3378         CMPXCommonListBoxArrayBase* listBoxArray =   
       
  3379             iContainer->ListBoxArray(); 
       
  3380         if ( count > 0 )
       
  3381             {
       
  3382                             
       
  3383             if ( count == 1 )
       
  3384                 {
       
  3385                 // marked one item, if it's not valid, ignore the command
       
  3386                 const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(0) );
       
  3387                 if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
       
  3388                     {
       
  3389                     // leave with special error code, this error
       
  3390                     // should not trigger any error message, the operation should
       
  3391                     // be terminated silently
       
  3392                     User::Leave( KMPXErrDataNotReady );
       
  3393                     }
       
  3394                 
       
  3395                 }
       
  3396                 for ( TInt i = 0; i < count; i++ )
       
  3397                     {
       
  3398                     const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(i) );
       
  3399                     if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
       
  3400                         {
       
  3401                         // item not ready, cache this command and execute
       
  3402                         // it when the data becomes valid
       
  3403                         User::Leave( KMPXErrDataNotReadyCacheCommand );
       
  3404                         }
       
  3405                     CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
       
  3406                     mediaArray->AppendL( entry );
       
  3407                     CleanupStack::Pop( entry );
       
  3408                     }
       
  3409             }
       
  3410        
       
  3411         else
       
  3412             {
       
  3413             const CMPXMedia& listBoxMedia = listBoxArray->MediaL(
       
  3414                 iContainer->CurrentLbxItemIndex() );
  3365             if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
  3415             if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
  3366                 {
  3416                 {
  3367                 // leave with special error code, this error
  3417                 // leave with special error code, this error
  3368                 // should not trigger any error message, the operation should
  3418                 // should not trigger any error message, the operation should
  3369                 // be terminated silently
  3419                 // be terminated silently
  3370                 User::Leave( KMPXErrDataNotReady );
  3420                 User::Leave( KMPXErrDataNotReady );
  3371                 }
  3421                 }
  3372             }
  3422             else
  3373         for ( TInt i = 0; i < count; i++ )
  3423                 {
  3374             {
  3424                 CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
  3375             const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(i) );
  3425                 mediaArray->AppendL( entry );
  3376             if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
  3426                 CleanupStack::Pop( entry );
  3377                 {
  3427                 }
  3378                 // item not ready, cache this command and execute
  3428             }
  3379                 // it when the data becomes valid
  3429        }
  3380                 User::Leave( KMPXErrDataNotReadyCacheCommand );
  3430  
  3381                 }
  3431        aMedia.SetTObjectValueL( KMPXMediaGeneralCollectionId, id );
  3382             CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
  3432        aMedia.SetCObjectValueL( KMPXMediaArrayContents, mediaArray );
  3383             mediaArray->AppendL( entry );
  3433        aMedia.SetTObjectValueL( KMPXMediaArrayCount, mediaArray->Count() );
  3384             CleanupStack::Pop( entry );
  3434        iNumSongAddedToPlaylist = mediaArray->Count();
  3385             }
  3435        CleanupStack::PopAndDestroy( mediaArray );
  3386         }
       
  3387     else
       
  3388         {
       
  3389         const CMPXMedia& listBoxMedia = listBoxArray->MediaL(
       
  3390             iContainer->CurrentLbxItemIndex() );
       
  3391         if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
       
  3392             {
       
  3393             // leave with special error code, this error
       
  3394             // should not trigger any error message, the operation should
       
  3395             // be terminated silently
       
  3396             User::Leave( KMPXErrDataNotReady );
       
  3397             }
       
  3398         else
       
  3399             {
       
  3400             CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
       
  3401             mediaArray->AppendL( entry );
       
  3402             CleanupStack::Pop( entry );
       
  3403             }
       
  3404         }
       
  3405     aMedia.SetTObjectValueL( KMPXMediaGeneralCollectionId, id );
       
  3406     aMedia.SetCObjectValueL( KMPXMediaArrayContents, mediaArray );
       
  3407     aMedia.SetTObjectValueL( KMPXMediaArrayCount, mediaArray->Count() );
       
  3408     iNumSongAddedToPlaylist = mediaArray->Count();
       
  3409     CleanupStack::PopAndDestroy( mediaArray );
       
  3410     }
  3436     }
  3411 
  3437 
  3412 // -----------------------------------------------------------------------------
  3438 // -----------------------------------------------------------------------------
  3413 // Populates media object with information needed for save to
  3439 // Populates media object with information needed for save to
  3414 // existing playlist
  3440 // existing playlist
  3581     {
  3607     {
  3582     MPX_FUNC( "CMPXCollectionViewHgImp::HandleFileCheckResultL" );
  3608     MPX_FUNC( "CMPXCollectionViewHgImp::HandleFileCheckResultL" );
  3583     const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
  3609     const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
  3584     if ( location.Length() == 0 || ConeUtils::FileExists( location ) )
  3610     if ( location.Length() == 0 || ConeUtils::FileExists( location ) )
  3585         {
  3611         {
  3586 #ifdef SINGLE_CLICK_INCLUDED
       
  3587         HandleListBoxEventL( NULL, EEventItemSingleClicked );
       
  3588 #else
       
  3589         HandleListBoxEventL( NULL, EEventItemClicked );   
  3612         HandleListBoxEventL( NULL, EEventItemClicked );   
  3590 #endif
       
  3591         HBufC* buf = HBufC::NewLC( 5 ); // magic number, array granularity
  3613         HBufC* buf = HBufC::NewLC( 5 ); // magic number, array granularity
  3592         buf->Des().AppendNum( iContainer->CurrentLbxItemIndex() );
  3614         buf->Des().AppendNum( iContainer->CurrentLbxItemIndex() );
  3593         // Activate view via View Framework
  3615         // Activate view via View Framework
  3594         iViewUtility->ActivateViewL( aViewToActivate, buf );
  3616         iViewUtility->ActivateViewL( aViewToActivate, buf );
  3595         CleanupStack::PopAndDestroy( buf );
  3617         CleanupStack::PopAndDestroy( buf );
  3974                 {
  3996                 {
  3975                 iCollectionCacheReady = EFalse;
  3997                 iCollectionCacheReady = EFalse;
  3976                 }
  3998                 }
  3977             // USB flags
  3999             // USB flags
  3978             //
  4000             //
       
  4001 	       CEikMenuBar* menuBar( MenuBar() );
       
  4002 #ifdef SINGLE_CLICK_INCLUDED
       
  4003             iContainer->EnableMarking( EFalse );
       
  4004             menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
       
  4005 #else
       
  4006             iContainer->EnableMarking( ETrue );
       
  4007             menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR );
       
  4008 #endif
       
  4009 	        TBool IsUSBEvent( EFalse );
  3979             if( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )
  4010             if( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )
  3980                 {
  4011                 {
  3981                 iUSBOnGoing = ETrue;
  4012                 iUSBOnGoing = ETrue;
       
  4013 		        IsUSBEvent = ETrue;
  3982                 }
  4014                 }
  3983             else if( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd )
  4015             else if( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd )
  3984                 {
  4016                 {
  3985                 iUSBOnGoing = EFalse;
  4017                 iUSBOnGoing = EFalse;
       
  4018 		        IsUSBEvent = ETrue;
  3986                 RProperty::Set( KMPXViewPSUid,
  4019                 RProperty::Set( KMPXViewPSUid,
  3987                                 KMPXUSBUnblockingPSStatus,
  4020                                 KMPXUSBUnblockingPSStatus,
  3988                                 EMPXUSBUnblockingPSStatusUninitialized );
  4021                                 EMPXUSBUnblockingPSStatusUninitialized );
  3989                 }
  4022                 }
  3990             else if( type == EMcMsgUSBMTPNotActive )
  4023             else if( type == EMcMsgUSBMTPNotActive )
  3991                 {
  4024                 {
       
  4025 		        IsUSBEvent = ETrue;
  3992                 RProperty::Set( KMPXViewPSUid,
  4026                 RProperty::Set( KMPXViewPSUid,
  3993                                 KMPXUSBUnblockingPSStatus,
  4027                                 KMPXUSBUnblockingPSStatus,
  3994                                 EMPXUSBUnblockingPSStatusActive );
  4028                                 EMPXUSBUnblockingPSStatusActive );
  3995 				}
  4029 		        }
       
  4030             if( IsUSBEvent && menuBar && menuBar->IsDisplayed() )
       
  4031             	{
       
  4032             	menuBar->StopDisplayingMenuBar();
       
  4033             	}
  3996 
  4034 
  3997             if ( iContainer && iIsEmbedded && type == EMcMsgUSBMassStorageEnd )
  4035             if ( iContainer && iIsEmbedded && type == EMcMsgUSBMassStorageEnd )
  3998             	{
  4036             	{
  3999             	DoIncrementalOpenL();
  4037             	DoIncrementalOpenL();
  4000             	}
  4038             	}
  5198         case EMPXCmdAddToSavedPlaylist:
  5236         case EMPXCmdAddToSavedPlaylist:
  5199             {
  5237             {
  5200             // flag used only in the case when songs are added incrementally
  5238             // flag used only in the case when songs are added incrementally
  5201             iIsAddingToPlaylist = ETrue;
  5239             iIsAddingToPlaylist = ETrue;
  5202             iNumSongAddedToPlaylist = -1;
  5240             iNumSongAddedToPlaylist = -1;
  5203             TMPXGeneralCategory category( EMPXNoCategory );
  5241       
  5204             CMPXCommonListBoxArrayBase* array(
  5242             CMPXCommonListBoxArrayBase* listboxArray(
  5205                 iContainer->ListBoxArray() );
  5243                    iContainer->ListBoxArray() );
  5206             const CMPXMedia& media = array->MediaL(
  5244                 
       
  5245             const CMPXMedia& currentMedia = listboxArray->MediaL(
  5207                 iContainer->CurrentLbxItemIndex() );
  5246                 iContainer->CurrentLbxItemIndex() );
  5208             category = media.ValueTObjectL<TMPXGeneralCategory>(
  5247             
  5209                 KMPXMediaGeneralCategory );
  5248             TMPXGeneralCategory mediaCategory( currentMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ));
  5210             if ( category == EMPXSong )
  5249                  
       
  5250             const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
       
  5251        
       
  5252             TMPXGeneralType containerType( EMPXNoType );
       
  5253             if ( containerMedia.IsSupported( KMPXMediaGeneralType ) )
       
  5254                  {
       
  5255                  containerType = containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
       
  5256                  }
       
  5257 
       
  5258             TMPXGeneralCategory containerCategory( EMPXNoCategory );
       
  5259             if ( containerMedia.IsSupported( KMPXMediaGeneralCategory ) )
       
  5260                  {
       
  5261                  containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
       
  5262                  } 
       
  5263                             
       
  5264             if ( mediaCategory == EMPXSong || (containerCategory == EMPXAlbum && containerType== EMPXItem) )
  5211                 {
  5265                 {
  5212                 CMPXMedia* tracks = CMPXMedia::NewL();
  5266                 CMPXMedia* tracks = CMPXMedia::NewL();
  5213                 CleanupStack::PushL( tracks );
  5267                 CleanupStack::PushL( tracks );
  5214 
  5268 
  5215                 MPX_TRAPD( err, PrepareMediaForSelectedItemsL( *tracks ) );
  5269                 MPX_TRAPD( err, PrepareMediaForSelectedItemsL( *tracks, containerCategory, containerType ) );
  5216                 if ( err == KErrNone )
  5270                 if ( err == KErrNone )
  5217                     {
  5271                     {
  5218                     TBool ret = EFalse;
  5272                     TBool ret = EFalse;
  5219                     if ( aCommand == EMPXCmdAddToNewPlaylist )
  5273                     if ( aCommand == EMPXCmdAddToNewPlaylist )
  5220                         {
  5274                         {
  5289                     TMPXAttribute( KMPXMediaIdGeneral,
  5343                     TMPXAttribute( KMPXMediaIdGeneral,
  5290                     EMPXMediaGeneralTitle | EMPXMediaGeneralId |
  5344                     EMPXMediaGeneralTitle | EMPXMediaGeneralId |
  5291                     EMPXMediaGeneralType | EMPXMediaGeneralCategory ) );
  5345                     EMPXMediaGeneralType | EMPXMediaGeneralCategory ) );
  5292                 CMPXMedia* criteria = CMPXMedia::NewL();
  5346                 CMPXMedia* criteria = CMPXMedia::NewL();
  5293                 CleanupStack::PushL( criteria );
  5347                 CleanupStack::PushL( criteria );
  5294                 CMPXCommonListBoxArrayBase* listboxArray =
       
  5295                     iContainer->ListBoxArray();
       
  5296                 const CMPXMedia& containerMedia =
       
  5297                     listboxArray->ContainerMedia();
       
  5298                 TMPXGeneralCategory containerCategory(
       
  5299                     containerMedia.ValueTObjectL<TMPXGeneralCategory>(
       
  5300                     KMPXMediaGeneralCategory ) );
       
  5301                 if ( containerCategory == EMPXArtist )
  5348                 if ( containerCategory == EMPXArtist )
  5302                     {
  5349                     {
  5303                     // artist/album level, need to specify artist ID in container ID
  5350                     // artist/album level, need to specify artist ID in container ID
  5304                     TMPXItemId containerId(
  5351                     TMPXItemId containerId(
  5305                         containerMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  5352                         containerMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  5306                     criteria->SetTObjectValueL<TMPXItemId>(
  5353                     criteria->SetTObjectValueL<TMPXItemId>(
  5307                         KMPXMediaGeneralContainerId, containerId );
  5354                         KMPXMediaGeneralContainerId, containerId );
  5308                     }
  5355                     }
  5309                 const CMPXMedia& currentMedia = listboxArray->MediaL(
  5356             
  5310                     iContainer->CurrentLbxItemIndex() );
       
  5311                 TMPXItemId id(
  5357                 TMPXItemId id(
  5312                     currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  5358                     currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  5313                 criteria->SetTObjectValueL<TMPXGeneralType>(
  5359                 criteria->SetTObjectValueL<TMPXGeneralType>(
  5314                     KMPXMediaGeneralType, EMPXGroup );
  5360                     KMPXMediaGeneralType, EMPXGroup );
  5315                 criteria->SetTObjectValueL<TMPXGeneralCategory>(
  5361                 criteria->SetTObjectValueL<TMPXGeneralCategory>(
  5998 			break;
  6044 			break;
  5999 			}
  6045 			}
  6000 		case EMPXAlbum:
  6046 		case EMPXAlbum:
  6001 		case EMPXArtist:
  6047 		case EMPXArtist:
  6002 			{
  6048 			{
  6003 			// Album & Artist view
  6049 			// Artists & Albums view
  6004 			aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue );
  6050 			aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue );
  6005 			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
  6051 			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
  6006 			break;
  6052 			break;
  6007 			}
  6053 			}
  6008 		case EMPXGenre:
  6054 		case EMPXGenre:
  6038         static_cast<CMPXCollectionViewListBoxArray*>(
  6084         static_cast<CMPXCollectionViewListBoxArray*>(
  6039         iContainer->ListBoxArray() );
  6085         iContainer->ListBoxArray() );
  6040     TInt currentItem( iContainer->CurrentLbxItemIndex() );
  6086     TInt currentItem( iContainer->CurrentLbxItemIndex() );
  6041     TBool isListEmpty( currentItem < 0 );
  6087     TBool isListEmpty( currentItem < 0 );
  6042     TInt selectionCount( 0 );
  6088     TInt selectionCount( 0 );
       
  6089 	
       
  6090     iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned
  6043     if ( iSelectionIndexCache)
  6091     if ( iSelectionIndexCache)
  6044         {
  6092         {
  6045         selectionCount = iSelectionIndexCache->Count();
  6093         selectionCount = iSelectionIndexCache->Count();
  6046         }
  6094         }
  6047 
  6095 
  6065 
  6113 
  6066             MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
  6114             MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
  6067 
  6115 
  6068             // Always dim the find in hg implementation
  6116             // Always dim the find in hg implementation
  6069             aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
  6117             aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
  6070             MMPXPlaybackUtility* pdPlaybackUtility;
  6118 
  6071             pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
  6119 			// Determine if we should hide "Goto now playing" option.
  6072             MMPXSource* pdsource( pdPlaybackUtility->Source() );
  6120             TBool hideNowPlaying(EFalse);
  6073             MMPXSource* source( iPlaybackUtility->Source() );
  6121 			MMPXSource* source( iPlaybackUtility->Source() );
  6074             TBool hideNowPlaying;
  6122             if ( source == 0 )
  6075             hideNowPlaying = ( (pdsource == 0)
  6123 				{
  6076                            &&  (source == 0));
  6124 				MMPXPlaybackUtility* pdPlaybackUtility;
  6077             pdPlaybackUtility->Close();
  6125 				pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
  6078             if ( hideNowPlaying )
  6126 				hideNowPlaying = pdPlaybackUtility->Source() ? EFalse : ETrue;
  6079                 {
  6127 				pdPlaybackUtility->Close();
  6080                 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
  6128 				}
  6081                 }
  6129             if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
       
  6130                 {
       
  6131                 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
       
  6132                 }
       
  6133 
       
  6134 			aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, hideNowPlaying );
       
  6135 
  6082             if ( !isListEmpty )
  6136             if ( !isListEmpty )
  6083                 {
  6137                 {
  6084                 const CMPXMedia& media = array->MediaL( currentItem );
  6138                 const CMPXMedia& media = array->MediaL( currentItem );
  6085                 TMPXGeneralType type(
  6139                 TMPXGeneralType type(
  6086                     media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
  6140                     media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
  6089                         KMPXMediaGeneralCategory ) );
  6143                         KMPXMediaGeneralCategory ) );
  6090                 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
  6144                 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
  6091 #ifdef SINGLE_CLICK_INCLUDED
  6145 #ifdef SINGLE_CLICK_INCLUDED
  6092                 if ( containerType == EMPXGroup && containerCategory == EMPXAlbum )
  6146                 if ( containerType == EMPXGroup && containerCategory == EMPXAlbum )
  6093                     {
  6147                     {
  6094                     // album view
  6148                     // Artists & Albums view
  6095                     switch ( category )
  6149                     switch ( category )
  6096                         {
  6150                         {
  6097                         case EMPXAlbum:
  6151                         case EMPXAlbum:
  6098                             {
  6152                             {
  6099                             if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6153                             TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
       
  6154                             if ( landscapeOrientation )
  6100                                 {
  6155                                 {
  6101                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
  6156                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
  6102                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
  6157                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
  6103                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
  6158                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
  6104                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
  6159                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
  6105                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
  6160                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
  6106                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6161                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6107                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
  6162                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
  6108                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
  6163                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );                            
  6109                                 }
  6164                                 }
  6110                             else
  6165                             else
  6111                                 {
  6166                                 {
  6112                                 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
  6167                                 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6113                                 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6168                                     {
  6114                                 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
  6169                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
  6115                                 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
  6170                                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
  6116                                 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
  6171                                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
  6117                                 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6172                                     aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
  6118                                 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
  6173                                     aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
  6119                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
  6174                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
       
  6175                                     aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6176                                     aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
       
  6177                                     }
       
  6178                                 else
       
  6179                                     {
       
  6180                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
       
  6181                                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
       
  6182                                     aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
       
  6183                                     aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
       
  6184                                     aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
       
  6185                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
       
  6186                                     aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6187                                     aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
       
  6188                                     }
  6120                                 }
  6189                                 }
  6121                             break;
  6190                             break;
  6122                             }
  6191                             }
  6123                         case EMPXCommand:
  6192                         case EMPXCommand:
  6124                             {
  6193                             {
  6227                                     {
  6296                                     {
  6228                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6297                                     aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
  6229                                     }
  6298                                     }
  6230                                 }
  6299                                 }
  6231                             aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
  6300                             aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
       
  6301                             TInt trackCount (0);                   
       
  6302                             if(media.IsSupported(KMPXMediaGeneralCount))
       
  6303                                 {
       
  6304                                 trackCount = media.ValueTObjectL<TInt>( KMPXMediaGeneralCount );
       
  6305                                 } 
       
  6306                             if( trackCount < 1 )
       
  6307                                 {
       
  6308                                 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
       
  6309                                 }   
  6232                             break;
  6310                             break;
  6233                             }
  6311                             }
  6234 #ifdef SINGLE_CLICK_INCLUDED
  6312 #ifdef SINGLE_CLICK_INCLUDED
  6235                         case EMPXAlbum:
  6313                         case EMPXAlbum:
  6236                             {
  6314                             {
  6237                             // album contents view
  6315                             // Album > Tracks view
  6238                             if ( iContainer->IsSelectedItemASong() )
  6316                             if ( iContainer->IsSelectedItemASong() )
  6239                                 {                            
  6317                                 {                            
  6240                                 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6318                                 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
  6241                                     {
  6319                                     {
  6242                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
  6320                                     aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );