]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fldlgcmn.cpp
removed invalid restriction
[wxWidgets.git] / src / common / fldlgcmn.cpp
index 01e9facb9495865958bcf35fdb8c2803f2e57df0..c9d8e15494ec59745c43c6436ba8db78329df270 100644 (file)
@@ -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()
+                         );
+        }
     }
 }