summaryrefslogtreecommitdiff
path: root/qml
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-06 21:20:30 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-06 21:20:30 +0200
commitb0886b317fd6de5fa960392b2a8a0dbb557475f5 (patch)
treea2e23cd67c601f2abee84b2d9553436f34716921 /qml
parentcb820fa02315cbf5ecc7f87435bc724460104f19 (diff)
downloadtapasboard-b0886b317fd6de5fa960392b2a8a0dbb557475f5.tar.gz
tapasboard-b0886b317fd6de5fa960392b2a8a0dbb557475f5.zip
creating new topics
Diffstat (limited to 'qml')
-rw-r--r--qml/ForumPage.qml10
-rw-r--r--qml/NewTopicSheet.qml97
2 files changed, 107 insertions, 0 deletions
diff --git a/qml/ForumPage.qml b/qml/ForumPage.qml
index 4f2b64f..6c21742 100644
--- a/qml/ForumPage.qml
+++ b/qml/ForumPage.qml
@@ -19,6 +19,16 @@ Page {
}
ToolIcon {
platformIconId: "toolbar-add"
+ onClicked: {
+ var component = Qt.createComponent("NewTopicSheet.qml");
+ if (component.status === Component.Ready) {
+ var sheet = component.createObject(forumPage, {
+ "board": board,
+ "forumId": forumId
+ });
+ sheet.open();
+ }
+ }
}
ToolIcon {
platformIconId: board.busy ? "toolbar-cancle" : "toolbar-refresh"
diff --git a/qml/NewTopicSheet.qml b/qml/NewTopicSheet.qml
new file mode 100644
index 0000000..76cac64
--- /dev/null
+++ b/qml/NewTopicSheet.qml
@@ -0,0 +1,97 @@
+import QtQuick 1.1
+import com.nokia.meego 1.1
+import com.nokia.extras 1.1
+import com.javispedro.tapasboard 1.0
+
+Sheet {
+ id: newTopicSheet
+
+ property Board board;
+ property int forumId;
+
+ anchors.leftMargin: UiConstants.DefaultMargin
+ anchors.rightMargin: UiConstants.DefaultMargin
+
+ acceptButtonText: qsTr("Submit")
+ rejectButtonText: qsTr("Cancel")
+
+ content: Flickable {
+ anchors.fill: parent
+ contentWidth: parent.width
+ contentHeight: subjectLine.height + postText.height
+
+ Item {
+ id: subjectLine
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ }
+ height: childrenRect.height - 1
+
+ Label {
+ id: subjectLabel
+ anchors {
+ margins: UiConstants.DefaultMargin - 2
+ top: parent.top
+ left: parent.left
+ }
+ text: qsTr("Subject:")
+ }
+
+ TextArea {
+ id: subjectText
+ anchors {
+ top: parent.top
+ left: subjectLabel.right
+ right: parent.right
+ }
+
+ platformStyle: TextAreaStyle {
+ background: ""
+ backgroundSelected: ""
+ backgroundDisabled: ""
+ textFont.bold: true
+ }
+
+ placeholderText: qsTr("Write subject here")
+ wrapMode: TextEdit.Wrap
+ }
+
+
+ BorderImage {
+ anchors {
+ top: subjectText.bottom
+ left: parent.left
+ right: parent.right
+ }
+
+ height: 3
+ source: "image://theme/meegotouch-sheet-editor-collapsed-background"
+ }
+ }
+
+ TextArea {
+ id: postText
+ anchors {
+ top: subjectLine.bottom
+ left: parent.left
+ right: parent.right
+ }
+ height: Math.max(400, implicitHeight)
+
+ platformStyle: TextAreaStyle {
+ background: "image://theme/meegotouch-sheet-inputfield-background"
+ backgroundSelected: background
+ backgroundDisabled: ""
+ }
+
+ placeholderText: qsTr("Write your message here")
+ wrapMode: TextEdit.Wrap
+ }
+ }
+
+ onAccepted: {
+ board.newTopic(forumId, subjectText.text, postText.text);
+ }
+}