diff -r 7d93ee07fb27 -r c48470be1ba7 videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Thu May 27 12:53:14 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Fri Jun 11 13:39:54 2010 +0300 @@ -14,7 +14,7 @@ * Description: Video list cache. Contains cached data from MDS.* */ -// Version : %version: TB101_58 % + // INCLUDE FILES @@ -344,18 +344,8 @@ { media = (*allVideosArray)[i]; - TUint8 mediaOrigin = EVcxMyVideosOriginOther; - - if ( media->IsSupported( KVcxMediaMyVideosOrigin ) ) - { - mediaOrigin = *(media->Value( KVcxMediaMyVideosOrigin )); - - if ( mediaOrigin == EVcxMyVideosOriginSideLoaded ) - { - mediaOrigin = EVcxMyVideosOriginOther; - } - } - + TUint8 mediaOrigin = TVcxMyVideosCollectionUtil::OriginL( *media ); + if ( mediaOrigin == aOrigin ) { filteredVideosArray->AppendL( *media ); @@ -749,7 +739,7 @@ TVcxMyVideosSortingOrder sortingOrder = SortingOrderL(); - if ( IsFetchingVideoList + if ( iIsFetchingVideoList && sortingOrder == iLastSortingOrder && !aForce ) { MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList creation is already ongoing, skipping"); @@ -760,11 +750,11 @@ { MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList was partial or in wrong order or aForce was ETrue, recreating"); - if ( IsFetchingVideoList ) + if ( iIsFetchingVideoList ) { MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it"); iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList ); - IsFetchingVideoList = EFalse; + iIsFetchingVideoList = EFalse; } ResetVideoListL(); @@ -790,7 +780,7 @@ EFalse /* brief list */, iVideoList /* use existing */ ); - IsFetchingVideoList = ETrue; + iIsFetchingVideoList = ETrue; iLastSortingOrder = sortingOrder; SetComplete( EFalse ); } @@ -947,14 +937,18 @@ TBool modified = EFalse; iCollection.CategoriesL().UpdateCategoryNewVideoNameAndDateL( *videoInCache, modified ); - + + TUint8 origin = TVcxMyVideosCollectionUtil::OriginL( *videoInCache ); + iCollection.CategoriesL().NewVideoFlagChangedL( oldFlags, newFlags, - videoInCache->ValueTObjectL( KVcxMediaMyVideosOrigin ), + origin, modified ); +#ifndef VIDEO_COLLECTION_PLUGIN_TB92 iCollection.AlbumsL().NewVideoFlagChangedL( TVcxMyVideosCollectionUtil::IdL( *videoInCache ).iId1 ); +#endif } changed = ETrue; } @@ -1146,7 +1140,7 @@ } } - // 22 + // 23 if ( aVideo.IsSupported( KMPXMediaVideoHeight ) ) { TUint16 height = aVideo.ValueTObjectL( KMPXMediaVideoHeight ); @@ -1196,8 +1190,10 @@ iCollection.CategoriesL().UpdateCategoryNewVideoNameAndDateL( *aVideoInCache, modified ); +#ifndef VIDEO_COLLECTION_PLUGIN_TB92 iCollection.AlbumsL().VideoTitleChangedL( TVcxMyVideosCollectionUtil::IdL( *aVideoInCache ).iId1 ); +#endif TVcxMyVideosSortingOrder sortingOrder = SortingOrderL(); if ( sortingOrder == EVcxMyVideosSortingName ) @@ -1443,17 +1439,18 @@ // TVcxMyVideosSortingOrder CVcxMyVideosVideoCache::SortingOrderL() { - TUid uid; - uid.iUid = KVcxMyVideosCollectionCenrepUid; - CRepository* cenRep = CRepository::NewL( uid ); - CleanupStack::PushL( cenRep ); // 1-> + + if( !iCenRep ) + { + TUid uid; + uid.iUid = KVcxMyVideosCollectionCenrepUid; + iCenRep = CRepository::NewL( uid ); + } TInt sortingOrderInCenrep; - TInt cenRepError = cenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder, + TInt cenRepError = iCenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder, sortingOrderInCenrep ); - - CleanupStack::PopAndDestroy( cenRep ); // <-1 TVcxMyVideosSortingOrder sortingOrder; @@ -1504,7 +1501,9 @@ if ( aUpdateCategories ) { iCollection.CategoriesL().VideoAddedL( aVideo ); +#ifndef VIDEO_COLLECTION_PLUGIN_TB92 iCollection.AlbumsL().VideoAddedOrRemovedFromCacheL( aVideo ); +#endif } return KErrNone; @@ -1557,14 +1556,14 @@ MPX_DEBUG1("CVcxMyVideosVideoCache:: RemoveL failed since the item wasn't on cache"); return KErrNotFound; } - - TUint32 flags = TVcxMyVideosCollectionUtil::FlagsL( *video ); if ( aUpdateCategories && pos != KErrNotFound /* no need to update if item is on iPartialVideoList*/ ) { iCollection.CategoriesL().VideoRemovedL( *video ); +#ifndef VIDEO_COLLECTION_PLUGIN_TB92 iCollection.AlbumsL().VideoAddedOrRemovedFromCacheL( *video ); +#endif } if ( pos != KErrNotFound ) @@ -1611,8 +1610,7 @@ { MPX_FUNC("CVcxMyVideosVideoCache::ResetVideoListL"); - //TODO: when should we cancel... - //iCollection.iMyVideosMdsDb->Cancel(); + iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList ); CMPXMediaArray* mediaArray = iVideoList->ValueCObjectL( KMPXMediaArrayContents );