diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-04-04 15:49:31 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-04-04 15:49:31 +0200 |
commit | d8fcff1a2d6eb61c97c44790dbdb920ba9f52980 (patch) | |
tree | 49df7f1e07e34061301ad5944a1807feba24b526 /qml/TopicPage.qml | |
parent | 11b4152301b408c7a4f02a8b202fed9f5e1ee1e7 (diff) | |
download | tapasboard-d8fcff1a2d6eb61c97c44790dbdb920ba9f52980.tar.gz tapasboard-d8fcff1a2d6eb61c97c44790dbdb920ba9f52980.zip |
add showing unread posts
Diffstat (limited to 'qml/TopicPage.qml')
-rw-r--r-- | qml/TopicPage.qml | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/qml/TopicPage.qml b/qml/TopicPage.qml new file mode 100644 index 0000000..689dce7 --- /dev/null +++ b/qml/TopicPage.qml @@ -0,0 +1,122 @@ +import QtQuick 1.1 +import com.nokia.meego 1.1 +import com.nokia.extras 1.1 +import com.javispedro.tapasboard 1.0 + +Page { + id: topicPage + + anchors.leftMargin: UiConstants.DefaultMargin + anchors.rightMargin: UiConstants.DefaultMargin + + property Board board; + property int topicId; + + tools: ToolBarLayout { + ToolIcon { + platformIconId: "toolbar-back" + onClicked: pageStack.pop() + } + ToolIcon { + platformIconId: board.busy ? "toolbar-cancle" : "toolbar-refresh" + onClicked: { + if (board.busy) { + board.cancelAllActions(); + } else { + topicModel.refresh(); + } + } + } + } + + ListView { + id: postsView + anchors.fill: parent + model: TopicModel { + id: topicModel + board: topicPage.board + topicId: topicPage.topicId + } + section.property: "humanDate" + section.criteria: ViewSection.FullString + section.delegate: GroupHeader { + width: parent.width + text: section + } + + delegate: Item { + id: postItem + + height: postItemRectangle.height + UiConstants.ButtonSpacing * 2 + width: parent.width + + Rectangle { + id: postItemRectangle + width: parent.width + height: postItemColumn.height + UiConstants.DefaultMargin + anchors.centerIn: parent + + color: "white" + radius: 20 + + Column { + id: postItemColumn + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: UiConstants.DefaultMargin + anchors.verticalCenter: parent.verticalCenter + spacing: 2 + + Item { + width: parent.width + height: childrenRect.height + + Text { + anchors.top: parent.top + anchors.left: parent.left + text: model.userName + font: UiConstants.SmallTitleFont + textFormat: Text.PlainText + } + Text { + anchors.top: parent.top + anchors.right: parent.right + text: model.humanTime + font: UiConstants.SubtitleFont + textFormat: Text.PlainText + } + } + + Text { + text: model.title + width: parent.width + font: UiConstants.TitleFont + visible: text != "" + textFormat: Text.PlainText + wrapMode: Text.Wrap + } + + Text { + text: model.content + width: parent.width + font: UiConstants.SubtitleFont + textFormat: Text.RichText + wrapMode: Text.Wrap + onLinkActivated: Qt.openUrlExternally(link) + } + } + } + } + } + + ScrollDecorator { + flickableItem: postsView + } + + BusyIndicator { + anchors.centerIn: parent + platformStyle: BusyIndicatorStyle { size: "large" } + visible: postsView.count == 0 && board.busy + running: visible + } +} |