Bug #2957125 Default browser choice ignored
This commit is contained in:
parent
a8ed8dc173
commit
5367c5dabb
|
@ -26,16 +26,12 @@ BEGIN_EVENT_TABLE ( MyPropertySheet, wxPropertySheetDialog )
|
|||
EVT_BUTTON (
|
||||
APPLICATION_DIR_BROWSE,
|
||||
MyPropertySheet::OnApplicationDirBrowse )
|
||||
EVT_BUTTON (
|
||||
BROWSER_COMMAND_BROWSE,
|
||||
MyPropertySheet::OnBrowserCommandBrowse )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyPropertySheet::MyPropertySheet (
|
||||
wxWindow *parent,
|
||||
XmlCtrlProperties& propertiesParameter,
|
||||
wxString& applicationDirParameter,
|
||||
wxString& browserCommandParameter,
|
||||
bool rememberOpenTabsParameter,
|
||||
bool libxmlNetAccessParameter,
|
||||
bool singleInstanceCheckParameter,
|
||||
|
@ -49,11 +45,11 @@ MyPropertySheet::MyPropertySheet (
|
|||
wxString title,
|
||||
const wxPoint& position,
|
||||
const wxSize& size,
|
||||
long style ) : wxPropertySheetDialog (
|
||||
parent, id, title, position, size, style ),
|
||||
properties ( propertiesParameter ),
|
||||
applicationDir ( applicationDirParameter ),
|
||||
browserCommand ( browserCommandParameter )
|
||||
long style
|
||||
)
|
||||
: wxPropertySheetDialog ( parent, id, title, position, size, style )
|
||||
, properties ( propertiesParameter )
|
||||
, applicationDir ( applicationDirParameter )
|
||||
{
|
||||
CreateButtons ( wxOK | wxCANCEL );
|
||||
|
||||
|
@ -140,7 +136,6 @@ MyPropertySheet::MyPropertySheet (
|
|||
wxPanel *generalPanel = new wxPanel ( GetBookCtrl() );
|
||||
wxBoxSizer *vsizer = new wxBoxSizer ( wxVERTICAL );
|
||||
wxBoxSizer *hsizer = new wxBoxSizer ( wxHORIZONTAL );
|
||||
wxBoxSizer *hsizerBrowser = new wxBoxSizer ( wxHORIZONTAL );
|
||||
wxBoxSizer *hsizerCheckboxes = new wxBoxSizer ( wxHORIZONTAL );
|
||||
wxBoxSizer *vsizerCheckbox1 = new wxBoxSizer ( wxVERTICAL );
|
||||
wxBoxSizer *vsizerCheckbox2 = new wxBoxSizer ( wxVERTICAL );
|
||||
|
@ -161,22 +156,6 @@ MyPropertySheet::MyPropertySheet (
|
|||
_ ( "Browse" ),
|
||||
wxDefaultPosition,
|
||||
wxSize ( -1, applicationDirEdit->GetSize().GetHeight() ) );
|
||||
wxStaticText *labelBrowser = new wxStaticText (
|
||||
generalPanel,
|
||||
wxID_ANY,
|
||||
_ ( "Browser" ) );
|
||||
browserCommandEdit = new wxTextCtrl (
|
||||
generalPanel,
|
||||
wxID_ANY,
|
||||
browserCommand,
|
||||
wxDefaultPosition,
|
||||
wxSize ( 240, -1 ) );
|
||||
wxButton *browseCommand = new wxButton (
|
||||
generalPanel,
|
||||
BROWSER_COMMAND_BROWSE,
|
||||
_ ( "Browse" ),
|
||||
wxDefaultPosition,
|
||||
wxSize ( -1, browserCommandEdit->GetSize().GetHeight() ) );
|
||||
|
||||
wxStaticText *labelLanguage = new wxStaticText (
|
||||
generalPanel,
|
||||
|
@ -233,12 +212,8 @@ MyPropertySheet::MyPropertySheet (
|
|||
|
||||
hsizer->Add ( applicationDirEdit, 0, wxALL | wxALIGN_LEFT, 0 );
|
||||
hsizer->Add ( browse, 0, wxLEFT | wxALIGN_LEFT, 5 );
|
||||
hsizerBrowser->Add ( browserCommandEdit, 0, wxALL | wxALIGN_LEFT, 0 );
|
||||
hsizerBrowser->Add ( browseCommand, 0, wxLEFT | wxALIGN_LEFT, 5 );
|
||||
vsizer->Add ( label, 0, wxLEFT | wxTOP | wxALIGN_LEFT, 5 );
|
||||
vsizer->Add ( hsizer, 0, wxALL | wxALIGN_LEFT, 5 );
|
||||
vsizer->Add ( labelBrowser, 0, wxLEFT | wxTOP | wxALIGN_LEFT, 5 );
|
||||
vsizer->Add ( hsizerBrowser, 0, wxALL | wxALIGN_LEFT, 5 );
|
||||
|
||||
vsizer->Add ( labelLanguage, 0, wxLEFT | wxTOP | wxALIGN_LEFT, 5 );
|
||||
vsizer->Add ( languageBox, 0, wxALL | wxALIGN_LEFT, 5 );
|
||||
|
@ -293,7 +268,6 @@ void MyPropertySheet::OnOk ( wxCommandEvent& e )
|
|||
else
|
||||
applicationDir = testDir;
|
||||
|
||||
browserCommand = browserCommandEdit->GetValue(); // permit incorrect value
|
||||
singleInstanceCheck = singleInstanceCheckBox->GetValue();
|
||||
restoreLayout = restoreLayoutBox->GetValue();
|
||||
rememberOpenTabs = rememberOpenTabsBox->GetValue();
|
||||
|
@ -319,13 +293,6 @@ void MyPropertySheet::OnApplicationDirBrowse ( wxCommandEvent& e )
|
|||
applicationDirEdit->SetValue ( browseDialog->GetPath() );
|
||||
}
|
||||
|
||||
void MyPropertySheet::OnBrowserCommandBrowse ( wxCommandEvent& e )
|
||||
{
|
||||
wxFileDialog *browseDialog = new wxFileDialog ( this );
|
||||
if ( browseDialog->ShowModal() == wxID_OK )
|
||||
browserCommandEdit->SetValue ( browseDialog->GetPath() );
|
||||
}
|
||||
|
||||
XmlCtrlProperties MyPropertySheet::getProperties()
|
||||
{
|
||||
return properties;
|
||||
|
@ -336,11 +303,6 @@ wxString MyPropertySheet::getApplicationDir()
|
|||
return applicationDir;
|
||||
}
|
||||
|
||||
wxString MyPropertySheet::getBrowserCommand()
|
||||
{
|
||||
return browserCommand;
|
||||
}
|
||||
|
||||
bool MyPropertySheet::getSingleInstanceCheck()
|
||||
{
|
||||
return singleInstanceCheck;
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
enum
|
||||
{
|
||||
APPLICATION_DIR_BROWSE,
|
||||
BROWSER_COMMAND_BROWSE,
|
||||
FONT_BROWSE
|
||||
};
|
||||
|
||||
|
@ -39,7 +38,6 @@ class MyPropertySheet : public wxPropertySheetDialog
|
|||
wxWindow *parent,
|
||||
XmlCtrlProperties& propertiesParameter,
|
||||
wxString& applicationDirParameter,
|
||||
wxString& browserCommandParameter,
|
||||
bool rememberOpenTabsParameter,
|
||||
bool libxmlNetAccess,
|
||||
bool singleInstanceCheck,
|
||||
|
@ -56,11 +54,9 @@ class MyPropertySheet : public wxPropertySheetDialog
|
|||
long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~MyPropertySheet();
|
||||
void OnOk ( wxCommandEvent& e );
|
||||
void OnBrowserCommandBrowse ( wxCommandEvent& e );
|
||||
void OnApplicationDirBrowse ( wxCommandEvent& e );
|
||||
XmlCtrlProperties getProperties();
|
||||
wxString getApplicationDir();
|
||||
wxString getBrowserCommand();
|
||||
bool getSingleInstanceCheck();
|
||||
bool getRememberOpenTabs();
|
||||
bool getLibxmlNetAccess();
|
||||
|
@ -93,9 +89,9 @@ class MyPropertySheet : public wxPropertySheetDialog
|
|||
*expandInternalEntitiesBox,
|
||||
*insertCloseTagBox;
|
||||
wxChoice *languageBox, *fontBox;
|
||||
wxTextCtrl *applicationDirEdit, *browserCommandEdit;
|
||||
wxTextCtrl *applicationDirEdit;
|
||||
XmlCtrlProperties properties;
|
||||
wxString applicationDir, browserCommand;
|
||||
wxString applicationDir;
|
||||
bool singleInstanceCheck,
|
||||
rememberOpenTabs,
|
||||
libxmlNetAccess,
|
||||
|
|
|
@ -89,7 +89,6 @@ StyleDialog::StyleDialog (
|
|||
const wxString& fileNameParameter,
|
||||
const wxString& ruleSetDirectoryParameter,
|
||||
const wxString& filterDirectoryParameter,
|
||||
const wxString& browserParameter,
|
||||
const wxString& ruleSetPresetParameter,
|
||||
const wxString& filterPresetParameter,
|
||||
#if !defined(USE_ENCHANT) && defined(__WXMSW__)
|
||||
|
@ -115,7 +114,6 @@ StyleDialog::StyleDialog (
|
|||
fileName ( fileNameParameter ),
|
||||
ruleSetDirectory ( ruleSetDirectoryParameter ),
|
||||
filterDirectory ( filterDirectoryParameter ),
|
||||
browser ( browserParameter ),
|
||||
ruleSetPreset ( ruleSetPresetParameter ),
|
||||
filterPreset ( filterPresetParameter ),
|
||||
type(typeParameter),
|
||||
|
@ -678,8 +676,7 @@ void StyleDialog::OnStyleWebReport ( wxCommandEvent& event )
|
|||
if ( !wxFileName::FileExists ( tempNameWide ) )
|
||||
return;
|
||||
|
||||
wxString cmd = browser + _T ( " \"" ) + tempNameWide + _T ( "\"" );
|
||||
wxExecute ( cmd, wxEXEC_SYNC );
|
||||
wxLaunchDefaultBrowser ( tempNameWide );
|
||||
}
|
||||
|
||||
void StyleDialog::OnStyleWebSummary ( wxCommandEvent& event )
|
||||
|
@ -745,8 +742,7 @@ void StyleDialog::OnStyleWebSummary ( wxCommandEvent& event )
|
|||
if ( !wxFileName::FileExists ( tempNameWide ) )
|
||||
return;
|
||||
|
||||
wxString cmd = browser + _T ( " \"" ) + tempNameWide + _T ( "\"" );
|
||||
wxExecute ( cmd, wxEXEC_SYNC );
|
||||
wxLaunchDefaultBrowser ( tempNameWide );
|
||||
}
|
||||
|
||||
void StyleDialog::styleSetIgnoreAll ( bool ignore )
|
||||
|
|
|
@ -70,7 +70,6 @@ class StyleDialog : public wxDialog
|
|||
const wxString& fileNameParameter,
|
||||
const wxString& ruleSetDirectoryParameter,
|
||||
const wxString& filterDirectoryParameter,
|
||||
const wxString& browserParameter,
|
||||
const wxString& ruleSetPresetParameter,
|
||||
const wxString& filterPresetParameter,
|
||||
#ifdef __WXMSW__
|
||||
|
@ -121,7 +120,7 @@ class StyleDialog : public wxDialog
|
|||
wxStatusBar *status;
|
||||
std::string bufferUtf8, aspellDataPath, aspellDictPath;
|
||||
std::set<wxString> tempFiles;
|
||||
wxString fileName, ruleSetDirectory, filterDirectory, browser;
|
||||
wxString fileName, ruleSetDirectory, filterDirectory;
|
||||
wxString ruleSetPreset, filterPreset;
|
||||
vector<ContextMatch> matchVector;
|
||||
int type;
|
||||
|
|
|
@ -656,8 +656,6 @@ MyFrame::MyFrame (
|
|||
|
||||
applicationDir =
|
||||
config->Read ( _T ( "applicationDir" ), wxStandardPaths::Get().GetDataDir() );
|
||||
browserCommand =
|
||||
config->Read ( _T ( "browserCommand" ), wxEmptyString );
|
||||
|
||||
// if default value != true, type as long int
|
||||
long valZoom, longFalse;
|
||||
|
@ -751,7 +749,6 @@ MyFrame::MyFrame (
|
|||
rememberOpenTabs = true;
|
||||
libxmlNetAccess = false;
|
||||
openTabsOnClose = wxEmptyString;
|
||||
browserCommand = wxEmptyString;
|
||||
notebookStyle = ID_NOTEBOOK_STYLE_VC8_COLOR;
|
||||
saveBom = unlimitedUndo = true;
|
||||
layout = wxEmptyString;
|
||||
|
@ -804,15 +801,6 @@ MyFrame::MyFrame (
|
|||
|
||||
findData.SetFlags ( findFlags );
|
||||
|
||||
if ( browserCommand.empty() )
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
browserCommand = binDir + _T ( "navigate.exe" );
|
||||
#else
|
||||
browserCommand = getLinuxBrowser();
|
||||
#endif
|
||||
}
|
||||
|
||||
// initialise document count for tab labels
|
||||
documentCount = 1;
|
||||
|
||||
|
@ -1023,7 +1011,6 @@ MyFrame::~MyFrame()
|
|||
config->Write ( _T ( "toolbarVisible" ), toolbarVisible );
|
||||
config->Write ( _T ( "protectTags" ), protectTags );
|
||||
config->Write ( _T ( "visibilityState" ), visibilityState );
|
||||
config->Write ( _T ( "browserCommand" ), browserCommand );
|
||||
config->Write ( _T ( "showLocationPane" ), manager.GetPane ( locationPanel ).IsShown() );
|
||||
config->Write ( _T ( "showInsertChildPane" ), manager.GetPane ( insertChildPanel ).IsShown() );
|
||||
config->Write ( _T ( "showInsertSiblingPane" ), manager.GetPane ( insertSiblingPanel ).IsShown() );
|
||||
|
@ -1071,30 +1058,6 @@ MyFrame::~MyFrame()
|
|||
wxTheClipboard->Flush();
|
||||
}
|
||||
|
||||
wxString MyFrame::getLinuxBrowser()
|
||||
{
|
||||
wxString s;
|
||||
const int stringArrayLen = 9;
|
||||
wxString stringArray[stringArrayLen];
|
||||
stringArray[0] = _T ( "/usr/bin/firefox" );
|
||||
stringArray[1] = _T ( "/usr/bin/mozilla" );
|
||||
stringArray[2] = _T ( "/usr/bin/opera" );
|
||||
stringArray[3] = _T ( "/usr/bin/dillo" );
|
||||
stringArray[4] = _T ( "/opt/gnome/bin/epiphany" );
|
||||
stringArray[5] = _T ( "/opt/gnome/bin/galeon" );
|
||||
stringArray[6] = _T ( "/opt/kde/bin/konqueror" );
|
||||
stringArray[7] = _T ( "/opt/mozilla/bin/firefox" );
|
||||
stringArray[8] = wxEmptyString; // empty option is safe
|
||||
|
||||
for ( int i = 0; i < stringArrayLen; i++ )
|
||||
{
|
||||
s = stringArray[i];
|
||||
if ( wxFileName::FileExists ( s ) )
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void MyFrame::showTopBars ( bool b )
|
||||
{
|
||||
if ( !menuBar )
|
||||
|
@ -2381,7 +2344,7 @@ void MyFrame::OnBrowser ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
wtfn.setKeepFiles ( true );
|
||||
}
|
||||
|
||||
navigate ( sourceFileName );
|
||||
wxLaunchDefaultBrowser ( sourceFileName );
|
||||
}
|
||||
|
||||
void MyFrame::OnHelp ( wxCommandEvent& event )
|
||||
|
@ -2533,7 +2496,6 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
this,
|
||||
properties,
|
||||
applicationDir,
|
||||
browserCommand,
|
||||
rememberOpenTabs,
|
||||
libxmlNetAccess,
|
||||
singleInstanceCheck,
|
||||
|
@ -2550,7 +2512,6 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) )
|
|||
properties = mpsd->getProperties();
|
||||
applyEditorProperties();
|
||||
applicationDir = mpsd->getApplicationDir();
|
||||
browserCommand = mpsd->getBrowserCommand();
|
||||
rememberOpenTabs = mpsd->getRememberOpenTabs();
|
||||
libxmlNetAccess = mpsd->getLibxmlNetAccess();
|
||||
singleInstanceCheck = mpsd->getSingleInstanceCheck();
|
||||
|
@ -3413,7 +3374,6 @@ void MyFrame::OnSpelling ( wxCommandEvent& event )
|
|||
doc->getShortFileName(),
|
||||
ruleSetDir,
|
||||
filterDir,
|
||||
browserCommand,
|
||||
( type == ID_TYPE_SPELL ) ? dictionaryPreset : ruleSetPreset,
|
||||
filterPreset,
|
||||
#ifdef __WXMSW__
|
||||
|
@ -4343,12 +4303,12 @@ void MyFrame::OnEncoding ( wxCommandEvent& event )
|
|||
|
||||
void MyFrame::OnHome ( wxCommandEvent& event )
|
||||
{
|
||||
navigate ( _T ( "http://xml-copy-editor.sourceforge.net" ) );
|
||||
wxLaunchDefaultBrowser ( _T ( "http://xml-copy-editor.sourceforge.net" ) );
|
||||
}
|
||||
|
||||
void MyFrame::OnDownloadSource ( wxCommandEvent& event )
|
||||
{
|
||||
navigate ( _T ( "http://xml-copy-editor.svn.sourceforge.net/viewvc/xml-copy-editor/" ) );
|
||||
wxLaunchDefaultBrowser ( _T ( "http://xml-copy-editor.svn.sourceforge.net/viewvc/xml-copy-editor/" ) );
|
||||
}
|
||||
|
||||
void MyFrame::OnToolbarVisible ( wxCommandEvent& event )
|
||||
|
@ -4475,32 +4435,7 @@ void MyFrame::OnFeedback ( wxCommandEvent& event )
|
|||
{
|
||||
wxString forumUrl =
|
||||
_T ( "https://sourceforge.net/forum/forum.php?forum_id=475215" );
|
||||
navigate ( forumUrl );
|
||||
}
|
||||
|
||||
void MyFrame::navigate ( const wxString& url )
|
||||
{
|
||||
wxString testString = browserCommand;
|
||||
testString.Replace ( _T ( " -remote" ), wxEmptyString, true );
|
||||
if ( browserCommand.empty() )
|
||||
{
|
||||
messagePane (
|
||||
_ ( "Cannot open in browser: no browser defined (see Tools, Options..., General)" ),
|
||||
CONST_STOP );
|
||||
return;
|
||||
}
|
||||
else if ( !wxFileName::FileExists ( testString ) )
|
||||
{
|
||||
wxString message;
|
||||
message.Printf (
|
||||
_ ( "Cannot open in browser: %s not found (see Tools, Options..., General)" ),
|
||||
testString.c_str() );
|
||||
messagePane ( message, CONST_STOP );
|
||||
return;
|
||||
}
|
||||
wxString cmd;
|
||||
cmd = browserCommand + _T ( " \"" ) + url + _T ( "\"" );
|
||||
wxExecute ( cmd, wxEXEC_ASYNC ); // make ASYNC an option?
|
||||
wxLaunchDefaultBrowser ( forumUrl );
|
||||
}
|
||||
|
||||
void MyFrame::findAgain ( wxString s, int flags )
|
||||
|
|
|
@ -309,7 +309,6 @@ class MyFrame : public wxFrame
|
|||
XmlDoc *doc,
|
||||
const wxString& schemaName,
|
||||
wxString& fileName );
|
||||
void navigate ( const wxString& url );
|
||||
void closePane();
|
||||
void closeFindReplacePane();
|
||||
void closeCommandPane();
|
||||
|
@ -410,7 +409,6 @@ class MyFrame : public wxFrame
|
|||
lastRelaxNGSchema,
|
||||
lastDtdPublicAux,
|
||||
openTabsOnClose,
|
||||
browserCommand,
|
||||
layout,
|
||||
defaultLayout,
|
||||
lastParent,
|
||||
|
@ -492,7 +490,6 @@ class MyFrame : public wxFrame
|
|||
bool checkLastModified = true );
|
||||
int getFileType ( const wxString& fileName );
|
||||
long getNotebookStyleMask();
|
||||
wxString getLinuxBrowser();
|
||||
bool isSpecialFileType ( const wxString& fileName );
|
||||
wxString getHtmlBuffer();
|
||||
void encodingMessage();
|
||||
|
|
Loading…
Reference in New Issue