Commit 71c4f49d authored by jean-pierre charras's avatar jean-pierre charras

Kicad manager: fix Bug #1385953 (unable to open .PDF files with spaces in...

Kicad manager: fix Bug #1385953 (unable to open .PDF files with spaces in name/path when using default PDF browser).
Fix also an issue when selecting preferred browser.
parent e273a48d
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <cvstruct.h> #include <cvstruct.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#define titleComponentLibErr _( "Component Library Error" )
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
{ {
......
...@@ -116,14 +116,7 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check ) ...@@ -116,14 +116,7 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
return false; return false;
} }
#if ( ( wxMAJOR_VERSION < 2 ) || ( ( wxMAJOR_VERSION == 2 ) \
&& ( wxMINOR_VERSION < 7 ) ) )
if( !wxRenameFile( GetFileName(), newFile ) )
#else
if( !wxRenameFile( GetFileName(), newFile, false ) ) if( !wxRenameFile( GetFileName(), newFile, false ) )
#endif
{ {
wxMessageDialog( m_parent, _( "Unable to rename file ... " ), wxMessageDialog( m_parent, _( "Unable to rename file ... " ),
_( "Permission error ?" ), wxICON_ERROR | wxOK ); _( "Permission error ?" ), wxICON_ERROR | wxOK );
...@@ -225,7 +218,6 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe ) ...@@ -225,7 +218,6 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
break; break;
case TREE_PDF: case TREE_PDF:
AddDelimiterString( fullFileName );
OpenPDF( fullFileName ); OpenPDF( fullFileName );
break; break;
......
...@@ -516,15 +516,12 @@ void KICAD_MANAGER_FRAME::SaveSettings( wxConfigBase* aCfg ) ...@@ -516,15 +516,12 @@ void KICAD_MANAGER_FRAME::SaveSettings( wxConfigBase* aCfg )
/** /**
* a minor helper function: * a minor helper function:
* Prints the Current Working Dir name and the projet name on the text panel. * Prints the Current Project full name on the text panel.
*/ */
void KICAD_MANAGER_FRAME::PrintPrjInfo() void KICAD_MANAGER_FRAME::PrintPrjInfo()
{ {
wxString msg = wxString::Format( _( wxString msg = wxString::Format( _( "Project name:\n%s\n" ),
"Working dir: %s\nProject: %s\n" ), GetChars( GetProjectFileName() ) );
GetChars( wxGetCwd() ),
GetChars( GetProjectFileName() )
);
PrintMsg( msg ); PrintMsg( msg );
} }
...@@ -58,33 +58,39 @@ void KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event ) ...@@ -58,33 +58,39 @@ void KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event )
void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
{ {
bool select = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME; bool setPdfBrowserName = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME;
if( !Pgm().GetPdfBrowserName() && !select ) if( !Pgm().GetPdfBrowserName() && !setPdfBrowserName )
{ {
DisplayError( this, DisplayError( this,
_( "You must choose a PDF viewer before using this option." ) ); _( "You must choose a PDF viewer before using this option." ) );
setPdfBrowserName = true;
} }
wxString mask( wxT( "*" ) ); if( setPdfBrowserName )
{
wxString mask( wxT( "*" ) );
#ifdef __WINDOWS__
mask += wxT( ".exe" );
#endif
#ifdef __WINDOWS__ wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask;
mask += wxT( ".exe" );
#endif
wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask; Pgm().ReadPdfBrowserInfos();
wxFileName fn = Pgm().GetPdfBrowserName();
Pgm().ReadPdfBrowserInfos(); wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(),
wxFileName fn = Pgm().GetPdfBrowserName(); fn.GetFullPath(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(), if( dlg.ShowModal() == wxID_CANCEL )
fn.GetFullPath(), wildcard, return;
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) Pgm().SetPdfBrowserName( dlg.GetPath() );
return; }
Pgm().SetPdfBrowserName( dlg.GetPath() ); Pgm().ForceSystemPdfBrowser( false );
Pgm().WritePdfBrowserInfos(); Pgm().WritePdfBrowserInfos();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment