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"); |
|
45 _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); |
44 _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); |
46 _LIT(KfileDBPath, "\\root\\file"); |
|
47 _LIT(KPathFolder, "\\root\\file\\folder"); |
45 _LIT(KPathFolder, "\\root\\file\\folder"); |
48 _LIT(KPathFileContent, "\\root\\file\\content"); |
46 _LIT(KPathFileContent, "\\root\\file\\content"); |
49 _LIT(KFileBaseAppClassContent, "root file content"); |
47 _LIT(KFileBaseAppClassContent, "root file content"); |
50 _LIT(KFileBaseAppClassFolder, "root file folder"); |
48 _LIT(KFileBaseAppClassFolder, "root file folder"); |
51 _LIT(KFilePluginAtSign, "@"); |
49 _LIT(KFilePluginAtSign, "@"); |
219 iMmcMonitor = CMMCMonitor::NewL(*this, &iFs); |
217 iMmcMonitor = CMMCMonitor::NewL(*this, &iFs); |
220 } |
218 } |
221 |
219 |
222 void CFilePlugin::StartPluginL() |
220 void CFilePlugin::StartPluginL() |
223 { |
221 { |
224 TInt error = KErrNone; |
222 TInt error = KErrNone; |
225 |
223 error = iMonitor->Initialize(); |
226 if (!iIsMonitorInit) |
224 OstTrace1( TRACE_NORMAL, CFILEPLUGIN_STARTPLUGINL, "CFilePlugin::StartPluginL;Monitor Error=%d", error ); |
227 { |
225 CPIXLOGSTRING2("CFilePlugin::StartMonitoring, error: %i", error ); |
228 error = iMonitor->Initialize(); |
|
229 OstTrace1( TRACE_NORMAL, CFILEPLUGIN_STARTPLUGINL, "CFilePlugin::StartPluginL;Monitor Error=%d", error ); |
|
230 CPIXLOGSTRING2("CFilePlugin::StartMonitoring, error: %i", error ); |
|
231 iIsMonitorInit = ETrue; |
|
232 } |
|
233 |
226 |
234 // Start the monitoring |
227 // Start the monitoring |
235 if (error == KErrNone && iIsMonitorInit) |
228 if (error == KErrNone ) |
236 { |
229 { |
237 iMonitor->StartMonitoring(); |
230 iMonitor->StartMonitoring(); |
238 OstTrace0( TRACE_NORMAL, DUP1_CFILEPLUGIN_STARTPLUGINL, "CFilePlugin::StartMonitoring - iFileMonitor->StartMonitoring " ); |
231 OstTrace0( TRACE_NORMAL, DUP1_CFILEPLUGIN_STARTPLUGINL, "CFilePlugin::StartMonitoring - iFileMonitor->StartMonitoring " ); |
239 CPIXLOGSTRING("CFilePlugin::StartMonitoring - iFileMonitor->StartMonitoring "); |
232 CPIXLOGSTRING("CFilePlugin::StartMonitoring - iFileMonitor->StartMonitoring "); |
240 } |
233 } |
273 OstTraceFunctionEntry0( CFILEPLUGIN_MOUNTL_ENTRY ); |
266 OstTraceFunctionEntry0( CFILEPLUGIN_MOUNTL_ENTRY ); |
274 CPIXLOGSTRING("ENTER CFilePlugin::MountL"); |
267 CPIXLOGSTRING("ENTER CFilePlugin::MountL"); |
275 // Check if already exists |
268 // Check if already exists |
276 if (iIndexer[aMedia] && iFolderIndexer[aMedia]) |
269 if (iIndexer[aMedia] && iFolderIndexer[aMedia]) |
277 return; |
270 return; |
278 //remove the database incase of memory card insertion before harvesting |
|
279 if (aForceReharvest) |
|
280 { |
|
281 RemoveFileDatabaseL(aMedia); |
|
282 } |
|
283 |
271 |
284 // Add Notifications paths prior to opening IndexDB. |
272 // Add Notifications paths prior to opening IndexDB. |
285 AddNotificationPathsL(aMedia); |
273 AddNotificationPathsL(aMedia); |
286 |
274 |
287 // Form the baseappclass for folder |
275 // Form the baseappclass for folder |
660 TBuf<2> Isfolder; |
648 TBuf<2> Isfolder; |
661 Isfolder.AppendNum(aIsDir); |
649 Isfolder.AppendNum(aIsDir); |
662 index_item->AddFieldL(KIsFolderField, Isfolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); |
650 index_item->AddFieldL(KIsFolderField, Isfolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); |
663 //Only content to be added to exceprt field. See appclass-hierarchy.txt |
651 //Only content to be added to exceprt field. See appclass-hierarchy.txt |
664 //Add excerpt field |
652 //Add excerpt field |
665 //index_item->AddExcerptL(aFilePath); |
653 index_item->AddExcerptL(aFilePath); |
666 |
654 |
667 CleanupStack::Pop(index_item); |
655 CleanupStack::Pop(index_item); |
668 return index_item; |
656 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(); |
|
691 } |
657 } |
692 |
658 |
693 #ifdef __PERFORMANCE_DATA |
659 #ifdef __PERFORMANCE_DATA |
694 void CFilePlugin::UpdatePerformaceDataL(TDriveNumber aDriveNumber) |
660 void CFilePlugin::UpdatePerformaceDataL(TDriveNumber aDriveNumber) |
695 { |
661 { |