Set up extensions filter correctly in wxFileDialog in wxOSX

We need to call DoOnFilterSelected() to restrict the files that can be
initially selected by the user to the filter.

Closes #17415.
This commit is contained in:
nick863 2016-03-04 19:43:53 +01:00 committed by Vadim Zeitlin
parent 54392cd75f
commit e495ff2246
2 changed files with 13 additions and 1 deletions

View File

@ -69,6 +69,7 @@ wxMSW:
wxOSX:
- Remove extra borders around wxFilePickerCtrl (John Roberts).
- Set up extensions filter correctly in wxFileDialog (nick863).
- Turn off automatic quotes substitutions in wxTextCtrl (Xlord2).

View File

@ -606,7 +606,18 @@ int wxFileDialog::ShowModal()
[oPanel setMessage:cf.AsNSString()];
[oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )];
[oPanel setAllowedFileTypes: (m_delegate == nil ? types : nil)];
// Note that the test here is intentionally different from the one
// above, in the wxFD_SAVE case: we need to call DoOnFilterSelected()
// even for m_firstFileTypeFilter == 0, i.e. when using the default
// filter.
if ( m_firstFileTypeFilter >= 0 )
{
DoOnFilterSelected(m_firstFileTypeFilter);
}
else
{
[oPanel setAllowedFileTypes: (m_delegate == nil ? types : nil)];
}
if ( !m_dir.IsEmpty() )
[oPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString()
isDirectory:YES]];