emailservices/nmutilities/src/nmcontacthistorymodel.cpp
changeset 76 38bf5461e270
parent 74 6c59112cfd31
--- a/emailservices/nmutilities/src/nmcontacthistorymodel.cpp	Thu Sep 30 11:43:07 2010 +0300
+++ b/emailservices/nmutilities/src/nmcontacthistorymodel.cpp	Thu Oct 14 17:33:43 2010 +0300
@@ -34,7 +34,7 @@
 {
     NM_FUNCTION;
     d_ptr = new NmContactHistoryModelPrivate(modelType);
-
+    
     QObject::connect(d_ptr, SIGNAL(queryCompleted(int)), this,
         SLOT(handleQueryCompleted(int)));
 }
@@ -71,8 +71,7 @@
 
     int lastUpdateIndex = (d_ptr->privateDataCount())-1;
 
-    if (lastUpdateIndex != -1)
-    {
+    if (lastUpdateIndex != -1) {
         // Notify views that we are about to change model data.
         beginInsertRows(QModelIndex(),0,lastUpdateIndex);
         d_ptr->refreshDataModel();
@@ -81,10 +80,14 @@
         // Emit dataChanged();
         bool validIndex = hasIndex ( lastUpdateIndex, 0 );
 
-        if (validIndex)
-        {
+        if (validIndex) {
             emit dataChanged(index(0,0), index(lastUpdateIndex,0));
         }
+           
+    }
+    else if (lastUpdateIndex == -1) {
+        beginResetModel();       
+        endResetModel();
     }
 
     emit modelCompleted(err);