X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/efaa0436fbf19a51d16fcd13fe9a764ec1bfc6de..3c5487b14442ddbc6e43ee2f4475b5a6ba251fb1:/src/common/fldlgcmn.cpp?ds=sidebyside diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 01e9facb94..c9d8e15494 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -43,21 +43,40 @@ wxFileDialogBase::wxFileDialogBase(wxWindow *parent, const wxString& wildCard, long style, const wxPoint& WXUNUSED(pos)) + : m_message(message), + m_dir(defaultDir), + m_fileName(defaultFile), + m_wildCard(wildCard) { m_parent = parent; - m_message = message; - m_dir = defaultDir; - m_fileName = defaultFile; - if (wildCard.IsEmpty()) m_wildCard = wxFileSelectorDefaultWildcardStr; m_dialogStyle = style; - m_path = wxT(""); m_filterIndex = 0; - // convert m_wildCard from "*.bar" to "Files (*.bar)|*.bar" - if ( m_wildCard.Find(wxT('|')) == wxNOT_FOUND ) + if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr ) { - m_wildCard = wxString::Format(_("Files (%s)|%s"), - m_wildCard.c_str(), m_wildCard.c_str()); + m_wildCard = wxString::Format(_("All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr); + } + else // have wild card + { + // convert m_wildCard from "*.bar" to "bar files (*.bar)|*.bar" + if ( m_wildCard.Find(wxT('|')) == wxNOT_FOUND ) + { + wxString::size_type nDot = m_wildCard.find(_T("*.")); + if ( nDot != wxString::npos ) + nDot++; + else + nDot = 0; + + m_wildCard = wxString::Format + ( + _("%s files (%s)|%s"), + wildCard.c_str() + nDot, + wildCard.c_str(), + wildCard.c_str() + ); + } } }