calendarui/controller/src/calenalarmmanager.cpp
branchRCL_3
changeset 19 1984aceb8774
parent 12 38571fd2a704
child 21 9711e452b5e9
--- a/calendarui/controller/src/calenalarmmanager.cpp	Mon Mar 15 12:40:18 2010 +0200
+++ b/calendarui/controller/src/calenalarmmanager.cpp	Wed Mar 31 21:29:10 2010 +0300
@@ -178,6 +178,7 @@
             break;
         case ECalenMissedAlarmsViewFromIdle:
             {
+            RemoveAllViewedEventsL();
             iViewManager.StartActiveStepL();
             }
             break;
@@ -572,11 +573,8 @@
     TInt missedAlarmEntryUid = context.InstanceId().iEntryLocalUid;
     TCalCollectionId colid = context.InstanceId().iColId;
     // clear missed alarm from cenrep
-    if( EFalse == ClearOneMissedAlarmL( missedAlarmEntryUid, colid ) )
-        {
-        TRACE_EXIT_POINT;
-        return;
-        }
+    
+    ClearOneMissedAlarmL( missedAlarmEntryUid, colid );
     for(TInt index = 0;index < iMissedAlarmList.Count();index++)
         {
         if( ( missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid ) &&
@@ -677,8 +675,9 @@
     TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime );
     id.iColId = session.CollectionIdL();
     context.SetInstanceIdL( id, context.ViewId() ); 
-		CleanupStack::PopAndDestroy( entry );
-    iMissedAlarmStore->RemoveL(*aMissedAlarmArray[0]);
+	CleanupStack::PopAndDestroy( entry );
+	iMissedAlarmList.Remove(0); //Clear the alarm list
+	iMissedAlarmStore->RemoveL(*aMissedAlarmArray[0]);
     CleanupStack::PopAndDestroy(); // aMissedAlarmArray
     
     iViewManager.StartActiveStepL();
@@ -862,10 +861,12 @@
     // get the context
     MCalenContext &context = iController.Services().Context();
     TInt missedAlarmEntryUid = context.InstanceId().iEntryLocalUid;
+    TCalCollectionId colid = context.InstanceId().iColId;
     
     for(TInt index = 0;index < iMissedAlarmList.Count();index++)
         {
-        if(missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid )
+        if((missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid ) && 
+            (colid == iMissedAlarmList[index].iColId))
             {
             // mark the missed alarm event as viewed 
             iMissedAlarmList[index].iInstanceViewed = 1;
@@ -889,6 +890,7 @@
         {
         if(iMissedAlarmList[index].iInstanceViewed)
             {
+            ClearOneMissedAlarmL( iMissedAlarmList[index].iEntryLocalUid, iMissedAlarmList[index].iColId );
             iMissedAlarmList.Remove(index);
             }
         else
@@ -987,8 +989,7 @@
     TRACE_ENTRY_POINT;
     // get the context
     MCalenContext &context = iController.Services().Context();
-    TInt deletedEntryUid = context.InstanceId().iEntryLocalUid;
-    
+    TInt deletedEntryUid = context.InstanceId().iEntryLocalUid;    
     TCalCollectionId colidFromContext = context.InstanceId().iColId;
     
     if( EFalse == ClearOneMissedAlarmL( deletedEntryUid, colidFromContext ) )