videocollection/hgmyvideos/src/vcxhgmyvideosvideomodelhandler.cpp
branchRCL_3
changeset 14 55fa1ec415c6
parent 12 7f2b2a65da29
child 15 8f0df5c82986
equal deleted inserted replaced
12:7f2b2a65da29 14:55fa1ec415c6
   111     : iVideoListImpl( aVideoListImpl ),
   111     : iVideoListImpl( aVideoListImpl ),
   112       iModel( aModel ),
   112       iModel( aModel ),
   113       iView( aView ),
   113       iView( aView ),
   114       iScroller( aScroller ),
   114       iScroller( aScroller ),
   115       iCurrentCategoryIndex( KErrNotFound ),
   115       iCurrentCategoryIndex( KErrNotFound ),
   116       iRestoreHighlightPosition( EFalse )
   116       iRestoreListPosition( EFalse )
   117     {
   117     {
   118     }
   118     }
   119 
   119 
   120 // -----------------------------------------------------------------------------
   120 // -----------------------------------------------------------------------------
   121 // CVcxHgMyVideosVideoModelHandler::ConstructL()
   121 // CVcxHgMyVideosVideoModelHandler::ConstructL()
   186     TRAP_IGNORE( iDataUpdater->SetPausedL( ETrue ) );
   186     TRAP_IGNORE( iDataUpdater->SetPausedL( ETrue ) );
   187     TRAP_IGNORE( iDownloadUpdater->SetPausedL( ETrue ) );
   187     TRAP_IGNORE( iDownloadUpdater->SetPausedL( ETrue ) );
   188     iModel.CollectionClient().SetVideoModelObserver( NULL );
   188     iModel.CollectionClient().SetVideoModelObserver( NULL );
   189     iScroller.DisableScrollBuffer();
   189     iScroller.DisableScrollBuffer();
   190 
   190 
   191     TRAP_IGNORE( SaveHighlightedItemIdL() );
   191     TRAP_IGNORE( SaveFirstListItemIdL() );
   192 
   192 
   193     IPTVLOGSTRING_LOW_LEVEL( 
   193     IPTVLOGSTRING_LOW_LEVEL( 
   194         "MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() - Exit" );    
   194         "MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() - Exit" );    
   195     }
   195     }
   196 
   196 
   197 // -----------------------------------------------------------------------------
   197 // -----------------------------------------------------------------------------
   198 // CVcxHgMyVideosVideoModelHandler::SaveHighlightedItemIdL()
   198 // CVcxHgMyVideosVideoModelHandler::SaveFirstListItemIdL()
   199 // -----------------------------------------------------------------------------
   199 // -----------------------------------------------------------------------------
   200 //
   200 //
   201 void CVcxHgMyVideosVideoModelHandler::SaveHighlightedItemIdL()
   201 void CVcxHgMyVideosVideoModelHandler::SaveFirstListItemIdL()
   202     {
   202     {
   203     iHighlightedItemId = iVideoArray->ArrayIndexToMpxItemIdL( Highlight() );
   203     iFirstListItemId = iVideoArray->ArrayIndexToMpxItemIdL(
       
   204             iScroller.FirstIndexOnScreen() );
   204     }
   205     }
   205 
   206 
   206 // -----------------------------------------------------------------------------
   207 // -----------------------------------------------------------------------------
   207 // CVcxHgMyVideosVideoModelHandler::UpdateVideoListL()
   208 // CVcxHgMyVideosVideoModelHandler::UpdateVideoListL()
   208 // -----------------------------------------------------------------------------
   209 // -----------------------------------------------------------------------------
   214 
   215 
   215     CVcxHgMyVideosCollectionClient& collectionClient = iModel.CollectionClient();
   216     CVcxHgMyVideosCollectionClient& collectionClient = iModel.CollectionClient();
   216 
   217 
   217     // If we are re-opening the same video list again, then try 
   218     // If we are re-opening the same video list again, then try 
   218     // restore the highlight to previous position.
   219     // restore the highlight to previous position.
   219     aCategoryIndex == iCurrentCategoryIndex ? iRestoreHighlightPosition = ETrue :
   220     aCategoryIndex == iCurrentCategoryIndex ? iRestoreListPosition = ETrue :
   220                                               iRestoreHighlightPosition = EFalse;
   221                                               iRestoreListPosition = EFalse;
   221     // Removes videos from video list.
   222     // Removes videos from video list.
   222     iVideoArray->RemoveVideoList();
   223     iVideoArray->RemoveVideoList();
   223          
   224          
   224     // Removes videos from scroller. After this command, list highlight 
   225     // Removes videos from scroller. After this command, list highlight 
   225     // disappears, so don't forget to set highlight in NewVideoListL() 
   226     // disappears, so don't forget to set highlight in NewVideoListL() 
  1212     TInt videoCount = iVideoArray->VideoCount();         
  1213     TInt videoCount = iVideoArray->VideoCount();         
  1213     if (  videoCount > 0 )
  1214     if (  videoCount > 0 )
  1214         {
  1215         {
  1215         ResizeScrollerL( videoCount );
  1216         ResizeScrollerL( videoCount );
  1216 
  1217 
  1217         TInt highlight( KErrNotFound );
  1218         TInt firstItemIndex( KErrNotFound );
  1218 
  1219 
  1219         if ( iRestoreHighlightPosition )
  1220         if ( iRestoreListPosition )
  1220             {
  1221             {
  1221             highlight = iVideoArray->IndexByMPXItemId( iHighlightedItemId );
  1222             firstItemIndex = iVideoArray->IndexByMPXItemId( iFirstListItemId );
  1222             }
  1223             }
  1223         
  1224         
  1224         highlight != KErrNotFound ? iScroller.SetSelectedIndex( highlight ) :
  1225         IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::NewVideoListL() Setting list position first index = %d", firstItemIndex );
  1225                                     iScroller.SetSelectedIndex( 0 );
  1226         firstItemIndex != KErrNotFound ? iScroller.SetFirstIndexOnScreen( firstItemIndex ) :
       
  1227                                     iScroller.SetFirstIndexOnScreen( 0 );
  1226         }
  1228         }
  1227     else
  1229     else
  1228         {
  1230         {
  1229         iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS );
  1231         iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS );
  1230         iScroller.DrawDeferred();
  1232         iScroller.DrawDeferred();