harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp
branchRCL_3
changeset 3 6752808b2036
parent 1 acef663c1218
child 6 646a02f170b9
equal deleted inserted replaced
2:b73a2e62868f 3:6752808b2036
    35 using namespace MdeConstants;
    35 using namespace MdeConstants;
    36 
    36 
    37 const TUid KRepositoryUid = { 0x20007182 };
    37 const TUid KRepositoryUid = { 0x20007182 };
    38 const TUint32 KCacheSizeKey = 0x00000001;
    38 const TUint32 KCacheSizeKey = 0x00000001;
    39 
    39 
    40 const TInt KMaxEventsAtTime = 20;
    40 const TInt KMaxEventsAtTime = 25;
    41 const TInt KMaxEventsGranularity = 20;
    41 const TInt KMaxEventsGranularity = 20;
    42 
    42 
    43 // ---------------------------------------------------------------------------
    43 // ---------------------------------------------------------------------------
    44 // CFileEventHandlerAO::NewL()
    44 // CFileEventHandlerAO::NewL()
    45 // ---------------------------------------------------------------------------
    45 // ---------------------------------------------------------------------------
    99     {
    99     {
   100     WRITELOG( "CFileEventHandlerAO::~CFileEventHandlerAO" );
   100     WRITELOG( "CFileEventHandlerAO::~CFileEventHandlerAO" );
   101     
   101     
   102     Cancel();
   102     Cancel();
   103     
   103     
   104     iIgnoreList.ResetAndDestroy();
       
   105     iIgnoreList.Close();
       
   106     
       
   107     iFs.Close();
   104     iFs.Close();
   108     
   105     
   109     delete iMapper;
   106     delete iMapper;
   110     delete iMoveTimer;
   107     delete iMoveTimer;
   111     delete iFolderRenamer;
   108     delete iFolderRenamer;
   126     WRITELOG( "CFileEventHandlerAO::RunL" );
   123     WRITELOG( "CFileEventHandlerAO::RunL" );
   127     switch( iNextRequest )
   124     switch( iNextRequest )
   128     	{
   125     	{
   129     	case ( ERequestIdle ):
   126     	case ( ERequestIdle ):
   130     		{
   127     		{
       
   128     	    iQueue.Compress();
       
   129     	    iEventArray->Compress();
       
   130     	    iUriArray.Compress();
   131         	break;
   131         	break;
   132     		}
   132     		}
   133     	
   133     	
   134     	case ( ERequestProcessing ):
   134     	case ( ERequestProcessing ):
   135     		{
   135     		{
   216     TBool fastHarvest( EFalse );
   216     TBool fastHarvest( EFalse );
   217     
   217     
   218     TOrigin origin = MdeConstants::Object::EOther;
   218     TOrigin origin = MdeConstants::Object::EOther;
   219     if ( iMapper )
   219     if ( iMapper )
   220         {
   220         {
   221         TRAPD( originErr, origin = iMapper->OriginL( status.iProcessId ) );
   221         origin = iMapper->OriginL( status.iProcessId );
   222         if( originErr == KErrNone )
   222         if ( origin == KOriginIgnored )
   223         	{
   223             {
   224         	if ( origin == KOriginIgnored )
   224             WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored origin for %S", &status.iFileName );
   225                 {
   225             return;
   226                 WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored origin for %S", &status.iFileName );
   226             }
   227                 return;
   227         else if( origin == KOriginFastHarvest )
   228                 }
   228             {
   229         	else if( origin == KOriginFastHarvest )
   229             WRITELOG( "CFileEventHandlerAO::HandleNotificationL - potential fast harvest file detected" );
   230         	    {
   230             fastHarvest = ETrue;
   231         	    WRITELOG( "CFileEventHandlerAO::HandleNotificationL - potential fast harvest file detected" );
   231             }
   232         	    fastHarvest = ETrue;
   232     
   233         	    }
   233         _LIT(KCameraTemp,"camcordertmp");
   234     
   234         if ( origin == MdeConstants::Object::ECamera &&
   235             _LIT(KCameraTemp,"camcordertmp");
   235         		(aEvent.iFileEventType == EMdsFileCreated || 
   236         	if ( origin == MdeConstants::Object::ECamera &&
   236 				aEvent.iFileName.FindF(KCameraTemp) != KErrNotFound) )        		
   237         			(aEvent.iFileEventType == EMdsFileCreated || 
   237             {
   238 					aEvent.iFileName.FindF(KCameraTemp) != KErrNotFound) )        		
   238             WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName );
   239                 {
   239             return;
   240                 WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName );
   240             }
   241                 return;
       
   242                 }
       
   243         	}
       
   244         else
       
   245         	{
       
   246         	origin = MdeConstants::Object::EOther;
       
   247         	}
       
   248         }
   241         }
   249 
   242 
   250     // ignore created file event if extension is not supported by any harverter plugin
   243     // ignore created file event if extension is not supported by any harverter plugin
   251     if( EMdsFileCreated == status.iFileEventType && 
   244     if( EMdsFileCreated == status.iFileEventType && 
   252     		status.iFileName.Length() > 0 )
   245     		status.iFileName.Length() > 0 )
   305             	// move event
   298             	// move event
   306             	CleanupStack::PushL( hd );
   299             	CleanupStack::PushL( hd );
   307             	RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
   300             	RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
   308             	CleanupStack::PopAndDestroy( hd );
   301             	CleanupStack::PopAndDestroy( hd );
   309             	}
   302             	}
   310 
   303             else
   311             DeleteFromMDEL( status.iFileName );
   304                 {
       
   305                 DeleteFromMDEL( status.iFileName );
       
   306                 }
   312             }
   307             }
   313         break;
   308         break;
   314 
   309 
   315         case EMdsDriveFormatted:
   310         case EMdsDriveFormatted:
   316         	{
   311         	{
   347         TMdsFSPStatus& status = (*aEvents)[i];
   342         TMdsFSPStatus& status = (*aEvents)[i];
   348         
   343         
   349         TOrigin origin = MdeConstants::Object::EOther;
   344         TOrigin origin = MdeConstants::Object::EOther;
   350         if ( iMapper )
   345         if ( iMapper )
   351             {
   346             {
   352             TRAPD( originErr, origin = iMapper->OriginL( status.iProcessId ) );
   347             origin = iMapper->OriginL( status.iProcessId );
   353             if( originErr == KErrNone )
   348             // Used only for delete events so fast harvest origin is not used
       
   349             if ( origin == KOriginIgnored )
   354                 {
   350                 {
   355                 if ( origin == KOriginIgnored )
   351                 WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - ignored origin for %S", &status.iFileName );
   356                     {
   352                 continue;
   357                     WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - ignored origin for %S", &status.iFileName );
       
   358                     continue;
       
   359                     }
       
   360                 }
   353                 }
   361             }
   354             }
   362         
   355         
   363         WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - EmdsFileDeleted: %S", &status.iFileName );
   356         WRITELOG1( "CFileEventHandlerAO::HandleMultideletionL - EmdsFileDeleted: %S", &status.iFileName );
   364         CHarvesterData* hd = iMoveTimer->CheckUriL( status.iFileName );
   357         CHarvesterData* hd = iMoveTimer->CheckUriL( status.iFileName );
   367             // move event
   360             // move event
   368             CleanupStack::PushL( hd );
   361             CleanupStack::PushL( hd );
   369             RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
   362             RenameToMDEL( status.iFileName, hd->Uri(), hd->Origin() );
   370             CleanupStack::PopAndDestroy( hd );
   363             CleanupStack::PopAndDestroy( hd );
   371             }
   364             }
   372         iUriArray.Append( &(status.iFileName) );
   365         else
       
   366             {
       
   367             iUriArray.Append( &(status.iFileName) );
       
   368             }
   373         }
   369         }
   374     MultiDeleteFromMDEL( iUriArray );
   370     MultiDeleteFromMDEL( iUriArray );
   375     }
   371     }
   376 
   372 
   377 // ---------------------------------------------------------------------------
   373 // ---------------------------------------------------------------------------
   801 		CActive( KHarvesterPriorityMonitorPlugin )
   797 		CActive( KHarvesterPriorityMonitorPlugin )
   802     {
   798     {
   803     }
   799     }
   804 
   800 
   805 // ---------------------------------------------------------------------------
   801 // ---------------------------------------------------------------------------
   806 // CFileEventHandlerAO::SetIgnoreListL()
       
   807 // ---------------------------------------------------------------------------
       
   808 //
       
   809 void CFileEventHandlerAO::SetIgnoreListL( RPointerArray<TDesC>& aList )
       
   810     {
       
   811     WRITELOG( "CFileEventHandlerAO::SetIgnoreListL" );
       
   812     
       
   813     iIgnoreList.ResetAndDestroy();
       
   814     
       
   815     const TInt count( aList.Count() );
       
   816     for ( TInt i = count; --i >= 0; )
       
   817         {
       
   818         TDesC* listPath = aList[i];
       
   819         
       
   820         HBufC* name = listPath->AllocLC();
       
   821 
       
   822         iIgnoreList.AppendL( name );
       
   823         
       
   824         CleanupStack::Pop( name );
       
   825         }
       
   826     }
       
   827 
       
   828 // ---------------------------------------------------------------------------
       
   829 // CFileEventHandlerAO::Mapper()
   802 // CFileEventHandlerAO::Mapper()
   830 // Returns a handle to CProcessOriginMapper.
   803 // Returns a handle to CProcessOriginMapper.
   831 // ---------------------------------------------------------------------------
   804 // ---------------------------------------------------------------------------
   832 //
   805 //
   833 CProcessOriginMapper& CFileEventHandlerAO::Mapper()
   806 CProcessOriginMapper& CFileEventHandlerAO::Mapper()