X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..521808ff62a4e48c88f6853048d9d1befcb18c23:/src/common/fldlgcmn.cpp diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 3f08486a1a..c9d8e15494 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -43,24 +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; - m_wildCard = wildCard; m_dialogStyle = style; - m_path = wxT(""); m_filterIndex = 0; - if (m_wildCard.IsEmpty()) - m_wildCard = wxFileSelectorDefaultWildcardStr; - - // 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(_("All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr); + } + else // have wild card { - m_wildCard.Printf(_("Files (%s)|%s"), - m_wildCard.c_str(), m_wildCard.c_str()); + // 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() + ); + } } }