From 3c88a76b1be759d13097810877d6e990b3371726 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Thu, 4 Apr 2013 01:15:54 +0200 Subject: implement refresh action --- forummodel.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'forummodel.cpp') diff --git a/forummodel.cpp b/forummodel.cpp index bdc2d17..4d59916 100644 --- a/forummodel.cpp +++ b/forummodel.cpp @@ -14,6 +14,7 @@ ForumModel::ForumModel(QObject *parent) : roles[TitleRole] = QByteArray("title"); roles[IconRole] = QByteArray("icon"); roles[TopicIdRole] = QByteArray("topicId"); + roles[NumPostsRole] = QByteArray("numPosts"); setRoleNames(roles); } @@ -79,10 +80,10 @@ QVariant ForumModel::data(const QModelIndex &index, int role) const switch (role) { case TitleRole: return _data[row].title; - break; case TopicIdRole: return _data[row].topic_id; - break; + case NumPostsRole: + return _data[row].num_replies; } return QVariant(); @@ -138,6 +139,15 @@ void ForumModel::fetchMore(const QModelIndex &parent) } } +void ForumModel::refresh() +{ + // Forcefully refresh all topics on this forum + _board->enqueueAction(new FetchTopicsAction(_forumId, + 0, + FetchTopicsAction::FetchAllTopics, + _board)); +} + QDateTime ForumModel::parseDateTime(const QVariant &v) { QString s = v.toString(); -- cgit v1.2.3