From ebffda68c248ce1282511774a173b4c5b72d8524 Mon Sep 17 00:00:00 2001 From: NickVs2015 Date: Wed, 17 Jun 2026 11:35:37 +0300 Subject: [PATCH] fix: double call filepicker --- client/ui/qml/Pages2/PageSettingsBackup.qml | 19 +++++++++++++++++-- .../Pages2/PageSetupWizardConfigSource.qml | 15 +++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/client/ui/qml/Pages2/PageSettingsBackup.qml b/client/ui/qml/Pages2/PageSettingsBackup.qml index 20056dce5..6d7bdf157 100644 --- a/client/ui/qml/Pages2/PageSettingsBackup.qml +++ b/client/ui/qml/Pages2/PageSettingsBackup.qml @@ -17,6 +17,8 @@ import "../Controls2/TextTypes" PageType { id: root + property bool isRestoringBackup: false + Connections { target: SettingsController @@ -138,9 +140,14 @@ PageType { textColor: AmneziaStyle.color.paleGray borderWidth: 1 + enabled: !root.isRestoringBackup + text: qsTr("Restore from backup") clickedFunc: function() { + if (root.isRestoringBackup) { + return + } var filePath = SystemController.getFileName(qsTr("Open backup file"), qsTr("Backup files (*.backup)")) if (filePath !== "") { @@ -152,6 +159,10 @@ PageType { } function restoreBackup(filePath) { + if (root.isRestoringBackup) { + return + } + var headerText = qsTr("Import settings from a backup file?") var descriptionText = qsTr("All current settings will be reset"); var yesButtonText = qsTr("Continue") @@ -161,9 +172,13 @@ PageType { if (ConnectionController.isConnected) { PageController.showNotificationMessage(qsTr("Cannot restore backup settings during active connection")) } else { + root.isRestoringBackup = true PageController.showBusyIndicator(true) - SettingsController.restoreAppConfig(filePath) - PageController.showBusyIndicator(false) + Qt.callLater(function() { + SettingsController.restoreAppConfig(filePath) + PageController.showBusyIndicator(false) + root.isRestoringBackup = false + }) } } var noButtonFunction = function() { diff --git a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml index 970587846..7f8c30292 100644 --- a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml +++ b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml @@ -16,6 +16,8 @@ import "../Config" PageType { id: root + property bool isRestoringBackup: false + Connections { target: ImportController @@ -228,6 +230,8 @@ PageType { rightImageSource: "qrc:/images/controls/chevron-right.svg" leftImageSource: imageSource + enabled: !root.isRestoringBackup + onClicked: { handler() } Keys.onEnterPressed: this.clicked() @@ -314,12 +318,19 @@ PageType { property string imageSource: "qrc:/images/controls/archive-restore.svg" property bool isVisible: PageController.isStartPageVisible() property var handler: function() { + if (root.isRestoringBackup) { + return + } var filePath = SystemController.getFileName(qsTr("Open backup file"), qsTr("Backup files (*.backup)")) if (filePath !== "") { + root.isRestoringBackup = true PageController.showBusyIndicator(true) - SettingsController.restoreAppConfig(filePath) - PageController.showBusyIndicator(false) + Qt.callLater(function() { + SettingsController.restoreAppConfig(filePath) + PageController.showBusyIndicator(false) + root.isRestoringBackup = false + }) } } }