From bfb8d9ddf177e94c02f4f8d523d29a7b78d429e7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 12 Oct 2021 17:34:34 +0200 Subject: [PATCH] Show 'Done' button when sync was successful And make it close the window when pressed then. Contributes to issue CURA-8609. --- .../Materials/MaterialsSyncDialog.qml | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index 83195611f2..8e51cd2dd7 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -452,8 +452,29 @@ Window { id: syncButton anchors.right: parent.right - text: (typeof syncModel !== "undefined" && syncModel.exportUploadStatus == "error") ? catalog.i18nc("@button", "Try again") : catalog.i18nc("@button", "Sync") - onClicked: syncModel.exportUpload() + text: + { + if(typeof syncModel !== "undefined" && syncModel.exportUploadStatus == "error") + { + return catalog.i18nc("@button", "Try again"); + } + if(typeof syncModel !== "undefined" && syncModel.exportUploadStatus == "success") + { + return catalog.i18nc("@button", "Done"); + } + return catalog.i18nc("@button", "Sync"); + } + onClicked: + { + if(typeof syncModel !== "undefined" && syncModel.exportUploadStatus == "success") + { + materialsSyncDialog.close(); + } + else + { + syncModel.exportUpload(); + } + } visible: { if(!syncModel) //When the dialog is created, this is not set yet.