videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp
changeset 36 8aed59de29f9
parent 34 bbb98528c666
child 24 7d93ee07fb27
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
   150 
   150 
   151         case videosLevel:
   151         case videosLevel:
   152             {
   152             {
   153             //we are at second level, return video list from some category or album
   153             //we are at second level, return video list from some category or album
   154 
   154 
       
   155             iCollection.AlbumsL().CreateAlbumListL(); //async
       
   156 
   155             TMPXItemId categoryId( aPath.Id() );
   157             TMPXItemId categoryId( aPath.Id() );
   156             
   158             
   157             if ( ( categoryId.iId2 == KVcxMvcMediaTypeCategory ) ||
   159             if ( ( categoryId.iId2 == KVcxMvcMediaTypeCategory ) ||
   158                     ( categoryId.iId2 == KVcxMvcMediaTypeVideo ) && 
   160                     ( categoryId.iId2 == KVcxMvcMediaTypeVideo ) && 
   159                  (categoryId.iId1 == KVcxMvcCategoryIdAll ||
   161                  (categoryId.iId1 == KVcxMvcCategoryIdAll ||
   168                 }
   170                 }
   169             else
   171             else
   170                 {
   172                 {
   171                 MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening album %d", categoryId.iId1 );
   173                 MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening album %d", categoryId.iId1 );
   172                 
   174                 
   173                 iCollection.AlbumsL().CreateAlbumListL(); //async
       
   174                 iPendingAlbumOpenId = categoryId.iId1;
   175                 iPendingAlbumOpenId = categoryId.iId1;
   175                 if ( iCollection.AlbumsL().iAlbumListIsComplete ) 
   176                 if ( iCollection.AlbumsL().iAlbumListIsComplete ) 
   176                     {
   177                     {
   177                     HandleAlbumOpenL(); // iPendingAlbumOpenId goes to 0
   178                     HandleAlbumOpenL(); // iPendingAlbumOpenId goes to 0
   178                     return;
   179                     return;
   207 
   208 
   208     iCache.CreateVideoListL(); // Causes async call to MDS, callbacks to DoHandleCreateVideoListRespL will follow.
   209     iCache.CreateVideoListL(); // Causes async call to MDS, callbacks to DoHandleCreateVideoListRespL will follow.
   209                                // If iCache.iVideoList is complete and can be used (correct sorting order),
   210                                // If iCache.iVideoList is complete and can be used (correct sorting order),
   210                                // then nothing is done.
   211                                // then nothing is done.
   211 
   212 
   212     if ( !iCache.iVideoListIsPartial )
   213     if ( iCache.IsComplete() )
   213         {
   214         {
   214         MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist complete");
   215         MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist complete");
   215 
   216 
   216         // iCache.iVideoList is complete
   217         // iCache.iVideoList is complete
   217         if ( aCategoryId == KVcxMvcCategoryIdAll )
   218         if ( aCategoryId == KVcxMvcCategoryIdAll )
   318         }                           
   319         }                           
   319     else
   320     else
   320         {
   321         {
   321         // End event arrived
   322         // End event arrived
   322         
   323         
   323         iCache.iVideoListIsPartial = EFalse;
   324         iCache.SetComplete( ETrue );
   324         iCache.IsFetchingVideoList = EFalse;
   325         iCache.IsFetchingVideoList = EFalse;
   325         
   326         
   326 
   327 
   327         // Create modify event for All category.
   328         // Create modify event for All category.
   328         // This will cause client to make a new OpenL() call.
   329         // This will cause client to make a new OpenL() call.
   357             // This will cause client to make a new OpenL() call.
   358             // This will cause client to make a new OpenL() call.
   358             // Also this causes collection framework to purge its possibly outdated
   359             // Also this causes collection framework to purge its possibly outdated
   359             // (KVcxMessageMyVideosItemsAppended events don't update collection frameworks cache) cache.
   360             // (KVcxMessageMyVideosItemsAppended events don't update collection frameworks cache) cache.
   360             MPX_DEBUG3("CVcxMyVideosOpenHandler:: adding modify event for album %d, extra info = %d",
   361             MPX_DEBUG3("CVcxMyVideosOpenHandler:: adding modify event for album %d, extra info = %d",
   361                     iAlbumIdsBeingOpened[i], EVcxMyVideosVideoListOrderChanged );
   362                     iAlbumIdsBeingOpened[i], EVcxMyVideosVideoListOrderChanged );
   362             iCollection.iMessageList->AddEventL( TMPXItemId( iAlbumIdsBeingOpened[i], 2 ), EMPXItemModified,
   363             iCollection.iMessageList->AddEventL(
   363                     EVcxMyVideosVideoListOrderChanged );
   364                     TMPXItemId( iAlbumIdsBeingOpened[i], KVcxMvcMediaTypeAlbum ),
       
   365                     EMPXItemModified, EVcxMyVideosVideoListOrderChanged );
   364             // We dont send here, the send is at the end of this function.
   366             // We dont send here, the send is at the end of this function.
   365             delete iAlbumVideoListsBeingOpened[i]; // we can delete our copy, client has its own copy
   367             delete iAlbumVideoListsBeingOpened[i]; // we can delete our copy, client has its own copy
   366             iAlbumVideoListsBeingOpened[i] = NULL;
   368             iAlbumVideoListsBeingOpened[i] = NULL;
   367             }
   369             }
   368         iAlbumVideoListsBeingOpened.Reset();
   370         iAlbumVideoListsBeingOpened.Reset();
   372         // ownership of the list to client. Video objects will continue to point to the same shared data.
   374         // ownership of the list to client. Video objects will continue to point to the same shared data.
   373         iCache.ReCreateVideoListL();
   375         iCache.ReCreateVideoListL();
   374 
   376 
   375         iCollection.CategoriesL().UpdateCategoriesNewVideoNamesL();
   377         iCollection.CategoriesL().UpdateCategoriesNewVideoNamesL();
   376 
   378 
       
   379         iCollection.AlbumsL().CalculateAttributesL();
       
   380         
   377         iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
   381         iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
   378         }
   382         }
   379     iCollection.iMessageList->SendL();
   383     iCollection.iMessageList->SendL();
   380     }
   384     }
   381 
   385 
   392     MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() start");
   396     MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() start");
   393     
   397     
   394     CVcxMyVideosAlbum* album = iCollection.AlbumsL().Album( iPendingAlbumOpenId );
   398     CVcxMyVideosAlbum* album = iCollection.AlbumsL().Album( iPendingAlbumOpenId );
   395     if ( album )
   399     if ( album )
   396         {
   400         {
   397         if ( !iCollection.iCache->iVideoListIsPartial )
   401         if ( iCollection.iCache->IsComplete() )
   398             {
   402             {
   399             //videolist complete
   403             //videolist complete
   400             CMPXMedia* videoList = album->CreateVideoListL();
   404             CMPXMedia* videoList = album->CreateVideoListL();
   401             videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
   405             videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
   402             iCollection.iObs->HandleOpen( videoList, KErrNone );
   406             iCollection.iObs->HandleOpen( videoList, KErrNone );
   510                 EVcxMyVideosVideoListOrderChanged );
   514                 EVcxMyVideosVideoListOrderChanged );
   511         }
   515         }
   512     else
   516     else
   513         {
   517         {
   514         //TODO: should add album id
   518         //TODO: should add album id
       
   519         iCollection.AlbumsL().CalculateAttributesL();
       
   520 
   515         iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
   521         iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
   516 
   522 
       
   523         
   517         delete iAlbumVideoList;
   524         delete iAlbumVideoList;
   518         iAlbumVideoList = NULL;
   525         iAlbumVideoList = NULL;
   519         }
   526         }
   520     
   527     
   521     iCollection.iMessageList->SendL();
   528     iCollection.iMessageList->SendL();