clfwrapper/ClientSrc/CCLFServerProxy.cpp
changeset 1 acef663c1218
parent 0 c53acadfccc6
child 8 6752808b2036
child 20 6dfc5f825351
equal deleted inserted replaced
0:c53acadfccc6 1:acef663c1218
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <PathInfo.h>
    20 #include <pathinfo.h>
    21 #include <driveinfo.h>
    21 #include <driveinfo.h>
    22 #include <s32mem.h>
    22 #include <s32mem.h>
    23 #include <bautils.h>
    23 #include <bautils.h>
    24 #include <mdeobjectquery.h>
    24 #include <mdeobjectquery.h>
    25 #include <mdeconstants.h>
    25 #include <mdeconstants.h>
   184 //
   184 //
   185 void CUpdateIDsHandler::HandleObjectNotification( const TItemId aId, TObserverNotificationType /* aType */ )
   185 void CUpdateIDsHandler::HandleObjectNotification( const TItemId aId, TObserverNotificationType /* aType */ )
   186     {
   186     {
   187     iWasNotificationHandled = EFalse;
   187     iWasNotificationHandled = EFalse;
   188 
   188 
   189     TInt index = iIdsPendingUpdate.Find( aId );
   189     const TInt index = iIdsPendingUpdate.Find( aId );
   190     if ( index != KErrNotFound )
   190     if ( index != KErrNotFound )
   191         {
   191         {
   192         iWasNotificationHandled = ETrue;
   192         iWasNotificationHandled = ETrue;
   193         iIdsPendingUpdate.Remove( index );
   193         iIdsPendingUpdate.Remove( index );
   194         }
   194         }
   284     {
   284     {
   285     iWasNotificationHandled = EFalse;
   285     iWasNotificationHandled = EFalse;
   286 
   286 
   287     if ( aType == ENotifyRemove )
   287     if ( aType == ENotifyRemove )
   288         {
   288         {
   289         TInt index = iIdsPendingRemoval.Find( aId );
   289         const TInt index = iIdsPendingRemoval.Find( aId );
   290         if ( index != KErrNotFound )
   290         if ( index != KErrNotFound )
   291             {
   291             {
   292             iWasNotificationHandled = ETrue;
   292             iWasNotificationHandled = ETrue;
   293             iIdsPendingRemoval.Remove( index );
   293             iIdsPendingRemoval.Remove( index );
   294             }
   294             }
   706 // Callback from harvester client after harvesting
   706 // Callback from harvester client after harvesting
   707 // -----------------------------------------------------------------------------
   707 // -----------------------------------------------------------------------------
   708 //
   708 //
   709 void CUpdateFoldersHandler::HarvestingComplete( TDesC& aURI, const TInt aError )
   709 void CUpdateFoldersHandler::HarvestingComplete( TDesC& aURI, const TInt aError )
   710     {
   710     {
   711     const TFileName uri( aURI );
       
   712     TBool match( EFalse );
   711     TBool match( EFalse );
   713     TCollationMethod m = *Mem::CollationMethodByIndex( 0 );
   712     TCollationMethod m = *Mem::CollationMethodByIndex( 0 );
   714 
   713 
   715     iHarvestError = aError;
   714     iHarvestError = aError;
   716     m.iFlags = ( TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase );   
   715     m.iFlags = ( TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase );   
   717 
   716 
       
   717     const TFileName uri( aURI );
       
   718     
   718     if ( uri.CompareC( iHarvestingFile, 3, &m ) == 0 )
   719     if ( uri.CompareC( iHarvestingFile, 3, &m ) == 0 )
   719         {
   720         {
   720         match = ETrue;
   721         match = ETrue;
   721         iHarvestingOngoing = EFalse;
   722         iHarvestingOngoing = EFalse;
   722         }
   723         }
  1019             User::LeaveIfError( err );
  1020             User::LeaveIfError( err );
  1020             }
  1021             }
  1021         if ( aHandler->AllDone() )
  1022         if ( aHandler->AllDone() )
  1022             {
  1023             {
  1023             delete aHandler;
  1024             delete aHandler;
       
  1025             aHandler = NULL;
  1024             iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 );
  1026             iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 );
  1025             }
  1027             }
  1026         else
  1028         else
  1027             {
  1029             {
  1028             aHandler->StartScheduler();
  1030             aHandler->StartScheduler();
  1057                 iDelayNotifyCLFGetUpdateEventCount = KDelayNotityCLFGetUpdateEventMaxTimes;
  1059                 iDelayNotifyCLFGetUpdateEventCount = KDelayNotityCLFGetUpdateEventMaxTimes;
  1058                 NotifyUpdateEvent( ECLFGetUpdateEvent );
  1060                 NotifyUpdateEvent( ECLFGetUpdateEvent );
  1059                 iUpdateItemsHandlerArray[ j ]->AsyncStopScheduler();
  1061                 iUpdateItemsHandlerArray[ j ]->AsyncStopScheduler();
  1060                 iUpdateItemsHandlerArray[j]->SetRemoveObserverFlag( EFalse );
  1062                 iUpdateItemsHandlerArray[j]->SetRemoveObserverFlag( EFalse );
  1061                 delete iUpdateItemsHandlerArray[ j ]; 
  1063                 delete iUpdateItemsHandlerArray[ j ]; 
       
  1064                 iUpdateItemsHandlerArray[ j ] = NULL;
  1062                 iUpdateItemsHandlerArray.Remove( j );
  1065                 iUpdateItemsHandlerArray.Remove( j );
  1063                 j--; // Compensate for the removed handler
  1066                 j--; // Compensate for the removed handler
  1064                 }
  1067                 }
  1065             }
  1068             }
  1066         unhandledIds = ( unhandledIds || !handled ) ? ETrue : EFalse;
  1069         unhandledIds = ( unhandledIds || !handled ) ? ETrue : EFalse;
  1106                 // If we have a pending update, we can now let it continue.
  1109                 // If we have a pending update, we can now let it continue.
  1107                 NotifyUpdateEvent( ECLFGetUpdateEvent );
  1110                 NotifyUpdateEvent( ECLFGetUpdateEvent );
  1108                 iUpdateItemsHandlerArray[ j ]->AsyncStopScheduler();
  1111                 iUpdateItemsHandlerArray[ j ]->AsyncStopScheduler();
  1109                 iUpdateItemsHandlerArray[j]->SetRemoveObserverFlag( EFalse );
  1112                 iUpdateItemsHandlerArray[j]->SetRemoveObserverFlag( EFalse );
  1110                 delete iUpdateItemsHandlerArray[ j ]; 
  1113                 delete iUpdateItemsHandlerArray[ j ]; 
       
  1114                 iUpdateItemsHandlerArray[ j ] = NULL;
  1111                 iUpdateItemsHandlerArray.Remove( j );
  1115                 iUpdateItemsHandlerArray.Remove( j );
  1112                 j--; // Compensate for the removed handler
  1116                 j--; // Compensate for the removed handler
  1113                 }
  1117                 }
  1114             }
  1118             }
  1115         unhandledIds = ( unhandledIds || !handled ) ? ETrue : EFalse;
  1119         unhandledIds = ( unhandledIds || !handled ) ? ETrue : EFalse;