summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board.h1
-rw-r--r--boardmodel.cpp20
-rw-r--r--boardmodel.h2
-rw-r--r--qml/tapasboard/BoardPage.qml15
4 files changed, 22 insertions, 16 deletions
diff --git a/board.h b/board.h
index f76efbe..facc339 100644
--- a/board.h
+++ b/board.h
@@ -46,7 +46,6 @@ public:
signals:
void configChanged();
void forumsChanged();
- void imageChanged(const QString& imageUrl);
void forumTopicsChanged(int forumId, int start, int end);
void topicPostsChanged(int topicId, int start, int end);
diff --git a/boardmodel.cpp b/boardmodel.cpp
index f8da74e..c2421f7 100644
--- a/boardmodel.cpp
+++ b/boardmodel.cpp
@@ -14,7 +14,7 @@ BoardModel::BoardModel(QObject *parent) :
roles[LogoRole] = QByteArray("logo");
roles[DescriptionRole] = QByteArray("description");
roles[ForumIdRole] = QByteArray("forumId");
- roles[ParentIdRole] = QByteArray("parentId");
+ roles[SubOnlyRole] = QByteArray("subOnly");
roles[CategoryRole] = QByteArray("category");
setRoleNames(roles);
}
@@ -62,18 +62,18 @@ QVariant BoardModel::data(const QModelIndex &index, int role) const
}
switch (role) {
+ case ForumIdRole:
+ return _query.value(0);
case NameRole:
return _query.value(1);
- break;
+ case LogoRole:
+ return _query.value(2);
case DescriptionRole:
+ return _query.value(3);
+ case SubOnlyRole:
return _query.value(4);
- break;
- case ForumIdRole:
- return _query.value(0);
- break;
case CategoryRole:
return _query.value(5);
- break;
}
return QVariant();
@@ -124,10 +124,10 @@ void BoardModel::reload()
Board *board = board_manager->getBoard(_boardUrl);
connect(board, SIGNAL(forumsChanged()), SLOT(reload()));
_query = QSqlQuery(board->database());
- _query.prepare("SELECT f1.forum_id,f1.forum_name,f1.parent_id,f1.logo_url,f1.description,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 AS cat_name FROM forums f1 "
"LEFT JOIN forums f2 ON f2.forum_id = f1.parent_id "
- "WHERE f1.sub_only=0 AND (f1.parent_id=:parent_id_1 OR f1.parent_id IN "
- " (SELECT forum_id from forums WHERE parent_id=:parent_id_2 AND sub_only=1)) "
+ "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) "
"ORDER by f1.sort_index ASC;");
_query.bindValue(0, _rootForumId);
_query.bindValue(1, _rootForumId);
diff --git a/boardmodel.h b/boardmodel.h
index 974173e..3662642 100644
--- a/boardmodel.h
+++ b/boardmodel.h
@@ -21,7 +21,7 @@ public:
DescriptionRole = Qt::StatusTipRole,
ForumIdRole = Qt::UserRole,
- ParentIdRole,
+ SubOnlyRole,
CategoryRole
};
diff --git a/qml/tapasboard/BoardPage.qml b/qml/tapasboard/BoardPage.qml
index 57d362d..4aeba79 100644
--- a/qml/tapasboard/BoardPage.qml
+++ b/qml/tapasboard/BoardPage.qml
@@ -69,10 +69,17 @@ Page {
}
onClicked: {
- pageStack.push(Qt.resolvedUrl("ForumPage.qml"), {
- boardUrl: boardPage.boardUrl,
- forumId: model.forumId
- });
+ if (model.subOnly) {
+ pageStack.push(Qt.resolvedUrl("BoardPage.qml"), {
+ boardUrl: boardPage.boardUrl,
+ rootForumId: model.forumId
+ });
+ } else {
+ pageStack.push(Qt.resolvedUrl("ForumPage.qml"), {
+ boardUrl: boardPage.boardUrl,
+ forumId: model.forumId
+ });
+ }
}
}
}