diff options
author | j.delarago <joeydelarago@gmail.com> | 2022-04-28 15:29:44 +0300 |
---|---|---|
committer | j.delarago <joeydelarago@gmail.com> | 2022-04-28 15:29:44 +0300 |
commit | 8bb1b0bee80ad631294223d9df93dbcd1891bdf0 (patch) | |
tree | f5cac5c4502fdd04135046fa95c6694778f3dc56 /resources/qml | |
parent | 2ecec1fa379c17cc6b975d36ec88f4fc80b09659 (diff) |
selectedNameFilter is now an object instead of a string. The nameFilter has to be manually pulled out using the index in selectedNameFilter.CURA-9214_export_profile_doesnt_work
If only one filter is supplied to nameFilters, the index will always be -1. I assume this is because we are not selecting the file type in the Dialog, it just defaults to the only item.
This code should still work if the behaviour is changed in the future.
FileDialog now uses currentFolder instead of folder.
CURA-9214
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/Preferences/Materials/MaterialsPage.qml | 8 | ||||
-rw-r--r-- | resources/qml/Preferences/ProfilesPage.qml | 9 |
2 files changed, 12 insertions, 5 deletions
diff --git a/resources/qml/Preferences/Materials/MaterialsPage.qml b/resources/qml/Preferences/Materials/MaterialsPage.qml index 1e783c9b4d..b5d6ee464e 100644 --- a/resources/qml/Preferences/Materials/MaterialsPage.qml +++ b/resources/qml/Preferences/Materials/MaterialsPage.qml @@ -246,7 +246,7 @@ UM.ManagementPage break; } messageDialog.open(); - CuraApplication.setDefaultPath("dialog_material_path", folder); + CuraApplication.setDefaultPath("dialog_material_path", currentFolder); } } @@ -259,7 +259,9 @@ UM.ManagementPage currentFolder: CuraApplication.getDefaultPath("dialog_material_path") onAccepted: { - const result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, selectedFile); + var nameFilterString = selectedNameFilter.index >= 0 ? nameFilters[selectedNameFilter.index] : nameFilters[0] + + const result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, nameFilterString, selectedFile); const messageDialog = Qt.createQmlObject("import Cura 1.5 as Cura; Cura.MessageDialog { onClosed: destroy() }", base); messageDialog.title = catalog.i18nc("@title:window", "Export Material"); @@ -275,7 +277,7 @@ UM.ManagementPage } messageDialog.open(); - CuraApplication.setDefaultPath("dialog_material_path", folder); + CuraApplication.setDefaultPath("dialog_material_path", currentFolder); } } } diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 9957747c42..bbc1afb825 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -354,8 +354,13 @@ UM.ManagementPage currentFolder: CuraApplication.getDefaultPath("dialog_profile_path") onAccepted: { + + // If nameFilters contains only 1 item, the index of selectedNameFilter will always be -1 + // This fetches the nameFilter at index selectedNameFilter.index if it is positive + var nameFilterString = selectedNameFilter.index >= 0 ? nameFilters[selectedNameFilter.index] : nameFilters[0] + var result = Cura.ContainerManager.exportQualityChangesGroup(base.currentItem.quality_changes_group, - selectedFile, selectedNameFilter); + selectedFile, nameFilterString); if (result && result.status == "error") { @@ -365,7 +370,7 @@ UM.ManagementPage } // else pop-up Message thing from python code - CuraApplication.setDefaultPath("dialog_profile_path", folder); + CuraApplication.setDefaultPath("dialog_profile_path", currentFolder); } } |