diff options
author | Jedi18 <targetakhil@gmail.com> | 2021-01-29 12:06:38 +0530 |
---|---|---|
committer | Jedi18 <targetakhil@gmail.com> | 2021-01-29 12:06:38 +0530 |
commit | e09e587796373d4cb2093689c82f9912e5f84c52 (patch) | |
tree | 4eabfbd9acb5d7ddc8d30c7aebca12d37e248056 /resources | |
parent | made requeste changes (diff) | |
download | nheko-e09e587796373d4cb2093689c82f9912e5f84c52.tar.xz |
shifted isUsernameEditingAllowed to qml from c++
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/UserProfile.qml | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml index 79e2b665..4442c97d 100644 --- a/resources/qml/UserProfile.qml +++ b/resources/qml/UserProfile.qml @@ -36,7 +36,10 @@ ApplicationWindow { TextInput { id: displayUsername - readOnly: !profile.isUsernameEditingAllowed + + property bool isUsernameEditingAllowed + + readOnly: !isUsernameEditingAllowed text: profile.displayName font.pixelSize: 20 color: TimelineManager.userColor(profile.userid, colors.window) @@ -44,20 +47,24 @@ ApplicationWindow { Layout.alignment: Qt.AlignHCenter selectByMouse: true - onAccepted: profile.changeUsername(displayUsername.text) + onAccepted: { + profile.changeUsername(displayUsername.text) + displayUsername.isUsernameEditingAllowed = false + } ImageButton { visible: profile.isSelf anchors.leftMargin: 5 anchors.left: displayUsername.right anchors.verticalCenter: displayUsername.verticalCenter - image: profile.isUsernameEditingAllowed ? ":/icons/icons/ui/checkmark.png" : ":/icons/icons/ui/edit.png" + image: displayUsername.isUsernameEditingAllowed ? ":/icons/icons/ui/checkmark.png" : ":/icons/icons/ui/edit.png" onClicked: { - if (profile.isUsernameEditingAllowed) { + if (displayUsername.isUsernameEditingAllowed) { profile.changeUsername(displayUsername.text) + displayUsername.isUsernameEditingAllowed = false } else { - profile.allowUsernameEditing(true) + displayUsername.isUsernameEditingAllowed = true } } } |