mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp
changeset 60 841f70763fbe
parent 49 c20dd21d1eb4
equal deleted inserted replaced
52:866b4af7ffbe 60:841f70763fbe
   123         {
   123         {
   124         //add for test
   124         //add for test
   125         OstTrace0( TRACE_FLOW, CMTPIMAGEDPDELETEOBJECT_SERVICEL, "delete all objects" );
   125         OstTrace0( TRACE_FLOW, CMTPIMAGEDPDELETEOBJECT_SERVICEL, "delete all objects" );
   126         GetObjectHandlesL( KMTPStorageAll, formatCode, KMTPHandleNone );
   126         GetObjectHandlesL( KMTPStorageAll, formatCode, KMTPHandleNone );
   127         iObjectsNotDelete = iObjectsToDelete.Count();
   127         iObjectsNotDelete = iObjectsToDelete.Count();
   128         StartL();
   128         Start();
   129         }
   129         }
   130     else
   130     else
   131         {
   131         {
   132         //add for test
   132         //add for test
   133         OstTrace0( TRACE_FLOW, DUP1_CMTPIMAGEDPDELETEOBJECT_SERVICEL, "delete only one object" );
   133         OstTrace0( TRACE_FLOW, DUP1_CMTPIMAGEDPDELETEOBJECT_SERVICEL, "delete only one object" );
   151         DeleteObjectL( iObjectsToDelete[0] );
   151         DeleteObjectL( iObjectsToDelete[0] );
   152         iObjectsToDelete.Remove( 0 );
   152         iObjectsToDelete.Remove( 0 );
   153         }
   153         }
   154     
   154     
   155     // Start the process again to read the next row...
   155     // Start the process again to read the next row...
   156     StartL();
   156     Start();
   157 
   157 
   158     OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_RUNL_EXIT );
   158     OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_RUNL_EXIT );
   159     }
   159     }
   160 
   160 
   161 void CMTPImageDpDeleteObject::DoCancel()
   161 void CMTPImageDpDeleteObject::DoCancel()
   163     OstTraceFunctionEntry0( CMTPIMAGEDPDELETEOBJECT_DOCANCEL_ENTRY );
   163     OstTraceFunctionEntry0( CMTPIMAGEDPDELETEOBJECT_DOCANCEL_ENTRY );
   164     
   164     
   165     TRAP_IGNORE( SendResponseL());
   165     TRAP_IGNORE( SendResponseL());
   166 
   166 
   167     OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_DOCANCEL_EXIT );
   167     OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_DOCANCEL_EXIT );
       
   168     }
       
   169 
       
   170 #ifdef OST_TRACE_COMPILER_IN_USE
       
   171 TInt CMTPImageDpDeleteObject::RunError(TInt aErr)
       
   172 #else
       
   173 TInt CMTPImageDpDeleteObject::RunError(TInt /*aErr*/)
       
   174 #endif
       
   175     {
       
   176     OstTrace1(TRACE_ERROR, CMTPIMAGEDPDELETEOBJECT_RUNERROR,"CMTPImageDpDeleteObject::RunError is %d", aErr );
       
   177 	TRAP_IGNORE(CMTPRequestProcessor::SendResponseL(EMTPRespCodeGeneralError));
       
   178     return KErrNone;
   168     }
   179     }
   169 
   180 
   170 /**
   181 /**
   171  Check whether the store on which the object resides is read only.
   182  Check whether the store on which the object resides is read only.
   172  @return ETrue if the store is read only, EFalse if read-write
   183  @return ETrue if the store is read only, EFalse if read-write
   273         iResponseCode = EMTPRespCodeObjectWriteProtected;
   284         iResponseCode = EMTPRespCodeObjectWriteProtected;
   274         }
   285         }
   275     OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_DELETEOBJECTL_EXIT );
   286     OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_DELETEOBJECTL_EXIT );
   276     }
   287     }
   277 
   288 
   278 void CMTPImageDpDeleteObject::StartL()
   289 void CMTPImageDpDeleteObject::Start()
   279     {
   290     {
   280     OstTraceFunctionEntry0( CMTPIMAGEDPDELETEOBJECT_STARTL_ENTRY );
   291     OstTraceFunctionEntry0( CMTPIMAGEDPDELETEOBJECT_START_ENTRY );
   281     
   292     
   282     if(iCancelled)
   293     if(iCancelled)
   283         {
   294         {
   284         OstTrace0( TRACE_NORMAL, CMTPIMAGEDPDELETEOBJECT_STARTL, "Cancell the delete" );
   295         OstTrace0( TRACE_NORMAL, CMTPIMAGEDPDELETEOBJECT_START, "Cancell the delete" );
   285         CMTPRequestProcessor::SendResponseL(EMTPRespCodeTransactionCancelled);
   296         TRAP_IGNORE(CMTPRequestProcessor::SendResponseL(EMTPRespCodeTransactionCancelled));
   286         iObjectsToDelete.Reset();
   297         iObjectsToDelete.Reset();
   287         iCancelled = EFalse;
   298         iCancelled = EFalse;
   288         OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_STARTL_EXIT );
   299         OstTraceFunctionExit0( CMTPIMAGEDPDELETEOBJECT_START_EXIT );
   289         return;
   300         return;
   290         }
   301         }
   291     
   302     
   292     TInt numObjectsToDelete = iObjectsToDelete.Count();
   303     TInt numObjectsToDelete = iObjectsToDelete.Count();
   293 
   304 
   298         User::RequestComplete( status, KErrNone );
   309         User::RequestComplete( status, KErrNone );
   299         SetActive();
   310         SetActive();
   300         }
   311         }
   301     else
   312     else
   302         {
   313         {
   303         SendResponseL();
   314         TRAP_IGNORE(SendResponseL());
   304         }
   315         }
   305     OstTraceFunctionExit0( DUP1_CMTPIMAGEDPDELETEOBJECT_STARTL_EXIT );
   316     OstTraceFunctionExit0( DUP1_CMTPIMAGEDPDELETEOBJECT_START_EXIT );
   306     }
   317     }
   307 
   318 
   308 void CMTPImageDpDeleteObject::SendResponseL()
   319 void CMTPImageDpDeleteObject::SendResponseL()
   309     {
   320     {
   310     OstTraceFunctionEntry0( CMTPIMAGEDPDELETEOBJECT_SENDRESPONSEL_ENTRY );
   321     OstTraceFunctionEntry0( CMTPIMAGEDPDELETEOBJECT_SENDRESPONSEL_ENTRY );