92 |
93 |
93 /** |
94 /** |
94 Kick off the enumeration on the specified storage |
95 Kick off the enumeration on the specified storage |
95 @param aStorageId storage to be enumerated |
96 @param aStorageId storage to be enumerated |
96 */ |
97 */ |
97 EXPORT_C void CMTPFSEnumerator::StartL(TUint32 aStorageId, TBool aOnlyRoot) |
98 EXPORT_C void CMTPFSEnumerator::StartL(TUint32 aStorageId, TBool aScanAll) |
98 { |
99 { |
99 __ASSERT_DEBUG(!IsActive(), User::Invariant()); |
100 __ASSERT_DEBUG(!IsActive(), User::Invariant()); |
100 iNumOfFoldersAndFiles = 0; |
101 iScanAll = aScanAll; |
101 iOnlyScanRoot = aOnlyRoot; |
102 iAllRootScaned = EFalse; |
102 __FLOG_VA((_L8("iOnlyScanRoot == %d "), iOnlyScanRoot)); |
103 iStorages.Reset(); |
103 |
104 if(iScanAll) |
104 MMTPStorageMgr& storageMgr(iFramework.StorageMgr()); |
105 { |
105 if (aStorageId == KMTPStorageAll) |
106 iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE2; |
106 { |
107 } |
|
108 else |
|
109 { |
|
110 iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE1; |
|
111 } |
|
112 __FLOG_VA((_L8("iScanAll %d files %d Storage 0x%x"), iScanAll, iObjectNeedToScan, aStorageId)); |
|
113 MMTPStorageMgr& storageMgr(iFramework.StorageMgr()); |
|
114 if (aStorageId == KMTPStorageAll) |
|
115 { |
107 // Retrieve the available logical StorageIDs |
116 // Retrieve the available logical StorageIDs |
108 RPointerArray<const CMTPStorageMetaData> storages; |
117 RPointerArray<const CMTPStorageMetaData> storages; |
109 CleanupClosePushL(storages); |
118 CleanupClosePushL(storages); |
110 TMTPStorageMgrQueryParams params(KNullDesC, CMTPStorageMetaData::ESystemTypeDefaultFileSystem); |
119 TMTPStorageMgrQueryParams params(KNullDesC, CMTPStorageMetaData::ESystemTypeDefaultFileSystem); |
111 storageMgr.GetLogicalStoragesL(params, storages); |
120 storageMgr.GetLogicalStoragesL(params, storages); |
112 |
|
113 // Construct the StorageIDs list. |
121 // Construct the StorageIDs list. |
114 const TUint KCount(storages.Count()); |
122 const TUint KCount(storages.Count()); |
115 for (TUint i(0); (i < KCount); i++) |
123 for (TUint i(0); (i < KCount); i++) |
116 { |
124 { |
117 iStorages.Insert(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0); |
125 iStorages.Insert(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0); |
118 __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) )); |
119 } |
127 } |
120 CleanupStack::PopAndDestroy(&storages); |
128 CleanupStack::PopAndDestroy(&storages); |
121 } |
129 } |
122 else if (aStorageId != KMTPNotSpecified32) |
130 else if (aStorageId != KMTPNotSpecified32) |
123 { |
131 { |
124 __ASSERT_DEBUG(storageMgr.ValidStorageId(aStorageId), User::Invariant()); |
132 __ASSERT_DEBUG(storageMgr.ValidStorageId(aStorageId), User::Invariant()); |
125 const CMTPStorageMetaData& storage(storageMgr.StorageL(aStorageId)); |
133 const CMTPStorageMetaData& storage(storageMgr.StorageL(aStorageId)); |
126 if (storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem) |
134 if (storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem) |
127 { |
135 { |
128 if (storageMgr.LogicalStorageId(aStorageId)) |
136 if (storageMgr.LogicalStorageId(aStorageId)) |
129 { |
137 { |
130 // Logical StorageID. |
138 // Logical StorageID. |
131 iStorages.AppendL(aStorageId); |
139 iStorages.AppendL(aStorageId); |
132 } |
140 } |
133 else |
141 else |
134 { |
142 { |
135 // Physical StorageID. Enumerate all eligible logical storages. |
143 // Physical StorageID. Enumerate all eligible logical storages. |
136 const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds)); |
144 const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds)); |
137 const TUint KCountLogicalIds(logicalIds.Count()); |
145 const TUint KCountLogicalIds(logicalIds.Count()); |
138 for (TUint i(0); (i < KCountLogicalIds); i++) |
146 for (TUint i(0); (i < KCountLogicalIds); i++) |
139 { |
147 { |
140 iStorages.AppendL(logicalIds[i]); |
148 iStorages.AppendL(logicalIds[i]); |
141 } |
149 } |
142 } |
150 } |
143 } |
151 } |
144 } |
152 } |
145 |
153 |
146 iStorageId = aStorageId; |
154 iStorageId = aStorageId; |
147 iSkipCurrentStorage = EFalse; |
155 iSkipCurrentStorage = EFalse; |
148 |
156 |
149 if (iStorages.Count() > 0) |
157 if (iStorages.Count() > 0) |
150 { |
158 { |
151 TRAPD(err, ScanStorageL(iStorages[0])); |
159 iScanPos = 0; |
152 if(err != KErrNone) |
160 TRAPD(err, ScanStorageL(iStorages[iScanPos])); |
153 { |
161 if(err != KErrNone) |
154 if( !storageMgr.ValidStorageId(iStorages[0]) ) |
162 { |
155 { |
163 if( !storageMgr.ValidStorageId(iStorages[iScanPos]) ) |
156 //Scan storage leave because storage(memory card) removed. |
164 { |
157 //Scan next specified storage in RunL, if there is. |
165 //Scan storage leave because storage(memory card) removed. |
158 __FLOG_VA(_L8("StartL - iSkipCurrentStorage - ETrue.")); |
166 //Scan next specified storage in RunL, if there is. |
159 iSkipCurrentStorage = ETrue; |
167 __FLOG_VA(_L8("StartL - iSkipCurrentStorage - ETrue.")); |
160 TRequestStatus* status = &iStatus; |
168 iSkipCurrentStorage = ETrue; |
161 User::RequestComplete(status, iStatus.Int()); |
169 TRequestStatus* status = &iStatus; |
162 SetActive(); |
170 User::RequestComplete(status, iStatus.Int()); |
163 } |
171 SetActive(); |
164 else |
172 } |
165 { |
173 else |
166 User::Leave(err); |
174 { |
167 } |
175 User::Leave(err); |
168 } |
176 } |
169 } |
177 } |
170 else |
178 } |
171 { |
179 else |
172 if((!iIsFileEnumerator) &&(iNumOfFoldersAndFiles > KMAX_FILECOUNT_ENUMERATINGPHASE1)) |
180 { |
173 { |
181 iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); |
174 iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); |
182 TMTPTypeEvent event; |
175 } |
183 |
176 |
184 event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeUnreportedStatus); |
177 iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); |
185 event.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll); |
178 |
186 |
179 TMTPTypeEvent event; |
187 iFramework.SendEventL(event); |
180 |
188 } |
181 event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeUnreportedStatus); |
189 } |
182 event.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll); |
|
183 |
|
184 iFramework.SendEventL(event); |
|
185 } |
|
186 } |
|
187 |
190 |
188 /** |
191 /** |
189 Cancel the enumeration process |
192 Cancel the enumeration process |
190 */ |
193 */ |
191 void CMTPFSEnumerator::DoCancel() |
194 void CMTPFSEnumerator::DoCancel() |
192 { |
195 { |
193 iDir.Close(); |
196 iDir.Close(); |
194 } |
197 } |
195 |
198 |
196 void CMTPFSEnumerator::ScanStorageL(TUint32 aStorageId) |
199 void CMTPFSEnumerator::ScanStorageL(TUint32 aStorageId) |
197 { |
200 { |
198 __FLOG_VA(_L8("ScanStorageL - entry")); |
201 __FLOG_VA(_L8("ScanStorageL - entry")); |
199 const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(aStorageId)); |
202 const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(aStorageId)); |
200 __ASSERT_DEBUG((storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem), User::Invariant()); |
203 __ASSERT_DEBUG((storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem), User::Invariant()); |
201 TFileName root(storage.DesC(CMTPStorageMetaData::EStorageSuid)); |
204 TFileName root(storage.DesC(CMTPStorageMetaData::EStorageSuid)); |
202 |
205 |
203 #ifdef __FLOG_ACTIVE |
206 #ifdef __FLOG_ACTIVE |
204 TBuf8<KMaxFileName> tmp; |
207 TBuf8<KMaxFileName> tmp; |
205 tmp.Copy(root); |
208 tmp.Copy(root); |
206 __FLOG_VA((_L8("StorageSuid - %S"), &tmp)); |
209 __FLOG_VA((_L8("StorageSuid - %S"), &tmp)); |
207 #endif // __FLOG_ACTIVE |
210 #endif // __FLOG_ACTIVE |
208 |
211 |
209 if ( iExclusionMgr.IsFolderAcceptedL(root, aStorageId) ) |
212 if ( iExclusionMgr.IsFolderAcceptedL(root, aStorageId) ) |
210 { |
213 { |
211 iParentHandle = KMTPHandleNoParent; |
214 iParentHandle = KMTPHandleNoParent; |
212 iPath.Set(root, NULL, NULL); |
215 iCurrentPath = root; |
213 User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); |
216 User::LeaveIfError(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); |
214 ScanDirL(); |
217 ScanDirL(); |
215 } |
218 } |
216 else |
219 else |
217 { |
220 { |
218 TRequestStatus* status = &iStatus; |
221 TRequestStatus* status = &iStatus; |
219 User::RequestComplete(status, iStatus.Int()); |
222 User::RequestComplete(status, iStatus.Int()); |
220 SetActive(); |
223 SetActive(); |
221 } |
224 } |
222 __FLOG_VA(_L8("ScanStorageL - exit")); |
225 __FLOG_VA(_L8("ScanStorageL - exit")); |
223 } |
226 } |
224 |
227 |
225 /** |
228 /** |
226 Scans directory at aPath recursing into subdirectories on a depth first basis. |
229 Scans directory at aPath recursing into subdirectories on a depth first basis. |
227 |
230 |
228 Directory entries are kept in iDirStack - which is a LIFO stack. |
231 Directory entries are kept in iDirStack - which is a LIFO stack. |
250 SetActive(); |
253 SetActive(); |
251 __FLOG_VA(_L8("ScanDirL - exit")); |
254 __FLOG_VA(_L8("ScanDirL - exit")); |
252 } |
255 } |
253 |
256 |
254 void CMTPFSEnumerator::ScanNextStorageL() |
257 void CMTPFSEnumerator::ScanNextStorageL() |
255 { |
258 { |
256 __FLOG_VA(_L8("ScanNextStorageL - entry")); |
259 iDirStack.Reset(); |
257 // If there are one or more unscanned storages left |
260 __FLOG_VA(_L8("ScanNextStorageL - entry")); |
258 // (the currently scanned one is still on the list) |
261 // If there are one or more unscanned storages left |
259 if (iStorages.Count() > 1) |
262 // (the currently scanned one is still on the list) |
260 { |
263 if (++ iScanPos < iStorages.Count()) |
261 iStorages.Remove(0); |
264 { |
262 ScanStorageL(iStorages[0]); |
265 ScanStorageL(iStorages[iScanPos]); |
263 } |
266 } |
264 else |
267 else |
265 { |
268 { |
266 // We are done |
269 // We are done |
267 iStorages.Reset(); |
270 iScanPos = 0; |
268 if((!iIsFileEnumerator) &&(iNumOfFoldersAndFiles > KMAX_FILECOUNT_ENUMERATINGPHASE1)) |
271 |
269 { |
272 if(iScanAll) //all object scaned or first time limit reached. |
270 iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); |
273 { |
271 } |
274 iStorages.Reset(); |
272 iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); |
275 if(iObjectNeedToScan <= 0) |
273 |
276 { |
274 } |
277 iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); |
275 __FLOG_VA(_L8("ScanNextStorageL - exit")); |
278 } |
276 } |
279 iDir.Close(); |
|
280 iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); |
|
281 } |
|
282 iAllRootScaned = ETrue; |
|
283 if(!iScanAll) |
|
284 { |
|
285 if(iObjectNeedToScan > 0)//partial scan didn't finish means root didn't have KMAX_FILECOUNT_ENUMERATINGPHASE1 files |
|
286 { |
|
287 iScanAll = ETrue; |
|
288 iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE1; |
|
289 ScanStorageL(iStorages[iScanPos]); |
|
290 } |
|
291 else //root has more than KMAX_FILECOUNT_ENUMERATINGPHASE1 files |
|
292 { |
|
293 iDir.Close(); |
|
294 iStorages.Reset(); |
|
295 iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue); |
|
296 iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone); |
|
297 } |
|
298 } |
|
299 } |
|
300 __FLOG_VA(_L8("ScanNextStorageL - exit")); |
|
301 } |
277 |
302 |
278 void CMTPFSEnumerator::ScanNextSubdirL() |
303 void CMTPFSEnumerator::ScanNextSubdirL() |
279 { |
304 { |
280 __FLOG_VA(_L8("ScanNextSubdirL - entry")); |
305 __FLOG_VA(_L8("ScanNextSubdirL - entry")); |
281 // A empty (non-constructed) TEntry is our marker telling us to pop a directory |
306 // A empty (non-constructed) TEntry is our marker telling us to pop a directory |
282 // from iPath when we see this |
307 // from iPath when we see this |
283 iDirStack.AppendL(TEntry()); |
308 //iDirStack.AppendL(TEntry()); |
284 |
309 |
285 // Leave with KErrNotFound if we don't find the object handle since it shouldn't be on the |
310 // Leave with KErrNotFound if we don't find the object handle since it shouldn't be on the |
286 // dirstack if the entry wasn't added |
311 // dirstack if the entry wasn't added |
287 TPtrC suid = iPath.DriveAndPath().Left(iPath.DriveAndPath().Length()); |
312 //TPtrC suid = iPath.DriveAndPath().Left(iPath.DriveAndPath().Length()); |
288 // Update the current parentId with object of the directory |
313 // Update the current parentId with object of the directory |
289 iParentHandle = iFramework.ObjectMgr().HandleL(suid); |
314 iParentHandle = iDirStack[iDirStack.Count() - 1].iHandle;//iFramework.ObjectMgr().HandleL(suid); |
290 |
315 iCurrentPath = iDirStack[iDirStack.Count() - 1].iPath; |
|
316 iDirStack.Remove(iDirStack.Count() - 1); |
|
317 __FLOG_VA((_L8("ScanNextSubdirL path %S"), &iCurrentPath)); |
291 // Kick-off a scan of the next directory |
318 // Kick-off a scan of the next directory |
292 iDir.Close(); |
319 iDir.Close(); |
293 User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); |
320 User::LeaveIfError(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir)); |
294 ScanDirL(); |
321 ScanDirL(); |
295 __FLOG_VA(_L8("ScanNextSubdirL - exit")); |
322 __FLOG_VA(_L8("ScanNextSubdirL - exit")); |
296 } |
323 } |
297 |
324 |
298 /** |
325 /** |
432 { |
436 { |
433 iSingletons.OpenL(); |
437 iSingletons.OpenL(); |
434 iDpSingletons.OpenL(iFramework); |
438 iDpSingletons.OpenL(iFramework); |
435 iObject = CMTPObjectMetaData::NewL(); |
439 iObject = CMTPObjectMetaData::NewL(); |
436 iDpID = iFramework.DataProviderId(); |
440 iDpID = iFramework.DataProviderId(); |
437 iIsFileEnumerator = (KMTPFileDPID == iDpID); |
|
438 } |
441 } |
439 |
442 |
440 /** |
443 /** |
441 Iterates iEntries adding entries as needed to object manager and iDirStack. |
444 Iterates iEntries adding entries as needed to object manager and iDirStack. |
442 */ |
445 */ |
443 |
446 |
444 void CMTPFSEnumerator::ProcessEntriesL() |
447 void CMTPFSEnumerator::ProcessEntriesL() |
445 { |
448 { |
446 TBuf<KMTPMaxFullFileName> path = iPath.DriveAndPath(); |
449 // Start looping through entries at where we left off |
447 |
450 TInt count = iEntries.Count() - iFirstUnprocessed; |
448 // Start looping through entries at where we left off |
451 // Process no more than KProcessLimit entries |
449 TInt count = iEntries.Count() - iFirstUnprocessed; |
452 count = Min(count, iProcessLimit); |
450 // Process no more than KProcessLimit entries |
453 iFirstUnprocessed += count; |
451 count = Min(count, iProcessLimit); |
454 |
452 iFirstUnprocessed += count; |
455 for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i) |
453 |
456 { |
454 if(!iIsFileEnumerator) |
457 const TEntry& entry = iEntries[i]; |
455 { |
458 iCurrentPath.Append(entry.iName); |
456 iNumOfFoldersAndFiles +=count; |
459 __FLOG_VA((_L8("Process path %S name %S"), &iCurrentPath, &entry.iName)); |
457 } |
|
458 |
|
459 for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i) |
|
460 { |
|
461 const TEntry& entry = iEntries[i]; |
|
462 path.Append(entry.iName); |
|
463 |
|
464 #ifdef __FLOG_ACTIVE |
460 #ifdef __FLOG_ACTIVE |
465 TBuf8<KMTPMaxFullFileName> tmp; |
461 TBuf8<KMTPMaxFullFileName> tmp; |
466 tmp.Copy(path); |
462 tmp.Copy(iCurrentPath); |
467 TInt pathLen=path.Length(); |
463 TInt pathLen=iCurrentPath.Length(); |
468 if(pathLen > KLogBufferSize) |
464 if(pathLen > KLogBufferSize) |
469 { |
465 { |
470 TBuf8<KLogBufferSize> tmp1; |
466 TBuf8<KLogBufferSize> tmp1; |
471 tmp1.Copy(tmp.Ptr(),KLogBufferSize); |
467 tmp1.Copy(tmp.Ptr(),KLogBufferSize); |
472 __FLOG_VA(_L8("Entry - ")); |
468 __FLOG_VA(_L8("Entry - ")); |
473 __FLOG_VA((_L8("%S"), &tmp1)); |
469 __FLOG_VA((_L8("%S"), &tmp1)); |
474 |
470 |
475 tmp1.Copy(tmp.Ptr()+KLogBufferSize, pathLen-KLogBufferSize); |
471 tmp1.Copy(tmp.Ptr()+KLogBufferSize, pathLen-KLogBufferSize); |
476 __FLOG_VA((_L8("%S"), &tmp1)); |
472 __FLOG_VA((_L8("%S"), &tmp1)); |
477 } |
473 } |
478 else |
474 else |
479 { |
475 { |
480 __FLOG_VA(_L8("Entry - ")); |
476 __FLOG_VA(_L8("Entry - ")); |
481 __FLOG_VA((_L8("%S"), &tmp)); |
477 __FLOG_VA((_L8("%S"), &tmp)); |
482 } |
478 } |
483 #endif // __FLOG_ACTIVE |
479 #endif // __FLOG_ACTIVE |
484 |
480 |
485 TInt len = entry.iName.Length(); |
481 TInt len = entry.iName.Length(); |
486 TInt totalLen = path.Length(); |
482 TInt totalLen = iCurrentPath.Length(); |
487 if(totalLen > KMaxFileName) |
483 if(totalLen > KMaxFileName) |
488 { |
484 { |
489 // Remove filename part |
485 // Remove filename part |
490 path.SetLength(totalLen - len); |
486 iCurrentPath.SetLength(totalLen - len); |
491 __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored.")); |
487 __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored.")); |
492 continue; |
488 continue; |
493 } |
489 } |
494 TUint32 handle = 0; |
490 TUint32 handle = 0; |
495 TMTPFormatCode format; |
491 TMTPFormatCode format; |
496 TParsePtrC parse(path); |
492 if(-- iObjectNeedToScan <=0 && iAllRootScaned) |
497 if (entry.IsDir()) |
493 { |
498 { |
494 iSkipCurrentStorage = ETrue; |
499 if (iExclusionMgr.IsFolderAcceptedL(path, iStorages[0])) |
495 return; |
500 { |
496 } |
501 path.Append('\\'); |
497 if (entry.IsDir()) |
502 ++len; |
498 { |
503 format = EMTPFormatCodeAssociation; |
499 if (iExclusionMgr.IsFolderAcceptedL(iCurrentPath, iStorages[iScanPos])) |
504 AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle); |
500 { |
505 iDirStack.AppendL(entry); |
501 iCurrentPath.Append('\\'); |
506 } |
502 ++len; |
507 } |
503 format = EMTPFormatCodeAssociation; |
508 else if ( iExclusionMgr.IsFileAcceptedL(path,iStorages[0]) ) |
504 AddEntryL(iCurrentPath, handle, format, KMTPDeviceDPID, entry, iStorages[iScanPos], iParentHandle); |
509 { |
505 iDirStack.Append(TStackItem(iCurrentPath, handle)); |
510 format = EMTPFormatCodeUndefined; |
506 } |
511 AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle); |
507 } |
512 } |
508 else |
513 else if ( parse.ExtPresent() ) |
509 { |
514 { |
510 if ( iExclusionMgr.IsFileAcceptedL(iCurrentPath,iStorages[iScanPos]) ) |
515 switch(iDpSingletons.MTPUtility().GetEnumerationFlag(parse.Ext().Mid(1))) |
511 { |
516 { |
512 format = EMTPFormatCodeUndefined; |
517 case MISSED_FILES_OWNED_BY_FILE_DP: |
513 AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle); |
518 if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(path)) |
514 } |
|
515 else |
|
516 { |
|
517 TParsePtrC parse(iCurrentPath); |
|
518 if ( parse.ExtPresent() ) |
519 { |
519 { |
520 format = EMTPFormatCodeUndefined; |
520 switch(iDpSingletons.MTPUtility().GetEnumerationFlag(parse.Ext().Mid(1))) |
521 AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle); |
521 { |
|
522 case MISSED_FILES_OWNED_BY_FILE_DP: |
|
523 if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath)) |
|
524 { |
|
525 format = EMTPFormatCodeUndefined; |
|
526 AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle); |
|
527 } |
|
528 break; |
|
529 |
|
530 case MISSED_FILES_OWNED_BY_OTHER_DP: |
|
531 if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath)) |
|
532 { |
|
533 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
|
534 TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); |
|
535 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); |
|
536 } |
|
537 break; |
|
538 |
|
539 case FILES_OWNED_BY_OTHER_DP: |
|
540 { |
|
541 _LIT( KTxtExtensionODF, ".odf" ); |
|
542 TUint32 DpId = iFramework.DataProviderId(); |
|
543 if (parse.Ext().CompareF(KTxtExtensionODF)==0) |
|
544 { |
|
545 format = iDpSingletons.MTPUtility().FormatFromFilename(parse.Ext().Mid(1)); |
|
546 if ( EMTPFormatCode3GPContainer==format || EMTPFormatCodeMP4Container==format ) |
|
547 { |
|
548 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1),KNullDesC); |
|
549 if ( 255 == DpId ) |
|
550 { |
|
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 } |
|
562 else |
|
563 { |
|
564 format = EMTPFormatCodeUndefined; |
|
565 AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle); |
|
566 } |
|
567 } |
|
568 else |
|
569 { |
|
570 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
|
571 TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); |
|
572 AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); |
|
573 } |
|
574 } |
|
575 break; |
|
576 |
|
577 // case FILES_OWNED_BY_NONE: |
|
578 default: |
|
579 //nothing to do |
|
580 break; |
|
581 } |
522 } |
582 } |
523 break; |
583 } |
524 |
584 } |
525 case MISSED_FILES_OWNED_BY_OTHER_DP: |
585 // Remove filename part |
526 if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(path)) |
586 iCurrentPath.SetLength(iCurrentPath.Length() - len); |
527 { |
587 } |
528 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
588 |
529 TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); |
589 } |
530 AddFileEntryForOtherDpL(path, handle, format, DpId, entry, iStorages[0], iParentHandle); |
|
531 } |
|
532 break; |
|
533 |
|
534 case FILES_OWNED_BY_OTHER_DP: |
|
535 { |
|
536 format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); |
|
537 TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); |
|
538 AddFileEntryForOtherDpL(path, handle, format, DpId, entry, iStorages[0], iParentHandle); |
|
539 } |
|
540 break; |
|
541 |
|
542 // case FILES_OWNED_BY_NONE: |
|
543 default: |
|
544 //nothing to do |
|
545 break; |
|
546 } |
|
547 } |
|
548 // Remove filename part |
|
549 path.SetLength(path.Length() - len); |
|
550 } |
|
551 |
|
552 } |
|
553 |
590 |
554 /** |
591 /** |
555 Add a file entry to the object store |
592 Add a file entry to the object store |
556 @param aEntry The file Entry to be added |
593 @param aEntry The file Entry to be added |
557 @param aPath The full path name of the entry |
594 @param aPath The full path name of the entry |