From 3f84b84a114bb094e85407fba83e544e8a7e59b6 Mon Sep 17 00:00:00 2001 From: Anmol Garg Date: Wed, 9 Sep 2026 16:46:09 +0530 Subject: [PATCH 1/2] Warn user and prevent switching when no remote account is logged in --- qml/app/AppDrawer.qml | 4 +++- qml/app/navigation/MenuPage.qml | 4 +++- qml/components/dialogs/AccountSelectorDialog.qml | 12 ++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/qml/app/AppDrawer.qml b/qml/app/AppDrawer.qml index 06f72516..35bc135d 100644 --- a/qml/app/AppDrawer.qml +++ b/qml/app/AppDrawer.qml @@ -138,7 +138,9 @@ Controls.Drawer { onClicked: { if (typeof accountPicker !== "undefined") { - accountPicker.toggleLocalMode(checked); + if (!accountPicker.toggleLocalMode(checked)) { + checked = true; + } } } diff --git a/qml/app/navigation/MenuPage.qml b/qml/app/navigation/MenuPage.qml index e980ee40..677e3c63 100644 --- a/qml/app/navigation/MenuPage.qml +++ b/qml/app/navigation/MenuPage.qml @@ -142,7 +142,9 @@ Page { onClicked: { if (typeof accountPicker !== "undefined") { - accountPicker.toggleLocalMode(checked); + if (!accountPicker.toggleLocalMode(checked)) { + checked = true; + } } } diff --git a/qml/components/dialogs/AccountSelectorDialog.qml b/qml/components/dialogs/AccountSelectorDialog.qml index 70a2879b..61966619 100644 --- a/qml/components/dialogs/AccountSelectorDialog.qml +++ b/qml/components/dialogs/AccountSelectorDialog.qml @@ -54,15 +54,23 @@ Item { selectedAccountName = Accounts.getAccountName(0) accepted(0, selectedAccountName) } + return true } else { - var targetId = lastRemoteAccountId > 0 ? lastRemoteAccountId : Accounts.getDefaultRemoteAccountId() + var targetId = (lastRemoteAccountId > 0 && Accounts.getAccountName(lastRemoteAccountId)) + ? lastRemoteAccountId + : Accounts.getDefaultRemoteAccountId() if (targetId > 0 && selectedAccountId !== targetId) { selectedAccountId = targetId selectedAccountName = Accounts.getAccountName(targetId) accepted(targetId, selectedAccountName) + return true } else if (targetId <= 0) { - open(selectedAccountId) + if (typeof notifPopup !== "undefined") { + notifPopup.open(i18n.dtr("ubtms", "Notice"), i18n.dtr("ubtms", "You don't have any account logged in"), "warning") + } + return false } + return true } } From 86042fc87bd001d3a9fa4c402f8808daddb07d83 Mon Sep 17 00:00:00 2001 From: Anmol Garg Date: Mon, 14 Sep 2026 12:00:47 +0530 Subject: [PATCH 2/2] Fix multiple overlapping pop-ups on repeated account toggle (#334) - Make NotificationPopup modal and guard open() with activeDialog reference - Guard AccountSelectorDialog open() against duplicate active dialogs - Reset activeDialog on dialog destruction and close --- .../dialogs/AccountSelectorDialog.qml | 10 +++++++++- qml/components/feedback/NotificationPopup.qml | 20 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/qml/components/dialogs/AccountSelectorDialog.qml b/qml/components/dialogs/AccountSelectorDialog.qml index 61966619..66f72059 100644 --- a/qml/components/dialogs/AccountSelectorDialog.qml +++ b/qml/components/dialogs/AccountSelectorDialog.qml @@ -39,11 +39,15 @@ Item { // carry initial request until dialog is visible property int _initialAccountId: -2 // -2 = none, -1 = "All" + property var activeDialog: null /** Show dialog; optionally preselect an account id */ function open(initialAccountId) { + if (activeDialog) + return activeDialog _initialAccountId = (typeof initialAccountId === "number") ? initialAccountId : -2 - PopupUtils.open(dialogComponent) + activeDialog = PopupUtils.open(dialogComponent) + return activeDialog } /** Toggle between Local Account (0) and last active remote account */ @@ -293,6 +297,10 @@ Item { loadAccounts() } } + + Component.onDestruction: { + root.activeDialog = null + } } } } diff --git a/qml/components/feedback/NotificationPopup.qml b/qml/components/feedback/NotificationPopup.qml index 16b4d70f..74fa94f4 100644 --- a/qml/components/feedback/NotificationPopup.qml +++ b/qml/components/feedback/NotificationPopup.qml @@ -37,6 +37,8 @@ Item { property string type: "info" // "success", "error", "warning", "info" property string titleText: "Notice" property string messageText: "Something happened." + property var activeDialog: null + readonly property bool isOpen: activeDialog !== null signal closed Component { @@ -45,6 +47,7 @@ Item { Dialog { id: popupDialog title: popupWrapper.titleText + modal: true // Dark mode friendly styling StyleHints { @@ -68,7 +71,11 @@ Item { // Color logic based on type (optional, add custom styling if needed) Button { text: "OK" - onClicked: PopupUtils.close(popupDialog) + onClicked: { + PopupUtils.close(popupDialog); + popupWrapper.activeDialog = null; + popupWrapper.closed(); + } // Dark mode friendly button styling StyleHints { @@ -77,6 +84,10 @@ Item { backgroundColor: LomiriColors.orange } } + + Component.onDestruction: { + popupWrapper.activeDialog = null; + } } } @@ -87,6 +98,11 @@ Item { messageText = messageArg; if (typeArg) type = typeArg; - PopupUtils.open(dialogComponent); + + if (activeDialog) + return activeDialog; + + activeDialog = PopupUtils.open(dialogComponent); + return activeDialog; } }