summaryrefslogtreecommitdiff
path: root/qml/NewTopicSheet.qml
blob: 76cac6416eb5f5f2a80df803145fe6b776b199af (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
84
85
86
87
88
89
90
91
92
93
94
95
96
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);
	}
}