X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd9f3519cf4d3adec765a932a726e2f1d34e0df9..c5288c5cfebea56239369dddcce8ac3ef6f4a8dd:/src/generic/filedlgg.cpp diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index e1c5770f7d..2729d5db5d 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -996,6 +996,8 @@ bool wxGenericFileDialog::Create( wxWindow *parent, { m_bypassGenericImpl = bypassGenericImpl; + parent = GetParentForModalDialog(parent); + if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name)) { @@ -1006,7 +1008,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent, return true; if (!wxDialog::Create( parent, wxID_ANY, message, pos, sz, - wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER, name + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | style, name )) { return false; @@ -1014,6 +1016,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent, ignoreChanges = true; +#if wxUSE_CONFIG if (wxConfig::Get(false)) { wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"), @@ -1021,6 +1024,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent, wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ShowHidden"), &ms_lastShowHidden); } +#endif if ((m_dir.empty()) || (m_dir == wxT("."))) { @@ -1102,7 +1106,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent, mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 ); long style2 = ms_lastViewStyle; - if ( !HasFlag(wxFD_MULTIPLE) ) + if ( !HasFdFlag(wxFD_MULTIPLE) ) style2 |= wxLC_SINGLE_SEL; #ifdef __WXWINCE__ @@ -1188,6 +1192,7 @@ wxGenericFileDialog::~wxGenericFileDialog() if (!m_bypassGenericImpl) { +#if wxUSE_CONFIG if (wxConfig::Get(false)) { wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"), @@ -1195,6 +1200,7 @@ wxGenericFileDialog::~wxGenericFileDialog() wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ShowHidden"), ms_lastShowHidden); } +#endif const int count = m_choice->GetCount(); for ( int i = 0; i < count; i++ ) @@ -1406,7 +1412,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn ) } #endif // __UNIX__ - if (!HasFlag(wxFD_SAVE)) + if (!HasFdFlag(wxFD_SAVE)) { if ((filename.Find(wxT('*')) != wxNOT_FOUND) || (filename.Find(wxT('?')) != wxNOT_FOUND)) @@ -1451,13 +1457,13 @@ void wxGenericFileDialog::HandleAction( const wxString &fn ) // VZ: the logic of testing for !wxFileExists() only for the open file // dialog is not entirely clear to me, why don't we allow saving to a // file without extension as well? - if ( !HasFlag(wxFD_OPEN) || !wxFileExists(filename) ) + if ( !HasFdFlag(wxFD_OPEN) || !wxFileExists(filename) ) { filename = AppendExtension(filename, m_filterExtension); } // check that the file [doesn't] exist if necessary - if ( HasFlag(wxFD_SAVE) && HasFlag(wxFD_OVERWRITE_PROMPT) && + if ( HasFdFlag(wxFD_SAVE) && HasFdFlag(wxFD_OVERWRITE_PROMPT) && wxFileExists( filename ) ) { wxString msg; @@ -1466,17 +1472,19 @@ void wxGenericFileDialog::HandleAction( const wxString &fn ) if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES) return; } - else if ( HasFlag(wxFD_OPEN) && HasFlag(wxFD_FILE_MUST_EXIST) && + else if ( HasFdFlag(wxFD_OPEN) && HasFdFlag(wxFD_FILE_MUST_EXIST) && !wxFileExists(filename) ) { wxMessageBox(_("Please choose an existing file."), _("Error"), wxOK | wxICON_ERROR ); + + return; } SetPath( filename ); // change to the directory where the user went if asked - if ( HasFlag(wxFD_CHANGE_DIR) ) + if ( HasFdFlag(wxFD_CHANGE_DIR) ) { wxString cwd; wxSplitPath(filename, &cwd, NULL, NULL); @@ -1631,10 +1639,10 @@ void wxGenericFileDialog::UpdateControls() #endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) } -#ifdef wxUSE_GENERIC_FILEDIALOG +#ifdef wxHAS_GENERIC_FILEDIALOG IMPLEMENT_DYNAMIC_CLASS(wxFileDialog, wxGenericFileDialog) -#endif // wxUSE_GENERIC_FILEDIALOG +#endif // wxHAS_GENERIC_FILEDIALOG #endif // wxUSE_FILEDLG