mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp
branchRCL_3
changeset 6 ef55b168cedb
parent 4 60a94a45d437
child 13 81da3301b632
equal deleted inserted replaced
5:3673b591050c 6:ef55b168cedb
   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         iCurrentPath.Append(entry.iName);
   458         iCurrentPath.Append(entry.iName);
   459         __FLOG_VA((_L8("Process path %S name %S"), &iCurrentPath, &entry.iName));
   459         __FLOG_VA((_L("Process path %S name %S"), &iCurrentPath, &entry.iName));
   460 #ifdef __FLOG_ACTIVE    
   460 #ifdef __FLOG_ACTIVE    
   461         TBuf8<KMTPMaxFullFileName> tmp;
   461         TBuf8<KMTPMaxFullFileName> tmp;
   462         tmp.Copy(iCurrentPath);
   462         tmp.Copy(iCurrentPath);
   463         TInt pathLen=iCurrentPath.Length();
   463         TInt pathLen=iCurrentPath.Length();
   464         if(pathLen > KLogBufferSize)
   464         if(pathLen > KLogBufferSize)
   529                         
   529                         
   530                     case MISSED_FILES_OWNED_BY_OTHER_DP:
   530                     case MISSED_FILES_OWNED_BY_OTHER_DP:
   531                         if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath))
   531                         if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath))
   532                             {
   532                             {
   533                             format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
   533                             format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
   534                             TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC);
   534                             TUint32 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1), KNullDesC);
   535                             AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle);
   535                             AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle);
   536                             }
   536                             }
   537                         break;
   537                         break;
   538                         
   538                         
   539                     case FILES_OWNED_BY_OTHER_DP:
   539                     case FILES_OWNED_BY_OTHER_DP:
   540                         {
   540                         {
   541                         _LIT( KTxtExtensionODF, ".odf" );
   541                         _LIT( KTxtExtensionODF, ".odf" );
   542                         TUint32 DpId = iFramework.DataProviderId();
   542                         TUint32 DpId = iFramework.DataProviderId();
   543                         if (parse.Ext().CompareF(KTxtExtensionODF)==0)
   543                         if (parse.Ext().CompareF(KTxtExtensionODF)==0)
   544                             {
   544                             {
   545                             format = iDpSingletons.MTPUtility().FormatFromFilename(parse.Ext().Mid(1));
   545                             HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iCurrentPath);
   546                             if ( EMTPFormatCode3GPContainer==format || EMTPFormatCodeMP4Container==format )
   546                             CleanupStack::PushL(mime);
       
   547                             if ( mime != NULL )
   547                                 {
   548                                 {
   548                                 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1),KNullDesC);
   549                                 __FLOG_VA((_L("mime %S"), mime));
   549                                 if ( 255 == DpId )
   550                                 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime);
   550                                     {
   551                                 __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                                 }
   552                                 }
   562                             else
   553                             format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime);
   563                                 {
   554                             AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], 
   564                                 format = EMTPFormatCodeUndefined;
   555                                     iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime));
   565                                 AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle);
   556                             CleanupStack::PopAndDestroy(mime);
   566                                 }
       
   567                             }
   557                             }
   568                         else
   558                         else
   569                             {
   559                             {
   570                             format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
   560                             format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
   571                             TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC);
   561                             TUint32 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1), KNullDesC);
   572                             AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle);
   562                             AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle);
   573                             }
   563                             }
   574                         }
   564                         }
   575                         break;
   565                         break;
   576                         
   566                         
   635         
   625         
   636         }
   626         }
   637 	__FLOG_VA(_L8("AddEntryL - exit"));	
   627 	__FLOG_VA(_L8("AddEntryL - exit"));	
   638 	}
   628 	}
   639 
   629 
   640 void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle)
   630 void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle, TUint16 aSubFormatCode/* = 0*/)
   641     {
   631     {
   642 #ifdef __FLOG_ACTIVE    
   632 #ifdef __FLOG_ACTIVE    
   643     TBuf8<KMaxFileName> tmp;
   633     TBuf8<KMaxFileName> tmp;
   644     tmp.Copy(aPath);
   634     tmp.Copy(aPath);
   645     
   635     
   646     __FLOG_VA((_L8("AddFileEntryForOtherDpL - entry: %S"), &tmp));
   636     __FLOG_VA((_L8("AddFileEntryForOtherDpL - entry: %S"), &tmp));
   647 #endif // __FLOG_ACTIVE
   637 #endif // __FLOG_ACTIVE
   648 
   638 
   649     TUint16 assoc = EMTPAssociationTypeUndefined;
       
   650     TParsePtrC pathParser(aPath);
   639     TParsePtrC pathParser(aPath);
   651     TPtrC name(pathParser.Name());    
   640     TPtrC name(pathParser.Name());    
   652     
   641     
   653     aHandle = KMTPHandleNone;
   642     aHandle = KMTPHandleNone;
   654     
   643     
   655     iObject->SetUint(CMTPObjectMetaData::EDataProviderId, aDPId);
   644     iObject->SetUint(CMTPObjectMetaData::EDataProviderId, aDPId);
   656     iObject->SetUint(CMTPObjectMetaData::EFormatCode, format);
   645     iObject->SetUint(CMTPObjectMetaData::EFormatCode, format);
   657     iObject->SetUint(CMTPObjectMetaData::EStorageId, aStorageId);
   646     iObject->SetUint(CMTPObjectMetaData::EStorageId, aStorageId);
   658     iObject->SetDesCL(CMTPObjectMetaData::ESuid, aPath);
   647     iObject->SetDesCL(CMTPObjectMetaData::ESuid, aPath);
   659     iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, assoc);
   648     iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, aSubFormatCode);
   660     iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle);
   649     iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle);
   661     iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable);
   650     iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable);
   662     iObject->SetDesCL(CMTPObjectMetaData::EName, name);
   651     iObject->SetDesCL(CMTPObjectMetaData::EName, name);
   663     iFramework.ObjectMgr().InsertObjectL(*iObject);
   652     iFramework.ObjectMgr().InsertObjectL(*iObject);
   664     __FLOG_VA(_L8("AddEntryL - exit")); 
   653     __FLOG_VA(_L8("AddEntryL - exit"));