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 b2328d6 commit ba5062d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 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 var activePopupComponents: []

signal closeProfilePopup()

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

onOpenPopupRequested: {
if (activePopupComponents.includes(popupComponent)) {
return;
}

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

activePopupComponents.push(popupComponent);

popup.closed.connect(() => {
const removeIndex = activePopupComponents.indexOf(popupComponent);
if (removeIndex !== -1) {
activePopupComponents.splice(removeIndex, 1);
}
})
return popup;
}

Expand Down

0 comments on commit ba5062d

Please sign in to comment.