messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp
changeset 44 36f374c67aa8
parent 23 238255e8b033
--- a/messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp	Wed Jun 23 18:09:17 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp	Tue Jul 06 14:12:40 2010 +0300
@@ -99,7 +99,8 @@
     for (TInt i = 0; i < aClientConversationList.Count(); ++i)
     {        
         CCsClientConversation *entry = aClientConversationList[i]->CloneL();
-        mClientConversationList.AppendL(entry);
+        mClientConversationList.InsertInOrderAllowRepeats( entry,
+                ConversationsListChangeHandler::CompareByConvTimeStamp );
     }
 
     if (aClientConversationList.Count() > 0)
@@ -137,6 +138,17 @@
 }
 
 //-----------------------------------------------------------------------
+// This is for handling partial delete conversation event asynchronusly from the server
+//-----------------------------------------------------------------------
+//
+
+void ConversationsListChangeHandler::PartialDeleteConversationList(
+            const CCsClientConversation& aClientConversation)
+{
+    ConversationsEngine::instance()->emitConversationListModelEntryDeleted( aClientConversation.GetConversationEntryId() );
+}
+
+//-----------------------------------------------------------------------
 // This is for handling modify conversation event asynchronusly from the server
 //-----------------------------------------------------------------------
 //
@@ -180,7 +192,7 @@
         if (mCurrentIndex < mClientConversationList.Count())
         {
             mConvSummaryModel->addRow(
-                * (mClientConversationList[mCurrentIndex]));
+                * (mClientConversationList[mCurrentIndex]),true);
             mCurrentIndex++;
         }
         else
@@ -213,4 +225,24 @@
 
 }
 
+// ----------------------------------------------------------------------------
+// ConversationsListChangeHandler::CompareByConvTimeStamp
+// ---------------------------------------------------------------------------
+TInt ConversationsListChangeHandler::CompareByConvTimeStamp(const CCsClientConversation& aObj1,
+        const CCsClientConversation& aObj2)
+    {
+    TInt64 timestamp1 = aObj1.GetConversationEntry()->TimeStamp();
+    TInt64 timestamp2 = aObj2.GetConversationEntry()->TimeStamp();
+
+    if (timestamp1 == timestamp2)
+        {
+        return 0;
+        }
+    else if (timestamp1 < timestamp2)
+        {
+        return 1;
+        }
+    return -1;
+    }
+
 // EOF