From a6e64fbf9404b201b04fbd1ab4b959a18d8f83a9 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 1 Apr 2013 20:46:39 +0200 Subject: add support for actually reading topics --- forummodel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'forummodel.cpp') diff --git a/forummodel.cpp b/forummodel.cpp index 43cb0bd..c66d3a8 100644 --- a/forummodel.cpp +++ b/forummodel.cpp @@ -13,10 +13,7 @@ ForumModel::ForumModel(QObject *parent) : QHash roles = roleNames(); roles[TitleRole] = QByteArray("title"); roles[IconRole] = QByteArray("icon"); - //roles[DescriptionRole] = QByteArray("subtitle"); - //roles[ForumIdRole] = QByteArray("forumId"); - //roles[ParentIdRole] = QByteArray("parentId"); - //roles[CategoryRole] = QByteArray("category"); + roles[TopicIdRole] = QByteArray("topicId"); setRoleNames(roles); } @@ -84,6 +81,9 @@ QVariant ForumModel::data(const QModelIndex &index, int role) const case TitleRole: return _data[row].title; break; + case TopicIdRole: + return _data[row].topic_id; + break; } return QVariant(); @@ -266,6 +266,7 @@ void ForumModel::update() if (!last.isValid() || last.secsTo(QDateTime::currentDateTime()) > FORUM_TOP_TLL) { // Outdated or empty, refresh. + qDebug() << "Fetching topics because the top are old"; _board->enqueueAction(new FetchTopicsAction(_forumId, 0, FORUM_PAGE_SIZE - 1, _board)); } else { qDebug() << "Topics not outdated"; -- cgit v1.2.3