diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-04-07 04:19:54 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-04-07 04:19:54 +0200 |
commit | 0a3f6f27868a6eaa15d27cfe5be303292737b562 (patch) | |
tree | eca52784e4ad518e3fbeaa0afb104878a1217496 /forummodel.cpp | |
parent | 564f185e62e85fbd1662e9da06abbd853bab7266 (diff) | |
download | tapasboard-0a3f6f27868a6eaa15d27cfe5be303292737b562.tar.gz tapasboard-0a3f6f27868a6eaa15d27cfe5be303292737b562.zip |
add categories for forum view
Diffstat (limited to 'forummodel.cpp')
-rw-r--r-- | forummodel.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/forummodel.cpp b/forummodel.cpp index 14f053f..3e912c6 100644 --- a/forummodel.cpp +++ b/forummodel.cpp @@ -15,7 +15,10 @@ ForumModel::ForumModel(QObject *parent) : roles[TitleRole] = QByteArray("title"); roles[IconRole] = QByteArray("icon"); roles[TopicIdRole] = QByteArray("topicId"); + roles[TopicTypeRole] = QByteArray("topicType"); + roles[LastReplyTimeRole] = QByteArray("lastReplyTime"); roles[NumRepliesRole] = QByteArray("numReplies"); + roles[HumanDateRole] = QByteArray("humanDate"); roles[UnreadRole] = QByteArray("unread"); setRoleNames(roles); } @@ -89,8 +92,19 @@ QVariant ForumModel::data(const QModelIndex &index, int role) const return _data[row].topic_id; case TopicTypeRole: return _data[row].type; + case LastReplyTimeRole: + return _data[row].last_reply_time; case NumRepliesRole: return _data[row].num_replies; + case HumanDateRole: + switch (_data[row].type) { + case Board::Announcement: + return tr("Announcement"); + case Board::Sticky: + return tr("Sticky"); + default: + return _board->renderHumanDate(_data[row].last_reply_time, true); + } case UnreadRole: return _data[row].unread; } |