Skip to content

Commit

Permalink
fix(AppMain): Open only one popup per component
Browse files Browse the repository at this point in the history
Close #9131
  • Loading branch information
MishkaRogachev committed Jan 17, 2023
1 parent 34cf8b6 commit 7e767d9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ui/app/mainui/AppMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Item {
// set from main.qml
property var sysPalette

property Component activePopupComponent: null

signal closeProfilePopup()

Connections {
Expand Down Expand Up @@ -158,8 +160,20 @@ Item {
onOpenEditDisplayNamePopup: Global.openPopup(displayNamePopupComponent)

onOpenPopupRequested: {
if (activePopupComponent === popupComponent) {
return;
}

const popup = popupComponent.createObject(appMain, params);
popup.open();

activePopupComponent = popupComponent;

popup.closed.connect(() => {
if (activePopupComponent === popupComponent) {
activePopupComponent = null;
}
})
return popup;
}

Expand Down

0 comments on commit 7e767d9

Please sign in to comment.