453 iFirstUnprocessed += count; |
453 iFirstUnprocessed += count; |
454 |
454 |
455 for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i) |
455 for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i) |
456 { |
456 { |
457 const TEntry& entry = iEntries[i]; |
457 const TEntry& entry = iEntries[i]; |
|
458 TInt len = entry.iName.Length(); |
|
459 if(iCurrentPath.Length() + len > KMaxFileName) |
|
460 { |
|
461 __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored.")); |
|
462 continue; |
|
463 } |
|
464 |
458 iCurrentPath.Append(entry.iName); |
465 iCurrentPath.Append(entry.iName); |
459 __FLOG_VA((_L8("Process path %S name %S"), &iCurrentPath, &entry.iName)); |
466 |
|
467 __FLOG_VA((_L("Process path %S name %S"), &iCurrentPath, &entry.iName)); |
460 #ifdef __FLOG_ACTIVE |
468 #ifdef __FLOG_ACTIVE |
461 TBuf8<KMTPMaxFullFileName> tmp; |
469 TBuf8<KMTPMaxFullFileName> tmp; |
462 tmp.Copy(iCurrentPath); |
470 tmp.Copy(iCurrentPath); |
463 TInt pathLen=iCurrentPath.Length(); |
471 TInt pathLen=iCurrentPath.Length(); |
464 if(pathLen > KLogBufferSize) |
472 if(pathLen > KLogBufferSize) |
476 __FLOG_VA(_L8("Entry - ")); |
484 __FLOG_VA(_L8("Entry - ")); |
477 __FLOG_VA((_L8("%S"), &tmp)); |
485 __FLOG_VA((_L8("%S"), &tmp)); |
478 } |
486 } |
479 #endif // __FLOG_ACTIVE |
487 #endif // __FLOG_ACTIVE |
480 |
488 |
481 TInt len = entry.iName.Length(); |
|
482 TInt totalLen = iCurrentPath.Length(); |
|
483 if(totalLen > KMaxFileName) |
|
484 { |
|
485 // Remove filename part |
|
486 iCurrentPath.SetLength(totalLen - len); |
|
487 __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored.")); |
|
488 continue; |
|
489 } |
|
490 TUint32 handle = 0; |
489 TUint32 handle = 0; |
491 TMTPFormatCode format; |
490 TMTPFormatCode format; |
492 if(-- iObjectNeedToScan <=0 && iAllRootScaned) |
491 if(-- iObjectNeedToScan <=0 && iAllRootScaned) |
493 { |
492 { |
494 iSkipCurrentStorage = ETrue; |
493 iSkipCurrentStorage = ETrue; |
529 |
528 |
530 case MISSED_FILES_OWNED_BY_OTHER_DP: |
529 case MISSED_FILES_OWNED_BY_OTHER_DP: |
531 if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath)) |
530 if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath)) |
532 { |
531 { |
533 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
532 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
534 TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); |
533 TUint32 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1), KNullDesC); |
535 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); |
534 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); |
536 } |
535 } |
537 break; |
536 break; |
538 |
537 |
539 case FILES_OWNED_BY_OTHER_DP: |
538 case FILES_OWNED_BY_OTHER_DP: |
540 { |
539 { |
541 _LIT( KTxtExtensionODF, ".odf" ); |
540 _LIT( KTxtExtensionODF, ".odf" ); |
542 TUint32 DpId = iFramework.DataProviderId(); |
541 TUint32 DpId = iFramework.DataProviderId(); |
543 if (parse.Ext().CompareF(KTxtExtensionODF)==0) |
542 if (parse.Ext().CompareF(KTxtExtensionODF)==0) |
544 { |
543 { |
545 format = iDpSingletons.MTPUtility().FormatFromFilename(parse.Ext().Mid(1)); |
544 HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iCurrentPath); |
546 if ( EMTPFormatCode3GPContainer==format || EMTPFormatCodeMP4Container==format ) |
545 CleanupStack::PushL(mime); |
|
546 if ( mime != NULL ) |
547 { |
547 { |
548 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1),KNullDesC); |
548 __FLOG_VA((_L("mime %S"), mime)); |
549 if ( 255 == DpId ) |
549 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime); |
550 { |
550 __FLOG_VA((_L("DpId find %d"), DpId)); |
551 HBufC* mime = NULL; |
|
552 mime = iDpSingletons.MTPUtility().ContainerMimeType(iCurrentPath); |
|
553 if ( mime != NULL ) |
|
554 { |
|
555 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1),*mime); |
|
556 delete mime; |
|
557 mime = NULL; |
|
558 } |
|
559 } |
|
560 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); |
|
561 } |
551 } |
562 else |
552 format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime); |
563 { |
553 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], |
564 format = EMTPFormatCodeUndefined; |
554 iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime)); |
565 AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle); |
555 CleanupStack::PopAndDestroy(mime); |
566 } |
|
567 } |
556 } |
568 else |
557 else |
569 { |
558 { |
570 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
559 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
571 TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); |
560 TUint32 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1), KNullDesC); |
572 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); |
561 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); |
573 } |
562 } |
574 } |
563 } |
575 break; |
564 break; |
576 |
565 |
635 |
624 |
636 } |
625 } |
637 __FLOG_VA(_L8("AddEntryL - exit")); |
626 __FLOG_VA(_L8("AddEntryL - exit")); |
638 } |
627 } |
639 |
628 |
640 void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle) |
629 void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle, TUint16 aSubFormatCode/* = 0*/) |
641 { |
630 { |
642 #ifdef __FLOG_ACTIVE |
631 #ifdef __FLOG_ACTIVE |
643 TBuf8<KMaxFileName> tmp; |
632 TBuf8<KMaxFileName> tmp; |
644 tmp.Copy(aPath); |
633 tmp.Copy(aPath); |
645 |
634 |
646 __FLOG_VA((_L8("AddFileEntryForOtherDpL - entry: %S"), &tmp)); |
635 __FLOG_VA((_L8("AddFileEntryForOtherDpL - entry: %S"), &tmp)); |
647 #endif // __FLOG_ACTIVE |
636 #endif // __FLOG_ACTIVE |
648 |
637 |
649 TUint16 assoc = EMTPAssociationTypeUndefined; |
|
650 TParsePtrC pathParser(aPath); |
638 TParsePtrC pathParser(aPath); |
651 TPtrC name(pathParser.Name()); |
639 TPtrC name(pathParser.Name()); |
652 |
640 |
653 aHandle = KMTPHandleNone; |
641 aHandle = KMTPHandleNone; |
654 |
642 |
655 iObject->SetUint(CMTPObjectMetaData::EDataProviderId, aDPId); |
643 iObject->SetUint(CMTPObjectMetaData::EDataProviderId, aDPId); |
656 iObject->SetUint(CMTPObjectMetaData::EFormatCode, format); |
644 iObject->SetUint(CMTPObjectMetaData::EFormatCode, format); |
657 iObject->SetUint(CMTPObjectMetaData::EStorageId, aStorageId); |
645 iObject->SetUint(CMTPObjectMetaData::EStorageId, aStorageId); |
658 iObject->SetDesCL(CMTPObjectMetaData::ESuid, aPath); |
646 iObject->SetDesCL(CMTPObjectMetaData::ESuid, aPath); |
659 iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, assoc); |
647 iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, aSubFormatCode); |
660 iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); |
648 iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); |
661 iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable); |
649 iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable); |
662 iObject->SetDesCL(CMTPObjectMetaData::EName, name); |
650 iObject->SetDesCL(CMTPObjectMetaData::EName, name); |
663 iFramework.ObjectMgr().InsertObjectL(*iObject); |
651 iFramework.ObjectMgr().InsertObjectL(*iObject); |
664 __FLOG_VA(_L8("AddEntryL - exit")); |
652 __FLOG_VA(_L8("AddEntryL - exit")); |