diff options
Diffstat (limited to 'boardmodel.cpp')
-rw-r--r-- | boardmodel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/boardmodel.cpp b/boardmodel.cpp index dc1757e..3e24769 100644 --- a/boardmodel.cpp +++ b/boardmodel.cpp @@ -16,6 +16,7 @@ BoardModel::BoardModel(QObject *parent) : roles[ForumIdRole] = QByteArray("forumId"); roles[SubOnlyRole] = QByteArray("subOnly"); roles[CategoryRole] = QByteArray("category"); + roles[UnreadRole] = QByteArray("unread"); setRoleNames(roles); } @@ -78,6 +79,8 @@ QVariant BoardModel::data(const QModelIndex &index, int role) const return _query.value(4); case CategoryRole: return _query.value(5); + case UnreadRole: + return _query.value(6); } return QVariant(); @@ -134,7 +137,7 @@ void BoardModel::reload() if (_board && _forumId >= 0) { _query = QSqlQuery(_board->database()); - _query.prepare("SELECT f1.forum_id,f1.forum_name,f1.logo_url,f1.description,f1.sub_only,f2.forum_name AS cat_name FROM forums f1 " + _query.prepare("SELECT f1.forum_id,f1.forum_name,f1.logo_url,f1.description,f1.sub_only,f2.forum_name,f1.new_post AS cat_name FROM forums f1 " "LEFT JOIN forums f2 ON f2.forum_id = f1.parent_id " "WHERE (f1.parent_id=:parent_id_1 AND f1.sub_only = 0) OR f1.parent_id IN " "(SELECT forum_id from forums WHERE parent_id=:parent_id_2 AND sub_only=1) " |