From cb820fa02315cbf5ecc7f87435bc724460104f19 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sat, 6 Apr 2013 20:34:56 +0200 Subject: support replying to posts --- qml/ForumPage.qml | 6 ++++++ qml/NewPostSheet.qml | 38 ++++++++++++++++++++++++++++++++++++++ qml/TopicPage.qml | 18 ++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 qml/NewPostSheet.qml (limited to 'qml') diff --git a/qml/ForumPage.qml b/qml/ForumPage.qml index ee04e43..4f2b64f 100644 --- a/qml/ForumPage.qml +++ b/qml/ForumPage.qml @@ -17,6 +17,9 @@ Page { platformIconId: "toolbar-back" onClicked: pageStack.pop() } + ToolIcon { + platformIconId: "toolbar-add" + } ToolIcon { platformIconId: board.busy ? "toolbar-cancle" : "toolbar-refresh" onClicked: { @@ -27,6 +30,9 @@ Page { } } } + ToolIcon { + platformIconId: "toolbar-view-menu" + } } ListView { diff --git a/qml/NewPostSheet.qml b/qml/NewPostSheet.qml new file mode 100644 index 0000000..96de9bc --- /dev/null +++ b/qml/NewPostSheet.qml @@ -0,0 +1,38 @@ +import QtQuick 1.1 +import com.nokia.meego 1.1 +import com.nokia.extras 1.1 +import com.javispedro.tapasboard 1.0 + +Sheet { + id: newPostSheet + + property Board board; + property int topicId; + + anchors.leftMargin: UiConstants.DefaultMargin + anchors.rightMargin: UiConstants.DefaultMargin + + acceptButtonText: qsTr("Submit") + rejectButtonText: qsTr("Cancel") + + content: TextArea { + id: postText + anchors { + fill: parent + } + + platformStyle: TextAreaStyle { + background: "image://theme/meegotouch-sheet-inputfield-background" + backgroundSelected: background + backgroundDisabled: "" + } + + placeholderText: qsTr("Write your reply here") + focus: true + wrapMode: TextEdit.Wrap + } + + onAccepted: { + board.replyToTopic(topicId, postText.text) + } +} diff --git a/qml/TopicPage.qml b/qml/TopicPage.qml index ebaa2c6..32a86ec 100644 --- a/qml/TopicPage.qml +++ b/qml/TopicPage.qml @@ -17,6 +17,19 @@ Page { platformIconId: "toolbar-back" onClicked: pageStack.pop() } + ToolIcon { + platformIconId: "toolbar-add" + onClicked: { + var component = Qt.createComponent("NewPostSheet.qml"); + if (component.status === Component.Ready) { + var sheet = component.createObject(topicPage, { + "board": board, + "topicId": topicId + }); + sheet.open(); + } + } + } ToolIcon { platformIconId: board.busy ? "toolbar-cancle" : "toolbar-refresh" onClicked: { @@ -27,6 +40,9 @@ Page { } } } + ToolIcon { + platformIconId: "toolbar-view-menu" + } } ListView { @@ -49,6 +65,8 @@ Page { text: section } + cacheBuffer: 200 + delegate: Item { id: postItem -- cgit v1.2.3