summaryrefslogtreecommitdiff
path: root/qml/tapasboard/BoardPage.qml
blob: 57d362d8888305359907ee6000b9d727cfb9f3c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import QtQuick 1.1
import com.nokia.meego 1.1
import com.nokia.extras 1.1
import com.javispedro.tapasboard 1.0

Page {
	id: boardPage

	anchors.leftMargin: UiConstants.DefaultMargin
	anchors.rightMargin: UiConstants.DefaultMargin

	property string boardUrl;
	property int rootForumId;

	tools: ToolBarLayout {
		ToolIcon {
			id: backToolIcon
			platformIconId: "toolbar-back"
			anchors.left: parent.left
			onClicked: pageStack.pop()
		}
	}

	ListView {
		id: forumsView
		anchors.fill: parent
		model: BoardModel {
			boardUrl: boardPage.boardUrl
			rootForumId: boardPage.rootForumId
		}
		section.criteria: ViewSection.FullString
		section.property: "category"
		section.delegate: GroupHeader {
			width: parent.width
			text: section
		}

		delegate: EmptyListDelegate {
			id: forumItem

			height: Math.max(forumItemColumn.height + UiConstants.ButtonSpacing * 2, UiConstants.ListItemHeightDefault)

			Column {
				id: forumItemColumn
				anchors.left: parent.left
				anchors.right: forumItemImage.left
				anchors.verticalCenter: parent.verticalCenter

				Text {
					text: model.title
					width: parent.width
					font: UiConstants.TitleFont
				}

				Text {
					text: model.description
					width: parent.width
					font: UiConstants.SubtitleFont
					wrapMode: Text.Wrap
					visible: text != ""
				}
			}

			Image {
				id: forumItemImage
				source: "image://theme/icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "")
				anchors.right: parent.right
				anchors.verticalCenter: parent.verticalCenter
			}

			onClicked: {
				pageStack.push(Qt.resolvedUrl("ForumPage.qml"), {
				                      boardUrl: boardPage.boardUrl,
				                      forumId: model.forumId
				                    });
			}
		}
	}

	ScrollDecorator {
		flickableItem: forumsView
	}
}