summaryrefslogtreecommitdiff
path: root/forummodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'forummodel.cpp')
-rw-r--r--forummodel.cpp14
1 files changed, 12 insertions, 2 deletions
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();