serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkmanageobjects.cpp
changeset 26 5d0ec8b709be
parent 5 989d2f495d90
--- a/serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkmanageobjects.cpp	Tue Nov 24 08:56:33 2009 +0200
+++ b/serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkmanageobjects.cpp	Thu Dec 17 09:09:50 2009 +0200
@@ -18,6 +18,8 @@
 
 #include "clandmarkmanageobjects.h"
 #include "clandmarkcmdbase.h"
+#include "clandmarkdummyao.h"
+#include "clandmarkoperation.h"
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -53,6 +55,10 @@
 	Cancel ( );
 	iObjects.ResetAndDestroy ( );
 	iObjects.Close();
+	iDummyObjects.ResetAndDestroy();
+	iDummyObjects.Close();
+	iOrgObjects.ResetAndDestroy();
+	iOrgObjects.Close();
 	}
 
 // -----------------------------------------------------------------------------
@@ -77,6 +83,15 @@
 	iObjects.AppendL (aObject );
 	}
 
+void CLandmarkManageObjects::AppendL(CLandmarkDummyAO* aObject)
+	{
+	iDummyObjects.AppendL(aObject);
+	}
+
+void CLandmarkManageObjects::AppendL(CLandmarkOperation* aObject)
+	{
+	iOrgObjects.AppendL(aObject);
+	}
 // -----------------------------------------------------------------------------
 // CLandmarkManageObjects::CancelObject()
 // Execute the next step.
@@ -84,15 +99,29 @@
 //
 void CLandmarkManageObjects::CancelObject( TInt32 aTransactionId )
 	{
-	TInt count = iObjects.Count ( );
-	for (TInt i = 0; i< count; ++i )
+	TBool isDone = EFalse;
+	TInt count = iObjects.Count();
+	for (TInt i = 0; i < count; ++i)
 		{
 		if ( iObjects[i]->TransactionId ( )== aTransactionId )
 			{
-			iObjects[i]->Cancel ( );
+			iObjects[i]->Cancel();
+			isDone = ETrue;
 			break;
 			}
 		}
+	if( !isDone )
+		{
+		count = iOrgObjects.Count();
+		for (TInt i = 0; i < count; ++i)
+			{
+			if (iOrgObjects[i]->TransactionId() == aTransactionId)
+				{
+				iOrgObjects[i]->Cancel();
+				break;
+				}
+			}
+		}
 	}
 // -----------------------------------------------------------------------------
 // CLandmarkManageObjects::RunL()
@@ -116,6 +145,36 @@
 			--i;
 			}
 		}
+	count = iDummyObjects.Count();
+	for (TInt i = 0; i < count; ++i)
+		{
+		if (!iDummyObjects[i]->IsActive())
+			{
+			delete iDummyObjects[i];
+			//Removes a node from the RPointerArray.
+			iDummyObjects.Remove(i);
+			//Decrement node count.
+			--count;
+			//Decrement index count since the present node
+			//has been deleted.
+			--i;
+			}
+		}
+	count = iOrgObjects.Count();
+	for (TInt i = 0; i < count; ++i)
+		{
+		if (!iOrgObjects[i]->IsActive())
+			{
+			delete iOrgObjects[i];
+			//Removes a node from the RPointerArray.
+			iOrgObjects.Remove(i);
+			//Decrement node count.
+			--count;
+			//Decrement index count since the present node
+			//has been deleted.
+			--i;
+			}
+		}
 	}
 
 // -----------------------------------------------------------------------------