139 // ----------------------------------------------------------------------------- |
139 // ----------------------------------------------------------------------------- |
140 // |
140 // |
141 CVcxHgMyVideosVideoModelHandler::~CVcxHgMyVideosVideoModelHandler() |
141 CVcxHgMyVideosVideoModelHandler::~CVcxHgMyVideosVideoModelHandler() |
142 { |
142 { |
143 iResumeArray.Close(); |
143 iResumeArray.Close(); |
|
144 iMarkedMediaList.Close(); |
144 |
145 |
145 delete iVideoDetails; |
146 delete iVideoDetails; |
146 delete iVideoIndicator; |
147 delete iVideoIndicator; |
147 delete iDataUpdater; |
148 delete iDataUpdater; |
148 delete iDownloadUpdater; |
149 delete iDownloadUpdater; |
184 |
185 |
185 TRAP_IGNORE( iDataUpdater->SetPausedL( ETrue ) ); |
186 TRAP_IGNORE( iDataUpdater->SetPausedL( ETrue ) ); |
186 TRAP_IGNORE( iDownloadUpdater->SetPausedL( ETrue ) ); |
187 TRAP_IGNORE( iDownloadUpdater->SetPausedL( ETrue ) ); |
187 iModel.CollectionClient().SetVideoModelObserver( NULL ); |
188 iModel.CollectionClient().SetVideoModelObserver( NULL ); |
188 iScroller.DisableScrollBuffer(); |
189 iScroller.DisableScrollBuffer(); |
189 |
190 |
190 TRAP_IGNORE( SaveHighlightedItemIdL() ); |
191 TRAP_IGNORE( SaveHighlightedItemIdL() ); |
191 |
192 |
192 IPTVLOGSTRING_LOW_LEVEL( |
193 IPTVLOGSTRING_LOW_LEVEL( |
193 "MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() - Exit" ); |
194 "MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() - Exit" ); |
194 } |
195 } |
195 |
196 |
196 // ----------------------------------------------------------------------------- |
197 // ----------------------------------------------------------------------------- |
197 // CVcxHgMyVideosVideoModelHandler::SaveHighlightedItemIdL() |
198 // CVcxHgMyVideosVideoModelHandler::SaveHighlightedItemIdL() |
198 // ----------------------------------------------------------------------------- |
199 // ----------------------------------------------------------------------------- |
199 // |
200 // |
200 void CVcxHgMyVideosVideoModelHandler::SaveHighlightedItemIdL() |
201 void CVcxHgMyVideosVideoModelHandler::SaveHighlightedItemIdL() |
201 { |
202 { |
202 iHighlightedItemId = iVideoArray->ArrayIndexToMpxItemIdL( Highlight() ); |
203 iHighlightedItemId = iVideoArray->ArrayIndexToMpxItemIdL( Highlight() ); |
203 } |
204 } |
204 |
205 |
205 // ----------------------------------------------------------------------------- |
206 // ----------------------------------------------------------------------------- |
206 // CVcxHgMyVideosVideoModelHandler::UpdateVideoListL() |
207 // CVcxHgMyVideosVideoModelHandler::UpdateVideoListL() |
246 if ( iScroller.ItemCount() > 0 ) |
247 if ( iScroller.ItemCount() > 0 ) |
247 { |
248 { |
248 iDownloadUpdater->SetPausedL( ETrue ); |
249 iDownloadUpdater->SetPausedL( ETrue ); |
249 |
250 |
250 TVcxMyVideosSortingOrder sortOrder = iModel.VideolistSortOrderL(); |
251 TVcxMyVideosSortingOrder sortOrder = iModel.VideolistSortOrderL(); |
|
252 |
|
253 if ( iVideoListImpl.IsMarking() ) |
|
254 { |
|
255 SaveMarkingsL(); |
|
256 } |
|
257 |
251 iVideoArray->ResortVideoListL( sortOrder ); |
258 iVideoArray->ResortVideoListL( sortOrder ); |
252 |
259 |
253 TInt highlight = iScroller.SelectedIndex(); |
260 TInt highlight = iScroller.SelectedIndex(); |
254 |
261 |
255 ResetScrollerBufferAndItemsL(); |
262 ResetScrollerBufferAndItemsL(); |
256 |
263 |
257 iScroller.SetSelectedIndex( highlight ); |
264 iScroller.SetSelectedIndex( highlight ); |
258 |
265 |
259 iView.DynInitMskL(); |
266 iView.DynInitMskL(); |
260 |
267 |
|
268 if ( iVideoListImpl.IsMarking() ) |
|
269 { |
|
270 RestoreMarkingsL(); |
|
271 } |
|
272 |
261 iDownloadUpdater->VideoArrayChangedL(); |
273 iDownloadUpdater->VideoArrayChangedL(); |
262 iDownloadUpdater->SetPausedL( EFalse ); |
274 iDownloadUpdater->SetPausedL( EFalse ); |
263 |
275 |
264 // Switch to appropriate scroller strip |
276 // Switch to appropriate scroller strip |
265 UpdateScrollbarTypeL( sortOrder ); |
277 UpdateScrollbarTypeL( sortOrder ); |
1051 else |
1063 else |
1052 { |
1064 { |
1053 // Last item has deleted, set empty text and reset list. |
1065 // Last item has deleted, set empty text and reset list. |
1054 iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS ); |
1066 iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS ); |
1055 iScroller.Reset(); |
1067 iScroller.Reset(); |
1056 } |
1068 |
1057 |
1069 // End marking mode for empty list |
|
1070 if ( iVideoListImpl.IsMarking() ) |
|
1071 { |
|
1072 iVideoListImpl.EndMarkingMode(); |
|
1073 iView.DynInitRskL(); |
|
1074 } |
|
1075 } |
|
1076 |
1058 // fix for error where highlight was sometimes lost after delete. Problem is |
1077 // fix for error where highlight was sometimes lost after delete. Problem is |
1059 // that someone is 'stealing' keyboard focus from the scroller (probably the |
1078 // that someone is 'stealing' keyboard focus from the scroller (probably the |
1060 // confirmation note, as user needs to clicks them to start the delete). |
1079 // confirmation note, as user needs to clicks them to start the delete). |
1061 iScroller.SetFocus( ETrue ); |
1080 iScroller.SetFocus( ETrue ); |
1062 |
1081 |
1192 |
1211 |
1193 TInt videoCount = iVideoArray->VideoCount(); |
1212 TInt videoCount = iVideoArray->VideoCount(); |
1194 if ( videoCount > 0 ) |
1213 if ( videoCount > 0 ) |
1195 { |
1214 { |
1196 ResizeScrollerL( videoCount ); |
1215 ResizeScrollerL( videoCount ); |
1197 |
1216 |
1198 TInt highlight( KErrNotFound ); |
1217 TInt highlight( KErrNotFound ); |
1199 |
1218 |
1200 if ( iRestoreHighlightPosition ) |
1219 if ( iRestoreHighlightPosition ) |
1201 { |
1220 { |
1202 highlight = iVideoArray->IndexByMPXItemId( iHighlightedItemId ); |
1221 highlight = iVideoArray->IndexByMPXItemId( iHighlightedItemId ); |
1203 } |
1222 } |
1204 |
1223 |
1205 highlight != KErrNotFound ? iScroller.SetSelectedIndex( highlight ) : |
1224 highlight != KErrNotFound ? iScroller.SetSelectedIndex( highlight ) : |
1206 iScroller.SetSelectedIndex( 0 ); |
1225 iScroller.SetSelectedIndex( 0 ); |
1207 } |
1226 } |
1208 else |
1227 else |
1209 { |
1228 { |
1210 iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS ); |
1229 iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS ); |
1211 iScroller.DrawDeferred(); |
1230 iScroller.DrawDeferred(); |
1480 { |
1499 { |
1481 // CHgScroller::Reset() was already called, no need to reset tricks |
1500 // CHgScroller::Reset() was already called, no need to reset tricks |
1482 iScroller.ResizeL( aNewItemCount ); |
1501 iScroller.ResizeL( aNewItemCount ); |
1483 } |
1502 } |
1484 } |
1503 } |
|
1504 |
|
1505 // ----------------------------------------------------------------------------- |
|
1506 // CVcxHgMyVideosVideoModelHandler::SaveMarkingsL() |
|
1507 // ----------------------------------------------------------------------------- |
|
1508 // |
|
1509 void CVcxHgMyVideosVideoModelHandler::SaveMarkingsL() |
|
1510 { |
|
1511 // Get marked list item indexes |
|
1512 RArray<TInt> markedVideos; |
|
1513 CleanupClosePushL( markedVideos ); |
|
1514 MarkedVideosL( markedVideos ); |
|
1515 TInt markedCount( markedVideos.Count() ); |
|
1516 |
|
1517 iMarkedMediaList.Reset(); |
|
1518 iMarkedMediaList.ReserveL( markedCount ); |
|
1519 |
|
1520 TInt markedIndex; |
|
1521 |
|
1522 for ( TInt i = 0; i <markedCount; i++ ) |
|
1523 { |
|
1524 markedIndex = markedVideos[ i ]; |
|
1525 CMPXMedia* media = iVideoArray->MPXMedia( markedIndex ); |
|
1526 iMarkedMediaList.Append( media ); |
|
1527 iScroller.ItemL( markedIndex ).ClearFlags( CHgItem::EHgItemFlagMarked ); |
|
1528 IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::SaveMarkingsL() marked index = %d CMPXMedia = 0x%08x", markedIndex, media ); |
|
1529 } |
|
1530 |
|
1531 CleanupStack::PopAndDestroy( &markedVideos ); |
|
1532 } |
|
1533 |
|
1534 // ----------------------------------------------------------------------------- |
|
1535 // CVcxHgMyVideosVideoModelHandler::RestoreMarkingsL() |
|
1536 // ----------------------------------------------------------------------------- |
|
1537 // |
|
1538 void CVcxHgMyVideosVideoModelHandler::RestoreMarkingsL() |
|
1539 { |
|
1540 TInt videoCount = iVideoArray->VideoCount(); |
|
1541 TInt found( KErrNotFound ); |
|
1542 |
|
1543 for ( TInt i = 0; i < videoCount; i++ ) |
|
1544 { |
|
1545 CMPXMedia* media = iVideoArray->MPXMedia( i ); |
|
1546 found = iMarkedMediaList.Find( media ); |
|
1547 if ( KErrNotFound != found ) |
|
1548 { |
|
1549 iScroller.ItemL( i ).SetFlags( CHgItem::EHgItemFlagMarked ); |
|
1550 } |
|
1551 IPTVLOGSTRING4_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::RestoreMarkingsL() list index = %d CMPXMedia = 0x%08x found = %d", i, media, found ); |
|
1552 } |
|
1553 |
|
1554 iMarkedMediaList.Reset(); |
|
1555 } |