267 // Proceed to next abstract media item |
267 // Proceed to next abstract media item |
268 // ----------------------------------------------------------------------------- |
268 // ----------------------------------------------------------------------------- |
269 // |
269 // |
270 void CAbstractMediaMtpDataProviderEnumerator::ScanNextL() |
270 void CAbstractMediaMtpDataProviderEnumerator::ScanNextL() |
271 { |
271 { |
272 while (iStorages.Count() > 0) |
272 while ( iStorages.Count() > 0 ) |
273 { |
273 { |
274 while ( iEnumState < EEnumCount ) |
274 while ( iEnumState < EEnumCount ) |
275 { |
275 { |
276 if ( iCurrentIndex < iCount ) |
276 if ( iCurrentIndex < iCount ) |
277 { |
277 { |
311 // NOTE: preserve for performance improvement |
312 // NOTE: preserve for performance improvement |
312 // ----------------------------------------------------------------------------- |
313 // ----------------------------------------------------------------------------- |
313 // |
314 // |
314 void CAbstractMediaMtpDataProviderEnumerator::RunL() |
315 void CAbstractMediaMtpDataProviderEnumerator::RunL() |
315 { |
316 { |
316 PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderEnumerator::RunL" ) ); |
|
317 |
|
318 // insert all abstract medias into handle db of framework |
317 // insert all abstract medias into handle db of framework |
319 CMPXMedia* media = ( *iAbstractMedias )[iCurrentIndex]; |
318 CMPXMedia* media = ( *iAbstractMedias )[iCurrentIndex]; |
320 |
319 |
321 // Increase the index first in case of leave |
320 // Increase the index first in case of leave |
322 iCurrentIndex++; |
321 iCurrentIndex++; |
409 TParsePtrC parser( aSuid ); |
408 TParsePtrC parser( aSuid ); |
410 PERFLOGSTART( KObjectManagerObjectUid ); |
409 PERFLOGSTART( KObjectManagerObjectUid ); |
411 TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parser.DriveAndPath() ); |
410 TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parser.DriveAndPath() ); |
412 PERFLOGSTOP( KObjectManagerObjectUid ); |
411 PERFLOGSTOP( KObjectManagerObjectUid ); |
413 |
412 |
414 object->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); |
413 // MTP FW returns KMTPHandleNone for parentHandle in two situations: |
415 |
414 // 1. The path doesn't exist |
416 PERFLOGSTART( KObjectManagerInsert ); |
415 // 2. The object is under root directory |
417 iObjectMgr.InsertObjectL( *object ); |
416 if ( parentHandle == KMTPHandleNone ) |
418 PERFLOGSTOP( KObjectManagerInsert ); |
417 { |
419 |
418 if ( BaflUtils::PathExists( iFramework.Fs(), parser.DriveAndPath() ) ) |
420 CleanupStack::PopAndDestroy( object );// - object |
419 { |
421 |
420 parentHandle = KMTPHandleNoParent; |
422 //Only remember the playlist file for clean up |
421 } |
423 if( iEnumState == EEnumPlaylist ) |
422 else |
424 { |
423 { |
425 iDataProvider.GetWrapperL().CreateDummyFile( aSuid ); |
424 iDataProvider.GetWrapperL().DeleteObjectL( *object ); |
426 |
425 } |
427 // remember the abstract media file for clean up |
426 } |
428 iDataProvider.GetWrapperL().AddDummyFileL( aSuid ); |
427 |
|
428 if ( parentHandle != KMTPHandleNone ) |
|
429 { |
|
430 object->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); |
|
431 |
|
432 PERFLOGSTART( KObjectManagerInsert ); |
|
433 iObjectMgr.InsertObjectL( *object ); |
|
434 PERFLOGSTOP( KObjectManagerInsert ); |
|
435 |
|
436 CleanupStack::PopAndDestroy( object );// - object |
|
437 |
|
438 //Only remember the playlist file for clean up |
|
439 if( iEnumState == EEnumPlaylist ) |
|
440 { |
|
441 iDataProvider.GetWrapperL().CreateDummyFile( aSuid ); |
|
442 |
|
443 // remember the abstract media file for clean up |
|
444 iDataProvider.GetWrapperL().AddDummyFileL( aSuid ); |
|
445 } |
429 } |
446 } |
430 |
447 |
431 PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::AddEntryL" ) ); |
448 PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::AddEntryL" ) ); |
432 } |
449 } |
433 |
450 |