EditAccount header: match Display name field

This commit is contained in:
miruka 2019-07-24 16:35:38 -04:00
parent c3746fa106
commit 47d30352fa
2 changed files with 12 additions and 4 deletions

View File

@ -17,10 +17,11 @@ HPage {
readonly property var userInfo: users.find(userId) readonly property var userInfo: users.find(userId)
readonly property bool ready: userInfo && ! userInfo.loading readonly property bool ready: userInfo && ! userInfo.loading
property string headerName: userInfo ? userInfo.displayName : ""
hideHeaderUnderHeight: avatarPreferredSize hideHeaderUnderHeight: avatarPreferredSize
headerLabel.text: headerLabel.text: qsTr("Account settings for %1").arg(
qsTr("Account settings for %1").arg( Utils.coloredNameHtml(headerName, userId)
Utils.coloredNameHtml(userInfo ? userInfo.displayName : "", userId)
) )
HRectangle { HRectangle {

View File

@ -15,6 +15,8 @@ HGridLayout {
py.callClientCoro( py.callClientCoro(
userId, "set_displayname", [nameField.field.text], () => { userId, "set_displayname", [nameField.field.text], () => {
saveButton.nameChangeRunning = false saveButton.nameChangeRunning = false
editAccount.headerName =
Qt.binding(() => userInfo.displayName)
} }
) )
} }
@ -42,6 +44,8 @@ HGridLayout {
aliasField.field.text = aliasField.currentAlias aliasField.field.text = aliasField.currentAlias
fileDialog.selectedFile = "" fileDialog.selectedFile = ""
fileDialog.file = "" fileDialog.file = ""
editAccount.headerName = Qt.binding(() => userInfo.displayName)
} }
columns: 2 columns: 2
@ -127,6 +131,9 @@ HGridLayout {
HLabeledTextField { HLabeledTextField {
property bool changed: field.text != userInfo.displayName property bool changed: field.text != userInfo.displayName
property string fText: field.text
onFTextChanged: editAccount.headerName = field.text
id: nameField id: nameField
label.text: qsTr("Display name:") label.text: qsTr("Display name:")
field.text: userInfo.displayName field.text: userInfo.displayName