diff -r ae724a111993 -r 7cc7d74059f9 phonebookui/cnthistorymodel/src/cnthistorymodel.cpp --- a/phonebookui/cnthistorymodel/src/cnthistorymodel.cpp Thu Sep 02 20:16:15 2010 +0300 +++ b/phonebookui/cnthistorymodel/src/cnthistorymodel.cpp Fri Sep 17 08:27:32 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 }