agendainterface/agendautil/src/agendautil_p.cpp
changeset 51 0b38fc5b94c6
parent 45 b6db4fd4947b
child 55 2c54b51f39c4
--- a/agendainterface/agendautil/src/agendautil_p.cpp	Fri Jul 02 19:56:46 2010 +0530
+++ b/agendainterface/agendautil/src/agendautil_p.cpp	Mon Jul 12 02:32:28 2010 +0530
@@ -53,6 +53,8 @@
 	mEntryViewCreated = false;
 	mInstanceViewCreated = false;
 	mIsDeleting = false;
+	mIsEntryViewBeingDeleted = false;
+	mIsInstanceViewBeingDeleted = false;
 	prepareSession();
 }
 
@@ -95,13 +97,13 @@
 				endDateArray[0], static_cast<TMonth>(endDateArray[1]),
 				0, 0, 0, 0, 0);
 
-		startDate.SetTimeLocalL(startTime);
-		endDate.SetTimeLocalL(endTime);
-		CalCommon::TCalTimeRange searchTimeRange(startDate, startDate);
+		startDate.SetTimeUtcL(startTime);
+		endDate.SetTimeUtcL(endTime);
+		CalCommon::TCalTimeRange searchTimeRange(startDate, endDate);
 
 		CCalChangeNotificationFilter* filter = 0;
 		filter = CCalChangeNotificationFilter::NewL(
-				EChangeEntryAll, true, searchTimeRange);
+				MCalChangeCallBack2::EChangeEntryAll, true, searchTimeRange);
 
 		iCalSession->StartChangeNotification(*this, *filter);
 
@@ -124,8 +126,18 @@
 
 AgendaUtilPrivate::~AgendaUtilPrivate()
 {
-	delete iCalEntryView;
-	delete iCalInstanceView;
+    if (iCalEntryView && !mIsEntryViewBeingDeleted) {
+        mIsEntryViewBeingDeleted = true;
+        delete iCalEntryView;
+        iCalEntryView = NULL;
+    }
+    
+    if (iCalInstanceView && !mIsInstanceViewBeingDeleted) {
+        mIsInstanceViewBeingDeleted = true;
+        delete iCalInstanceView;
+        iCalInstanceView = NULL;
+    }
+	
 	if (iCalSession) {
 		iCalSession->StopChangeNotification();
 	}
@@ -135,8 +147,6 @@
 void AgendaUtilPrivate::Completed(TInt aError)
 {
 	iError = aError;
-	static bool isInstanceViewDeleted = false;
-	static bool isEntryViewDeleted = false;
 
 	if (mIsDeleting) {
 		// If deletion was in progress, then it is completed now
@@ -147,15 +157,17 @@
 
 	if (KErrNone != iError) {
 		// Something has gone wrong, return
-		if (iCalEntryView && !isEntryViewDeleted) {
-		isEntryViewDeleted = true;
-		delete iCalEntryView;
-		iCalEntryView = NULL;
+		if (iCalEntryView && !mIsEntryViewBeingDeleted) {
+            mIsEntryViewBeingDeleted = true;
+            delete iCalEntryView;
+            iCalEntryView = NULL;
+            mIsEntryViewBeingDeleted = false;
 		}
-		if (iCalInstanceView && !isInstanceViewDeleted) {
-		isInstanceViewDeleted = true;
-		delete iCalInstanceView;
-		iCalInstanceView = NULL;
+		if (iCalInstanceView && !mIsInstanceViewBeingDeleted) {
+            mIsInstanceViewBeingDeleted = true;
+            delete iCalInstanceView;
+            iCalInstanceView = NULL;
+            mIsInstanceViewBeingDeleted = false;
 		}
 		return;
 	}