messagingapp/msgui/appengine/src/conversationssummarymodel.cpp
changeset 44 36f374c67aa8
parent 43 35b64624a9e7
child 47 5b14749788d7
child 52 12db4185673b
--- a/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp	Wed Jun 23 18:09:17 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp	Tue Jul 06 14:12:40 2010 +0300
@@ -38,6 +38,8 @@
 ConversationsSummaryModel::ConversationsSummaryModel(QObject* parent)
 :QStandardItemModel(parent)
     {
+    QStandardItemModel::setSortRole(TimeStamp);
+    QStandardItemModel::sort(0, Qt::DescendingOrder);
     }
 
 //---------------------------------------------------------------
@@ -156,7 +158,7 @@
 // @see header
 //---------------------------------------------------------------
 void ConversationsSummaryModel::addRow(
-        const CCsClientConversation& conversation)
+        const CCsClientConversation& conversation, bool caching)
     {  
     int convId = conversation.GetConversationEntryId();
     
@@ -178,7 +180,12 @@
         QModelIndex index = indexList[0];
         QStandardItem* item = this->item(index.row(), 0);
         populateItem(*item,conversation);
-    }        
+    }  
+    // no need to sort if it is initial caching, as sorting is already done
+    if (!caching)
+        {
+        QStandardItemModel::sort(0, Qt::DescendingOrder);
+        }
     }
 
 //---------------------------------------------------------------