mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp
branchRCL_3
changeset 9 bee149131e4b
parent 0 a2952bb97e68
child 14 05b0d2323768
--- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp	Tue Feb 02 00:27:58 2010 +0200
+++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp	Fri Feb 19 23:18:32 2010 +0200
@@ -18,12 +18,14 @@
 
 #include <mtp/mmtpdataproviderframework.h>
 #include <mtp/mmtpobjectmgr.h>
+#include <mtp/mmtpreferencemgr.h>
 #include <mtp/cmtpobjectmetadata.h>
 
 #include "cdeleteobject.h"
 #include "mmmtpdplogger.h"
 #include "mmmtpdpconfig.h"
 #include "cmmmtpdpmetadataaccesswrapper.h"
+#include "mmmtpdputility.h"
 
 // static const TInt KMTPDriveGranularity = 5;
 
@@ -91,7 +93,7 @@
         KMTPDeleteObjectPolicy ),
     iObjectMgr( aFramework.ObjectMgr() ),
     iFs( aFramework.Fs() ),
-    iObjectsToDelete( KMmMtpRArrayGranularity ), 
+    iObjectsToDelete( KMmMtpRArrayGranularity ),
     iDeleteError( KErrNone ),
     iDpConfig( aDpConfig )
     {
@@ -264,6 +266,10 @@
     // 3. Delete object from framework db
     iObjectMgr.RemoveObjectL( aObjectInfo.Uint( CMTPObjectMetaData::EHandle ) );
 
+    // 4. If the object has references, Delete references from reference manager
+    if ( MmMtpDpUtility::HasReference( aObjectInfo.Uint( CMTPObjectMetaData::EFormatCode ) ) )
+        iFramework.ReferenceMgr().RemoveReferencesL( aObjectInfo.DesC( CMTPObjectMetaData::ESuid ) );
+
     PRINT( _L( "MM MTP <= CDeleteObject::DeleteObjectL" ) );
     }