Browse Source

Change button to 'done' once USB export has completed

Also important to keep in mind: It won't change to 'done' if the user cancelled the file dialogue.

Contributes to issue CURA-8609.
Ghostkeeper 3 years ago
parent
commit
c58d03ad4c
1 changed files with 14 additions and 3 deletions
  1. 14 3
      resources/qml/Preferences/Materials/MaterialsSyncDialog.qml

+ 14 - 3
resources/qml/Preferences/Materials/MaterialsSyncDialog.qml

@@ -682,12 +682,22 @@ Window
                     }
                     Cura.PrimaryButton
                     {
+                        id: exportUsbButton
                         anchors.right: parent.right
-                        text: catalog.i18nc("@button", "Export material archive")
+
+                        property bool hasExported: false
+                        text: hasExported ? catalog.i18nc("@button", "Done") : catalog.i18nc("@button", "Export material archive")
                         onClicked:
                         {
-                            exportUsbDialog.folder = syncModel.getPreferredExportAllPath();
-                            exportUsbDialog.open();
+                            if(!hasExported)
+                            {
+                                exportUsbDialog.folder = syncModel.getPreferredExportAllPath();
+                                exportUsbDialog.open();
+                            }
+                            else
+                            {
+                                materialsSyncDialog.close();
+                            }
                         }
                     }
                 }
@@ -719,6 +729,7 @@ Window
         {
             syncModel.exportAll(fileUrl);
             CuraApplication.setDefaultPath("dialog_material_path", folder);
+            exportUsbButton.hasExported = true;
         }
     }
 }