harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp
changeset 20 6dfc5f825351
parent 1 acef663c1218
child 21 50bf9db68373
--- a/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp	Fri Mar 19 09:38:01 2010 +0200
@@ -37,7 +37,7 @@
 const TUid KRepositoryUid = { 0x20007182 };
 const TUint32 KCacheSizeKey = 0x00000001;
 
-const TInt KMaxEventsAtTime = 20;
+const TInt KMaxEventsAtTime = 25;
 const TInt KMaxEventsGranularity = 20;
 
 // ---------------------------------------------------------------------------
@@ -101,9 +101,6 @@
     
     Cancel();
     
-    iIgnoreList.ResetAndDestroy();
-    iIgnoreList.Close();
-    
     iFs.Close();
     
     delete iMapper;
@@ -111,6 +108,8 @@
     delete iFolderRenamer;
     
     delete iEventArray;
+    
+    iQueue.ResetAndDestroy();
     iUriArray.Close();
     }
 
@@ -128,6 +127,9 @@
     	{
     	case ( ERequestIdle ):
     		{
+    	    iQueue.Compress();
+    	    iEventArray->Compress();
+    	    iUriArray.Compress();
         	break;
     		}
     	
@@ -218,33 +220,26 @@
     TOrigin origin = MdeConstants::Object::EOther;
     if ( iMapper )
         {
-        TRAPD( originErr, origin = iMapper->OriginL( status.iProcessId ) );
-        if( originErr == KErrNone )
-        	{
-        	if ( origin == KOriginIgnored )
-                {
-                WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored origin for %S", &status.iFileName );
-                return;
-                }
-        	else if( origin == KOriginFastHarvest )
-        	    {
-        	    WRITELOG( "CFileEventHandlerAO::HandleNotificationL - potential fast harvest file detected" );
-        	    fastHarvest = ETrue;
-        	    }
+        origin = iMapper->OriginL( status.iProcessId );
+        if ( origin == KOriginIgnored )
+            {
+            WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored origin for %S", &status.iFileName );
+            return;
+            }
+        else if( origin == KOriginFastHarvest )
+            {
+            WRITELOG( "CFileEventHandlerAO::HandleNotificationL - potential fast harvest file detected" );
+            fastHarvest = ETrue;
+            }
     
-            _LIT(KCameraTemp,"camcordertmp");
-        	if ( origin == MdeConstants::Object::ECamera &&
-        			(aEvent.iFileEventType == EMdsFileCreated || 
-					aEvent.iFileName.FindF(KCameraTemp) != KErrNotFound) )        		
-                {
-                WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName );
-                return;
-                }
-        	}
-        else
-        	{
-        	origin = MdeConstants::Object::EOther;
-        	}
+        _LIT(KCameraTemp,"camcordertmp");
+        if ( origin == MdeConstants::Object::ECamera &&
+        		(aEvent.iFileEventType == EMdsFileCreated || 
+				aEvent.iFileName.FindF(KCameraTemp) != KErrNotFound) )        		
+            {
+            WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName );
+            return;
+            }
         }
 
     // ignore created file event if extension is not supported by any harverter plugin
@@ -307,8 +302,10 @@
             	RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
             	CleanupStack::PopAndDestroy( hd );
             	}
-
-            DeleteFromMDEL( status.iFileName );
+            else
+                {
+                DeleteFromMDEL( status.iFileName );
+                }
             }
         break;
 
@@ -349,14 +346,12 @@
         TOrigin origin = MdeConstants::Object::EOther;
         if ( iMapper )
             {
-            TRAPD( originErr, origin = iMapper->OriginL( status.iProcessId ) );
-            if( originErr == KErrNone )
+            origin = iMapper->OriginL( status.iProcessId );
+            // Used only for delete events so fast harvest origin is not used
+            if ( origin == KOriginIgnored )
                 {
-                if ( origin == KOriginIgnored )
-                    {
-                    WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - ignored origin for %S", &status.iFileName );
-                    continue;
-                    }
+                WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - ignored origin for %S", &status.iFileName );
+                continue;
                 }
             }
         
@@ -369,7 +364,10 @@
             RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
             CleanupStack::PopAndDestroy( hd );
             }
-        iUriArray.Append( &(status.iFileName) );
+        else
+            {
+            iUriArray.Append( &(status.iFileName) );
+            }
         }
     MultiDeleteFromMDEL( iUriArray );
     }
@@ -803,29 +801,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CFileEventHandlerAO::SetIgnoreListL()
-// ---------------------------------------------------------------------------
-//
-void CFileEventHandlerAO::SetIgnoreListL( RPointerArray<TDesC>& aList )
-    {
-    WRITELOG( "CFileEventHandlerAO::SetIgnoreListL" );
-    
-    iIgnoreList.ResetAndDestroy();
-    
-    const TInt count( aList.Count() );
-    for ( TInt i = count; --i >= 0; )
-        {
-        TDesC* listPath = aList[i];
-        
-        HBufC* name = listPath->AllocLC();
-
-        iIgnoreList.AppendL( name );
-        
-        CleanupStack::Pop( name );
-        }
-    }
-
-// ---------------------------------------------------------------------------
 // CFileEventHandlerAO::Mapper()
 // Returns a handle to CProcessOriginMapper.
 // ---------------------------------------------------------------------------