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