Merge branch 'Ok_button_dialog' of github.com:Ultimaker/Cura into replace_controls_1_for_controls_2

This commit is contained in:
Jaime van Kessel 2022-02-17 15:21:15 +01:00
commit 5f9e916f29

View File

@ -335,16 +335,19 @@ Item
folder: CuraApplication.getDefaultPath("dialog_material_path") folder: CuraApplication.getDefaultPath("dialog_material_path")
onAccepted: onAccepted:
{ {
var result = Cura.ContainerManager.importMaterialContainer(fileUrl); const result = Cura.ContainerManager.importMaterialContainer(fileUrl);
const messageDialog = Qt.createQmlObject("import UM 1.5 as UM; UM.MessageDialog { onClosed: destroy() }", base);
messageDialog.standardButtons = Dialog.Ok;
messageDialog.title = catalog.i18nc("@title:window", "Import Material"); messageDialog.title = catalog.i18nc("@title:window", "Import Material");
if(result.status == "success") switch (result.status)
{ {
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl); case "success":
} messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl);
else break;
{ default:
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message); messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
break;
} }
messageDialog.open(); messageDialog.open();
CuraApplication.setDefaultPath("dialog_material_path", folder); CuraApplication.setDefaultPath("dialog_material_path", folder);
@ -360,25 +363,23 @@ Item
folder: CuraApplication.getDefaultPath("dialog_material_path") folder: CuraApplication.getDefaultPath("dialog_material_path")
onAccepted: onAccepted:
{ {
var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl); const result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl);
const messageDialog = Qt.createQmlObject("import UM 1.5 as UM; UM.MessageDialog { onClosed: destroy() }", base);
messageDialog.title = catalog.i18nc("@title:window", "Export Material"); messageDialog.title = catalog.i18nc("@title:window", "Export Material");
if(result.status == "error") messageDialog.standardButtons = Dialog.Ok;
switch (result.status)
{ {
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message); case "error":
messageDialog.open(); messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
} break;
else if(result.status == "success") case "success":
{ messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path);
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path); break;
messageDialog.open();
} }
messageDialog.open();
CuraApplication.setDefaultPath("dialog_material_path", folder); CuraApplication.setDefaultPath("dialog_material_path", folder);
} }
} }
UM.MessageDialog
{
id: messageDialog
}
} }