107 iMusicLibraryMenuIds.Close(); |
107 iMusicLibraryMenuIds.Close(); |
108 delete iMusicLibraryMenuTitles; |
108 delete iMusicLibraryMenuTitles; |
109 delete iMusicLibraryTitles; |
109 delete iMusicLibraryTitles; |
110 delete iAllSongsForArtistTitle; |
110 delete iAllSongsForArtistTitle; |
111 delete iMusicMenuTitle; |
111 delete iMusicMenuTitle; |
112 delete iShuffleAllText; |
|
113 |
112 |
114 if (iActiveTask) |
113 if (iActiveTask) |
115 { |
114 { |
116 iActiveTask->Cancel(); |
115 iActiveTask->Cancel(); |
117 delete iActiveTask; |
116 delete iActiveTask; |
154 iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_MY_MUSIC_MENU_NSERIES); |
153 iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_MY_MUSIC_MENU_NSERIES); |
155 #else |
154 #else |
156 iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MUS_TITLE_MUSIC_MENU); |
155 iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MUS_TITLE_MUSIC_MENU); |
157 #endif // __ENABLE_MUSIC_TEXT_ALIGNMENT |
156 #endif // __ENABLE_MUSIC_TEXT_ALIGNMENT |
158 |
157 |
159 iShuffleAllText = iResource->ReadHBufCL(R_MC_SHUFFLE_ALL); |
|
160 |
158 |
161 iActiveTask = CMPXDbActiveTask::NewL(*this); |
159 iActiveTask = CMPXDbActiveTask::NewL(*this); |
162 |
160 |
163 CRepository* cenrep(NULL); |
161 CRepository* cenrep(NULL); |
164 TRAPD( err, cenrep = CRepository::NewL( KCRUIDMusicPlayerFeatures ) ); |
162 TRAPD( err, cenrep = CRepository::NewL( KCRUIDMusicPlayerFeatures ) ); |
988 |
986 |
989 RArray<TMPXItemId> ids; |
987 RArray<TMPXItemId> ids; |
990 CleanupClosePushL( ids ); |
988 CleanupClosePushL( ids ); |
991 |
989 |
992 iDbHandler->GetAllSongsLimitedL( aAttrs, *aArray, KFirstFetchCount ); |
990 iDbHandler->GetAllSongsLimitedL( aAttrs, *aArray, KFirstFetchCount ); |
993 if ( aArray->Count() > 1 ) |
991 |
994 { |
|
995 // Add "Shuffle" item |
|
996 MPXDbCommonUtil::PrependMediaL(*aArray, *iShuffleAllText, |
|
997 EMPXItem, EMPXCommand, 0, 0, 0, 0); |
|
998 //MPXDbCommonUtil::AppendMediaL(*aArray, *iShuffleAllText, EMPXItem, EMPXCommand, |
|
999 // 0, 0, 0); |
|
1000 aArray->AtL(0)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems, |
|
1001 iDbHandler->NumberOfItemsL(EMPXSong)); |
|
1002 } |
|
1003 TInt c( aArray->Count() ); |
992 TInt c( aArray->Count() ); |
1004 for( TInt i=0; i<c; ++i ) |
993 for( TInt i=0; i<c; ++i ) |
1005 { |
994 { |
1006 TMPXItemId id = aArray->AtL(i)->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
995 TMPXItemId id = aArray->AtL(i)->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
1007 ids.Append( id ); |
996 ids.Append( id ); |
1070 |
1059 |
1071 iDbHandler->GetAllSongsL(aArray, aAttrs); |
1060 iDbHandler->GetAllSongsL(aArray, aAttrs); |
1072 SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXSong, |
1061 SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXSong, |
1073 iMusicLibraryTitles->MdcaPoint(EBrowseAll)); |
1062 iMusicLibraryTitles->MdcaPoint(EBrowseAll)); |
1074 |
1063 |
1075 // Add "Shuffle" item |
|
1076 if (aArray->Count() > 2) |
|
1077 { |
|
1078 MPXDbCommonUtil::PrependMediaL(*aArray, *iShuffleAllText, |
|
1079 EMPXItem, EMPXCommand, 0, 0, 0, 1); |
|
1080 aArray->AtL(1)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems, |
|
1081 iDbHandler->NumberOfItemsL(EMPXSong)); |
|
1082 |
|
1083 } |
|
1084 MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAllL_All); |
1064 MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAllL_All); |
1085 break; |
1065 break; |
1086 } |
1066 } |
1087 |
1067 |
1088 // A Song in all songs |
1068 // A Song in all songs |
1284 |
1264 |
1285 iDbHandler->GetAllAlbumsL(aAttrs, aArray); |
1265 iDbHandler->GetAllAlbumsL(aAttrs, aArray); |
1286 SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXAlbum, |
1266 SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXAlbum, |
1287 iMusicLibraryTitles->MdcaPoint(EBrowseAlbum)); |
1267 iMusicLibraryTitles->MdcaPoint(EBrowseAlbum)); |
1288 |
1268 |
1289 // Add "Shuffle" item |
|
1290 if (aArray->Count() > 2) |
|
1291 { |
|
1292 MPXDbCommonUtil::PrependMediaL(*aArray, *iShuffleAllText, |
|
1293 EMPXItem, EMPXCommand, 0, 0, 0, 1); |
|
1294 aArray->AtL(1)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems, 0); |
|
1295 |
|
1296 TInt pPath(0); |
|
1297 CMPXMedia* pMedia = aArray->AtL(0); |
|
1298 if (pMedia->IsSupported(KMPXMediaGeneralValue)) |
|
1299 { |
|
1300 pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue); |
|
1301 MPX_ASSERT(pPath); |
|
1302 } |
|
1303 //Update path to include the additional id. |
|
1304 ((CMPXCollectionPath*)pPath)->InsertL(0,0); |
|
1305 } |
|
1306 |
|
1307 MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_All); |
1269 MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_All); |
1308 break; |
1270 break; |
1309 } |
1271 } |
1310 |
1272 |
1311 // All songs in one or multiple albums |
1273 // All songs in one or multiple albums |
1312 case 3: |
1274 case 3: |
1313 { |
1275 { |
1314 iDbHandler->GetAllAlbumsL(aAttrs, aArray); |
1276 MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAlbumL_AllSongs); |
1315 CMPXMedia* album = aArray->AtL(aPath.Index()); |
1277 if (selections.Count()) |
1316 TMPXItemId albumId = aPath.Id(); // id of selected album |
1278 { |
1317 |
1279 // Multiple albums |
1318 CMPXMediaArray* songs = CMPXMediaArray::NewL(); |
1280 const TInt count(aPath.Selection().Count()); |
1319 CleanupStack::PushL(songs); |
1281 for (TInt i = 0; i < count; ++i) |
1320 // get all the songs for the selected album |
1282 { |
1321 iDbHandler->GetSongsMatchingAlbumL(albumId, aAttrs, songs); |
1283 iDbHandler->GetSongsMatchingAlbumL(selections[i].iId2, aAttrs, aArray); |
1322 album->SetCObjectValueL(KMPXMediaArrayContents, songs); |
1284 } |
1323 album->SetTObjectValueL<TInt>(KMPXMediaArrayCount, songs->Count()); |
1285 } |
1324 CleanupStack::PopAndDestroy(songs); |
1286 else |
1325 |
1287 { |
1326 //iDbHandler->GetAllAlbumsL(aAttrs, aArray); |
1288 // One album |
1327 SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXAlbum, |
1289 iDbHandler->GetSongsMatchingAlbumL(aPath.Id(idIndex).iId2, aAttrs, aArray); |
1328 iMusicLibraryTitles->MdcaPoint(EBrowseAlbumSong)); |
1290 } |
|
1291 |
|
1292 // added for ganes |
|
1293 SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXAlbum, iMusicLibraryTitles->MdcaPoint(EBrowseAlbumSong)); |
|
1294 |
|
1295 MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_AllSongs); |
1329 break; |
1296 break; |
1330 } |
1297 } |
1331 |
1298 |
1332 // A song in an album |
1299 // A song in an album |
1333 case 4: |
1300 case 4: |
1405 else |
1372 else |
1406 { |
1373 { |
1407 iDbHandler->GetSongsMatchingPlaylistL(aPath.Id (idIndex).iId2, aAttrs, aArray); |
1374 iDbHandler->GetSongsMatchingPlaylistL(aPath.Id (idIndex).iId2, aAttrs, aArray); |
1408 } |
1375 } |
1409 |
1376 |
1410 |
|
1411 // Add "Shuffle" item |
|
1412 if (aArray->Count() > 2) |
|
1413 { |
|
1414 MPXDbCommonUtil::PrependMediaL(*aArray, *iShuffleAllText, |
|
1415 EMPXItem, EMPXCommand, 0, 0, 0, 1); |
|
1416 aArray->AtL(1)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems, aArray->Count()-2); |
|
1417 |
|
1418 TInt pPath(0); |
|
1419 CMPXMedia* pMedia = aArray->AtL(0); |
|
1420 if (pMedia->IsSupported(KMPXMediaGeneralValue)) |
|
1421 { |
|
1422 pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue); |
|
1423 MPX_ASSERT(pPath); |
|
1424 } |
|
1425 //Update path to include the additional id. |
|
1426 ((CMPXCollectionPath*)pPath)->InsertL(0,0); |
|
1427 } |
|
1428 |
1377 |
1429 SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXPlaylist, aPath.Id(idIndex).iId2); |
1378 SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXPlaylist, aPath.Id(idIndex).iId2); |
1430 |
1379 |
1431 // populate EMPXMediaGeneralNonPermissibleActions |
1380 // populate EMPXMediaGeneralNonPermissibleActions |
1432 if (iDbHandler->IsAutoPlaylistL(aPath.Id(idIndex).iId2)) |
1381 if (iDbHandler->IsAutoPlaylistL(aPath.Id(idIndex).iId2)) |
4084 aCmd.ValueText( KMPXCollectionCommandIdIncOpenLKeyItem ), |
4033 aCmd.ValueText( KMPXCollectionCommandIdIncOpenLKeyItem ), |
4085 numItems, |
4034 numItems, |
4086 direction ); |
4035 direction ); |
4087 } |
4036 } |
4088 |
4037 |
4089 // Add "Shuffle" item |
|
4090 if (offset == 0 && array->Count() > 1) |
|
4091 { |
|
4092 //MPXDbCommonUtil::AppendMediaL(*array, *iShuffleAllText, EMPXItem, EMPXCommand, |
|
4093 //0, 0, 0); |
|
4094 MPXDbCommonUtil::PrependMediaL(*array, *iShuffleAllText, |
|
4095 EMPXItem, EMPXCommand, 0, 0, 0, 0); |
|
4096 array->AtL(0)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems, |
|
4097 iDbHandler->NumberOfItemsL(EMPXSong)); |
|
4098 } |
|
4099 |
|
4100 TInt max( path->Count() ); |
4038 TInt max( path->Count() ); |
4101 TInt count(0); |
4039 TInt count(0); |
4102 TInt aryCount( array->Count() ); |
4040 TInt aryCount( array->Count() ); |
4103 // Update the collection path |
4041 // Update the collection path |
4104 while( count<numItems && offset<max && |
4042 while( count<numItems && offset<max && |