summaryrefslogtreecommitdiff
path: root/forummodel.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-04 01:15:54 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-04 01:15:54 +0200
commit3c88a76b1be759d13097810877d6e990b3371726 (patch)
treedd5627700ef12be7c55d9f3ceda5a9575691a337 /forummodel.cpp
parent723e0e7f37636379f76008582dca459490b845f4 (diff)
downloadtapasboard-3c88a76b1be759d13097810877d6e990b3371726.tar.gz
tapasboard-3c88a76b1be759d13097810877d6e990b3371726.zip
implement refresh action
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();