Set user typing state when using the SendBox

This commit is contained in:
miruka
2019-04-19 03:11:56 -04:00
parent 1d0cce402e
commit 9a1b91caa5
3 changed files with 48 additions and 2 deletions

View File

@@ -33,6 +33,8 @@ Rectangle {
clip: true
TextArea {
property string typedText: text
id: textArea
placeholderText: qsTr("Type a message...")
wrapMode: TextEdit.Wrap
@@ -41,6 +43,14 @@ Rectangle {
font.pixelSize: 16
focus: true
function set_typing(typing) {
Backend.clientManager.clients[chatPage.user_id]
.setTypingState(chatPage.room.room_id, typing)
}
onTypedTextChanged: set_typing(Boolean(text))
onEditingFinished: set_typing(false) // when lost focus
Keys.onReturnPressed: {
event.accepted = true
@@ -57,6 +67,7 @@ Rectangle {
.sendMarkdown(chatPage.room.room_id, textArea.text)
textArea.clear()
}
Keys.onEnterPressed: Keys.onReturnPressed(event) // numpad enter
}
}