39 |
39 |
40 // local declarations and functions |
40 // local declarations and functions |
41 namespace { |
41 namespace { |
42 |
42 |
43 _LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); |
43 _LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); |
|
44 _LIT(KIndexingDBPath,"indexing\\indexdb"); |
44 _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); |
45 _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); |
45 |
46 _LIT(KfileDBPath, "\\root\\file"); |
46 _LIT(KPathFolder, "\\root\\file\\folder"); |
47 _LIT(KPathFolder, "\\root\\file\\folder"); |
47 _LIT(KPathFileContent, "\\root\\file\\content"); |
48 _LIT(KPathFileContent, "\\root\\file\\content"); |
48 _LIT(KFileBaseAppClassContent, "root file content"); |
49 _LIT(KFileBaseAppClassContent, "root file content"); |
49 _LIT(KFileBaseAppClassFolder, "root file folder"); |
50 _LIT(KFileBaseAppClassFolder, "root file folder"); |
50 _LIT(KFilePluginAtSign, "@"); |
51 _LIT(KFilePluginAtSign, "@"); |
51 _LIT(KFilePluginColon, ":"); |
52 _LIT(KFilePluginColon, ":"); |
52 _LIT(KNameField, "Name"); |
53 _LIT(KNameField, "Name"); |
53 _LIT(KExtensionField, "Extension"); |
54 _LIT(KExtensionField, "Extension"); |
|
55 _LIT(KIsFolderField, "IsFolder"); |
54 _LIT(KMimeTypeFile, FILE_MIMETYPE); |
56 _LIT(KMimeTypeFile, FILE_MIMETYPE); |
55 _LIT(KMimeTypeFolder , FOLDER_MIMETYPE); |
57 _LIT(KMimeTypeFolder , FOLDER_MIMETYPE); |
56 _LIT(KMimeTypeField , CPIX_MIMETYPE_FIELD); |
58 _LIT(KMimeTypeField , CPIX_MIMETYPE_FIELD); |
57 |
59 |
58 #define CONSTANT_TO_PTR16(ptr, c) TPtrC16 ptr; ptr.Set((const TUint16*)c,User::StringLength(c) ); |
60 #define CONSTANT_TO_PTR16(ptr, c) TPtrC16 ptr; ptr.Set((const TUint16*)c,User::StringLength(c) ); |
271 OstTraceFunctionEntry0( CFILEPLUGIN_MOUNTL_ENTRY ); |
273 OstTraceFunctionEntry0( CFILEPLUGIN_MOUNTL_ENTRY ); |
272 CPIXLOGSTRING("ENTER CFilePlugin::MountL"); |
274 CPIXLOGSTRING("ENTER CFilePlugin::MountL"); |
273 // Check if already exists |
275 // Check if already exists |
274 if (iIndexer[aMedia] && iFolderIndexer[aMedia]) |
276 if (iIndexer[aMedia] && iFolderIndexer[aMedia]) |
275 return; |
277 return; |
276 |
278 //remove the database incase of memory card insertion before harvesting |
|
279 if (aForceReharvest) |
|
280 { |
|
281 RemoveFileDatabaseL(aMedia); |
|
282 } |
|
283 |
277 // Add Notifications paths prior to opening IndexDB. |
284 // Add Notifications paths prior to opening IndexDB. |
278 AddNotificationPathsL(aMedia); |
285 AddNotificationPathsL(aMedia); |
279 |
286 |
280 // Form the baseappclass for folder |
287 // Form the baseappclass for folder |
281 TBuf<KFilePluginBaseAppClassMaxLen> baseFolderAppClass; |
288 TBuf<KFilePluginBaseAppClassMaxLen> baseFolderAppClass; |
647 } |
654 } |
648 else |
655 else |
649 { |
656 { |
650 index_item->AddFieldL(KExtensionField, KNullDesC); |
657 index_item->AddFieldL(KExtensionField, KNullDesC); |
651 index_item->AddFieldL(KMimeTypeField, KMimeTypeFolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); |
658 index_item->AddFieldL(KMimeTypeField, KMimeTypeFolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); |
652 } |
659 } |
653 |
660 TBuf<2> Isfolder; |
|
661 Isfolder.AppendNum(aIsDir); |
|
662 index_item->AddFieldL(KIsFolderField, Isfolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); |
654 //Only content to be added to exceprt field. See appclass-hierarchy.txt |
663 //Only content to be added to exceprt field. See appclass-hierarchy.txt |
655 //Add excerpt field |
664 //Add excerpt field |
656 //index_item->AddExcerptL(aFilePath); |
665 //index_item->AddExcerptL(aFilePath); |
657 |
666 |
658 CleanupStack::Pop(index_item); |
667 CleanupStack::Pop(index_item); |
659 return index_item; |
668 return index_item; |
|
669 } |
|
670 |
|
671 void CFilePlugin::RemoveFileDatabaseL(TDriveNumber aDrive) |
|
672 { |
|
673 RFs aFs; |
|
674 User::LeaveIfError( aFs.Connect() ); |
|
675 TChar drive; |
|
676 TInt err = aFs.DriveToChar((TDriveNumber)aDrive,drive); |
|
677 if ( err == KErrNone ) |
|
678 { |
|
679 TBuf<KMaxFileName> folderpath; |
|
680 folderpath.Append(drive); |
|
681 folderpath.Append(KFilePluginColon); |
|
682 folderpath.Append(KCPixSearchServerPrivateDirectory); |
|
683 folderpath.Append(KIndexingDBPath); |
|
684 folderpath.Append(KfileDBPath); |
|
685 CFileMan* FileMan = CFileMan::NewL(aFs); |
|
686 if ( FileMan ) |
|
687 FileMan->Delete( folderpath ); |
|
688 delete FileMan; |
|
689 } |
|
690 aFs.Close(); |
660 } |
691 } |
661 |
692 |
662 #ifdef __PERFORMANCE_DATA |
693 #ifdef __PERFORMANCE_DATA |
663 void CFilePlugin::UpdatePerformaceDataL(TDriveNumber aDriveNumber) |
694 void CFilePlugin::UpdatePerformaceDataL(TDriveNumber aDriveNumber) |
664 { |
695 { |