summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-02-01 19:14:57 +0100
committerGitHub <noreply@github.com>2021-02-01 19:14:57 +0100
commit2b7bd09ad330988301576161d629bca40117bb33 (patch)
treef9a5bf3f0a4f3ea2b4afd4f2491702735871a04b /resources
parentTranslated using Weblate (Hungarian) (diff)
parentfocus and select text on clicking edit button (diff)
downloadnheko-2b7bd09ad330988301576161d629bca40117bb33.tar.xz
Merge pull request #431 from Jedi18/avatar_username_feature
Username editing (room specific and global)
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/UserProfile.qml34
1 files changed, 32 insertions, 2 deletions
diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml

index a1fbfa41..4cb9eb10 100644 --- a/resources/qml/UserProfile.qml +++ b/resources/qml/UserProfile.qml
@@ -17,6 +17,7 @@ ApplicationWindow { minimumHeight: 420 palette: colors color: colors.window + title: profile.isGlobalUserProfile ? "Global User Profile" : "Room User Profile" Shortcut { sequence: StandardKey.Cancel @@ -40,13 +41,42 @@ ApplicationWindow { onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id) } - Label { + TextInput { + id: displayUsername + + property bool isUsernameEditingAllowed + + readOnly: !isUsernameEditingAllowed text: profile.displayName - fontSizeMode: Text.HorizontalFit font.pixelSize: 20 color: TimelineManager.userColor(profile.userid, colors.window) font.bold: true Layout.alignment: Qt.AlignHCenter + selectByMouse: true + + onAccepted: { + profile.changeUsername(displayUsername.text) + displayUsername.isUsernameEditingAllowed = false + } + + ImageButton { + visible: profile.isSelf + anchors.leftMargin: 5 + anchors.left: displayUsername.right + anchors.verticalCenter: displayUsername.verticalCenter + image: displayUsername.isUsernameEditingAllowed ? ":/icons/icons/ui/checkmark.png" : ":/icons/icons/ui/edit.png" + + onClicked: { + if (displayUsername.isUsernameEditingAllowed) { + profile.changeUsername(displayUsername.text) + displayUsername.isUsernameEditingAllowed = false + } else { + displayUsername.isUsernameEditingAllowed = true + displayUsername.focus = true + displayUsername.selectAll() + } + } + } } MatrixText {