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