2022-06-20 11:54:17 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import utils 1.0
|
2022-06-22 12:16:21 +00:00
|
|
|
import shared.controls.chat 1.0
|
2022-06-20 11:54:17 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
StatusModal {
|
|
|
|
id: root
|
|
|
|
|
2022-06-22 12:16:21 +00:00
|
|
|
property string userPublicKey: ""
|
|
|
|
property string userDisplayName: ""
|
|
|
|
property string userIcon: ""
|
|
|
|
|
2022-06-20 11:54:17 +00:00
|
|
|
signal accepted(string message)
|
|
|
|
|
2022-06-22 12:16:21 +00:00
|
|
|
padding: 16
|
2022-06-20 11:54:17 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property int maxMsgLength: 280
|
|
|
|
readonly property int minMsgLength: 1
|
|
|
|
readonly property int msgHeight: 152
|
|
|
|
readonly property int contentSpacing: 5
|
|
|
|
}
|
|
|
|
|
2022-06-20 14:48:38 +00:00
|
|
|
ColumnLayout {
|
2022-06-20 11:54:17 +00:00
|
|
|
id: content
|
2022-06-22 12:16:21 +00:00
|
|
|
anchors.fill: parent
|
2022-06-20 11:54:17 +00:00
|
|
|
spacing: d.contentSpacing
|
|
|
|
|
2022-06-22 12:16:21 +00:00
|
|
|
ProfileHeader {
|
2022-06-20 11:54:17 +00:00
|
|
|
Layout.fillWidth: true
|
2022-06-22 12:16:21 +00:00
|
|
|
|
|
|
|
displayName: root.userDisplayName
|
|
|
|
pubkey: root.userPublicKey
|
|
|
|
icon: root.userIcon
|
|
|
|
|
|
|
|
displayNameVisible: false
|
|
|
|
pubkeyVisible: false
|
|
|
|
imageSize: ProfileHeader.ImageSize.Middle
|
|
|
|
editImageButtonVisible: false
|
2022-06-20 11:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: messageInput
|
|
|
|
charLimit: d.maxMsgLength
|
|
|
|
|
2022-07-22 10:28:04 +00:00
|
|
|
placeholderText: qsTr("Say who you are / why you want to become a contact...")
|
2022-06-20 11:54:17 +00:00
|
|
|
input.multiline: true
|
|
|
|
input.implicitHeight: d.msgHeight
|
|
|
|
input.verticalAlignment: TextEdit.AlignTop
|
|
|
|
|
|
|
|
validators: StatusMinLengthValidator {
|
|
|
|
minLength: d.minMsgLength
|
|
|
|
errorMessage: Utils.getErrorMessage(messageInput.errors, qsTr("who are you"))
|
|
|
|
}
|
|
|
|
validationMode: StatusInput.ValidationMode.Always
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rightButtons: StatusButton {
|
|
|
|
enabled: messageInput.valid
|
|
|
|
text: qsTr("Send Contact Request")
|
|
|
|
onClicked: {
|
2022-06-28 18:11:18 +00:00
|
|
|
root.accepted(Utils.escapeHtml(messageInput.text));
|
2022-06-20 11:54:17 +00:00
|
|
|
root.close();
|
|
|
|
}
|
|
|
|
}
|
2022-06-22 12:16:21 +00:00
|
|
|
}
|