aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qml.qrc1
-rw-r--r--qml/ChatPage.qml41
-rw-r--r--qml/ComposePane.qml38
3 files changed, 43 insertions, 37 deletions
diff --git a/qml.qrc b/qml.qrc
index dbebf76..b750885 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -7,6 +7,7 @@
<file>qml/ConfigurePage.qml</file>
<file>qml/SettingsPage.qml</file>
<file>qml/Message.qml</file>
+ <file>qml/ComposePane.qml</file>
<file>qtquickcontrols2.conf</file>
</qresource>
</RCC>
diff --git a/qml/ChatPage.qml b/qml/ChatPage.qml
index 4a4ab2a..431c92f 100644
--- a/qml/ChatPage.qml
+++ b/qml/ChatPage.qml
@@ -83,40 +83,6 @@ Kirigami.ScrollablePage {
anchors.fill: parent
}
- Component {
- id: composePane
-
- Pane {
- Layout.fillWidth: true
- padding: 0
-
- RowLayout {
- width: parent.width
-
- TextArea {
- id: messageField
-
- Layout.fillWidth: true
- placeholderText: qsTr("Message")
- wrapMode: TextArea.Wrap
- selectByMouse: true
- }
-
- Button {
- id: sendButton
-
- icon.name: "document-send"
- text: qsTr("Send")
- enabled: messageField.length > 0
- onClicked: {
- chatPage.context.sendTextMessage(chatPage.chatId, messageField.text)
- messageField.text = ""
- }
- }
- }
- }
- }
-
ListView {
id: messageListView
@@ -142,9 +108,10 @@ Kirigami.ScrollablePage {
}
}
- footer: Loader {
- sourceComponent: composePane
- Layout.fillWidth: true
+ footer: ComposePane {
+ context: chatPage.context
+ chatId: chatPage.chatId
+
visible: chatPage.chat && chatPage.chat.canSend
}
}
diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml
new file mode 100644
index 0000000..bbf075b
--- /dev/null
+++ b/qml/ComposePane.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.12
+import QtQuick.Layouts 1.12
+
+import DeltaChat 1.0
+
+Pane {
+ Layout.fillWidth: true
+ padding: 0
+
+ required property DcContext context
+ required property var chatId
+
+ RowLayout {
+ width: parent.width
+
+ TextArea {
+ id: messageField
+
+ Layout.fillWidth: true
+ placeholderText: qsTr("Message")
+ wrapMode: TextArea.Wrap
+ selectByMouse: true
+ }
+
+ Button {
+ id: sendButton
+
+ icon.name: "document-send"
+ text: qsTr("Send")
+ enabled: messageField.length > 0
+ onClicked: {
+ chatPage.context.sendTextMessage(chatId, messageField.text)
+ messageField.text = ""
+ }
+ }
+ }
+}