[Manager] Add HTML TOU support to Wizard

Add function to open links in default browser from Wizard TOU.

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
This commit is contained in:
Charlie Fenton 2018-06-05 22:14:23 +03:00 committed by Vitalii Koshura
parent 8ef9bb3b51
commit cd68801710
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
2 changed files with 17 additions and 1 deletions

View File

@ -54,6 +54,7 @@ BEGIN_EVENT_TABLE( CTermsOfUsePage, wxWizardPageEx )
EVT_WIZARDEX_CANCEL( -1, CTermsOfUsePage::OnCancel )
EVT_RADIOBUTTON( ID_TERMSOFUSEAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
EVT_RADIOBUTTON( ID_TERMSOFUSEDISAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
EVT_HTML_LINK_CLICKED(ID_TERMSOFUSECTRL, CTermsOfUsePage::OnLinkClicked)
////@end CTermsOfUsePage event table entries
END_EVENT_TABLE()
@ -139,6 +140,18 @@ void CTermsOfUsePage::CreateControls()
////@end CTermsOfUsePage content construction
}
void CTermsOfUsePage::OnLinkClicked( wxHtmlLinkEvent& event ) {
wxString url = event.GetLinkInfo().GetHref();
if (url.StartsWith(wxT("http://")) || url.StartsWith(wxT("https://"))) {
// wxHtmlLinkEvent doesn't have Veto(), but only loads the page if you
// call Skip().
wxLaunchDefaultBrowser(url);
} else {
event.Skip();
}
}
/*!
* Gets the previous page.
*/

View File

@ -43,6 +43,9 @@ public:
/// Creates the controls and sizers
void CreateControls();
/// Handles clicks on links
void OnLinkClicked( wxHtmlLinkEvent & event );
////@begin CTermsOfUsePage event handler declarations
/// wxEVT_WIZARD_PAGE_CHANGED event handler for ID_TERMSOFUSEPAGE