Implement functionality of export to USB button

It now creates a similar dialogue of what the old button did. The dialogue is no longer necessary in the materials page, so I've moved it to here specifically.

Contributes to issue CURA-8609.
This commit is contained in:
Ghostkeeper 2021-10-06 15:20:26 +02:00
parent e5dc90a519
commit 038db1fc4f
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
3 changed files with 21 additions and 13 deletions

View file

@ -332,6 +332,7 @@ class MaterialManagementModel(QObject):
self._sync_all_dialog = cura.CuraApplication.CuraApplication.getInstance().createQmlComponent(qml_path, {})
if self._sync_all_dialog is None: # Failed to load QML file.
return
self._sync_all_dialog.setProperty("materialManagementModel", self)
self._sync_all_dialog.setProperty("pageIndex", 0)
self._sync_all_dialog.show()

View file

@ -382,19 +382,6 @@ Item
}
}
FileDialog
{
id: exportAllMaterialsDialog
title: catalog.i18nc("@title:window", "Export All Materials")
selectExisting: false
nameFilters: ["Material archives (*.umm)", "All files (*)"]
onAccepted:
{
base.materialManagementModel.exportAll(fileUrl);
CuraApplication.setDefaultPath("dialog_material_path", folder);
}
}
MessageDialog
{
id: messageDialog

View file

@ -3,6 +3,7 @@
import QtQuick 2.1
import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.15
import QtQuick.Window 2.1
import Cura 1.1 as Cura
@ -20,6 +21,7 @@ Window
height: minimumHeight
modality: Qt.ApplicationModal
property variant materialManagementModel
property alias pageIndex: swipeView.currentIndex
SwipeView
@ -430,9 +432,27 @@ Window
{
anchors.right: parent.right
text: catalog.i18nc("@button", "Export material archive")
onClicked:
{
exportUsbDialog.folder = materialManagementModel.getPreferredExportAllPath();
exportUsbDialog.open();
}
}
}
}
}
}
FileDialog
{
id: exportUsbDialog
title: catalog.i18nc("@title:window", "Export All Materials")
selectExisting: false
nameFilters: ["Material archives (*.umm)", "All files (*)"]
onAccepted:
{
materialManagementModel.exportAll(fileUrl);
CuraApplication.setDefaultPath("dialog_material_path", folder);
}
}
}