Make EditAccount show a spinner until ready

Instead of crashing if userInfo is not yet available.

statusMessage is removed for now from UserUpdated events,
and the users model items will have a "loading" property.
This commit is contained in:
miruka
2019-07-21 07:14:16 -04:00
parent 71f78feec6
commit 853bb350b4
13 changed files with 53 additions and 62 deletions

View File

@@ -15,13 +15,17 @@ HPage {
property string userId: ""
readonly property var userInfo: users.find(userId)
readonly property bool ready: userInfo && ! userInfo.loading
hideHeaderUnderHeight: avatarPreferredSize
headerLabel.text: qsTr("Account settings for %1")
.arg(Utils.coloredNameHtml(userInfo.displayName, userId))
headerLabel.text:
qsTr("Account settings for %1").arg(
Utils.coloredNameHtml(userInfo ? userInfo.displayName : "", userId)
)
HRectangle {
color: theme.box.background
color: ready ? theme.box.background : "transparent"
Behavior on color { HColorAnimation {} }
Layout.alignment: Qt.AlignCenter
@@ -31,18 +35,9 @@ HPage {
Layout.preferredHeight: childrenRect.height
Profile { width: parent.width }
Loader {
width: parent.width
source: ready ? "Profile.qml" : "../../Base/HBusyIndicator.qml"
}
}
// HRectangle {
// color: theme.box.background
// radius: theme.box.radius
// ClientSettings { width: parent.width }
// }
// HRectangle {
// color: theme.box.background
// radius: theme.box.radius
// Devices { width: parent.width }
// }
}