videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp
changeset 15 cf5481c2bc0b
parent 1 6711b85517b7
child 17 69946d1824c4
equal deleted inserted replaced
2:dec420019252 15:cf5481c2bc0b
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:    Video list cache. Contains cached data from MDS.*
    14 * Description:   Video list cache. Contains cached data from MDS.*
    15 */
    15 */
    16 
       
    17 
    16 
    18 
    17 
    19 
    18 
    20 // INCLUDE FILES
    19 // INCLUDE FILES
    21 #include <mpxlog.h>
    20 #include <mpxlog.h>
    28 #include <centralrepository.h>
    27 #include <centralrepository.h>
    29 #include <collate.h>
    28 #include <collate.h>
    30 #include <mpxmediavideodefs.h>
    29 #include <mpxmediavideodefs.h>
    31 #include "vcxmyvideosvideocache.h"
    30 #include "vcxmyvideosvideocache.h"
    32 #include "vcxmyvideoscollectionplugin.h"
    31 #include "vcxmyvideoscollectionplugin.h"
    33 #include "vcxmyvideosdownloadutil.h"
       
    34 #include "vcxmyvideoscollectionutil.h"
    32 #include "vcxmyvideoscollectionutil.h"
    35 #include "vcxmyvideoscategories.h"
    33 #include "vcxmyvideoscategories.h"
    36 #include "vcxmyvideosdownloadcache.h"
       
    37 #include "vcxmyvideosmessagelist.h"
    34 #include "vcxmyvideosmessagelist.h"
    38 #include "vcxmyvideosopenhandler.h"
    35 #include "vcxmyvideosopenhandler.h"
    39 
    36 
    40 //       If video list fetching is going on and at the same time add/delete events
    37 //       If video list fetching is going on and at the same time add/delete events
    41 //       arrive from mds, what to do?
    38 //       arrive from mds, what to do?
    65 CVcxMyVideosVideoCache::~CVcxMyVideosVideoCache()
    62 CVcxMyVideosVideoCache::~CVcxMyVideosVideoCache()
    66     {
    63     {
    67     MPX_FUNC("CVcxMyVideosVideoCache::~CVcxMyVideosVideoCache");
    64     MPX_FUNC("CVcxMyVideosVideoCache::~CVcxMyVideosVideoCache");
    68     
    65     
    69     delete iVideoList;
    66     delete iVideoList;
    70     delete iDownloadCache;
       
    71     delete iCenRep;
       
    72     
       
    73     DeletePartialList();
    67     DeletePartialList();
    74     }
    68     }
    75 
    69 
    76 // ----------------------------------------------------------------------------
    70 // ----------------------------------------------------------------------------
    77 // Constructor.
    71 // Constructor.
    93     MPX_FUNC("CVcxMyVideosVideoCache::ConstructL");
    87     MPX_FUNC("CVcxMyVideosVideoCache::ConstructL");
    94 
    88 
    95     iVideoList          = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
    89     iVideoList          = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
    96     iVideoListIsPartial = ETrue;
    90     iVideoListIsPartial = ETrue;
    97 
    91 
    98     iDownloadCache = CVcxMyVideosDownloadCache::NewL();
       
    99     iPartialVideoList.Reset();
    92     iPartialVideoList.Reset();
   100     }
    93     }
   101 
    94 
   102 // ----------------------------------------------------------------------------------------------------------
    95 // ----------------------------------------------------------------------------------------------------------
   103 // CVcxMyVideosVideoCache::CreateVideoListByOriginL
    96 // CVcxMyVideosVideoCache::CreateVideoListByOriginL
   268     MPX_DEBUG2("CVcxMyVideosCollectionPlugin::FindVideoByMdsIdL() MDSID %d NOT FOUND", aMdsId);
   261     MPX_DEBUG2("CVcxMyVideosCollectionPlugin::FindVideoByMdsIdL() MDSID %d NOT FOUND", aMdsId);
   269     return NULL;
   262     return NULL;
   270     }
   263     }
   271 
   264 
   272 // ----------------------------------------------------------------------------
   265 // ----------------------------------------------------------------------------
   273 // CVcxMyVideosVideoCache::FindVideoByDownloadIdL
       
   274 // ----------------------------------------------------------------------------
       
   275 //
       
   276 CMPXMedia* CVcxMyVideosVideoCache::FindVideoByDownloadIdL( TUint aDownloadId )
       
   277     {
       
   278     MPX_FUNC("CVcxMyVideosVideoCache::FindVideoByDownloadIdL()");
       
   279     
       
   280     MPX_DEBUG2("CVcxMyVideosVideoCache:: looking for MPX item  with download ID %d from cache", aDownloadId);
       
   281         
       
   282     if ( aDownloadId == 0 )
       
   283         {
       
   284         MPX_DEBUG1("CVcxMyVideosVideoCache:: dl id == 0 -> NOT FOUND");
       
   285         return NULL;
       
   286         }
       
   287     
       
   288     if ( !iVideoList )
       
   289         {
       
   290         MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList is NULL -> NOT FOUND");
       
   291         return NULL;
       
   292         }
       
   293 
       
   294     CMPXMedia* video = iDownloadCache->Get( aDownloadId );
       
   295     if ( video )
       
   296         {
       
   297         MPX_DEBUG1("CVcxMyVideosVideoCache:: found from Download Cache");
       
   298         return video;
       
   299         }
       
   300 
       
   301     MPX_DEBUG1("CVcxMyVideosVideoCache:: not found from Download Cache");
       
   302 
       
   303     CMPXMediaArray* cachedVideoArray = iVideoList->Value<CMPXMediaArray>(
       
   304                                 KMPXMediaArrayContents);
       
   305               
       
   306     TUint32 downloadId;
       
   307     TInt count = cachedVideoArray->Count();
       
   308     for ( TInt i = 0; i < count; i++ )
       
   309         {
       
   310         downloadId = TVcxMyVideosCollectionUtil::DownloadIdL( *cachedVideoArray->AtL( i ) );
       
   311         if ( downloadId == aDownloadId )
       
   312             {
       
   313             MPX_DEBUG1("CVcxMyVideosVideoCache:: found from iVideoList");
       
   314             MPX_DEBUG1("CVcxMyVideosVideoCache:: adding to iDownloadCache");
       
   315             iDownloadCache->Add( downloadId, (*cachedVideoArray)[i] );
       
   316             return (*cachedVideoArray)[i];
       
   317             }
       
   318         }
       
   319     
       
   320     count = iPartialVideoList.Count();  
       
   321     for ( TInt i = 0; i < count; i++ )
       
   322         {
       
   323         downloadId = TVcxMyVideosCollectionUtil::DownloadIdL( *(iPartialVideoList[i]) );
       
   324         if ( downloadId ==  aDownloadId )
       
   325             {
       
   326             MPX_DEBUG1("CVcxMyVideosVideoCache:: found from iPartialVideoList");
       
   327             MPX_DEBUG1("CVcxMyVideosVideoCache:: adding to iDownloadCache");
       
   328             iDownloadCache->Add( downloadId, iPartialVideoList[i] );
       
   329             return iPartialVideoList[i];
       
   330             }       
       
   331         }
       
   332         
       
   333     MPX_DEBUG1("CVcxMyVideosVideoCache:: NOT FOUND");
       
   334     return NULL;
       
   335     }
       
   336 
       
   337 
       
   338 // ----------------------------------------------------------------------------
       
   339 // CVcxMyVideosVideoCache::GetVideosL
   266 // CVcxMyVideosVideoCache::GetVideosL
   340 // ----------------------------------------------------------------------------
   267 // ----------------------------------------------------------------------------
   341 //
   268 //
   342 CMPXMedia* CVcxMyVideosVideoCache::GetVideosL( RArray<TUint32> aMdsIds )
   269 CMPXMedia* CVcxMyVideosVideoCache::GetVideosL( RArray<TUint32>& aMdsIds )
   343     {
   270     {
   344     CMPXMessage* videoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
   271     CMPXMessage* videoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
   345     CleanupStack::PushL( videoList ); // 1->
   272     CleanupStack::PushL( videoList ); // 1->
   346 
   273 
   347     // copy from iVideoList
   274     // copy from iVideoList
   358     
   285     
   359 // ----------------------------------------------------------------------------
   286 // ----------------------------------------------------------------------------
   360 // CVcxMyVideosVideoCache::AddVideosFromMdsL
   287 // CVcxMyVideosVideoCache::AddVideosFromMdsL
   361 // Called when item inserted events arrive from mds or from
   288 // Called when item inserted events arrive from mds or from
   362 // KVcxCommandMyVideosGetMediasByMpxId cmd handler.
   289 // KVcxCommandMyVideosGetMediasByMpxId cmd handler.
   363 // Synchronizing with downloads is not done here, caller must take care of it.
       
   364 // If mpx item is already in cache, or MDS does not contain the item (or was not video item),
   290 // If mpx item is already in cache, or MDS does not contain the item (or was not video item),
   365 // then it is removed from aMdsIds. Ie after this function call aMdsIds contains
   291 // then it is removed from aMdsIds. Ie after this function call aMdsIds contains
   366 // only IDs which are actually added to cache.
   292 // only IDs which are actually added to cache. aNonVideoIds will contain IDs
       
   293 // which were not video objects.
   367 // ----------------------------------------------------------------------------
   294 // ----------------------------------------------------------------------------
   368 //    
   295 //    
   369 void CVcxMyVideosVideoCache::AddVideosFromMdsL( RArray<TUint32>& aMdsIds,
   296 void CVcxMyVideosVideoCache::AddVideosFromMdsL( RArray<TUint32>& aMdsIds,
   370         TBool& aListFetchingWasCanceled )
   297         TBool& aListFetchingWasCanceled, RArray<TUint32>* aNonVideoIds  )
   371     {
   298     {
   372     MPX_FUNC("CVcxMyVideosVideoCache::AddVideosFromMdsL");
   299     MPX_FUNC("CVcxMyVideosVideoCache::AddVideosFromMdsL");
   373 
   300 
   374     TVcxMyVideosSortingOrder sortingOrder = SortingOrderL();
   301     TVcxMyVideosSortingOrder sortingOrder = SortingOrderL();
   375   
   302   
   383         TInt pos;
   310         TInt pos;
   384         if ( !FindVideoByMdsIdL( aMdsIds[j], pos ) )
   311         if ( !FindVideoByMdsIdL( aMdsIds[j], pos ) )
   385             {
   312             {
   386             MPX_DEBUG2("CVcxMyVideosVideoCache:: MDSID(%d) not found from cache, ok", aMdsIds[j]);
   313             MPX_DEBUG2("CVcxMyVideosVideoCache:: MDSID(%d) not found from cache, ok", aMdsIds[j]);
   387             
   314             
       
   315             //TODO: This doesnt work with new mds cmd queue. Cancel must be done if there is _any_ async req going on.
       
   316             //      Maybe the fetching could be changed to asynchronous...
   388             if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing )
   317             if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing )
   389                 {
   318                 {
   390                 // If list fetching is not canceled, CreateVideoObjectL will leave with KErrNotReady.
   319                 // If list fetching is not canceled, CreateVideoObjectL will leave with KErrNotReady.
   391                 MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it to be able to fetch single items!");
   320                 MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it to be able to fetch single items!");
   392                 iCollection.iMyVideosMdsDb->Cancel();
   321                 iCollection.iMyVideosMdsDb->Cancel();
   413                     
   342                     
   414                 MPX_DEBUG3("CVcxMyVideosVideoCache:: %d (pointer = %x) added to cache", aMdsIds[j], videoToCache);
   343                 MPX_DEBUG3("CVcxMyVideosVideoCache:: %d (pointer = %x) added to cache", aMdsIds[j], videoToCache);
   415                 }
   344                 }
   416             else
   345             else
   417                 {
   346                 {
   418                 MPX_DEBUG2("CVcxMyVideosVideoCache:: video with %d ID not found from MDS -> skipping add to cache and deleting from id array", aMdsIds[j] );
   347                 MPX_DEBUG2("CVcxMyVideosVideoCache:: video with %d ID not found from MDS -> prob non video object, skipping add to cache", aMdsIds[j] );
   419                 aMdsIds.Remove( j );
   348                 aMdsIds.Remove( j );
       
   349                 if ( aNonVideoIds )
       
   350                     {
       
   351                     aNonVideoIds->AppendL( j );
       
   352                     }
   420                 }
   353                 }
   421             }
   354             }
   422         else
   355         else
   423             {
   356             {
   424             MPX_DEBUG2("CVcxMyVideosVideoCache:: %d was already in cache -> skipping add, and deleting from id array", aMdsIds[j]);
   357             MPX_DEBUG2("CVcxMyVideosVideoCache:: %d was already in cache -> skipping add", aMdsIds[j]);
   425             aMdsIds.Remove( j );
   358             aMdsIds.Remove( j );
   426             }
   359             }
   427         }
   360         }
   428 
   361 
   429     }
   362     }
   586 
   519 
   587     MPX_DEBUG2("CVcxMyVideosVideoCache:: aForce = %d", aForce );
   520     MPX_DEBUG2("CVcxMyVideosVideoCache:: aForce = %d", aForce );
   588     
   521     
   589     TVcxMyVideosSortingOrder sortingOrder = SortingOrderL();
   522     TVcxMyVideosSortingOrder sortingOrder = SortingOrderL();
   590         
   523         
   591     if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing
   524     if ( IsFetchingVideoList
   592             && sortingOrder == iLastSortingOrder && !aForce )
   525             && sortingOrder == iLastSortingOrder && !aForce )
   593         {
   526         {
   594         MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList creation is already ongoing, skipping");
   527         MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList creation is already ongoing, skipping");
   595         return;
   528         return;
   596         }
   529         }
   597                    
   530                    
   598     if ( iVideoListIsPartial || (sortingOrder != iLastSortingOrder) || aForce )
   531     if ( iVideoListIsPartial || (sortingOrder != iLastSortingOrder) || aForce )
   599         {
   532         {
   600         MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList was partial or in wrong order or aForce was ETrue, recreating");
   533         MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList was partial or in wrong order or aForce was ETrue, recreating");
   601 
   534 
   602         if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing )
   535         if ( IsFetchingVideoList )
   603             {
   536             {
   604             MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it");
   537             MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it");
   605             iCollection.iMyVideosMdsDb->Cancel();
   538             iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList );
       
   539             IsFetchingVideoList = EFalse;
   606             }
   540             }
   607         
   541         
   608         ResetVideoListL();
   542         ResetVideoListL();
   609                         
   543                         
   610         TBool ascending = ETrue;
   544         TBool ascending = ETrue;
   626                 sortingOrder,
   560                 sortingOrder,
   627                 ascending,
   561                 ascending,
   628                 EFalse /* brief list */,
   562                 EFalse /* brief list */,
   629                 iVideoList /* use existing */ );
   563                 iVideoList /* use existing */ );
   630 
   564 
       
   565         IsFetchingVideoList = ETrue;
   631         iLastSortingOrder   = sortingOrder;
   566         iLastSortingOrder   = sortingOrder;
   632         iVideoListIsPartial = ETrue;
   567         iVideoListIsPartial = ETrue;
   633         }
   568         }
   634     else
   569     else
   635         {
   570         {
   656         }
   591         }
   657 
   592 
   658     TBool changed = EFalse;
   593     TBool changed = EFalse;
   659         
   594         
   660     // 1 MPX ID cant be changed
   595     // 1 MPX ID cant be changed
   661     // 2 
   596     // 2
   662     if ( aVideo.IsSupported( KMPXMediaGeneralTitle ) )
   597     if ( aVideo.IsSupported( KMPXMediaGeneralTitle ) )
   663         {
   598         {
   664         if ( videoInCache->ValueText( KMPXMediaGeneralTitle ) !=
   599         if ( videoInCache->ValueText( KMPXMediaGeneralTitle ) !=
   665                 aVideo.ValueText( KMPXMediaGeneralTitle ) )
   600                 aVideo.ValueText( KMPXMediaGeneralTitle ) )
   666             {
   601             {
   953             videoInCache->SetTObjectValueL<TInt>( KMPXMediaGeneralLastPlaybackPosition,
   888             videoInCache->SetTObjectValueL<TInt>( KMPXMediaGeneralLastPlaybackPosition,
   954                     aVideo.ValueTObjectL<TInt>( KMPXMediaGeneralLastPlaybackPosition ) );
   889                     aVideo.ValueTObjectL<TInt>( KMPXMediaGeneralLastPlaybackPosition ) );
   955             changed = ETrue;
   890             changed = ETrue;
   956             }
   891             }
   957         }
   892         }
   958     // 18
   893 
   959     if ( aVideo.IsSupported( KVcxMediaMyVideosDownloadId ) )
       
   960         {
       
   961         TUint32 downloadIdInCache( TVcxMyVideosCollectionUtil::DownloadIdL( *videoInCache ) );
       
   962         TUint32 downloadIdInNew( TVcxMyVideosCollectionUtil::DownloadIdL( aVideo ) );
       
   963         if (  downloadIdInNew != downloadIdInCache )
       
   964             {
       
   965             videoInCache->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId,
       
   966                     downloadIdInNew );
       
   967 
       
   968             if ( downloadIdInNew == 0 )
       
   969                 {
       
   970                 iDownloadCache->Delete( videoInCache );
       
   971                 }
       
   972             changed = ETrue;
       
   973             }
       
   974         }
       
   975     // 19
   894     // 19
   976     if ( aVideo.IsSupported( KVcxMediaMyVideosRating ) )
   895     if ( aVideo.IsSupported( KVcxMediaMyVideosRating ) )
   977         {
   896         {
   978         TUint8 ratingInCache( TVcxMyVideosCollectionUtil::RatingL( *videoInCache ) );
   897         TUint8 ratingInCache( TVcxMyVideosCollectionUtil::RatingL( *videoInCache ) );
   979         TUint8 ratingInNew( TVcxMyVideosCollectionUtil::RatingL( aVideo ) );
   898         TUint8 ratingInNew( TVcxMyVideosCollectionUtil::RatingL( aVideo ) );
  1007         if (  AudioFourCcInNew != AudioFourCcInCache )
   926         if (  AudioFourCcInNew != AudioFourCcInCache )
  1008             {
   927             {
  1009             videoInCache->SetTObjectValueL<TUint32>( KVcxMediaMyVideosAudioFourCc,
   928             videoInCache->SetTObjectValueL<TUint32>( KVcxMediaMyVideosAudioFourCc,
  1010                     AudioFourCcInNew );
   929                     AudioFourCcInNew );
  1011 
   930 
  1012             if ( AudioFourCcInNew == 0 )
       
  1013                 {
       
  1014                 iDownloadCache->Delete( videoInCache );
       
  1015                 }
       
  1016             changed = ETrue;
   931             changed = ETrue;
  1017             }
   932             }
  1018         }
   933         }
  1019 
   934 
  1020     // 22
   935     // 22
  1028             
   943             
  1029             changed = ETrue;
   944             changed = ETrue;
  1030             }
   945             }
  1031         }
   946         }
  1032     
   947     
  1033     // 23
   948     // 22
  1034     if ( aVideo.IsSupported( KMPXMediaVideoHeight ) )
   949     if ( aVideo.IsSupported( KMPXMediaVideoHeight ) )
  1035         {
   950         {
  1036         TUint16 height = aVideo.ValueTObjectL<TUint16>( KMPXMediaVideoHeight ); 
   951         TUint16 height = aVideo.ValueTObjectL<TUint16>( KMPXMediaVideoHeight ); 
  1037         if ( height != videoInCache->ValueTObjectL<TUint16>( KMPXMediaVideoHeight ) )
   952         if ( height != videoInCache->ValueTObjectL<TUint16>( KMPXMediaVideoHeight ) )
  1038             {
   953             {
  1317 // CVcxMyVideosVideoCache::SortingOrderL
  1232 // CVcxMyVideosVideoCache::SortingOrderL
  1318 // ----------------------------------------------------------------------------
  1233 // ----------------------------------------------------------------------------
  1319 //    
  1234 //    
  1320 TVcxMyVideosSortingOrder CVcxMyVideosVideoCache::SortingOrderL()
  1235 TVcxMyVideosSortingOrder CVcxMyVideosVideoCache::SortingOrderL()
  1321     {
  1236     {
  1322 
  1237     TUid uid;
  1323     if( !iCenRep ) 
  1238     uid.iUid = KVcxMyVideosCollectionCenrepUid;
  1324         {
  1239     CRepository* cenRep = CRepository::NewL( uid );
  1325         TUid uid;
  1240     CleanupStack::PushL( cenRep ); // 1->
  1326         uid.iUid = KVcxMyVideosCollectionCenrepUid;
       
  1327 		iCenRep = CRepository::NewL( uid );
       
  1328         }
       
  1329     
  1241     
  1330     TInt sortingOrderInCenrep;
  1242     TInt sortingOrderInCenrep;
  1331 
  1243 
  1332     TInt cenRepError = iCenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder,
  1244     TInt cenRepError = cenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder,
  1333             sortingOrderInCenrep );
  1245             sortingOrderInCenrep );
       
  1246 
       
  1247     CleanupStack::PopAndDestroy( cenRep ); // <-1
  1334     
  1248     
  1335     TVcxMyVideosSortingOrder sortingOrder;
  1249     TVcxMyVideosSortingOrder sortingOrder;
  1336     
  1250     
  1337     if ( cenRepError != KErrNone )
  1251     if ( cenRepError != KErrNone )
  1338         {
  1252         {
  1428         {
  1342         {
  1429         MPX_DEBUG1("CVcxMyVideosVideoCache:: RemoveL failed since the item wasn't on cache");
  1343         MPX_DEBUG1("CVcxMyVideosVideoCache:: RemoveL failed since the item wasn't on cache");
  1430         return KErrNotFound;
  1344         return KErrNotFound;
  1431         }
  1345         }
  1432 
  1346 
  1433     iDownloadCache->Delete( video );
       
  1434 
       
  1435     TUint32 flags( 0 );
  1347     TUint32 flags( 0 );
  1436 	if ( video->IsSupported( KMPXMediaGeneralFlags ) )
  1348 	if ( video->IsSupported( KMPXMediaGeneralFlags ) )
  1437 	    {
  1349 	    {
  1438 		flags = video->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags );
  1350 		flags = video->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags );
  1439 		}
  1351 		}
  1489 //
  1401 //
  1490 void CVcxMyVideosVideoCache::ResetVideoListL()
  1402 void CVcxMyVideosVideoCache::ResetVideoListL()
  1491     {
  1403     {
  1492     MPX_FUNC("CVcxMyVideosVideoCache::ResetVideoListL");
  1404     MPX_FUNC("CVcxMyVideosVideoCache::ResetVideoListL");
  1493 
  1405 
  1494     iCollection.iMyVideosMdsDb->Cancel();
  1406     //TODO: when should we cancel...
       
  1407     //iCollection.iMyVideosMdsDb->Cancel();
  1495 
  1408 
  1496     CMPXMediaArray* mediaArray =
  1409     CMPXMediaArray* mediaArray =
  1497             iVideoList->ValueCObjectL<CMPXMediaArray>( KMPXMediaArrayContents );
  1410             iVideoList->ValueCObjectL<CMPXMediaArray>( KMPXMediaArrayContents );
  1498     CleanupStack::PushL( mediaArray ); // 1->
  1411     CleanupStack::PushL( mediaArray ); // 1->
  1499     
  1412     
  1528             CleanupStack::PopAndDestroy( mediaArray ); // <-1
  1441             CleanupStack::PopAndDestroy( mediaArray ); // <-1
  1529             }
  1442             }
  1530         }
  1443         }
  1531         
  1444         
  1532     iVideoListIsPartial = ETrue;
  1445     iVideoListIsPartial = ETrue;
  1533 
       
  1534     delete iDownloadCache;
       
  1535     iDownloadCache = NULL;
       
  1536     iDownloadCache = CVcxMyVideosDownloadCache::NewL();
       
  1537                 
  1446                 
  1538     iCollection.CategoriesL().ResetVideoCountersL(); //this does not send events
  1447     iCollection.CategoriesL().ResetVideoCountersL(); //this does not send events
  1539     }
  1448     }
  1540 
  1449 
  1541 // ----------------------------------------------------------------------------
  1450 // ----------------------------------------------------------------------------
  1570     
  1479     
  1571     delete iVideoList;
  1480     delete iVideoList;
  1572     iVideoList = NULL;
  1481     iVideoList = NULL;
  1573     iVideoList = newList;
  1482     iVideoList = newList;
  1574     CleanupStack::Pop( newList ); // <-1
  1483     CleanupStack::Pop( newList ); // <-1
  1575 
       
  1576     delete iDownloadCache;
       
  1577     iDownloadCache = NULL;
       
  1578     iDownloadCache = CVcxMyVideosDownloadCache::NewL();
       
  1579     }
  1484     }
  1580 // End of file
  1485 // End of file
  1581 
  1486