Re-add wxFD_OVERWRITE_PROMPT and wxFD_FILE_MUST_EXIST to wxGenericFileDialog.
Support for these styles was accidentally removed in r48733, re-add them back. Closes #16652. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78080 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -336,9 +336,35 @@ void wxGenericFileDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
|
|||||||
if (selectedFiles.Count() == 0)
|
if (selectedFiles.Count() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const wxString& path = selectedFiles[0];
|
||||||
|
|
||||||
if (selectedFiles.Count() == 1)
|
if (selectedFiles.Count() == 1)
|
||||||
{
|
{
|
||||||
SetPath( selectedFiles[0] );
|
SetPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check that the file [doesn't] exist if necessary
|
||||||
|
if ( HasFdFlag(wxFD_SAVE) && HasFdFlag(wxFD_OVERWRITE_PROMPT) &&
|
||||||
|
wxFileExists(path) )
|
||||||
|
{
|
||||||
|
if ( wxMessageBox
|
||||||
|
(
|
||||||
|
wxString::Format
|
||||||
|
(
|
||||||
|
_("File '%s' already exists, do you really want to overwrite it?"),
|
||||||
|
path
|
||||||
|
),
|
||||||
|
_("Confirm"),
|
||||||
|
wxYES_NO
|
||||||
|
) != wxYES)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if ( HasFdFlag(wxFD_OPEN) && HasFdFlag(wxFD_FILE_MUST_EXIST) &&
|
||||||
|
!wxFileExists(path) )
|
||||||
|
{
|
||||||
|
wxMessageBox(_("Please choose an existing file."), _("Error"),
|
||||||
|
wxOK | wxICON_ERROR );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
|
Reference in New Issue
Block a user