From 0c0baf29e858fe063cdfc2831887d4087d087447 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 17 Sep 2020 10:26:26 -0400 Subject: [PATCH] fix: small fixes to the profile popup --- src/status/contacts.nim | 2 +- .../Chat/components/MessageContextMenu.qml | 11 +++++++++-- .../AppLayouts/Chat/components/NicknamePopup.qml | 1 + .../AppLayouts/Chat/components/ProfilePopup.qml | 16 ++++++++-------- ui/nim-status-client.pro | 1 + 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/status/contacts.nim b/src/status/contacts.nim index eee5924352..de89ac6268 100644 --- a/src/status/contacts.nim +++ b/src/status/contacts.nim @@ -51,7 +51,7 @@ proc addContact*(self: ContactModel, id: string, localNickname: string): string self.events.emit("contactAdded", Args()) proc addContact*(self: ContactModel, id: string): string = - result = self.addContact(id) + result = self.addContact(id, "") proc removeContact*(self: ContactModel, id: string) = let contact = self.getContactByID(id) diff --git a/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml b/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml index 84f4905a9b..2ad7f7bf40 100644 --- a/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml +++ b/ui/app/AppLayouts/Chat/components/MessageContextMenu.qml @@ -83,6 +83,7 @@ PopupMenu { } onClicked: { profilePopup.open() + messageContextMenu.close() } } } @@ -95,7 +96,10 @@ PopupMenu { id: viewProfileAction //% "View profile" text: qsTrId("view-profile") - onTriggered: profilePopup.open() + onTriggered: { + profilePopup.open() + messageContextMenu.close() + } icon.source: "../../../img/profileActive.svg" icon.width: 16 icon.height: 16 @@ -106,7 +110,10 @@ PopupMenu { qsTrId("send-message") : //% "Reply to" qsTrId("reply-to") - onTriggered: messageContextMenu.isProfile ? chatsModel.joinChat(profilePopup.fromAuthor, Constants.chatTypeOneToOne) : showReplyArea() + onTriggered: { + messageContextMenu.isProfile ? chatsModel.joinChat(profilePopup.fromAuthor, Constants.chatTypeOneToOne) : showReplyArea() + messageContextMenu.close() + } icon.source: "../../../img/messageActive.svg" icon.width: 16 icon.height: 16 diff --git a/ui/app/AppLayouts/Chat/components/NicknamePopup.qml b/ui/app/AppLayouts/Chat/components/NicknamePopup.qml index d3e5a9c4ab..96a9528184 100644 --- a/ui/app/AppLayouts/Chat/components/NicknamePopup.qml +++ b/ui/app/AppLayouts/Chat/components/NicknamePopup.qml @@ -78,6 +78,7 @@ ModalPopup { disabled: popup.nicknameLength === 0 || popup.nicknameTooLong onClicked: { userName = nicknameInput.textField.text + nickname = nicknameInput.textField.text profileModel.changeContactNickname(fromAuthor, nicknameInput.textField.text) popup.close() } diff --git a/ui/app/AppLayouts/Chat/components/ProfilePopup.qml b/ui/app/AppLayouts/Chat/components/ProfilePopup.qml index 2e1d4d132d..ea5d816a11 100644 --- a/ui/app/AppLayouts/Chat/components/ProfilePopup.qml +++ b/ui/app/AppLayouts/Chat/components/ProfilePopup.qml @@ -8,12 +8,12 @@ import "./" ModalPopup { id: popup - property string identicon: "" - property string userName: "" - property string nickname: "" - property string fromAuthor: "" - property string text: "" - property string alias: "" + property var identicon: "" + property var userName: "" + property var nickname: "" + property var fromAuthor: "" + property var text: "" + property var alias: "" property bool showQR: false property bool isEnsVerified: false @@ -32,9 +32,9 @@ ModalPopup { isEnsVerified = chatsModel.isEnsVerified(this.fromAuthor) alias = chatsModel.alias(this.fromAuthor) || "" } - + function openPopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam) { - setPopupData(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam); + setPopupData(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam) popup.open() } diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 8b93f1e41a..fa4a6a2bb3 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -152,6 +152,7 @@ DISTFILES += \ app/AppLayouts/Chat/components/EmojiCategoryButton.qml \ app/AppLayouts/Chat/components/EmojiPopup.qml \ app/AppLayouts/Chat/components/EmojiReaction.qml \ + app/AppLayouts/Chat/components/ProfilePopup.qml \ app/AppLayouts/Chat/components/EmojiSection.qml \ app/AppLayouts/Chat/components/InviteFriendsPopup.qml \ app/AppLayouts/Chat/components/MessageContextMenu.qml \