videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp
changeset 28 c48470be1ba7
parent 24 7d93ee07fb27
child 40 13331705e488
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp	Thu May 27 12:53:14 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp	Fri Jun 11 13:39:54 2010 +0300
@@ -125,8 +125,10 @@
         case categoryLevel:
             {
             //we are at root level, return main level items (categories + albums)
-            
+
+#ifndef VIDEO_COLLECTION_PLUGIN_TB92            
             iCollection.AlbumsL().CreateAlbumListL(); //async
+#endif
 
             // This is needed to update category counters.
             // Goes to queue if CreateAlbumListL command goes to execution
@@ -139,8 +141,14 @@
             
             CMPXMedia* itemList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
             CleanupStack::PushL( itemList );
+            
+            itemList->SetTObjectValueL<TBool>( KVcxMediaMyVideosVideoListIsPartial,
+                !iCache.IsComplete() );
+                
             TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.CategoriesL().iList );
+#ifndef VIDEO_COLLECTION_PLUGIN_TB92
             TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.AlbumsL().iAlbumList );
+#endif
             itemList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
             iCollection.iObs->HandleOpen( itemList, KErrNone );
             CleanupStack::PopAndDestroy( itemList );
@@ -152,7 +160,9 @@
             {
             //we are at second level, return video list from some category or album
 
+#ifndef VIDEO_COLLECTION_PLUGIN_TB92
             iCollection.AlbumsL().CreateAlbumListL(); //async
+#endif
 
             TMPXItemId categoryId( aPath.Id() );
             
@@ -229,7 +239,7 @@
             CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin );
             MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen(new list)");
             videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
-            iCache.iVideoList->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value,
+            videoList->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value,
                     EVcxMyVideosVideoListComplete );
             iCollection.iObs->HandleOpen( videoList, KErrNone );
             delete videoList;
@@ -266,8 +276,8 @@
                 iVideoListsBeingOpened.AppendL( videoList );
                 CleanupStack::Pop( videoList );
                 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen");
-                iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
-                iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone  );
+                videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+                iCollection.iObs->HandleOpen( videoList, KErrNone  );
                 }
             else
                 {
@@ -326,7 +336,7 @@
         // End event arrived
         
         iCache.SetComplete( ETrue );
-        iCache.IsFetchingVideoList = EFalse;
+        iCache.iIsFetchingVideoList = EFalse;
         
 
         // Create modify event for All category.
@@ -394,9 +404,6 @@
 //
 void CVcxMyVideosOpenHandler::HandleAlbumOpenL()
     {
-    //TODO: If iVideoList is partial and fetching is already going on -> use the implementation below.
-    //      If iVideoList is partial but fetching is not going on -> fetch only album items to iCache.
-
     MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() start");
     
     CVcxMyVideosAlbum* album = iCollection.AlbumsL().Album( iPendingAlbumOpenId );
@@ -406,17 +413,18 @@
             {
             //videolist complete
             CMPXMedia* videoList = album->CreateVideoListL();
+            CleanupStack::PushL( videoList ); // 1->
             videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
             videoList->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value,
                     EVcxMyVideosVideoListComplete ); 
             iCollection.iObs->HandleOpen( videoList, KErrNone );
-            delete videoList;
+            CleanupStack::PopAndDestroy( videoList ); // <-1
             iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
             iCollection.iMessageList->SendL();
             }
         else
             {
-            if ( iCollection.iCache->IsFetchingVideoList )
+            if ( iCollection.iCache->iIsFetchingVideoList )
                 {
                 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist fetching already in progress -> use that to populate album");
 
@@ -443,9 +451,6 @@
                 }
             else
                 {
-                // videolist incomplete and fetching hasn't been started
-                // TODO: Test how fast this is. If slow, then ditch the separate album fetching.
-
                 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist partial and no fetching going on -> fetch the album videos separately");
 
                 delete iAlbumVideoList;