790 |
790 |
791 TInt count(0); |
791 TInt count(0); |
792 TInt levels(aPath.Levels()); |
792 TInt levels(aPath.Levels()); |
793 TBool isASong(EFalse); |
793 TBool isASong(EFalse); |
794 |
794 |
795 aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPath.Id(levels - 1)); |
795 |
796 |
796 if ( 1 == levels ) |
797 if (1 == levels) |
797 { |
798 { |
798 |
799 // return the "main menu" |
799 // Redirecting all open requests at level 1 to open albums |
800 count = iMusicLibraryMenuTitles->Count(); |
800 // due to UI changes that removed the library menu collection level. |
801 RArray<TMPXItemId> ids; |
801 TInt acount = array->Count(); |
802 CleanupClosePushL(ids); |
802 MPX_DEBUG2(" array count11 [%d]", acount); |
803 |
803 |
804 // due to ui changes, the order of main menu is changed |
804 CMPXCollectionPath* path = CMPXCollectionPath::NewL(aPath); |
805 // since multiple clients hardcode indexes to each entry, |
805 CleanupStack::PushL( path ); |
806 // the enum cannot be changed, instead we will have to |
806 |
807 // manually change the display order to minimize the impact to |
807 path->AppendL(3); // Albums |
808 // external clients |
808 TInt whatLevel = path->Levels(); |
809 |
809 |
810 // change from: |
810 MPX_DEBUG_PATH(*path); |
811 // all songs, playlist, artist, album, (podcast), genre, composer |
811 |
812 // to: |
812 aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, path->Id(whatLevel - 1) ); |
813 // artist, album, playlist, all songs, (podcast), genre, composer |
813 |
814 for (TInt i = EBrowseArtist; i <= EBrowseAlbum; ++i) |
814 // Create a media which hold the pointer to the returned path |
815 { |
815 if (aEntries.IsSupported(KMPXMediaGeneralValue)) |
816 MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(i), EMPXGroup, |
816 { |
817 CategoryForBrowseType(static_cast<TMCBrowseType>(i)), iMusicLibraryMenuIds[i]); |
817 MPX_DEBUG1(" pointer to the returned path "); |
818 ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[i])); |
818 CMPXMedia* pMedia = CMPXMedia::NewL(); |
819 } |
819 CleanupStack::PushL(pMedia); |
820 MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(1), EMPXGroup, |
820 pMedia->SetTObjectValueL<TInt>(KMPXMediaGeneralValue, |
821 CategoryForBrowseType(static_cast<TMCBrowseType>(1)), iMusicLibraryMenuIds[1]); |
821 aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue)); |
822 ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[1])); |
822 array->AppendL(*pMedia); |
823 MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(0), EMPXGroup, |
823 CleanupStack::PopAndDestroy(pMedia); |
824 CategoryForBrowseType(static_cast<TMCBrowseType>(0)), iMusicLibraryMenuIds[0]); |
824 } |
825 ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[0])); |
825 |
826 |
826 |
827 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
827 RArray<TMPXAttribute> openAttrs; |
828 if( !iDisablePodcasting ) |
828 CleanupClosePushL(openAttrs); |
829 { |
829 |
830 MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(EBrowsePodcasts), EMPXGroup, |
830 RArray<TInt> supportedIds; |
831 CategoryForBrowseType(static_cast<TMCBrowseType>(EBrowsePodcasts)), iMusicLibraryMenuIds[EBrowsePodcasts]); |
831 CleanupClosePushL(supportedIds); |
832 ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[EBrowsePodcasts])); |
832 |
833 } |
833 SetAttributesL(*path, openAttrs, supportedIds); |
834 #endif // __ENABLE_PODCAST_IN_MUSIC_MENU |
834 openAttrs.AppendL(KMPXMediaArrayContents); |
835 |
835 |
836 // Genre and composer |
836 CleanupStack::PopAndDestroy(&supportedIds); |
837 for (TInt i = ( EBrowseGenre ); i < count; ++i) |
837 |
838 { |
838 if( iAllSongsValid ) |
839 MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(i), EMPXGroup, |
839 { |
840 CategoryForBrowseType(static_cast<TMCBrowseType>(i)), iMusicLibraryMenuIds[i]); |
840 isASong = DoOpenBrowseAlbumL( *path, openAttrs.Array(), aEntries, array ); |
841 ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[i])); |
841 } |
842 } |
842 CleanupStack::PopAndDestroy(&openAttrs); |
843 |
843 CleanupStack::PopAndDestroy( path ); |
844 TInt pPath = aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue); |
844 |
845 MPX_ASSERT(pPath); |
845 //Remove the first media |
846 ((CMPXCollectionPath*)pPath)->AppendL(ids.Array()); |
846 if ( array->Count() && |
847 CleanupStack::PopAndDestroy(&ids); |
847 (*array)[0]->IsSupported(KMPXMediaGeneralValue)) |
848 SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXCollection, *iMusicMenuTitle); |
848 { |
849 aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>( |
849 array->Remove(0); |
850 KMPXMediaGeneralNonPermissibleActions, EMPXWrite); |
850 } |
851 } |
851 } |
852 else if (levels >= 2) |
852 else if (levels >= 2) |
853 { |
853 { |
|
854 aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPath.Id(levels - 1)); |
854 // Create a media which hold the pointer to the returned path |
855 // Create a media which hold the pointer to the returned path |
855 if (aEntries.IsSupported(KMPXMediaGeneralValue)) |
856 if (aEntries.IsSupported(KMPXMediaGeneralValue)) |
856 { |
857 { |
857 CMPXMedia* pMedia = CMPXMedia::NewL(); |
858 CMPXMedia* pMedia = CMPXMedia::NewL(); |
858 CleanupStack::PushL(pMedia); |
859 CleanupStack::PushL(pMedia); |