26 #include "cmtpfsenumerator.h" |
26 #include "cmtpfsenumerator.h" |
27 #include "mmtpenumerationcallback.h" |
27 #include "mmtpenumerationcallback.h" |
28 #include "cmtpdataprovidercontroller.h" |
28 #include "cmtpdataprovidercontroller.h" |
29 #include "cmtpdataprovider.h" |
29 #include "cmtpdataprovider.h" |
30 #include "mtpframeworkconst.h" |
30 #include "mtpframeworkconst.h" |
|
31 #include "mtpdebug.h" |
|
32 #include "OstTraceDefinitions.h" |
|
33 #ifdef OST_TRACE_COMPILER_IN_USE |
|
34 #include "cmtpfsenumeratorTraces.h" |
|
35 #endif |
|
36 |
31 |
37 |
32 |
38 |
33 // Class constants. |
39 // Class constants. |
34 __FLOG_STMT(_LIT8(KComponent,"FSEnumerator");) |
|
35 |
40 |
36 /* |
41 /* |
37 * |
42 * |
38 */ |
43 */ |
39 #define KMAX_FILECOUNT_ENUMERATINGPHASE1 1 |
44 #define KMAX_FILECOUNT_ENUMERATINGPHASE1 1 |
107 } |
113 } |
108 else |
114 else |
109 { |
115 { |
110 iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE1; |
116 iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE1; |
111 } |
117 } |
112 __FLOG_VA((_L8("iScanAll %d files %d Storage 0x%x"), iScanAll, iObjectNeedToScan, aStorageId)); |
118 OstTraceExt3(TRACE_NORMAL, CMTPFSENUMERATOR_STARTL, "iScanAll %d files %d Storage 0x%x", (TInt32)iScanAll, (TInt32)iObjectNeedToScan, aStorageId); |
113 MMTPStorageMgr& storageMgr(iFramework.StorageMgr()); |
119 MMTPStorageMgr& storageMgr(iFramework.StorageMgr()); |
114 if (aStorageId == KMTPStorageAll) |
120 if (aStorageId == KMTPStorageAll) |
115 { |
121 { |
116 // Retrieve the available logical StorageIDs |
122 // Retrieve the available logical StorageIDs |
117 RPointerArray<const CMTPStorageMetaData> storages; |
123 RPointerArray<const CMTPStorageMetaData> storages; |
121 // Construct the StorageIDs list. |
127 // Construct the StorageIDs list. |
122 const TUint KCount(storages.Count()); |
128 const TUint KCount(storages.Count()); |
123 for (TUint i(0); (i < KCount); i++) |
129 for (TUint i(0); (i < KCount); i++) |
124 { |
130 { |
125 iStorages.InsertL(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0); |
131 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) )); |
132 OstTrace1( TRACE_NORMAL, DUP1_CMTPFSENUMERATOR_STARTL, |
|
133 "FileEnumerator is doing storage id = %x\r\n", storages[i]->Uint(CMTPStorageMetaData::EStorageId)); |
127 } |
134 } |
128 CleanupStack::PopAndDestroy(&storages); |
135 CleanupStack::PopAndDestroy(&storages); |
129 } |
136 } |
130 else if (aStorageId != KMTPNotSpecified32) |
137 else if (aStorageId != KMTPNotSpecified32) |
131 { |
138 { |
162 { |
169 { |
163 if( !storageMgr.ValidStorageId(iStorages[iScanPos]) ) |
170 if( !storageMgr.ValidStorageId(iStorages[iScanPos]) ) |
164 { |
171 { |
165 //Scan storage leave because storage(memory card) removed. |
172 //Scan storage leave because storage(memory card) removed. |
166 //Scan next specified storage in RunL, if there is. |
173 //Scan next specified storage in RunL, if there is. |
167 __FLOG_VA(_L8("StartL - iSkipCurrentStorage - ETrue.")); |
174 OstTrace0( TRACE_NORMAL, DUP2_CMTPFSENUMERATOR_STARTL, "StartL - iSkipCurrentStorage - ETrue." ); |
168 iSkipCurrentStorage = ETrue; |
175 iSkipCurrentStorage = ETrue; |
169 TRequestStatus* status = &iStatus; |
176 TRequestStatus* status = &iStatus; |
170 User::RequestComplete(status, iStatus.Int()); |
177 User::RequestComplete(status, iStatus.Int()); |
171 SetActive(); |
178 SetActive(); |
172 } |
179 } |
173 else |
180 else |
174 { |
181 { |
|
182 OstTrace1(TRACE_ERROR, DUP3_CMTPFSENUMERATOR_STARTL, "invalid storage %d", iStorages[iScanPos]); |
175 User::Leave(err); |
183 User::Leave(err); |
176 } |
184 } |
177 } |
185 } |
178 } |
186 } |
179 else |
187 else |
196 iDir.Close(); |
204 iDir.Close(); |
197 } |
205 } |
198 |
206 |
199 void CMTPFSEnumerator::ScanStorageL(TUint32 aStorageId) |
207 void CMTPFSEnumerator::ScanStorageL(TUint32 aStorageId) |
200 { |
208 { |
201 __FLOG_VA(_L8("ScanStorageL - entry")); |
209 OstTraceFunctionEntry0( CMTPFSENUMERATOR_SCANSTORAGEL_ENTRY ); |
202 const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(aStorageId)); |
210 const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(aStorageId)); |
203 __ASSERT_DEBUG((storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem), User::Invariant()); |
211 __ASSERT_DEBUG((storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem), User::Invariant()); |
204 TFileName root(storage.DesC(CMTPStorageMetaData::EStorageSuid)); |
212 TFileName root(storage.DesC(CMTPStorageMetaData::EStorageSuid)); |
205 |
213 |
206 #ifdef __FLOG_ACTIVE |
214 #ifdef OST_TRACE_COMPILER_IN_USE |
207 TBuf8<KMaxFileName> tmp; |
215 TBuf8<KMaxFileName> tmp; |
208 tmp.Copy(root); |
216 tmp.Copy(root); |
209 __FLOG_VA((_L8("StorageSuid - %S"), &tmp)); |
217 OstTraceExt1( TRACE_NORMAL, CMTPFSENUMERATOR_SCANSTORAGEL, "StorageSuid - %s", tmp ); |
210 #endif // __FLOG_ACTIVE |
218 #endif // OST_TRACE_COMPILER_IN_USE |
211 |
219 |
212 if ( iExclusionMgr.IsFolderAcceptedL(root, aStorageId) ) |
220 if ( iExclusionMgr.IsFolderAcceptedL(root, aStorageId) ) |
213 { |
221 { |
214 iParentHandle = KMTPHandleNoParent; |
222 iParentHandle = KMTPHandleNoParent; |
215 iCurrentPath = root; |
223 iCurrentPath = root; |
216 User::LeaveIfError(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); |
224 LEAVEIFERROR(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir), |
|
225 OstTraceExt1( TRACE_ERROR, DUP1_CMTPFSENUMERATOR_SCANSTORAGEL, "open %S failed!", iCurrentPath )); |
217 ScanDirL(); |
226 ScanDirL(); |
218 } |
227 } |
219 else |
228 else |
220 { |
229 { |
221 TRequestStatus* status = &iStatus; |
230 TRequestStatus* status = &iStatus; |
222 User::RequestComplete(status, iStatus.Int()); |
231 User::RequestComplete(status, iStatus.Int()); |
223 SetActive(); |
232 SetActive(); |
224 } |
233 } |
225 __FLOG_VA(_L8("ScanStorageL - exit")); |
234 OstTraceFunctionExit0( CMTPFSENUMERATOR_SCANSTORAGEL_EXIT ); |
226 } |
235 } |
227 |
236 |
228 /** |
237 /** |
229 Scans directory at aPath recursing into subdirectories on a depth first basis. |
238 Scans directory at aPath recursing into subdirectories on a depth first basis. |
230 |
239 |
245 7. Repeat 1-7 until iDirStack is empty. |
254 7. Repeat 1-7 until iDirStack is empty. |
246 */ |
255 */ |
247 |
256 |
248 void CMTPFSEnumerator::ScanDirL() |
257 void CMTPFSEnumerator::ScanDirL() |
249 { |
258 { |
250 __FLOG_VA(_L8("ScanDirL - entry")); |
259 OstTraceFunctionEntry0( CMTPFSENUMERATOR_SCANDIRL_ENTRY ); |
251 iFirstUnprocessed = 0; |
260 iFirstUnprocessed = 0; |
252 iDir.Read(iEntries, iStatus); |
261 iDir.Read(iEntries, iStatus); |
253 SetActive(); |
262 SetActive(); |
254 __FLOG_VA(_L8("ScanDirL - exit")); |
263 OstTraceFunctionExit0( CMTPFSENUMERATOR_SCANDIRL_EXIT ); |
255 } |
264 } |
256 |
265 |
257 void CMTPFSEnumerator::ScanNextStorageL() |
266 void CMTPFSEnumerator::ScanNextStorageL() |
258 { |
267 { |
|
268 OstTraceFunctionEntry0( CMTPFSENUMERATOR_SCANNEXTSTORAGEL_ENTRY ); |
259 iDirStack.Reset(); |
269 iDirStack.Reset(); |
260 __FLOG_VA(_L8("ScanNextStorageL - entry")); |
|
261 // If there are one or more unscanned storages left |
270 // If there are one or more unscanned storages left |
262 // (the currently scanned one is still on the list) |
271 // (the currently scanned one is still on the list) |
263 if (++ iScanPos < iStorages.Count()) |
272 if (++ iScanPos < iStorages.Count()) |
264 { |
273 { |
265 ScanStorageL(iStorages[iScanPos]); |
274 ScanStorageL(iStorages[iScanPos]); |
295 iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); |
304 iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); |
296 iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); |
305 iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); |
297 } |
306 } |
298 } |
307 } |
299 } |
308 } |
300 __FLOG_VA(_L8("ScanNextStorageL - exit")); |
309 OstTraceFunctionExit0( CMTPFSENUMERATOR_SCANNEXTSTORAGEL_EXIT ); |
301 } |
310 } |
302 |
311 |
303 void CMTPFSEnumerator::ScanNextSubdirL() |
312 void CMTPFSEnumerator::ScanNextSubdirL() |
304 { |
313 { |
305 __FLOG_VA(_L8("ScanNextSubdirL - entry")); |
314 OstTraceFunctionEntry0( CMTPFSENUMERATOR_SCANNEXTSUBDIRL_ENTRY ); |
306 // A empty (non-constructed) TEntry is our marker telling us to pop a directory |
315 // A empty (non-constructed) TEntry is our marker telling us to pop a directory |
307 // from iPath when we see this |
316 // from iPath when we see this |
308 //iDirStack.AppendL(TEntry()); |
317 //iDirStack.AppendL(TEntry()); |
309 |
318 |
310 // Leave with KErrNotFound if we don't find the object handle since it shouldn't be on the |
319 // Leave with KErrNotFound if we don't find the object handle since it shouldn't be on the |
312 //TPtrC suid = iPath.DriveAndPath().Left(iPath.DriveAndPath().Length()); |
321 //TPtrC suid = iPath.DriveAndPath().Left(iPath.DriveAndPath().Length()); |
313 // Update the current parentId with object of the directory |
322 // Update the current parentId with object of the directory |
314 iParentHandle = iDirStack[iDirStack.Count() - 1].iHandle;//iFramework.ObjectMgr().HandleL(suid); |
323 iParentHandle = iDirStack[iDirStack.Count() - 1].iHandle;//iFramework.ObjectMgr().HandleL(suid); |
315 iCurrentPath = iDirStack[iDirStack.Count() - 1].iPath; |
324 iCurrentPath = iDirStack[iDirStack.Count() - 1].iPath; |
316 iDirStack.Remove(iDirStack.Count() - 1); |
325 iDirStack.Remove(iDirStack.Count() - 1); |
317 __FLOG_VA((_L8("ScanNextSubdirL path %S"), &iCurrentPath)); |
326 OstTraceExt1( TRACE_NORMAL, CMTPFSENUMERATOR_SCANNEXTSUBDIRL, "ScanNextSubdirL path %S", iCurrentPath); |
318 // Kick-off a scan of the next directory |
327 // Kick-off a scan of the next directory |
319 iDir.Close(); |
328 iDir.Close(); |
320 User::LeaveIfError(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); |
329 LEAVEIFERROR(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir), |
|
330 OstTraceExt1(TRACE_ERROR, DUP1_CMTPFSENUMERATOR_SCANNEXTSUBDIRL, "Open %S failed!", iCurrentPath)); |
321 ScanDirL(); |
331 ScanDirL(); |
322 __FLOG_VA(_L8("ScanNextSubdirL - exit")); |
332 OstTraceFunctionExit0( CMTPFSENUMERATOR_SCANNEXTSUBDIRL_EXIT ); |
323 } |
333 } |
324 |
334 |
325 /** |
335 /** |
326 Recurse into the next directory on the stack |
336 Recurse into the next directory on the stack |
327 and scan it for entries. |
337 and scan it for entries. |
328 */ |
338 */ |
329 |
339 |
330 void CMTPFSEnumerator::ScanNextL() |
340 void CMTPFSEnumerator::ScanNextL() |
331 { |
341 { |
332 __FLOG_VA(_L8("ScanNextL - entry")); |
342 OstTraceFunctionEntry0( CMTPFSENUMERATOR_SCANNEXTL_ENTRY ); |
333 TInt count = iDirStack.Count(); |
343 TInt count = iDirStack.Count(); |
334 |
344 |
335 if ((count == 0) || !iScanAll) |
345 if ((count == 0) || !iScanAll) |
336 { |
346 { |
337 // No more directories on the stack, try the next storage |
347 // No more directories on the stack, try the next storage |
340 else |
350 else |
341 { |
351 { |
342 // Remove directory so we don't think it's a subdirectory |
352 // Remove directory so we don't think it's a subdirectory |
343 ScanNextSubdirL(); |
353 ScanNextSubdirL(); |
344 } |
354 } |
345 __FLOG_VA(_L8("ScanNextL - exit")); |
355 OstTraceFunctionExit0( CMTPFSENUMERATOR_SCANNEXTL_EXIT ); |
346 } |
356 } |
347 |
357 |
348 void CMTPFSEnumerator::RunL() |
358 void CMTPFSEnumerator::RunL() |
349 { |
359 { |
350 __FLOG_VA(_L8("RunL - entry")); |
360 OstTraceFunctionEntry0( CMTPFSENUMERATOR_RUNL_ENTRY ); |
351 if(iSkipCurrentStorage) |
361 if(iSkipCurrentStorage) |
352 { |
362 { |
353 __FLOG_VA(_L8("RunL - iSkipCurrentStorage - ETrue.")); |
363 OstTrace0( TRACE_NORMAL, CMTPFSENUMERATOR_RUNL, "RunL - iSkipCurrentStorage - ETrue." ); |
354 iSkipCurrentStorage = EFalse; |
364 iSkipCurrentStorage = EFalse; |
355 ScanNextStorageL(); |
365 ScanNextStorageL(); |
356 } |
366 } |
357 else if (iEntries.Count() == 0) |
367 else if (iEntries.Count() == 0) |
358 { |
368 { |
385 // Error, ignore and continue with next dir |
395 // Error, ignore and continue with next dir |
386 ScanNextL(); |
396 ScanNextL(); |
387 break; |
397 break; |
388 } |
398 } |
389 } |
399 } |
390 __FLOG_VA(_L8("RunL - exit")); |
400 OstTraceFunctionExit0( CMTPFSENUMERATOR_RUNL_EXIT ); |
391 } |
401 } |
392 |
402 |
393 /** |
403 /** |
394 Ignore the error, continue with the next one |
404 Ignore the error, continue with the next one |
395 */ |
405 */ |
396 TInt CMTPFSEnumerator::RunError(TInt aError) |
406 TInt CMTPFSEnumerator::RunError(TInt aError) |
397 { |
407 { |
398 __FLOG_VA((_L8("RunError - entry with error %d"), aError)); |
408 OstTraceFunctionEntry0( CMTPFSENUMERATOR_RUNERROR_ENTRY ); |
|
409 OstTrace1( TRACE_NORMAL, CMTPFSENUMERATOR_RUNERROR, "with error %d", aError); |
399 |
410 |
400 // avoid to access overflow of iStorages |
411 // avoid to access overflow of iStorages |
401 if (iScanPos < iStorages.Count()) |
412 if (iScanPos < iStorages.Count()) |
402 { |
413 { |
403 if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos])) |
414 if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos])) |
404 { |
415 { |
405 __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] )); |
416 OstTrace1( TRACE_WARNING, DUP1_CMTPFSENUMERATOR_RUNERROR, "Invalid StorageID = %d",iStorages[iScanPos] ); |
406 if (iStorages.Count()>1) |
417 if (iStorages.Count()>1) |
407 { |
418 { |
408 //Not necessary to process any entry on the storage, since the storage removed. |
419 //Not necessary to process any entry on the storage, since the storage removed. |
409 //Then need to start from root dir of next storage if there is. |
420 //Then need to start from root dir of next storage if there is. |
410 //So, the dir stack is popped to bottom. |
421 //So, the dir stack is popped to bottom. |
435 iFramework(aFramework), |
446 iFramework(aFramework), |
436 iExclusionMgr(aExclusionMgr), |
447 iExclusionMgr(aExclusionMgr), |
437 iCallback(aCallback), |
448 iCallback(aCallback), |
438 iProcessLimit(aProcessLimit) |
449 iProcessLimit(aProcessLimit) |
439 { |
450 { |
440 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
441 CActiveScheduler::Add(this); |
451 CActiveScheduler::Add(this); |
442 } |
452 } |
443 |
453 |
444 void CMTPFSEnumerator::ConstructL() |
454 void CMTPFSEnumerator::ConstructL() |
445 { |
455 { |
|
456 OstTraceFunctionEntry0( CMTPFSENUMERATOR_CONSTRUCTL_ENTRY ); |
446 iSingletons.OpenL(); |
457 iSingletons.OpenL(); |
447 iDpSingletons.OpenL(iFramework); |
458 iDpSingletons.OpenL(iFramework); |
448 iObject = CMTPObjectMetaData::NewL(); |
459 iObject = CMTPObjectMetaData::NewL(); |
449 iDpID = iFramework.DataProviderId(); |
460 iDpID = iFramework.DataProviderId(); |
|
461 OstTraceFunctionExit0( CMTPFSENUMERATOR_CONSTRUCTL_EXIT ); |
450 } |
462 } |
451 |
463 |
452 /** |
464 /** |
453 Iterates iEntries adding entries as needed to object manager and iDirStack. |
465 Iterates iEntries adding entries as needed to object manager and iDirStack. |
454 */ |
466 */ |
465 { |
477 { |
466 const TEntry& entry = iEntries[i]; |
478 const TEntry& entry = iEntries[i]; |
467 TInt len = entry.iName.Length(); |
479 TInt len = entry.iName.Length(); |
468 if(iCurrentPath.Length() + len > KMaxFileName) |
480 if(iCurrentPath.Length() + len > KMaxFileName) |
469 { |
481 { |
470 __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored.")); |
482 OstTrace0( TRACE_WARNING, CMTPFSENUMERATOR_PROCESSENTRIESL, "Full name exceeds KMaxFileName, ignored." ); |
471 continue; |
483 continue; |
472 } |
484 } |
473 |
485 |
474 iCurrentPath.Append(entry.iName); |
486 iCurrentPath.Append(entry.iName); |
475 |
487 |
476 __FLOG_VA((_L("Process path %S name %S"), &iCurrentPath, &entry.iName)); |
488 OstTraceExt2( TRACE_NORMAL, DUP1_CMTPFSENUMERATOR_PROCESSENTRIESL, |
477 #ifdef __FLOG_ACTIVE |
489 "Process path %S name %S", iCurrentPath, entry.iName ); |
|
490 |
|
491 #ifdef OST_TRACE_COMPILER_IN_USE |
478 TBuf8<KMTPMaxFullFileName> tmp; |
492 TBuf8<KMTPMaxFullFileName> tmp; |
479 tmp.Copy(iCurrentPath); |
493 tmp.Copy(iCurrentPath); |
480 TInt pathLen=iCurrentPath.Length(); |
494 TInt pathLen=iCurrentPath.Length(); |
481 if(pathLen > KLogBufferSize) |
495 if(pathLen > KLogBufferSize) |
482 { |
496 { |
483 TBuf8<KLogBufferSize> tmp1; |
497 TBuf8<KLogBufferSize> tmp1; |
484 tmp1.Copy(tmp.Ptr(),KLogBufferSize); |
498 tmp1.Copy(tmp.Ptr(),KLogBufferSize); |
485 __FLOG_VA(_L8("Entry - ")); |
499 OstTrace0( TRACE_NORMAL, DUP2_CMTPFSENUMERATOR_PROCESSENTRIESL, "Entry - " ); |
486 __FLOG_VA((_L8("%S"), &tmp1)); |
500 OstTraceExt1( TRACE_NORMAL, DUP3_CMTPFSENUMERATOR_PROCESSENTRIESL, "%s", tmp1); |
|
501 |
487 |
502 |
488 tmp1.Copy(tmp.Ptr()+KLogBufferSize, pathLen-KLogBufferSize); |
503 tmp1.Copy(tmp.Ptr()+KLogBufferSize, pathLen-KLogBufferSize); |
489 __FLOG_VA((_L8("%S"), &tmp1)); |
504 OstTraceExt1( TRACE_NORMAL, DUP4_CMTPFSENUMERATOR_PROCESSENTRIESL, "%s", tmp1); |
490 } |
505 } |
491 else |
506 else |
492 { |
507 { |
493 __FLOG_VA(_L8("Entry - ")); |
508 OstTrace0( TRACE_NORMAL, DUP5_CMTPFSENUMERATOR_PROCESSENTRIESL, "Entry - " ); |
494 __FLOG_VA((_L8("%S"), &tmp)); |
509 OstTraceExt1( TRACE_NORMAL, DUP6_CMTPFSENUMERATOR_PROCESSENTRIESL, "%s", tmp); |
495 } |
510 } |
496 #endif // __FLOG_ACTIVE |
511 #endif // OST_TRACE_COMPILER_IN_USE |
497 |
512 |
498 TUint32 handle = 0; |
513 TUint32 handle = 0; |
499 TMTPFormatCode format; |
514 TMTPFormatCode format; |
500 if(-- iObjectNeedToScan <=0 && iAllRootScaned) |
515 if(-- iObjectNeedToScan <=0 && iAllRootScaned) |
501 { |
516 { |
552 { |
567 { |
553 HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iCurrentPath); |
568 HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iCurrentPath); |
554 CleanupStack::PushL(mime); |
569 CleanupStack::PushL(mime); |
555 if ( mime != NULL ) |
570 if ( mime != NULL ) |
556 { |
571 { |
557 __FLOG_VA((_L("mime %S"), mime)); |
572 OstTraceExt1( TRACE_NORMAL, DUP7_CMTPFSENUMERATOR_PROCESSENTRIESL, "mime %S", *mime ); |
558 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime); |
573 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime); |
559 __FLOG_VA((_L("DpId find %d"), DpId)); |
574 OstTrace1( TRACE_NORMAL, DUP8_CMTPFSENUMERATOR_PROCESSENTRIESL, "DpId find %d", DpId ); |
560 |
575 |
561 format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime); |
576 format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime); |
562 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], |
577 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], |
563 iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime)); |
578 iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime)); |
564 } |
579 } |
598 @param aPath The full path name of the entry |
613 @param aPath The full path name of the entry |
599 @return MTP object handle, or KMTPHandleNone if entry was not accepted |
614 @return MTP object handle, or KMTPHandleNone if entry was not accepted |
600 */ |
615 */ |
601 void CMTPFSEnumerator::AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle) |
616 void CMTPFSEnumerator::AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle) |
602 { |
617 { |
603 #ifdef __FLOG_ACTIVE |
618 OstTraceFunctionEntry0( CMTPFSENUMERATOR_ADDENTRYL_ENTRY ); |
|
619 #ifdef OST_TRACE_COMPILER_IN_USE |
604 TBuf8<KMaxFileName> tmp; |
620 TBuf8<KMaxFileName> tmp; |
605 tmp.Copy(aPath); |
621 tmp.Copy(aPath); |
606 |
622 |
607 __FLOG_VA((_L8("AddEntryL - entry: %S"), &tmp)); |
623 OstTraceExt1( TRACE_NORMAL, CMTPFSENUMERATOR_ADDENTRYL, "entry: %s", tmp ); |
608 #endif // __FLOG_ACTIVE |
624 #endif // OST_TRACE_COMPILER_IN_USE |
609 |
625 |
610 TUint16 assoc; |
626 TUint16 assoc; |
611 TPtrC name; |
627 TPtrC name; |
612 if (format == EMTPFormatCodeAssociation) |
628 if (format == EMTPFormatCodeAssociation) |
613 { |
629 { |
636 iObject->SetDesCL(CMTPObjectMetaData::EName, name); |
652 iObject->SetDesCL(CMTPObjectMetaData::EName, name); |
637 iFramework.ObjectMgr().InsertObjectL(*iObject); |
653 iFramework.ObjectMgr().InsertObjectL(*iObject); |
638 aHandle = iObject->Uint(CMTPObjectMetaData::EHandle); |
654 aHandle = iObject->Uint(CMTPObjectMetaData::EHandle); |
639 |
655 |
640 } |
656 } |
641 __FLOG_VA(_L8("AddEntryL - exit")); |
657 OstTraceFunctionExit0( CMTPFSENUMERATOR_ADDENTRYL_EXIT ); |
642 } |
658 } |
643 |
659 |
644 void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle, TUint16 aSubFormatCode/* = 0*/) |
660 void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle, TUint16 aSubFormatCode/* = 0*/) |
645 { |
661 { |
646 #ifdef __FLOG_ACTIVE |
662 OstTraceFunctionEntry0( CMTPFSENUMERATOR_ADDFILEENTRYFOROTHERDPL_ENTRY ); |
|
663 #ifdef OST_TRACE_COMPILER_IN_USE |
647 TBuf8<KMaxFileName> tmp; |
664 TBuf8<KMaxFileName> tmp; |
648 tmp.Copy(aPath); |
665 tmp.Copy(aPath); |
649 |
666 |
650 __FLOG_VA((_L8("AddFileEntryForOtherDpL - entry: %S"), &tmp)); |
667 OstTraceExt1( TRACE_NORMAL, CMTPFSENUMERATOR_ADDFILEENTRYFOROTHERDPL, "%S", tmp ); |
651 #endif // __FLOG_ACTIVE |
668 #endif // OST_TRACE_COMPILER_IN_USE |
652 |
669 |
653 TParsePtrC pathParser(aPath); |
670 TParsePtrC pathParser(aPath); |
654 TPtrC name(pathParser.Name()); |
671 TPtrC name(pathParser.Name()); |
655 |
672 |
656 aHandle = KMTPHandleNone; |
673 aHandle = KMTPHandleNone; |
662 iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, aSubFormatCode); |
679 iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, aSubFormatCode); |
663 iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); |
680 iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); |
664 iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable); |
681 iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable); |
665 iObject->SetDesCL(CMTPObjectMetaData::EName, name); |
682 iObject->SetDesCL(CMTPObjectMetaData::EName, name); |
666 iFramework.ObjectMgr().InsertObjectL(*iObject); |
683 iFramework.ObjectMgr().InsertObjectL(*iObject); |
667 __FLOG_VA(_L8("AddEntryL - exit")); |
684 OstTraceFunctionExit0( CMTPFSENUMERATOR_ADDFILEENTRYFOROTHERDPL_EXIT ); |
668 } |
685 } |
669 |
686 |
670 void CMTPFSEnumerator::NotifyObjectAddToDP(const TUint32 aHandle,const TUint DpId) |
687 void CMTPFSEnumerator::NotifyObjectAddToDP(const TUint32 aHandle,const TUint DpId) |
671 { |
688 { |
672 iSingletons.DpController().NotifyDataProvidersL(DpId,EMTPObjectAdded,(TAny*)&aHandle); |
689 iSingletons.DpController().NotifyDataProvidersL(DpId,EMTPObjectAdded,(TAny*)&aHandle); |