From 1ca68052f0d14b557ea0a8495fa8bcfade4f8641 Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Fri, 17 May 2024 11:04:39 +0200 Subject: [PATCH] Dialog pop should be done via accept destination --- ui/qml/components/platform.kirigami/DialogPL.qml | 12 +++++++----- ui/qml/pages/FirstPage.qml | 11 ++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ui/qml/components/platform.kirigami/DialogPL.qml b/ui/qml/components/platform.kirigami/DialogPL.qml index 8a2c2803..ee68edcc 100644 --- a/ui/qml/components/platform.kirigami/DialogPL.qml +++ b/ui/qml/components/platform.kirigami/DialogPL.qml @@ -35,12 +35,14 @@ PagePL { onAccepted: { if (acceptDestination) { - if (acceptDestinationPop) + if (acceptDestinationPop) { app.pages.pop(acceptDestination); - else - app.push(acceptDestination); - } //else - //app.pages.pop(); + } else { + app.pages.push(acceptDestination); + } + } else { + app.pages.pop(); + } } function accept() { diff --git a/ui/qml/pages/FirstPage.qml b/ui/qml/pages/FirstPage.qml index e2964638..c82907f1 100644 --- a/ui/qml/pages/FirstPage.qml +++ b/ui/qml/pages/FirstPage.qml @@ -11,21 +11,18 @@ PagePL { function unpairAccepted() { DaemonInterfaceInstance.disconnect(); - app.pages.push(Qt.resolvedUrl("./PairSelectDeviceType.qml")); } pageMenu: PageMenuPL { PageMenuItemPL { text: qsTr("Pair with watch") onClicked: { - var page = AmazfishConfig.pairedAddress - ? "UnpairDeviceDialog.qml" - : "PairSelectDeviceType.qml" - - var obj = app.pages.push(Qt.resolvedUrl(page)); - if (AmazfishConfig.pairedAddress) { + var obj = app.pages.push(Qt.resolvedUrl("UnpairDeviceDialog.qml")); + obj.acceptDestination = Qt.resolvedUrl("PairSelectDeviceType.qml") obj.accepted.connect(unpairAccepted); + } else { + app.pages.push(Qt.resolvedUrl("PairSelectDeviceType.qml")); } } }