mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp
changeset 31 a26669f87b46
parent 29 3ae5cb0b4c02
child 49 c20dd21d1eb4
equal deleted inserted replaced
29:3ae5cb0b4c02 31:a26669f87b46
   120         storageMgr.GetLogicalStoragesL(params, storages);
   120         storageMgr.GetLogicalStoragesL(params, storages);
   121         // Construct the StorageIDs list.
   121         // Construct the StorageIDs list.
   122         const TUint KCount(storages.Count());
   122         const TUint KCount(storages.Count());
   123         for (TUint i(0); (i < KCount); i++)
   123         for (TUint i(0); (i < KCount); i++)
   124             {
   124             {
   125             iStorages.Insert(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0);
   125             iStorages.InsertL(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0);
   126             __FLOG_VA((_L8("FileEnumerator is doing storage id = %x\r\n"), storages[i]->Uint(CMTPStorageMetaData::EStorageId) ));
   126             __FLOG_VA((_L8("FileEnumerator is doing storage id = %x\r\n"), storages[i]->Uint(CMTPStorageMetaData::EStorageId) ));
   127             }
   127             }
   128         CleanupStack::PopAndDestroy(&storages);
   128         CleanupStack::PopAndDestroy(&storages);
   129         }
   129         }
   130     else if (aStorageId != KMTPNotSpecified32)
   130     else if (aStorageId != KMTPNotSpecified32)
   394 Ignore the error, continue with the next one
   394 Ignore the error, continue with the next one
   395 */    
   395 */    
   396 TInt CMTPFSEnumerator::RunError(TInt aError)
   396 TInt CMTPFSEnumerator::RunError(TInt aError)
   397 	{
   397 	{
   398 	__FLOG_VA((_L8("RunError - entry with error %d"), aError));
   398 	__FLOG_VA((_L8("RunError - entry with error %d"), aError));
   399 	 if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos]))
   399 	
   400 		 {
   400 	// avoid to access overflow of iStorages
   401 		 __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] ));
   401     if (iScanPos < iStorages.Count())
   402 		 if (iStorages.Count()>1)
   402         {
   403 			 {
   403         if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos]))
   404 			 //Not necessary to process any entry on the storage, since the storage removed.
   404             {
   405 			 //Then need to start from root dir of next storage if there is.
   405              __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] ));
   406 			 //So, the dir stack is popped to bottom.
   406              if (iStorages.Count()>1)
   407 			 iDirStack.Reset();
   407                  {
   408 			 }
   408                  //Not necessary to process any entry on the storage, since the storage removed.
   409 		 iSkipCurrentStorage = ETrue;
   409                  //Then need to start from root dir of next storage if there is.
   410 		 }
   410                  //So, the dir stack is popped to bottom.
       
   411                  iDirStack.Reset();
       
   412                  }
       
   413              iSkipCurrentStorage = ETrue;
       
   414             }
       
   415         }
       
   416     else
       
   417         {
       
   418         iSkipCurrentStorage = ETrue;
       
   419         }
   411 	
   420 	
   412 	// Reschedule ourselves
   421 	// Reschedule ourselves
   413 	TRequestStatus* status = &iStatus;
   422 	TRequestStatus* status = &iStatus;
   414 	User::RequestComplete(status, aError);
   423 	User::RequestComplete(status, aError);
   415 	SetActive();
   424 	SetActive();
   499                 {
   508                 {
   500                 iCurrentPath.Append('\\');
   509                 iCurrentPath.Append('\\');
   501                 ++len;
   510                 ++len;
   502                 format = EMTPFormatCodeAssociation;
   511                 format = EMTPFormatCodeAssociation;
   503                 AddEntryL(iCurrentPath, handle, format, KMTPDeviceDPID, entry, iStorages[iScanPos], iParentHandle);
   512                 AddEntryL(iCurrentPath, handle, format, KMTPDeviceDPID, entry, iStorages[iScanPos], iParentHandle);
   504                 iDirStack.Append(TStackItem(iCurrentPath, handle));
   513                 iDirStack.AppendL(TStackItem(iCurrentPath, handle));
   505                 }
   514                 }
   506             }
   515             }
   507         else
   516         else
   508             {
   517             {
   509             if ( iExclusionMgr.IsFileAcceptedL(iCurrentPath,iStorages[iScanPos]) )
   518             if ( iExclusionMgr.IsFileAcceptedL(iCurrentPath,iStorages[iScanPos]) )
   546                             if ( mime != NULL )
   555                             if ( mime != NULL )
   547                                 {
   556                                 {
   548                                 __FLOG_VA((_L("mime %S"), mime));
   557                                 __FLOG_VA((_L("mime %S"), mime));
   549                                 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime);
   558                                 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime);
   550                                 __FLOG_VA((_L("DpId find %d"), DpId));
   559                                 __FLOG_VA((_L("DpId find %d"), DpId));
       
   560 								
       
   561 								format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime);
       
   562 								AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], 
       
   563 										iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime));
   551                                 }
   564                                 }
   552                             format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime);
   565 							else
   553                             AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], 
   566                                 {
   554                                     iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime));
   567                                 AddEntryL(iCurrentPath, handle, EMTPFormatCodeUndefined, iDpID, entry, iStorages[iScanPos], iParentHandle);
       
   568                                 }
       
   569 
   555                             CleanupStack::PopAndDestroy(mime);
   570                             CleanupStack::PopAndDestroy(mime);
   556                             }
   571                             }
   557                         else
   572                         else
   558                             {
   573                             {
   559                             format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
   574                             format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));