fix(chat): Fix applying edit of nickname using enter key

This commit is contained in:
Stefan Dunca 2022-03-08 12:01:57 +01:00 committed by Stefan Dunca
parent 12b6500fbe
commit 1d6d20200a
2 changed files with 4 additions and 6 deletions

View File

@ -23,7 +23,7 @@ StatusModal {
property int nicknameLength: nicknameInput.textField.text.length
readonly property int maxNicknameLength: 32
property bool nicknameTooLong: nicknameLength > maxNicknameLength
signal doneClicked(string newNickname)
signal editDone(string newNickname)
onOpened: {
nicknameInput.forceActiveFocus(Qt.MouseFocusReason);
@ -59,7 +59,7 @@ StatusModal {
validationError: popup.nicknameTooLong ? qsTrId("your-nickname-is-too-long") : ""
Keys.onReleased: {
if (event.key === Qt.Key_Return) {
doneBtn.onClicked();
editDone()
}
}
@ -82,9 +82,7 @@ StatusModal {
//% "Done"
text: qsTrId("done")
enabled: !popup.nicknameTooLong
onClicked: {
doneClicked(nicknameInput.textField.text)
}
onClicked: editDone(nicknameInput.textField.text)
}
]
}

View File

@ -257,7 +257,7 @@ StatusModal {
nickname: popup.userNickname
header.subTitle: popup.header.subTitle
header.subTitleElide: popup.header.subTitleElide
onDoneClicked: {
onEditDone: {
if(popup.userNickname !== newNickname)
{
popup.userNickname = newNickname;