mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-09 23:05:04 -06:00
FIX:block HTTP links&open in default browser
fixed:https://jira.bambooolab.com/browse/STUDIO-3030 Block web page redirect requests and open them in the default browser Change-Id: Ie79f8259859fa6ba158f31710179a8c7c53d6fa4
This commit is contained in:
parent
297e4d1373
commit
46a48539bb
2 changed files with 15 additions and 0 deletions
|
@ -58,6 +58,7 @@ ProjectPanel::ProjectPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
|||
main_sizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
|
||||
m_browser->Bind(wxEVT_WEBVIEW_NAVIGATED, &ProjectPanel::on_navigated, this);
|
||||
m_browser->Bind(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, &ProjectPanel::OnScriptMessage, this, m_browser->GetId());
|
||||
Bind(wxEVT_WEBVIEW_NAVIGATING, &ProjectPanel::onWebNavigating, this, m_browser->GetId());
|
||||
|
||||
Bind(EVT_PROJECT_RELOAD, &ProjectPanel::on_reload, this);
|
||||
|
||||
|
@ -68,6 +69,19 @@ ProjectPanel::ProjectPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
|||
|
||||
ProjectPanel::~ProjectPanel() {}
|
||||
|
||||
|
||||
void ProjectPanel::onWebNavigating(wxWebViewEvent& evt)
|
||||
{
|
||||
wxString tmpUrl = evt.GetURL();
|
||||
//wxString NowUrl = m_browser->GetCurrentURL();
|
||||
|
||||
if (boost::starts_with(tmpUrl, "http://") || boost::starts_with(tmpUrl, "https://")) {
|
||||
m_browser->Stop();
|
||||
evt.Veto();
|
||||
wxLaunchDefaultApplication(tmpUrl);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectPanel::on_reload(wxCommandEvent& evt)
|
||||
{
|
||||
boost::thread reload = boost::thread([this] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue