summary refs log tree commit diff
path: root/resources/qml/UserProfile.qml
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml/UserProfile.qml')
-rw-r--r--resources/qml/UserProfile.qml17
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
                     }
                 }
             }