Merge pull request #9610 from shubham2892/incorrect-file-extension-with-showSaveDialog-fix
Fix incorrect extension when filters is used
This commit is contained in:
commit
e8911fe48c
1 changed files with 9 additions and 4 deletions
|
@ -40,6 +40,7 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
|
||||||
if ([file_type_set count])
|
if ([file_type_set count])
|
||||||
file_types = [file_type_set allObjects];
|
file_types = [file_type_set allObjects];
|
||||||
|
|
||||||
|
[dialog setExtensionHidden:NO];
|
||||||
[dialog setAllowedFileTypes:file_types];
|
[dialog setAllowedFileTypes:file_types];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,15 +76,19 @@ void SetupDialog(NSSavePanel* dialog,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.filters.empty()) {
|
||||||
|
[dialog setAllowsOtherFileTypes:YES];
|
||||||
|
} else {
|
||||||
|
// Set setAllowedFileTypes before setNameFieldStringValue as it might
|
||||||
|
// override the extension set using setNameFieldStringValue
|
||||||
|
SetAllowedFileTypes(dialog, settings.filters);
|
||||||
|
}
|
||||||
|
|
||||||
if (default_dir)
|
if (default_dir)
|
||||||
[dialog setDirectoryURL:[NSURL fileURLWithPath:default_dir]];
|
[dialog setDirectoryURL:[NSURL fileURLWithPath:default_dir]];
|
||||||
if (default_filename)
|
if (default_filename)
|
||||||
[dialog setNameFieldStringValue:default_filename];
|
[dialog setNameFieldStringValue:default_filename];
|
||||||
|
|
||||||
if (settings.filters.empty())
|
|
||||||
[dialog setAllowsOtherFileTypes:YES];
|
|
||||||
else
|
|
||||||
SetAllowedFileTypes(dialog, settings.filters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
|
void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue