--- a/harvesterplugins/file/src/cfileharvester.cpp Mon Apr 19 14:40:05 2010 +0300
+++ b/harvesterplugins/file/src/cfileharvester.cpp Mon May 03 12:32:15 2010 +0300
@@ -24,6 +24,11 @@
// For Logging
#include "harvesterserverlogger.h"
#include "cfileharvester.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cfileharvesterTraces.h"
+#endif
+
// CONSTANTS
_LIT( KFileMask, "*.*" );
@@ -67,9 +72,11 @@
iFilePlugin( aFilePlugin ),
iFs( aFs )
{
+ OstTraceFunctionEntry0( CFILEHARVESTER_CFILEHARVESTER_ENTRY );
CPIXLOGSTRING("ENTER CFileHarvester::CFileHarvester");
CActiveScheduler::Add( this );
CPIXLOGSTRING("END CFileHarvester::CFileHarvester");
+ OstTraceFunctionExit0( CFILEHARVESTER_CFILEHARVESTER_EXIT );
}
@@ -89,6 +96,7 @@
//
void CFileHarvester::StartL( const TDriveNumber aDriveNumber )
{
+ OstTraceFunctionEntry0( CFILEHARVESTER_STARTL_ENTRY );
CPIXLOGSTRING("ENTER CFileHarvester::Start");
TFileName rootPath;
@@ -100,6 +108,7 @@
iCurrentHarvestDrive = aDriveNumber;
SetNextRequest( EHarvesterStartHarvest );
CPIXLOGSTRING("END CFileHarvester::Start");
+ OstTraceFunctionExit0( CFILEHARVESTER_STARTL_EXIT );
}
@@ -116,6 +125,7 @@
ignorePath.Append( chr );
ignorePath.Append( KExcludePathSystem );
AddIgnorePathL( ignorePath );
+ OstTraceExt1( TRACE_NORMAL, CFILEHARVESTER_ADDIGNOREPATHSL, "CFileHarvester::AddIgnorePathsL;AddIgnorePath=%S", ignorePath );
CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath );
ignorePath.Zero();
@@ -125,6 +135,7 @@
ignorePath.Append( chr );
ignorePath.Append( KExcludePathPrivate );
AddIgnorePathL( ignorePath );
+ OstTraceExt1( TRACE_NORMAL, DUP1_CFILEHARVESTER_ADDIGNOREPATHSL, "CFileHarvester::AddIgnorePathsL;AddIgnorePath=%S", ignorePath );
CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath );
ignorePath.Zero();
@@ -133,6 +144,7 @@
ignorePath.Append( chr );
ignorePath.Append( KExcludePathMapsCities );
AddIgnorePathL( ignorePath );
+ OstTraceExt1( TRACE_NORMAL, DUP2_CFILEHARVESTER_ADDIGNOREPATHSL, "CFileHarvester::AddIgnorePathsL;AddIgnorePath=%S", ignorePath );
CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath );
}
@@ -150,6 +162,7 @@
ignorePath.Append( chr );
ignorePath.Append( KExcludePathSystem );
RemoveIgnorePath( ignorePath );
+ OstTraceExt1( TRACE_NORMAL, CFILEHARVESTER_REMOVEIGNOREPATHS, "CFileHarvester::RemoveIgnorePaths;RemoveIgnorePath=%S", ignorePath );
CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath );
ignorePath.Zero();
@@ -159,6 +172,7 @@
ignorePath.Append( chr );
ignorePath.Append( KExcludePathPrivate );
RemoveIgnorePath( ignorePath );
+ OstTraceExt1( TRACE_NORMAL, DUP1_CFILEHARVESTER_REMOVEIGNOREPATHS, "CFileHarvester::RemoveIgnorePaths;RemoveIgnorePath=%S", ignorePath );
CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath );
ignorePath.Zero();
@@ -167,6 +181,7 @@
ignorePath.Append( chr );
ignorePath.Append( KExcludePathMapsCities );
RemoveIgnorePath( ignorePath );
+ OstTraceExt1( TRACE_NORMAL, DUP2_CFILEHARVESTER_REMOVEIGNOREPATHS, "CFileHarvester::RemoveIgnorePaths;RemoveIgnorePath=%S", ignorePath );
CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath );
}
@@ -232,6 +247,7 @@
TFileName* tf = iIgnorePaths[i];
if ( tf->Compare(aIgnorePath) == 0 )
{
+ OstTraceExt1( TRACE_NORMAL, CFILEHARVESTER_REMOVEIGNOREPATH, "CFileHarvester::RemoveIgnorePath;remove path=%S", aIgnorePath );
CPIXLOGSTRING2( "CFileHarvester::RemoveIgnorePath() - remove path: %S", &aIgnorePath );
delete tf;
tf = NULL;
@@ -269,6 +285,7 @@
tempFileName.LowerCase();
if ( tempFileName.Find(*pathName) != KErrNotFound )
{
+ OstTrace0( TRACE_NORMAL, CFILEHARVESTER_CHECKPATH, "CFileHarvester::CheckPath() - is ignore path" );
CPIXLOGSTRING( "CFileHarvester::CheckPath() - is ignore path" );
return EFalse;
}
@@ -284,6 +301,7 @@
//
void CFileHarvester::GetNextFolderL()
{
+ OstTraceFunctionEntry0( CFILEHARVESTER_GETNEXTFOLDERL_ENTRY );
CPIXLOGSTRING("ENTER CFileHarvester::GetNextFolderL");
delete iDir;
@@ -297,21 +315,25 @@
// if folder is in ignore path then skip it
if ( !CheckPath( iDirscan->FullPath() ) )
{
+ OstTrace0( TRACE_NORMAL, CFILEHARVESTER_GETNEXTFOLDERL, "CFileHarvester::GetNextFolderL - IF EHarvesterStartHarvest" );
CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterStartHarvest");
SetNextRequest( EHarvesterStartHarvest );
}
else
{
+ OstTrace0( TRACE_NORMAL, DUP1_CFILEHARVESTER_GETNEXTFOLDERL, "CFileHarvester::GetNextFolderL - IF EHarvesterGetFileId" );
CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterGetFileId");
SetNextRequest( EHarvesterGetFileId );
}
}
else
{
+ OstTrace0( TRACE_NORMAL, DUP2_CFILEHARVESTER_GETNEXTFOLDERL, "CFileHarvester::GetNextFolderL - IF EHarvesterIdle" );
CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterIdle");
SetNextRequest( EHarvesterIdleState );
}
CPIXLOGSTRING("END CFileHarvester::GetNextFolderL");
+ OstTraceFunctionExit0( CFILEHARVESTER_GETNEXTFOLDERL_EXIT );
}
@@ -322,6 +344,7 @@
//
void CFileHarvester::GetFileIdL()
{
+ OstTraceFunctionEntry0( CFILEHARVESTER_GETFILEIDL_ENTRY );
CPIXLOGSTRING("ENTER CFileHarvester::GetFileId");
if( iCurrentIndex == 0 )
@@ -346,11 +369,21 @@
TEntry aEntry = (*iDir)[iCurrentIndex];
// Check if entry is a hidden or system file
// if true -> continue until find something to index or have checked whole directory
- if( !aEntry.IsHidden() && !aEntry.IsSystem() && !aEntry.IsDir() )
+ // if the entry is a file, index both its filename and contents, for folder index the
+ // folder name
+ if( !aEntry.IsHidden() && !aEntry.IsSystem())
{
TParse fileParser;
fileParser.Set( iDirscan->FullPath(), &(*iDir)[iCurrentIndex].iName, NULL );
- iFilePlugin.CreateFileIndexItemL(fileParser.FullName(), ECPixAddAction);
+ if(aEntry.IsDir())
+ {
+ iFilePlugin.CreateFolderFileIndexItemL(fileParser.FullName(), ECPixAddAction);
+ }
+ else
+ {
+ iFilePlugin.CreateContentIndexItemL(fileParser.FullName(), ECPixAddAction);
+ iFilePlugin.CreateFolderFileIndexItemL(fileParser.FullName(), ECPixAddAction, false);
+ }
// TODO: If this is not TRAPPED, state machine breaks
iStepNumber++;
}
@@ -374,6 +407,7 @@
SetNextRequest( EHarvesterStartHarvest );
}
CPIXLOGSTRING("END CFileHarvester::GetFileId");
+ OstTraceFunctionExit0( CFILEHARVESTER_GETFILEIDL_EXIT );
}
@@ -383,6 +417,7 @@
//
void CFileHarvester::DoCancel()
{
+ OstTrace0( TRACE_NORMAL, CFILEHARVESTER_DOCANCEL, "CFileHarvester::DoCancel" );
CPIXLOGSTRING("CFileHarvester::DoCancel");
}
@@ -393,6 +428,7 @@
//
void CFileHarvester::RunL()
{
+ OstTraceFunctionEntry0( CFILEHARVESTER_RUNL_ENTRY );
CPIXLOGSTRING("ENTER CFileHarvester::RunL");
// Simple Round-Robin scheduling.
Deque();
@@ -422,6 +458,7 @@
break;
}
CPIXLOGSTRING("END CFileHarvester::RunL");
+ OstTraceFunctionExit0( CFILEHARVESTER_RUNL_EXIT );
}
@@ -431,6 +468,7 @@
//
TInt CFileHarvester::RunError(TInt aError)
{
+ OstTrace1( TRACE_NORMAL, CFILEHARVESTER_RUNERROR, "CFileHarvester::RunError;aError=%d", aError );
CPIXLOGSTRING2("CFileHarvester::RunError - aError: %d", aError );
iHarvestState = EHarvesterIdleState;
iFilePlugin.HarvestingCompleted(iCurrentHarvestDrive, aError);
@@ -444,6 +482,7 @@
//
void CFileHarvester::SetNextRequest( TFileHarvesterState aState )
{
+ OstTrace0( TRACE_NORMAL, CFILEHARVESTER_SETNEXTREQUEST, "CFileHarvester::SetNextRequest" );
CPIXLOGSTRING("CFileHarvester::SetNextRequest");
if ( !IsActive() )
{