harvesterplugins/file/src/cfilemonitor.cpp
changeset 26 367228f82b66
parent 2 208a4ba3894c
equal deleted inserted replaced
24:1abfa342db42 26:367228f82b66
   135 			{
   135 			{
   136 			OstTraceExt1( TRACE_NORMAL, DUP4_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileCreated old=%S", fileNameOld );
   136 			OstTraceExt1( TRACE_NORMAL, DUP4_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileCreated old=%S", fileNameOld );
   137 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated old = %S", &fileNameOld);
   137 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated old = %S", &fileNameOld);
   138 			OstTraceExt1( TRACE_NORMAL, DUP2_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileCreated new=%S", fileNameNew );
   138 			OstTraceExt1( TRACE_NORMAL, DUP2_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileCreated new=%S", fileNameNew );
   139 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated new = %S", &fileNameNew);
   139 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated new = %S", &fileNameNew);
   140             // File creation (for example over PC suite) gives fileNameOld as the created files, fileNameOld is empty.			
   140             // File creation (for example over PC suite) gives fileNameOld as the created files, fileNameOld is empty.
   141             iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixAddAction);
   141 			if(iFilePlugin.GetHarvesterState())
   142             iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixAddAction, false);
   142 			    {
       
   143 			    iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixAddAction);
       
   144 			    iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixAddAction, EFalse);
       
   145 			    }
       
   146 			else
       
   147 			    {
       
   148 			    iFilePlugin.AddToQueueL(fileNameOld, ECPixAddAction, EFalse);
       
   149 			    }
   143 			}
   150 			}
   144 		break;
   151 		break;
   145 		
   152 		
   146 		case EFastFindFileModified:
   153 		case EFastFindFileModified:
   147 			{
   154 			{
   158 			OstTraceExt1( TRACE_NORMAL, DUP3_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileModified old=%S", fileNameOld );
   165 			OstTraceExt1( TRACE_NORMAL, DUP3_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileModified old=%S", fileNameOld );
   159 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified old = %S", &fileNameOld);
   166 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified old = %S", &fileNameOld);
   160 			OstTraceExt1( TRACE_NORMAL, DUP5_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileModified new=%S", fileNameNew );
   167 			OstTraceExt1( TRACE_NORMAL, DUP5_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileModified new=%S", fileNameNew );
   161 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified new = %S", &fileNameNew);
   168 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified new = %S", &fileNameNew);
   162 			// File copy, fileNameOld contains the file name, fileNameNew is empty
   169 			// File copy, fileNameOld contains the file name, fileNameNew is empty
   163 			iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixUpdateAction);
   170 			if(iFilePlugin.GetHarvesterState())
   164 			iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixUpdateAction, false);
   171 			    {
       
   172 			    iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixUpdateAction);
       
   173 			    iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixUpdateAction, EFalse);
       
   174 			    }
       
   175 			else
       
   176 			    {
       
   177                 iFilePlugin.AddToQueueL(fileNameOld, ECPixUpdateAction, EFalse);
       
   178                 }			    
   165 			}
   179 			}
   166 		break;
   180 		break;
   167 		
   181 		
   168 		case EFastFindFileRenamed:
   182 		case EFastFindFileRenamed:
   169 			{
   183 			{
   176 				{
   190 				{
   177 				if ( !entry.IsDir() )
   191 				if ( !entry.IsDir() )
   178 					{
   192 					{
   179 					if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0)
   193 					if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0)
   180 						{
   194 						{
   181 						iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction);
   195 					    if (iFilePlugin.GetHarvesterState())
   182 						iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, false);
   196 					        {
       
   197 					        iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction);
       
   198 					        iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, EFalse);
       
   199 					        }
       
   200 					    else
       
   201 					        iFilePlugin.AddToQueueL(fileNameOld, ECPixRemoveAction, EFalse);
   183 						}
   202 						}
   184 					iFilePlugin.CreateContentIndexItemL(fileNameNew, ECPixUpdateAction);
   203 					if( iFilePlugin.GetHarvesterState())
   185 					iFilePlugin.CreateFolderFileIndexItemL(fileNameNew, ECPixUpdateAction, false);
   204 					    {
       
   205 					    iFilePlugin.CreateContentIndexItemL(fileNameNew, ECPixUpdateAction);
       
   206 					    iFilePlugin.CreateFolderFileIndexItemL(fileNameNew, ECPixUpdateAction, EFalse);
       
   207 					    }
       
   208 					else
       
   209 					    iFilePlugin.AddToQueueL(fileNameNew, ECPixUpdateAction, EFalse);
   186 					}
   210 					}
   187 				else
   211 				else
   188 					{
   212 					{
   189 					iFolderRenamedHarvester->StartL(fileNameOld, fileNameNew);
   213 					iFolderRenamedHarvester->StartL(fileNameOld, fileNameNew);
   190 					}
   214 					}
   199 			OstTraceExt1( TRACE_NORMAL, DUP9_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileReplaced new=%S", fileNameNew );
   223 			OstTraceExt1( TRACE_NORMAL, DUP9_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileReplaced new=%S", fileNameNew );
   200 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileReplaced new = %S", &fileNameNew);
   224 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileReplaced new = %S", &fileNameNew);
   201 			// File rename (funnily), fileNameOld contains the old file name, fileNameNew the new name
   225 			// File rename (funnily), fileNameOld contains the old file name, fileNameNew the new name
   202 			if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0)
   226 			if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0)
   203 			    {
   227 			    {
   204 				iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction);
   228 			    if( iFilePlugin.GetHarvesterState() )
   205 				iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, false);
   229 			        {
   206 			    }
   230 			        iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction);
   207 			iFilePlugin.CreateContentIndexItemL(fileNameNew, ECPixUpdateAction);
   231 			        iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, EFalse);
   208 			iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixUpdateAction, false);
   232 			        }
       
   233 			    else
       
   234 			        iFilePlugin.AddToQueueL(fileNameOld, ECPixRemoveAction, EFalse);
       
   235 			    }
       
   236 			if( iFilePlugin.GetHarvesterState() )
       
   237 			    {
       
   238 			    iFilePlugin.CreateContentIndexItemL(fileNameNew, ECPixUpdateAction);
       
   239 			    iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixUpdateAction, EFalse);
       
   240 			    }
       
   241 			else
       
   242 			    iFilePlugin.AddToQueueL(fileNameOld, ECPixUpdateAction, EFalse);
   209 			}
   243 			}
   210 		break;
   244 		break;
   211 				
   245 				
   212 		case EFastFindFileDeleted:
   246 		case EFastFindFileDeleted:
   213 			{
   247 			{
   214 			OstTraceExt1( TRACE_NORMAL, DUP10_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileDeleted old=%S", fileNameOld );
   248 			OstTraceExt1( TRACE_NORMAL, DUP10_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileDeleted old=%S", fileNameOld );
   215 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted old = %S", &fileNameOld);
   249 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted old = %S", &fileNameOld);
   216 			OstTraceExt1( TRACE_NORMAL, DUP11_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileDeleted new=%S", fileNameNew );
   250 			OstTraceExt1( TRACE_NORMAL, DUP11_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileDeleted new=%S", fileNameNew );
   217 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted new = %S", &fileNameNew);
   251 			CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted new = %S", &fileNameNew);
   218 			// File delete, fileNameOld contains the name of the deleted file
   252 			// File delete, fileNameOld contains the name of the deleted file
   219 			iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction);
   253 			if( iFilePlugin.GetHarvesterState() )
   220 			iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, false);
   254 			    {
       
   255 			    iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction);
       
   256 			    iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, EFalse);
       
   257 			    }
       
   258 			else
       
   259 			    iFilePlugin.AddToQueueL(fileNameOld, ECPixRemoveAction, EFalse);
   221 			}
   260 			}
   222 		break;
   261 		break;
   223 		
   262 		
   224 		case EFastFindDirCreated:
   263 		case EFastFindDirCreated:
   225             {
   264             {
   226             iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixAddAction);
   265             if (iFilePlugin.GetHarvesterState())
       
   266                 iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixAddAction);
       
   267             else
       
   268                 iFilePlugin.AddToQueueL(fileNameOld, ECPixAddAction, ETrue);
   227             }
   269             }
   228             break;
   270             break;
   229 
   271 
   230 		case EFastFindDirDeleted:
   272 		case EFastFindDirDeleted:
   231             {
   273             {
   232             iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction);
   274             if(iFilePlugin.GetHarvesterState())
       
   275                 iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction);
       
   276             else
       
   277                 iFilePlugin.AddToQueueL(fileNameOld, ECPixRemoveAction, ETrue);
   233             }
   278             }
   234             break;
   279             break;
   235 		default:
   280 		default:
   236 			{
   281 			{
   237 			OstTraceExt1( TRACE_NORMAL, DUP12_CFILEMONITOR_RUNL, "CFileMonitor::RunL;unknown event old=%S", fileNameOld );
   282 			OstTraceExt1( TRACE_NORMAL, DUP12_CFILEMONITOR_RUNL, "CFileMonitor::RunL;unknown event old=%S", fileNameOld );