2020-05-29 16:22:53 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2020-08-24 05:44:25 -04:00
|
|
|
import "../../.."
|
2020-05-29 16:22:53 -04:00
|
|
|
import "../../../Base"
|
2020-08-21 05:39:46 -04:00
|
|
|
import "../AutoCompletion"
|
2020-05-29 16:22:53 -04:00
|
|
|
|
|
|
|
Rectangle {
|
2020-08-21 05:39:46 -04:00
|
|
|
property UserAutoCompletion userCompletion
|
2020-05-29 16:22:53 -04:00
|
|
|
property alias eventList: messageArea.eventList
|
2020-08-21 05:39:46 -04:00
|
|
|
|
2020-06-05 05:42:12 -04:00
|
|
|
readonly property bool hasFocus: messageArea.activeFocus
|
2020-08-21 05:39:46 -04:00
|
|
|
readonly property alias messageArea: messageArea
|
2020-05-29 16:22:53 -04:00
|
|
|
|
|
|
|
function takeFocus() { messageArea.forceActiveFocus() }
|
|
|
|
|
|
|
|
|
2020-08-21 05:39:46 -04:00
|
|
|
implicitHeight: Math.max(theme.baseElementsHeight, row.implicitHeight)
|
2020-05-29 16:22:53 -04:00
|
|
|
color: theme.chat.composer.background
|
|
|
|
|
2020-08-21 05:39:46 -04:00
|
|
|
HRowLayout {
|
|
|
|
id: row
|
2020-05-29 16:22:53 -04:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2020-08-21 05:39:46 -04:00
|
|
|
HUserAvatar {
|
|
|
|
id: avatar
|
2020-05-29 16:22:53 -04:00
|
|
|
|
2020-08-24 05:44:25 -04:00
|
|
|
readonly property QtObject writerInfo:
|
|
|
|
ModelStore.get("accounts").find(clientUserId)
|
2020-08-20 12:21:47 -04:00
|
|
|
|
2020-08-24 05:44:25 -04:00
|
|
|
clientUserId: messageArea.writerId
|
|
|
|
userId: clientUserId
|
|
|
|
mxc: writerInfo ? writerInfo.avatar_url : ""
|
|
|
|
displayName: writerInfo ? writerInfo.display_name : ""
|
|
|
|
radius: 0
|
2020-08-21 05:39:46 -04:00
|
|
|
}
|
2020-08-20 12:21:47 -04:00
|
|
|
|
2020-08-21 05:39:46 -04:00
|
|
|
HScrollView {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
2020-08-20 12:21:47 -04:00
|
|
|
|
2020-08-21 05:39:46 -04:00
|
|
|
MessageArea {
|
|
|
|
id: messageArea
|
2020-09-01 14:27:28 -04:00
|
|
|
autoCompletionOpen: userCompletion.open && userCompletion.count
|
2020-08-21 05:39:46 -04:00
|
|
|
usersCompleted: userCompletion.usersCompleted
|
2020-08-20 12:21:47 -04:00
|
|
|
|
2020-08-21 05:39:46 -04:00
|
|
|
onAutoCompletePrevious: userCompletion.previous()
|
|
|
|
onAutoCompleteNext: userCompletion.next()
|
|
|
|
onCancelAutoCompletion: userCompletion.cancel()
|
|
|
|
onAcceptAutoCompletion:
|
|
|
|
! userCompletion.autoOpen ||
|
|
|
|
userCompletion.autoOpenCompleted ?
|
|
|
|
userCompletion.accept() :
|
|
|
|
null
|
2020-08-20 12:21:47 -04:00
|
|
|
}
|
2020-08-21 05:39:46 -04:00
|
|
|
}
|
2020-05-29 16:22:53 -04:00
|
|
|
|
2020-08-21 05:39:46 -04:00
|
|
|
UploadButton {
|
|
|
|
Layout.fillHeight: true
|
2020-05-29 16:22:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|