messagingapp/msgappfw/server/src/ccsconversationcache.cpp
changeset 44 36f374c67aa8
parent 43 35b64624a9e7
child 47 5b14749788d7
child 52 12db4185673b
--- a/messagingapp/msgappfw/server/src/ccsconversationcache.cpp	Wed Jun 23 18:09:17 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationcache.cpp	Tue Jul 06 14:12:40 2010 +0300
@@ -405,6 +405,20 @@
         CleanupStack::PopAndDestroy(clientConv);
     }
 
+    // send all CV entry delete events, required in case CV is open
+    // Notify client of conversation change
+    TInt totalEntryCount = conversation->GetEntryCount();
+    for (TInt entryCounter = totalEntryCount - 1; entryCounter >= 0;
+            entryCounter--)
+    {
+        CCsConversationEntry* entryInConversation =
+                conversation->GetEntryL(entryCounter);
+        CCsClientConversation * clientConv =
+                CreateClientConvLC(conversation, entryInConversation);
+        NotifyL(clientConv, KConversationEventDelete);
+        CleanupStack::PopAndDestroy(clientConv);
+    }
+
     iConversationList->Remove(aIndex);
     entryList.ResetAndDestroy();
 
@@ -436,7 +450,7 @@
 // CCsConversationCache::MarkConversationAsDeleted
 // ----------------------------------------------------------------------------
 void CCsConversationCache::MarkConversationAsDeleted(TInt aConversationId,
-                                                     TBool aDeleted)
+                                                     TBool aDeleted, TInt aCount)
 {
     TInt conversationCount = iConversationList->Count();
 
@@ -449,6 +463,14 @@
         if (id == aConversationId)
         {
             conversation->MarkDeleted(aDeleted);
+            if( aCount )
+                {
+                CCsClientConversation* clientConversation =
+                                    CreateClientConvLC(conversation,
+                                                       conversation->GetLatestEntryL());
+                NotifyL(clientConversation, KConversationListEventPartialDelete);
+                CleanupStack::PopAndDestroy();// clientConversation
+                }
             break;
         }
     }
@@ -639,6 +661,29 @@
     }
 
 // ----------------------------------------------------------------------------
+// CCsConversationCache::GetConversationFromConversationId
+// ----------------------------------------------------------------------------
+CCsClientConversation* CCsConversationCache::GetConversationFromConversationIdL(TInt aConversationId)
+    {
+
+    CCsClientConversation* clientConv = NULL;
+
+    for ( TInt loop = 0; loop < iConversationList->Count(); ++loop )
+       {
+        CCsConversation* conversation =
+            static_cast<CCsConversation*>((*iConversationList)[loop]);
+
+            if (aConversationId == conversation->GetConversationId())
+              {
+                clientConv = CreateClientConvLC(conversation, conversation->GetLatestEntryL());
+                CleanupStack::Pop();
+                break;
+              }
+       }
+    return clientConv;
+    }
+
+// ----------------------------------------------------------------------------
 // CCsConversationCache::GetConversationFromMessageIdL
 // ---------------------------------------------------------------------------
 CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId)