phonebookui/cnthistorymodel/src/cnthistorymodel.cpp
changeset 66 554fe4dbbb59
parent 47 7cbcb2896f0e
--- a/phonebookui/cnthistorymodel/src/cnthistorymodel.cpp	Mon Aug 23 16:06:28 2010 +0300
+++ b/phonebookui/cnthistorymodel/src/cnthistorymodel.cpp	Fri Sep 03 14:32:33 2010 +0300
@@ -17,6 +17,7 @@
 
 #include "cnthistorymodel_p.h"
 #include "cnthistorymodel.h"
+#include "cntdebug.h"
 
 /*!
  * Construct a new CntHistoryModel object to communicate 
@@ -32,14 +33,22 @@
     : QAbstractListModel(parent),
       d_ptr(new CntHistoryModelPrivate(contactId, manager))
 {
+    CNT_ENTRY
+    
     Q_D(CntHistoryModel);
     d->q_ptr = this;
+    
+    CNT_EXIT
 }
 
 CntHistoryModel::~CntHistoryModel()
 {
+    CNT_ENTRY
+    
     Q_D(CntHistoryModel);
     delete d;
+    
+    CNT_EXIT
 }
 
 /*!
@@ -69,26 +78,18 @@
 }
 
 /*!
- * Sort list items on the model.
- *
- * \param column Column to be sorted. It is not used.
- * \param order Order to sort the list items.
- */
-void CntHistoryModel::sort(int column, Qt::SortOrder order)
-{
-    Q_D(CntHistoryModel);
-    d->sort(column, order);
-}
-
-/*!
  * Clear history from the database. If the history cached
  * is specific to one contact, only that history is cleared.
  * 
  */
 void CntHistoryModel::clearHistory()
-{    
-    Q_D(CntHistoryModel);    
+{
+    CNT_ENTRY
+    
+    Q_D(CntHistoryModel);
     d->clearHistory();
+    
+    CNT_EXIT
 }
 
 /*!
@@ -97,43 +98,91 @@
  */
 void CntHistoryModel::markAllAsSeen()
 {
+    CNT_ENTRY
+    
     Q_D(CntHistoryModel);
     d->markAllAsSeen();
+    
+    CNT_EXIT
 }
 
 /*!
  * Sort items in the model and refresh the view
- * 
+ *
+ * \param order Order to sort the list items.
  */
 void CntHistoryModel::sortAndRefresh(Qt::SortOrder order)
 {
+    CNT_ENTRY_ARGS(order)
+    
     Q_D(CntHistoryModel);
+    
+    doBeginResetModel();
     d->sort(order);
-    beginInsertRows(QModelIndex(), 0, rowCount());
-    endInsertRows();
+    doEndResetModel();
+    
+    CNT_EXIT
 }
 
 void CntHistoryModel::doBeginInsertRows(const QModelIndex &parent, int first, int last)
 {
+    CNT_ENTRY_ARGS(parent << first << last)
+    
     beginInsertRows(parent, first, last);
+    
+    CNT_EXIT
 }
 
-void CntHistoryModel::doEndRemoveRows()
+void CntHistoryModel::doEndInsertRows()
 {
-    endRemoveRows();
+    CNT_ENTRY
+    
+    endInsertRows();
+    
+    CNT_EXIT
 }
 
 void CntHistoryModel::doBeginRemoveRows(const QModelIndex &parent, int first, int last)
 {
+    CNT_ENTRY_ARGS(parent << first << last)
+    
     beginRemoveRows(parent, first, last);
+    
+    CNT_EXIT
+}
+
+void CntHistoryModel::doEndRemoveRows()
+{
+    CNT_ENTRY
+    
+    endRemoveRows();
+    
+    CNT_EXIT
 }
 
-void CntHistoryModel::doEndInsertRows()
+void CntHistoryModel::doBeginResetModel()
 {
-    endInsertRows();
+    CNT_ENTRY
+    
+    beginResetModel();
+    
+    CNT_EXIT
+}
+
+void CntHistoryModel::doEndResetModel()
+{
+    CNT_ENTRY
+    
+    endResetModel();
+    
+    CNT_EXIT
 }
 
 void CntHistoryModel::doDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
 {
+    CNT_ENTRY_ARGS(topLeft << bottomRight)
+    
     emit dataChanged(topLeft, bottomRight);
+    
+    CNT_EXIT
 }