97 MPX_FUNC("CVcxMyVideosOpenHandler::OpenL"); |
112 MPX_FUNC("CVcxMyVideosOpenHandler::OpenL"); |
98 |
113 |
99 MPX_DEBUG1("CVcxMyVideosOpenHandler:: path before open:"); |
114 MPX_DEBUG1("CVcxMyVideosOpenHandler:: path before open:"); |
100 MPX_DEBUG_PATH( aPath ); |
115 MPX_DEBUG_PATH( aPath ); |
101 |
116 |
|
117 iPath = &aPath; |
|
118 |
|
119 const TInt categoryLevel = 1; |
|
120 const TInt videosLevel = 2; |
|
121 const TInt playlistLevel = 3; |
|
122 |
102 switch ( aPath.Levels() ) |
123 switch ( aPath.Levels() ) |
103 { |
124 { |
104 case 1: |
125 case categoryLevel: |
105 { |
126 { |
106 //we are at root level, return main level items (categories) |
127 //we are at root level, return main level items (categories + albums) |
107 |
128 |
108 // this is needed to update category counters |
129 iCollection.AlbumsL().CreateAlbumListL(); //async |
|
130 |
|
131 // This is needed to update category counters. |
|
132 // Goes to queue if CreateAlbumListL command goes to execution |
109 TRAPD( err, iCache.CreateVideoListL() ); |
133 TRAPD( err, iCache.CreateVideoListL() ); |
110 |
134 |
111 if ( err != KErrNone ) |
135 if ( err != KErrNone ) |
112 { |
136 { |
113 MPX_DEBUG2("iCache->CreateVideoListL() left: %d. Returning categories anyway.", err); |
137 MPX_DEBUG2("iCache->CreateVideoListL() left: %d. Returning categories and albums anyway.", err); |
114 } |
138 } |
115 iCollection.iObs->HandleOpen( iCollection.CategoriesL().iList, KErrNone ); |
139 |
|
140 CMPXMedia* itemList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL(); |
|
141 CleanupStack::PushL( itemList ); |
|
142 TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.CategoriesL().iList ); |
|
143 TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.AlbumsL().iAlbumList ); |
|
144 itemList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
145 iCollection.iObs->HandleOpen( itemList, KErrNone ); |
|
146 CleanupStack::PopAndDestroy( itemList ); |
|
147 MPX_DEBUG1("CVcxMyVideosOpenHandler:: called HandleOpen for categories + albums"); |
116 } |
148 } |
117 break; |
149 break; |
118 |
150 |
119 case 2: |
151 case videosLevel: |
120 { |
152 { |
121 //we are at second level, return video list from some category |
153 //we are at second level, return video list from some category or album |
122 |
154 |
123 TInt categoryId = aPath.Id(); |
155 TMPXItemId categoryId( aPath.Id() ); |
124 |
|
125 MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening category %d", categoryId); |
|
126 |
156 |
127 if ( categoryId != KVcxMvcCategoryIdAll && |
157 if ( ( categoryId.iId2 == KVcxMvcMediaTypeCategory ) || |
128 categoryId != KVcxMvcCategoryIdDownloads && |
158 ( categoryId.iId2 == KVcxMvcMediaTypeVideo ) && |
129 categoryId != KVcxMvcCategoryIdTvRecordings && |
159 (categoryId.iId1 == KVcxMvcCategoryIdAll || |
130 categoryId != KVcxMvcCategoryIdCaptured && |
160 categoryId.iId1 == KVcxMvcCategoryIdDownloads || |
131 categoryId != KVcxMvcCategoryIdOther ) |
161 categoryId.iId1 == KVcxMvcCategoryIdTvRecordings || |
132 { |
162 categoryId.iId1 == KVcxMvcCategoryIdCaptured || |
133 MPX_DEBUG2("CVcxMyVideosOpenHandler:: category ID not valid (%d) -> calling HandleOpen with KErrNotFound", categoryId); |
163 categoryId.iId1 == KVcxMvcCategoryIdOther) ) |
134 iCollection.iObs->HandleOpen( static_cast<CMPXMedia*>(NULL), KErrNotFound ); |
164 { |
|
165 MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening category %d", categoryId.iId1 ); |
|
166 OpenCategoryL( categoryId.iId1 ); |
135 return; |
167 return; |
136 } |
168 } |
137 |
169 else |
138 TUint8 origin = static_cast<TUint8>( TVcxMyVideosCollectionUtil::Origin( categoryId ) ); |
170 { |
139 |
171 MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening album %d", categoryId.iId1 ); |
140 iCache.CreateVideoListL(); // Causes async call to MDS, callbacks to DoHandleCreateVideoListRespL will happen. |
172 |
141 // If iCache.iVideoList is complete and can be used (correct sorting order), |
173 iCollection.AlbumsL().CreateAlbumListL(); //async |
142 // then nothing is done. |
174 iPendingAlbumOpenId = categoryId.iId1; |
143 |
175 if ( iCollection.AlbumsL().iAlbumListIsComplete ) |
144 if ( !iCache.iVideoListIsPartial ) |
|
145 { |
|
146 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist complete"); |
|
147 |
|
148 // iCache.iVideoList is complete |
|
149 if ( categoryId == KVcxMvcCategoryIdAll ) |
|
150 { |
176 { |
151 MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll: calling HandleOpen(iCache.iVideoList)"); |
177 HandleAlbumOpenL(); // iPendingAlbumOpenId goes to 0 |
152 iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone ); |
178 return; |
153 } |
179 } |
154 else |
180 else |
155 { |
181 { |
156 MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll: creating new category video list"); |
182 // We will continue at HandleAlbumOpenL when album list arrives, iPendingAlbumOpenId is left != 0 |
157 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
183 return; |
158 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen(new list)"); |
|
159 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
|
160 delete videoList; |
|
161 } |
184 } |
162 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
185 } |
163 iCollection.iMessageList->SendL(); |
186 } |
164 |
187 |
165 // No append events will arrive anymore -> we create our own version of the |
188 case playlistLevel: |
166 // video list. |
|
167 iCache.ReCreateVideoListL(); |
|
168 } |
|
169 else |
|
170 { |
|
171 MPX_DEBUG1("CVcxMyVideosOpenHandler:: video list incomplete"); |
|
172 // iCache.iVideoList is incomplete |
|
173 |
|
174 if ( categoryId == KVcxMvcCategoryIdAll ) |
|
175 { |
|
176 MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll, calling HandleOpen"); |
|
177 iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone ); |
|
178 } |
|
179 else |
|
180 { |
|
181 MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll"); |
|
182 |
|
183 TInt pos = iCategoryIdsBeingOpened.Find( categoryId ); |
|
184 if ( pos == KErrNotFound ) |
|
185 { |
|
186 MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was not opened yet, creating list for it"); |
|
187 iCategoryIdsBeingOpened.AppendL( categoryId ); |
|
188 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
|
189 iVideoListsBeingOpened.AppendL( videoList ); |
|
190 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen"); |
|
191 iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone ); |
|
192 } |
|
193 else |
|
194 { |
|
195 MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was already being opened, calling HandleOpen with that"); |
|
196 iCollection.iObs->HandleOpen( iVideoListsBeingOpened[pos], KErrNone ); |
|
197 } |
|
198 } |
|
199 } |
|
200 |
|
201 } |
|
202 break; |
|
203 |
|
204 case 3: |
|
205 { |
189 { |
206 iCollection.iObs->HandleOpen(const_cast<CMPXCollectionPath*> (&aPath), KErrNone); |
190 iCollection.iObs->HandleOpen(const_cast<CMPXCollectionPath*> (&aPath), KErrNone); |
207 } |
191 } |
208 break; |
192 break; |
209 |
193 |
211 break; |
195 break; |
212 |
196 |
213 } //switch |
197 } //switch |
214 } |
198 } |
215 |
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CVcxMyVideosOpenHandler::OpenCategoryL |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 void CVcxMyVideosOpenHandler::OpenCategoryL( TUint32 aCategoryId ) |
|
205 { |
|
206 TUint8 origin = static_cast<TUint8>( TVcxMyVideosCollectionUtil::Origin( aCategoryId ) ); |
|
207 |
|
208 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 // then nothing is done. |
|
211 |
|
212 if ( !iCache.iVideoListIsPartial ) |
|
213 { |
|
214 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist complete"); |
|
215 |
|
216 // iCache.iVideoList is complete |
|
217 if ( aCategoryId == KVcxMvcCategoryIdAll ) |
|
218 { |
|
219 MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll: calling HandleOpen(iCache.iVideoList)"); |
|
220 iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
221 iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone ); |
|
222 } |
|
223 else |
|
224 { |
|
225 MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll: creating new category video list"); |
|
226 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
|
227 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen(new list)"); |
|
228 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
229 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
|
230 delete videoList; |
|
231 } |
|
232 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
|
233 iCollection.iMessageList->SendL(); |
|
234 |
|
235 // No append events will arrive anymore -> we create our own version of the |
|
236 // video list. |
|
237 iCache.ReCreateVideoListL(); |
|
238 } |
|
239 else |
|
240 { |
|
241 MPX_DEBUG1("CVcxMyVideosOpenHandler:: video list incomplete"); |
|
242 // iCache.iVideoList is incomplete |
|
243 |
|
244 if ( aCategoryId == KVcxMvcCategoryIdAll ) |
|
245 { |
|
246 MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll, calling HandleOpen"); |
|
247 iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
248 iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone ); |
|
249 } |
|
250 else |
|
251 { |
|
252 MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll"); |
|
253 |
|
254 TInt pos = iCategoryIdsBeingOpened.Find( aCategoryId ); |
|
255 if ( pos == KErrNotFound ) |
|
256 { |
|
257 MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was not opened yet, creating list for it"); |
|
258 iCategoryIdsBeingOpened.AppendL( aCategoryId ); |
|
259 CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin ); |
|
260 CleanupStack::PushL( videoList ); |
|
261 iVideoListsBeingOpened.AppendL( videoList ); |
|
262 CleanupStack::Pop( videoList ); |
|
263 MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen"); |
|
264 iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
265 iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone ); |
|
266 } |
|
267 else |
|
268 { |
|
269 MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was already being opened, calling HandleOpen with that"); |
|
270 iVideoListsBeingOpened[pos]->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
271 iCollection.iObs->HandleOpen( iVideoListsBeingOpened[pos], KErrNone ); |
|
272 } |
|
273 } |
|
274 } |
|
275 } |
|
276 |
216 // ---------------------------------------------------------------------------- |
277 // ---------------------------------------------------------------------------- |
217 // CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL |
278 // CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL |
218 // New items fetched from MDS. iCache.iVideoList = aVideoList. |
279 // New items fetched from MDS. iCollection.iCache->iVideoList = &aVideoList. |
219 // ---------------------------------------------------------------------------- |
280 // ---------------------------------------------------------------------------- |
220 // |
281 // |
221 void CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL( |
282 void CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL( |
222 CMPXMedia* aVideoList, TInt aNewItemsStartIndex, TBool aComplete ) |
283 CMPXMedia* aVideoList, TInt aNewItemsStartIndex, TBool aComplete ) |
223 { |
284 { |
224 MPX_FUNC("CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL()"); |
285 MPX_FUNC("CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL()"); |
225 |
286 |
226 MPX_DEBUG2("CVcxMyVideosOpenHandler:: aComplete = %d", aComplete); |
287 MPX_DEBUG2("CVcxMyVideosOpenHandler:: aComplete = %d", aComplete); |
227 |
288 |
228 if ( aNewItemsStartIndex != KErrNotFound ) |
289 if ( aNewItemsStartIndex != KErrNotFound ) |
230 //iCache.iVideoList now contains new items, tell iCache to check if partial list contains the new items |
291 //iCache.iVideoList now contains new items, tell iCache to check if partial list contains the new items |
231 iCache.CheckForPartialVideoListItemsL( aNewItemsStartIndex ); |
292 iCache.CheckForPartialVideoListItemsL( aNewItemsStartIndex ); |
232 } |
293 } |
233 |
294 |
234 // Append new items to category video lists. All category is using iCache.iVideoList, thus no need to append to it. |
295 // Append new items to category video lists. All category is using iCache.iVideoList, thus no need to append to it. |
235 TInt count = iCategoryIdsBeingOpened.Count(); |
296 TInt categoryCount = iCategoryIdsBeingOpened.Count(); |
236 for ( TInt i = 0; i < count; i++ ) |
297 for ( TInt i = 0; i < categoryCount; i++ ) |
237 { |
298 { |
238 iCache.AppendToListL( *iVideoListsBeingOpened[i], *aVideoList, |
299 iCache.AppendToListL( *iVideoListsBeingOpened[i], *aVideoList, |
239 TVcxMyVideosCollectionUtil::Origin( iCategoryIdsBeingOpened[i] ), |
300 TVcxMyVideosCollectionUtil::Origin( iCategoryIdsBeingOpened[i] ), |
240 aNewItemsStartIndex ); |
301 aNewItemsStartIndex ); |
241 } |
302 } |
242 |
303 |
|
304 // Append new items to album video lists. |
|
305 TInt albumCount = iAlbumVideoListsBeingOpened.Count(); |
|
306 for ( TInt i = 0; i < albumCount; i++ ) |
|
307 { |
|
308 iCollection.iAlbums->Album( iAlbumIdsBeingOpened[i] )->AppendToVideoListL( |
|
309 *aVideoList, *(iAlbumVideoListsBeingOpened[i]), aNewItemsStartIndex ); |
|
310 } |
|
311 |
243 if ( aComplete == 0 ) |
312 if ( aComplete == 0 ) |
244 { |
313 { |
245 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosItemsAppended ); |
314 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosItemsAppended ); |
246 |
315 |
247 // Still fetching items |
316 // Still fetching items |
248 // Missing download fields filled from download manager |
|
249 TRAP_IGNORE( iCollection.SyncVideoListWithDownloadsL( *(iCache.iVideoList), |
|
250 EFalse /* dont send events */, aNewItemsStartIndex ); ); |
|
251 iCollection.CategoriesL().UpdateCategoriesL( *aVideoList, aNewItemsStartIndex ); |
317 iCollection.CategoriesL().UpdateCategoriesL( *aVideoList, aNewItemsStartIndex ); |
252 } |
318 } |
253 else |
319 else |
254 { |
320 { |
255 // End event arrived |
321 // End event arrived |
256 |
322 |
257 iCache.iVideoListIsPartial = EFalse; |
323 iCache.iVideoListIsPartial = EFalse; |
|
324 iCache.IsFetchingVideoList = EFalse; |
|
325 |
258 |
326 |
259 // Create modify event for All category. |
327 // Create modify event for All category. |
260 // This will cause client to make a new OpenL() call. |
328 // This will cause client to make a new OpenL() call. |
261 // Also this causes collection framework to purge its possibly outdated |
329 // Also this causes collection framework to purge its possibly outdated |
262 // (KVcxMessageMyVideosItemsAppended events don't update collection framework cache) cache. |
330 // (KVcxMessageMyVideosItemsAppended events don't update collection framework cache) cache. |
281 iVideoListsBeingOpened[i] = NULL; |
349 iVideoListsBeingOpened[i] = NULL; |
282 } |
350 } |
283 iVideoListsBeingOpened.Reset(); |
351 iVideoListsBeingOpened.Reset(); |
284 iCategoryIdsBeingOpened.Reset(); |
352 iCategoryIdsBeingOpened.Reset(); |
285 |
353 |
286 // all category, lets delete our copy and start using new one, this gives the full ownership to client |
354 for ( TInt i = 0; i < albumCount; i++ ) |
|
355 { |
|
356 // Create modify event for albums. |
|
357 // This will cause client to make a new OpenL() call. |
|
358 // Also this causes collection framework to purge its possibly outdated |
|
359 // (KVcxMessageMyVideosItemsAppended events don't update collection frameworks cache) cache. |
|
360 MPX_DEBUG3("CVcxMyVideosOpenHandler:: adding modify event for album %d, extra info = %d", |
|
361 iAlbumIdsBeingOpened[i], EVcxMyVideosVideoListOrderChanged ); |
|
362 iCollection.iMessageList->AddEventL( TMPXItemId( iAlbumIdsBeingOpened[i], 2 ), EMPXItemModified, |
|
363 EVcxMyVideosVideoListOrderChanged ); |
|
364 // 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 |
|
366 iAlbumVideoListsBeingOpened[i] = NULL; |
|
367 } |
|
368 iAlbumVideoListsBeingOpened.Reset(); |
|
369 iAlbumIdsBeingOpened.Reset(); |
|
370 |
|
371 // All category, lets delete our copy and start using new one, this gives the full |
|
372 // ownership of the list to client. Video objects will continue to point to the same shared data. |
287 iCache.ReCreateVideoListL(); |
373 iCache.ReCreateVideoListL(); |
288 |
374 |
289 iCollection.CategoriesL().UpdateCategoriesNewVideoNamesL(); |
375 iCollection.CategoriesL().UpdateCategoriesNewVideoNamesL(); |
290 |
376 |
291 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
377 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
292 } |
378 } |
293 iCollection.iMessageList->SendL(); |
379 iCollection.iMessageList->SendL(); |
294 } |
380 } |
295 |
381 |
|
382 // ---------------------------------------------------------------------------- |
|
383 // CVcxMyVideosOpenHandler::HandleAlbumOpenL |
|
384 // Album list has been fetched already. |
|
385 // ---------------------------------------------------------------------------- |
|
386 // |
|
387 void CVcxMyVideosOpenHandler::HandleAlbumOpenL() |
|
388 { |
|
389 //TODO: If iVideoList is partial and fetching is already going on -> use the implementation below. |
|
390 // If iVideoList is partial but fetching is not going on -> fetch only album items to iCache. |
|
391 |
|
392 MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() start"); |
|
393 |
|
394 CVcxMyVideosAlbum* album = iCollection.AlbumsL().Album( iPendingAlbumOpenId ); |
|
395 if ( album ) |
|
396 { |
|
397 if ( !iCollection.iCache->iVideoListIsPartial ) |
|
398 { |
|
399 //videolist complete |
|
400 CMPXMedia* videoList = album->CreateVideoListL(); |
|
401 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
402 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
|
403 delete videoList; |
|
404 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
|
405 iCollection.iMessageList->SendL(); |
|
406 } |
|
407 else |
|
408 { |
|
409 if ( iCollection.iCache->IsFetchingVideoList ) |
|
410 { |
|
411 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist fetching already in progress -> use that to populate album"); |
|
412 |
|
413 // videolist incomplete and fetching already going on |
|
414 TInt pos = iAlbumIdsBeingOpened.Find( iPendingAlbumOpenId ); |
|
415 if ( pos == KErrNotFound ) |
|
416 { |
|
417 //store video list for append events |
|
418 CMPXMedia* videoList = album->CreateVideoListL(); |
|
419 CleanupStack::PushL( videoList ); |
|
420 iAlbumVideoListsBeingOpened.AppendL( videoList ); |
|
421 CleanupStack::Pop( videoList ); |
|
422 iAlbumIdsBeingOpened.AppendL( iPendingAlbumOpenId ); |
|
423 videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
424 iCollection.iObs->HandleOpen( videoList, KErrNone ); |
|
425 } |
|
426 else |
|
427 { |
|
428 //video list already stored |
|
429 iAlbumVideoListsBeingOpened[pos]->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
430 iCollection.iObs->HandleOpen( iAlbumVideoListsBeingOpened[pos], |
|
431 KErrNone ); |
|
432 } |
|
433 } |
|
434 else |
|
435 { |
|
436 // videolist incomplete and fetching hasn't been started |
|
437 // TODO: Test how fast this is. If slow, then ditch the separate album fetching. |
|
438 |
|
439 MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist partial and no fetching going on -> fetch the album videos separately"); |
|
440 |
|
441 delete iAlbumVideoList; |
|
442 iAlbumVideoList = NULL; |
|
443 iAlbumVideoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL(); |
|
444 iCollection.iMyVideosMdsDb->iAlbums->GetAlbumContentVideosL( iPendingAlbumOpenId, |
|
445 *iAlbumVideoList, *this ); |
|
446 return; |
|
447 } |
|
448 } |
|
449 } |
|
450 else |
|
451 { |
|
452 MPX_DEBUG2("CVcxMyVideosOpenHandler:: album ID not valid (%d) -> calling HandleOpen with KErrNotFound", |
|
453 iPendingAlbumOpenId); |
|
454 iCollection.iObs->HandleOpen( static_cast<CMPXMedia*>(NULL), KErrNotFound ); |
|
455 } |
|
456 iPendingAlbumOpenId = 0; |
|
457 |
|
458 MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() exit"); |
|
459 } |
|
460 |
|
461 // ---------------------------------------------------------------------------- |
|
462 // CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosResp |
|
463 // ---------------------------------------------------------------------------- |
|
464 // |
|
465 void CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosResp( |
|
466 TUint32 aAlbumId, CMPXMedia& aVideoList, TInt aError, |
|
467 TInt aFirstNewItemIndex, TInt aNewItemCount, TBool aComplete ) |
|
468 { |
|
469 TRAPD( err, HandleGetAlbumContentVideosRespL( aAlbumId, aVideoList, aError, |
|
470 aFirstNewItemIndex, aNewItemCount, aComplete )); |
|
471 if ( err != KErrNone ) |
|
472 { |
|
473 MPX_DEBUG2("CVcxMyVideosOpenHandler:: HandleGetAlbumContentVideosRespL leaved: %d", err); |
|
474 } |
|
475 } |
|
476 |
|
477 // ---------------------------------------------------------------------------- |
|
478 // CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL |
|
479 // ---------------------------------------------------------------------------- |
|
480 // |
|
481 void CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL( |
|
482 TUint32 aAlbumId, CMPXMedia& /*aVideoList*/, TInt aError, |
|
483 TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/, TBool aComplete ) |
|
484 { |
|
485 MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL() start"); |
|
486 |
|
487 if ( aError != KErrNone ) |
|
488 { |
|
489 MPX_DEBUG2("CVcxMyVideosOpenHandler:: error %d occured when fetching album videos", aError ); |
|
490 } |
|
491 |
|
492 MPX_DEBUG3("CVcxMyVideosOpenHandler:: iPendingAlbumOpenId = %d, aAlbumId = %d", iPendingAlbumOpenId, aAlbumId ); |
|
493 |
|
494 if ( iPendingAlbumOpenId == aAlbumId ) |
|
495 { |
|
496 MPX_DEBUG2("CVcxMyVideosOpenHandler:: First videos for album %d arrived, calling HandleOpen()", aAlbumId); |
|
497 |
|
498 iAlbumVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath ); |
|
499 iCollection.iObs->HandleOpen( iAlbumVideoList, aError ); |
|
500 iPendingAlbumOpenId = 0; |
|
501 } |
|
502 |
|
503 if ( !aComplete ) |
|
504 { |
|
505 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosItemsAppended ); |
|
506 |
|
507 MPX_DEBUG3("CVcxMyVideosOpenHandler:: adding modify event for album %d, extra info = %d", |
|
508 aAlbumId, EVcxMyVideosVideoListOrderChanged ); |
|
509 iCollection.iMessageList->AddEventL( TMPXItemId( aAlbumId, 2 ), EMPXItemModified, |
|
510 EVcxMyVideosVideoListOrderChanged ); |
|
511 } |
|
512 else |
|
513 { |
|
514 //TODO: should add album id |
|
515 iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete ); |
|
516 |
|
517 delete iAlbumVideoList; |
|
518 iAlbumVideoList = NULL; |
|
519 } |
|
520 |
|
521 iCollection.iMessageList->SendL(); |
|
522 |
|
523 MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL() exit"); |
|
524 } |
|
525 |
296 // END OF FILE |
526 // END OF FILE |