Fixed a file URI problem

This commit is contained in:
Zane U. Ji 2014-06-05 21:43:34 +08:00
parent ae7fa25c73
commit a8a6bf6a07
1 changed files with 9 additions and 8 deletions

View File

@ -19,6 +19,7 @@
#include <memory> #include <memory>
#include "associatedialog.h" #include "associatedialog.h"
#include "wraplibxml.h"
BEGIN_EVENT_TABLE ( AssociateDialog, wxDialog ) BEGIN_EVENT_TABLE ( AssociateDialog, wxDialog )
EVT_BUTTON ( wxID_OK, AssociateDialog::OnOk ) EVT_BUTTON ( wxID_OK, AssociateDialog::OnOk )
@ -160,16 +161,16 @@ void AssociateDialog::OnBrowse ( wxCommandEvent& e )
{ {
wxString extensionArgument; wxString extensionArgument;
extensionArgument = extensionArgument =
type + type + _T ( " (" ) + extension + _T ( ")|" ) + extension
_T ( " (" ) + + _ ( "|All files (*.*)|*.*" );
extension + wxFileName fileName = WrapLibxml::URLToFileName ( urlCtrl->GetValue() );
_T ( ")|" ) + wxString dir = fileName.GetPath();
extension + if ( dir.empty() && mLastDir )
_ ( "|All files (*.*)|*.*" ); dir = *mLastDir;
std::auto_ptr<wxFileDialog> fd ( new wxFileDialog ( std::auto_ptr<wxFileDialog> fd ( new wxFileDialog (
this, this,
_ ( "Select " ) + type, _ ( "Select " ) + type,
mLastDir ? *mLastDir : _T ( "" ), dir,
_T ( "" ), _T ( "" ),
extensionArgument, extensionArgument,
#if wxCHECK_VERSION(2,9,0) #if wxCHECK_VERSION(2,9,0)
@ -181,7 +182,7 @@ void AssociateDialog::OnBrowse ( wxCommandEvent& e )
if ( fd->ShowModal() == wxID_OK ) if ( fd->ShowModal() == wxID_OK )
{ {
wxString newValue = fd->GetPath(); wxString newValue = WrapLibxml::FileNameToURL ( fd->GetPath() );
urlCtrl->SetValue ( newValue ); urlCtrl->SetValue ( newValue );
if ( mLastDir ) if ( mLastDir )