fix(@desktop/chat): If profile popup is opened close it before another opening

Fix #6650
This commit is contained in:
Michal Iskierko 2022-10-27 12:05:10 +02:00 committed by Michał Iskierko
parent 27c883ae98
commit 58fe1ed8ca
1 changed files with 10 additions and 0 deletions

View File

@ -51,6 +51,8 @@ Item {
// set from main.qml // set from main.qml
property var sysPalette property var sysPalette
signal closeProfilePopup()
Connections { Connections {
target: rootStore.mainModuleInst target: rootStore.mainModuleInst
@ -121,6 +123,9 @@ Item {
} }
onOpenProfilePopupRequested: { onOpenProfilePopupRequested: {
if (Global.profilePopupOpened) {
appMain.closeProfilePopup()
}
Global.openPopup(profilePopupComponent, {publicKey: publicKey, parentPopup: parentPopup}) Global.openPopup(profilePopupComponent, {publicKey: publicKey, parentPopup: parentPopup})
Global.profilePopupOpened = true Global.profilePopupOpened = true
} }
@ -210,6 +215,7 @@ Item {
id: profilePopup id: profilePopup
profileStore: appMain.rootStore.profileSectionStore.profileStore profileStore: appMain.rootStore.profileSectionStore.profileStore
contactsStore: appMain.rootStore.profileSectionStore.contactsStore contactsStore: appMain.rootStore.profileSectionStore.contactsStore
onClosed: { onClosed: {
if (profilePopup.parentPopup) { if (profilePopup.parentPopup) {
profilePopup.parentPopup.close() profilePopup.parentPopup.close()
@ -217,6 +223,10 @@ Item {
Global.profilePopupOpened = false Global.profilePopupOpened = false
destroy() destroy()
} }
Component.onCompleted: {
appMain.closeProfilePopup.connect(profilePopup.close)
}
} }
} }