342 |
342 |
343 for( TInt i = 0; i < allVideosArrayCount; i++ ) |
343 for( TInt i = 0; i < allVideosArrayCount; i++ ) |
344 { |
344 { |
345 media = (*allVideosArray)[i]; |
345 media = (*allVideosArray)[i]; |
346 |
346 |
347 TUint8 mediaOrigin = EVcxMyVideosOriginOther; |
347 TUint8 mediaOrigin = TVcxMyVideosCollectionUtil::OriginL( *media ); |
348 |
348 |
349 if ( media->IsSupported( KVcxMediaMyVideosOrigin ) ) |
|
350 { |
|
351 mediaOrigin = *(media->Value<TUint8>( KVcxMediaMyVideosOrigin )); |
|
352 |
|
353 if ( mediaOrigin == EVcxMyVideosOriginSideLoaded ) |
|
354 { |
|
355 mediaOrigin = EVcxMyVideosOriginOther; |
|
356 } |
|
357 } |
|
358 |
|
359 if ( mediaOrigin == aOrigin ) |
349 if ( mediaOrigin == aOrigin ) |
360 { |
350 { |
361 filteredVideosArray->AppendL( *media ); |
351 filteredVideosArray->AppendL( *media ); |
362 } |
352 } |
363 } |
353 } |
747 |
737 |
748 MPX_DEBUG2("CVcxMyVideosVideoCache:: aForce = %d", aForce ); |
738 MPX_DEBUG2("CVcxMyVideosVideoCache:: aForce = %d", aForce ); |
749 |
739 |
750 TVcxMyVideosSortingOrder sortingOrder = SortingOrderL(); |
740 TVcxMyVideosSortingOrder sortingOrder = SortingOrderL(); |
751 |
741 |
752 if ( IsFetchingVideoList |
742 if ( iIsFetchingVideoList |
753 && sortingOrder == iLastSortingOrder && !aForce ) |
743 && sortingOrder == iLastSortingOrder && !aForce ) |
754 { |
744 { |
755 MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList creation is already ongoing, skipping"); |
745 MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList creation is already ongoing, skipping"); |
756 return; |
746 return; |
757 } |
747 } |
758 |
748 |
759 if ( !IsComplete() || (sortingOrder != iLastSortingOrder) || aForce ) |
749 if ( !IsComplete() || (sortingOrder != iLastSortingOrder) || aForce ) |
760 { |
750 { |
761 MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList was partial or in wrong order or aForce was ETrue, recreating"); |
751 MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList was partial or in wrong order or aForce was ETrue, recreating"); |
762 |
752 |
763 if ( IsFetchingVideoList ) |
753 if ( iIsFetchingVideoList ) |
764 { |
754 { |
765 MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it"); |
755 MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it"); |
766 iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList ); |
756 iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList ); |
767 IsFetchingVideoList = EFalse; |
757 iIsFetchingVideoList = EFalse; |
768 } |
758 } |
769 |
759 |
770 ResetVideoListL(); |
760 ResetVideoListL(); |
771 |
761 |
772 TBool ascending = ETrue; |
762 TBool ascending = ETrue; |
788 sortingOrder, |
778 sortingOrder, |
789 ascending, |
779 ascending, |
790 EFalse /* brief list */, |
780 EFalse /* brief list */, |
791 iVideoList /* use existing */ ); |
781 iVideoList /* use existing */ ); |
792 |
782 |
793 IsFetchingVideoList = ETrue; |
783 iIsFetchingVideoList = ETrue; |
794 iLastSortingOrder = sortingOrder; |
784 iLastSortingOrder = sortingOrder; |
795 SetComplete( EFalse ); |
785 SetComplete( EFalse ); |
796 } |
786 } |
797 else |
787 else |
798 { |
788 { |
945 MPX_DEBUG1("CVcxMyVideosVideoCache:: new video flag modified-> updating categories' new video names and counters"); |
935 MPX_DEBUG1("CVcxMyVideosVideoCache:: new video flag modified-> updating categories' new video names and counters"); |
946 |
936 |
947 TBool modified = EFalse; |
937 TBool modified = EFalse; |
948 iCollection.CategoriesL().UpdateCategoryNewVideoNameAndDateL( |
938 iCollection.CategoriesL().UpdateCategoryNewVideoNameAndDateL( |
949 *videoInCache, modified ); |
939 *videoInCache, modified ); |
950 |
940 |
|
941 TUint8 origin = TVcxMyVideosCollectionUtil::OriginL( *videoInCache ); |
|
942 |
951 iCollection.CategoriesL().NewVideoFlagChangedL( |
943 iCollection.CategoriesL().NewVideoFlagChangedL( |
952 oldFlags, newFlags, |
944 oldFlags, newFlags, |
953 videoInCache->ValueTObjectL<TUint8>( KVcxMediaMyVideosOrigin ), |
945 origin, |
954 modified ); |
946 modified ); |
955 |
947 |
|
948 #ifndef VIDEO_COLLECTION_PLUGIN_TB92 |
956 iCollection.AlbumsL().NewVideoFlagChangedL( |
949 iCollection.AlbumsL().NewVideoFlagChangedL( |
957 TVcxMyVideosCollectionUtil::IdL( *videoInCache ).iId1 ); |
950 TVcxMyVideosCollectionUtil::IdL( *videoInCache ).iId1 ); |
|
951 #endif |
958 } |
952 } |
959 changed = ETrue; |
953 changed = ETrue; |
960 } |
954 } |
961 } |
955 } |
962 // 8 |
956 // 8 |
1194 |
1188 |
1195 TBool modified = EFalse; |
1189 TBool modified = EFalse; |
1196 iCollection.CategoriesL().UpdateCategoryNewVideoNameAndDateL( |
1190 iCollection.CategoriesL().UpdateCategoryNewVideoNameAndDateL( |
1197 *aVideoInCache, modified ); |
1191 *aVideoInCache, modified ); |
1198 |
1192 |
|
1193 #ifndef VIDEO_COLLECTION_PLUGIN_TB92 |
1199 iCollection.AlbumsL().VideoTitleChangedL( |
1194 iCollection.AlbumsL().VideoTitleChangedL( |
1200 TVcxMyVideosCollectionUtil::IdL( *aVideoInCache ).iId1 ); |
1195 TVcxMyVideosCollectionUtil::IdL( *aVideoInCache ).iId1 ); |
|
1196 #endif |
1201 |
1197 |
1202 TVcxMyVideosSortingOrder sortingOrder = SortingOrderL(); |
1198 TVcxMyVideosSortingOrder sortingOrder = SortingOrderL(); |
1203 if ( sortingOrder == EVcxMyVideosSortingName ) |
1199 if ( sortingOrder == EVcxMyVideosSortingName ) |
1204 { |
1200 { |
1205 MPX_DEBUG1(" Title modified and sorting by Name -> moving item to correct place"); |
1201 MPX_DEBUG1(" Title modified and sorting by Name -> moving item to correct place"); |
1441 // CVcxMyVideosVideoCache::SortingOrderL |
1437 // CVcxMyVideosVideoCache::SortingOrderL |
1442 // ---------------------------------------------------------------------------- |
1438 // ---------------------------------------------------------------------------- |
1443 // |
1439 // |
1444 TVcxMyVideosSortingOrder CVcxMyVideosVideoCache::SortingOrderL() |
1440 TVcxMyVideosSortingOrder CVcxMyVideosVideoCache::SortingOrderL() |
1445 { |
1441 { |
1446 TUid uid; |
1442 |
1447 uid.iUid = KVcxMyVideosCollectionCenrepUid; |
1443 if( !iCenRep ) |
1448 CRepository* cenRep = CRepository::NewL( uid ); |
1444 { |
1449 CleanupStack::PushL( cenRep ); // 1-> |
1445 TUid uid; |
|
1446 uid.iUid = KVcxMyVideosCollectionCenrepUid; |
|
1447 iCenRep = CRepository::NewL( uid ); |
|
1448 } |
1450 |
1449 |
1451 TInt sortingOrderInCenrep; |
1450 TInt sortingOrderInCenrep; |
1452 |
1451 |
1453 TInt cenRepError = cenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder, |
1452 TInt cenRepError = iCenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder, |
1454 sortingOrderInCenrep ); |
1453 sortingOrderInCenrep ); |
1455 |
|
1456 CleanupStack::PopAndDestroy( cenRep ); // <-1 |
|
1457 |
1454 |
1458 TVcxMyVideosSortingOrder sortingOrder; |
1455 TVcxMyVideosSortingOrder sortingOrder; |
1459 |
1456 |
1460 if ( cenRepError != KErrNone ) |
1457 if ( cenRepError != KErrNone ) |
1461 { |
1458 { |
1555 if ( !video ) |
1554 if ( !video ) |
1556 { |
1555 { |
1557 MPX_DEBUG1("CVcxMyVideosVideoCache:: RemoveL failed since the item wasn't on cache"); |
1556 MPX_DEBUG1("CVcxMyVideosVideoCache:: RemoveL failed since the item wasn't on cache"); |
1558 return KErrNotFound; |
1557 return KErrNotFound; |
1559 } |
1558 } |
1560 |
|
1561 TUint32 flags = TVcxMyVideosCollectionUtil::FlagsL( *video ); |
|
1562 |
1559 |
1563 if ( aUpdateCategories && |
1560 if ( aUpdateCategories && |
1564 pos != KErrNotFound /* no need to update if item is on iPartialVideoList*/ ) |
1561 pos != KErrNotFound /* no need to update if item is on iPartialVideoList*/ ) |
1565 { |
1562 { |
1566 iCollection.CategoriesL().VideoRemovedL( *video ); |
1563 iCollection.CategoriesL().VideoRemovedL( *video ); |
|
1564 #ifndef VIDEO_COLLECTION_PLUGIN_TB92 |
1567 iCollection.AlbumsL().VideoAddedOrRemovedFromCacheL( *video ); |
1565 iCollection.AlbumsL().VideoAddedOrRemovedFromCacheL( *video ); |
|
1566 #endif |
1568 } |
1567 } |
1569 |
1568 |
1570 if ( pos != KErrNotFound ) |
1569 if ( pos != KErrNotFound ) |
1571 { |
1570 { |
1572 CMPXMediaArray* cachedVideoArray = iVideoList->Value<CMPXMediaArray>( |
1571 CMPXMediaArray* cachedVideoArray = iVideoList->Value<CMPXMediaArray>( |
1609 // |
1608 // |
1610 void CVcxMyVideosVideoCache::ResetVideoListL() |
1609 void CVcxMyVideosVideoCache::ResetVideoListL() |
1611 { |
1610 { |
1612 MPX_FUNC("CVcxMyVideosVideoCache::ResetVideoListL"); |
1611 MPX_FUNC("CVcxMyVideosVideoCache::ResetVideoListL"); |
1613 |
1612 |
1614 //TODO: when should we cancel... |
1613 iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList ); |
1615 //iCollection.iMyVideosMdsDb->Cancel(); |
|
1616 |
1614 |
1617 CMPXMediaArray* mediaArray = |
1615 CMPXMediaArray* mediaArray = |
1618 iVideoList->ValueCObjectL<CMPXMediaArray>( KMPXMediaArrayContents ); |
1616 iVideoList->ValueCObjectL<CMPXMediaArray>( KMPXMediaArrayContents ); |
1619 CleanupStack::PushL( mediaArray ); // 1-> |
1617 CleanupStack::PushL( mediaArray ); // 1-> |
1620 |
1618 |