selectedNameFilter is now an object instead of a string. The nameFilter has to be manually pulled out using the index in selectedNameFilter.

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
This commit is contained in:
j.delarago 2022-04-28 14:29:44 +02:00
parent 2ecec1fa37
commit 8bb1b0bee8
2 changed files with 12 additions and 5 deletions

View file

@ -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);
}
}