fix: small fixes to the profile popup

This commit is contained in:
Jonathan Rainville 2020-09-17 10:26:26 -04:00 committed by Iuri Matias
parent 6e357cb5e2
commit 0c0baf29e8
5 changed files with 20 additions and 11 deletions

View File

@ -51,7 +51,7 @@ proc addContact*(self: ContactModel, id: string, localNickname: string): string
self.events.emit("contactAdded", Args()) self.events.emit("contactAdded", Args())
proc addContact*(self: ContactModel, id: string): string = proc addContact*(self: ContactModel, id: string): string =
result = self.addContact(id) result = self.addContact(id, "")
proc removeContact*(self: ContactModel, id: string) = proc removeContact*(self: ContactModel, id: string) =
let contact = self.getContactByID(id) let contact = self.getContactByID(id)

View File

@ -83,6 +83,7 @@ PopupMenu {
} }
onClicked: { onClicked: {
profilePopup.open() profilePopup.open()
messageContextMenu.close()
} }
} }
} }
@ -95,7 +96,10 @@ PopupMenu {
id: viewProfileAction id: viewProfileAction
//% "View profile" //% "View profile"
text: qsTrId("view-profile") text: qsTrId("view-profile")
onTriggered: profilePopup.open() onTriggered: {
profilePopup.open()
messageContextMenu.close()
}
icon.source: "../../../img/profileActive.svg" icon.source: "../../../img/profileActive.svg"
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16
@ -106,7 +110,10 @@ PopupMenu {
qsTrId("send-message") : qsTrId("send-message") :
//% "Reply to" //% "Reply to"
qsTrId("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.source: "../../../img/messageActive.svg"
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16

View File

@ -78,6 +78,7 @@ ModalPopup {
disabled: popup.nicknameLength === 0 || popup.nicknameTooLong disabled: popup.nicknameLength === 0 || popup.nicknameTooLong
onClicked: { onClicked: {
userName = nicknameInput.textField.text userName = nicknameInput.textField.text
nickname = nicknameInput.textField.text
profileModel.changeContactNickname(fromAuthor, nicknameInput.textField.text) profileModel.changeContactNickname(fromAuthor, nicknameInput.textField.text)
popup.close() popup.close()
} }

View File

@ -8,12 +8,12 @@ import "./"
ModalPopup { ModalPopup {
id: popup id: popup
property string identicon: "" property var identicon: ""
property string userName: "" property var userName: ""
property string nickname: "" property var nickname: ""
property string fromAuthor: "" property var fromAuthor: ""
property string text: "" property var text: ""
property string alias: "" property var alias: ""
property bool showQR: false property bool showQR: false
property bool isEnsVerified: false property bool isEnsVerified: false
@ -32,9 +32,9 @@ ModalPopup {
isEnsVerified = chatsModel.isEnsVerified(this.fromAuthor) isEnsVerified = chatsModel.isEnsVerified(this.fromAuthor)
alias = chatsModel.alias(this.fromAuthor) || "" alias = chatsModel.alias(this.fromAuthor) || ""
} }
function openPopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam) { function openPopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam) {
setPopupData(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam); setPopupData(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam)
popup.open() popup.open()
} }

View File

@ -152,6 +152,7 @@ DISTFILES += \
app/AppLayouts/Chat/components/EmojiCategoryButton.qml \ app/AppLayouts/Chat/components/EmojiCategoryButton.qml \
app/AppLayouts/Chat/components/EmojiPopup.qml \ app/AppLayouts/Chat/components/EmojiPopup.qml \
app/AppLayouts/Chat/components/EmojiReaction.qml \ app/AppLayouts/Chat/components/EmojiReaction.qml \
app/AppLayouts/Chat/components/ProfilePopup.qml \
app/AppLayouts/Chat/components/EmojiSection.qml \ app/AppLayouts/Chat/components/EmojiSection.qml \
app/AppLayouts/Chat/components/InviteFriendsPopup.qml \ app/AppLayouts/Chat/components/InviteFriendsPopup.qml \
app/AppLayouts/Chat/components/MessageContextMenu.qml \ app/AppLayouts/Chat/components/MessageContextMenu.qml \