diff --git a/docs/changes.txt b/docs/changes.txt index f701982499..31d43b9b23 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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). diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 540358f757..3316b3e414 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -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]];