123 switch ( aPath.Levels() ) |
123 switch ( aPath.Levels() ) |
124 { |
124 { |
125 case categoryLevel: |
125 case categoryLevel: |
126 { |
126 { |
127 //we are at root level, return main level items (categories + albums) |
127 //we are at root level, return main level items (categories + albums) |
128 |
128 |
|
129 #ifndef VIDEO_COLLECTION_PLUGIN_TB92 |
129 iCollection.AlbumsL().CreateAlbumListL(); //async |
130 iCollection.AlbumsL().CreateAlbumListL(); //async |
|
131 #endif |
130 |
132 |
131 // This is needed to update category counters. |
133 // This is needed to update category counters. |
132 // Goes to queue if CreateAlbumListL command goes to execution |
134 // Goes to queue if CreateAlbumListL command goes to execution |
133 TRAPD( err, iCache.CreateVideoListL() ); |
135 TRAPD( err, iCache.CreateVideoListL() ); |
134 |
136 |
137 MPX_DEBUG2("iCache->CreateVideoListL() left: %d. Returning categories and albums anyway.", err); |
139 MPX_DEBUG2("iCache->CreateVideoListL() left: %d. Returning categories and albums anyway.", err); |
138 } |
140 } |
139 |
141 |
140 CMPXMedia* itemList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL(); |
142 CMPXMedia* itemList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL(); |
141 CleanupStack::PushL( itemList ); |
143 CleanupStack::PushL( itemList ); |
|
144 |
|
145 itemList->SetTObjectValueL<TBool>( KVcxMediaMyVideosVideoListIsPartial, |
|
146 !iCache.IsComplete() ); |
|
147 |
142 TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.CategoriesL().iList ); |
148 TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.CategoriesL().iList ); |
|
149 #ifndef VIDEO_COLLECTION_PLUGIN_TB92 |
143 TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.AlbumsL().iAlbumList ); |
150 TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.AlbumsL().iAlbumList ); |
|
151 #endif |
144 itemList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
152 itemList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
145 iCollection.iObs->HandleOpen( itemList, KErrNone ); |
153 iCollection.iObs->HandleOpen( itemList, KErrNone ); |
146 CleanupStack::PopAndDestroy( itemList ); |
154 CleanupStack::PopAndDestroy( itemList ); |
147 MPX_DEBUG1("CVcxMyVideosOpenHandler:: called HandleOpen for categories + albums"); |
155 MPX_DEBUG1("CVcxMyVideosOpenHandler:: called HandleOpen for categories + albums"); |
148 } |
156 } |
150 |
158 |
151 case videosLevel: |
159 case videosLevel: |
152 { |
160 { |
153 //we are at second level, return video list from some category or album |
161 //we are at second level, return video list from some category or album |
154 |
162 |
|
163 #ifndef VIDEO_COLLECTION_PLUGIN_TB92 |
155 iCollection.AlbumsL().CreateAlbumListL(); //async |
164 iCollection.AlbumsL().CreateAlbumListL(); //async |
|
165 #endif |
156 |
166 |
157 TMPXItemId categoryId( aPath.Id() ); |
167 TMPXItemId categoryId( aPath.Id() ); |
158 |
168 |
159 if ( ( categoryId.iId2 == KVcxMvcMediaTypeCategory ) || |
169 if ( ( categoryId.iId2 == KVcxMvcMediaTypeCategory ) || |
160 ( categoryId.iId2 == KVcxMvcMediaTypeVideo ) && |
170 ( categoryId.iId2 == KVcxMvcMediaTypeVideo ) && |
227 { |
237 { |
228 MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll: creating new category video list"); |
238 MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll: creating new category video list"); |
229 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
239 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
230 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen(new list)"); |
240 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen(new list)"); |
231 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
241 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
232 iCache.iVideoList->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value, |
242 videoList->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value, |
233 EVcxMyVideosVideoListComplete ); |
243 EVcxMyVideosVideoListComplete ); |
234 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
244 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
235 delete videoList; |
245 delete videoList; |
236 } |
246 } |
237 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
247 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
264 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
274 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
265 CleanupStack::PushL( videoList ); |
275 CleanupStack::PushL( videoList ); |
266 iVideoListsBeingOpened.AppendL( videoList ); |
276 iVideoListsBeingOpened.AppendL( videoList ); |
267 CleanupStack::Pop( videoList ); |
277 CleanupStack::Pop( videoList ); |
268 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen"); |
278 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen"); |
269 iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
279 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
270 iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone ); |
280 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
271 } |
281 } |
272 else |
282 else |
273 { |
283 { |
274 MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was already being opened, calling HandleOpen with that"); |
284 MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was already being opened, calling HandleOpen with that"); |
275 iVideoListsBeingOpened[pos]->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
285 iVideoListsBeingOpened[pos]->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
324 else |
334 else |
325 { |
335 { |
326 // End event arrived |
336 // End event arrived |
327 |
337 |
328 iCache.SetComplete( ETrue ); |
338 iCache.SetComplete( ETrue ); |
329 iCache.IsFetchingVideoList = EFalse; |
339 iCache.iIsFetchingVideoList = EFalse; |
330 |
340 |
331 |
341 |
332 // Create modify event for All category. |
342 // Create modify event for All category. |
333 // This will cause client to make a new OpenL() call. |
343 // This will cause client to make a new OpenL() call. |
334 // Also this causes collection framework to purge its possibly outdated |
344 // Also this causes collection framework to purge its possibly outdated |
392 // Album list has been fetched already. |
402 // Album list has been fetched already. |
393 // ---------------------------------------------------------------------------- |
403 // ---------------------------------------------------------------------------- |
394 // |
404 // |
395 void CVcxMyVideosOpenHandler::HandleAlbumOpenL() |
405 void CVcxMyVideosOpenHandler::HandleAlbumOpenL() |
396 { |
406 { |
397 //TODO: If iVideoList is partial and fetching is already going on -> use the implementation below. |
|
398 // If iVideoList is partial but fetching is not going on -> fetch only album items to iCache. |
|
399 |
|
400 MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() start"); |
407 MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() start"); |
401 |
408 |
402 CVcxMyVideosAlbum* album = iCollection.AlbumsL().Album( iPendingAlbumOpenId ); |
409 CVcxMyVideosAlbum* album = iCollection.AlbumsL().Album( iPendingAlbumOpenId ); |
403 if ( album ) |
410 if ( album ) |
404 { |
411 { |
405 if ( iCollection.iCache->IsComplete() ) |
412 if ( iCollection.iCache->IsComplete() ) |
406 { |
413 { |
407 //videolist complete |
414 //videolist complete |
408 CMPXMedia* videoList = album->CreateVideoListL(); |
415 CMPXMedia* videoList = album->CreateVideoListL(); |
|
416 CleanupStack::PushL( videoList ); // 1-> |
409 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
417 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
410 videoList->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value, |
418 videoList->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value, |
411 EVcxMyVideosVideoListComplete ); |
419 EVcxMyVideosVideoListComplete ); |
412 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
420 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
413 delete videoList; |
421 CleanupStack::PopAndDestroy( videoList ); // <-1 |
414 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
422 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
415 iCollection.iMessageList->SendL(); |
423 iCollection.iMessageList->SendL(); |
416 } |
424 } |
417 else |
425 else |
418 { |
426 { |
419 if ( iCollection.iCache->IsFetchingVideoList ) |
427 if ( iCollection.iCache->iIsFetchingVideoList ) |
420 { |
428 { |
421 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist fetching already in progress -> use that to populate album"); |
429 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist fetching already in progress -> use that to populate album"); |
422 |
430 |
423 // videolist incomplete and fetching already going on |
431 // videolist incomplete and fetching already going on |
424 TInt pos = iAlbumIdsBeingOpened.Find( iPendingAlbumOpenId ); |
432 TInt pos = iAlbumIdsBeingOpened.Find( iPendingAlbumOpenId ); |
441 KErrNone ); |
449 KErrNone ); |
442 } |
450 } |
443 } |
451 } |
444 else |
452 else |
445 { |
453 { |
446 // videolist incomplete and fetching hasn't been started |
|
447 // TODO: Test how fast this is. If slow, then ditch the separate album fetching. |
|
448 |
|
449 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist partial and no fetching going on -> fetch the album videos separately"); |
454 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist partial and no fetching going on -> fetch the album videos separately"); |
450 |
455 |
451 delete iAlbumVideoList; |
456 delete iAlbumVideoList; |
452 iAlbumVideoList = NULL; |
457 iAlbumVideoList = NULL; |
453 iAlbumVideoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL(); |
458 iAlbumVideoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL(); |