diff -r 171e07ac910f -r c8156a91d13c mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp --- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Mon Mar 15 12:40:11 2010 +0200 +++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp Wed Mar 31 21:26:33 2010 +0300 @@ -1263,7 +1263,33 @@ { MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAlbumL_All); - iDbHandler->GetAllAlbumsL(aAttrs, aArray); + TRAPD(err, iDbHandler->GetAllAlbumsL(aAttrs, aArray) ); + // in error case, return empty list and append empty id to path + // in order to increase one level + if ( err != KErrNone ) + { + TInt pPath(0); + if (aArray->Count()) + { + CMPXMedia* pMedia = (*aArray)[0]; + if (pMedia->IsSupported(KMPXMediaGeneralValue)) + { + pPath = pMedia->ValueTObjectL(KMPXMediaGeneralValue); + MPX_ASSERT(pPath); + } + } + + RArray ids; + CleanupClosePushL(ids); + + // Append ids to the returned path + if (pPath) + { + ((CMPXCollectionPath*)pPath)->AppendL(ids.Array()); + } + CleanupStack::PopAndDestroy(&ids); + } + SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXAlbum, iMusicLibraryTitles->MdcaPoint(EBrowseAlbum)); @@ -2565,6 +2591,13 @@ mediaId = iDbHandler->GetPlaylistIdMatchingUriL(uri); iDbHandler->RemovePlaylistL(mediaId, *fp, *itemChangedMessages); } +#ifdef ABSTRACTAUDIOALBUM_INCLUDED + else if (category == EMPXAbstractAlbum ) + { + mediaId = iDbHandler->GetAbstractAlbumIdMatchingUriL(uri); + iDbHandler->RemoveAbstractAlbumL(mediaId, *fp, *itemChangedMessages); + } +#endif // ABSTRACTAUDIOALBUM_INCLUDED else { // otherwise unable to process this item @@ -3414,11 +3447,11 @@ CMPXMessageArray* changeMsgAry = CMPXMessageArray::NewL(); CleanupStack::PushL(changeMsgAry); - // start a transaction here - if (!iDbHandler->InTransaction()) - { - iDbHandler->BeginTransactionL(); - } + // start a transaction here + if (!iDbHandler->InTransaction()) + { + iDbHandler->BeginTransactionL(); + } // Group of items if (aMedia.ValueTObjectL(KMPXMediaGeneralType) == EMPXGroup) @@ -3440,8 +3473,8 @@ itemId = DoAddItemL(aMedia, *changeMsgAry); } - // end transaction here. - iDbHandler->EndTransactionL(KErrNone); + // end transaction here. + iDbHandler->EndTransactionL(KErrNone); iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible); DoHandleChangeL(changeMsgAry); @@ -3494,7 +3527,31 @@ } } break; - +#ifdef ABSTRACTAUDIOALBUM_INCLUDED + case EMPXAbstractAlbum: + { + if (aMedia.IsSupported(KMPXMediaGeneralUri)) + { + + itemId = iDbHandler->AddAbstractAlbumL(aMedia, &aMessageArray); + + if ( aMedia.IsSupported(KMPXMediaArrayContents)) + { + //need to update songs information to music table + CMPXMediaArray* array = aMedia.Value(KMPXMediaArrayContents); + if (array->Count()) + { + iDbHandler->UpdateAbstractAlbumSongsL(aMedia, aMessageArray); + } + } + } + else + { + User::Leave(KErrArgument); + } + } + break; +#endif // ABSTRACTAUDIOALBUM_INCLUDED case EMPXSong: { // For the use case of adding thousands of songs at once, @@ -3660,7 +3717,13 @@ visibleChange = CMPXDbActiveTask::ESingleVisible; } break; - +#ifdef ABSTRACTAUDIOALBUM_INCLUDED + case EMPXAbstractAlbum: + { + visibleChange = iDbHandler->UpdateAbstractAlbumSongsL(aMedia, aMessageArray); + } + break; +#endif // ABSTRACTAUDIOALBUM_INCLUDED case EMPXSong: { // a list of changed messages as a result of the song being updated @@ -4309,13 +4372,13 @@ break; } case EBrowseAlbum: - { + { aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic, EMPXMediaMusicArtist | EMPXMediaMusicAlbum | EMPXMediaMusicAlbumArtFileName ) ); aSupportedIds.AppendL( KMPXMediaIdMusic ); break; - } + } case EBrowsePlaylist: case EBrowseGenre: case EBrowseComposer: