diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index cb221ad..3fd71d8 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -800,48 +800,33 @@ public: m_is_config(is_config), _Tbase(parent) { + if (!is_config && !m_cfg.m_use_cred && m_cfg.m_allow_save) { + m_remember = new wxCheckBox(m_sb_credentials->GetStaticBox(), wxID_ANY, _("&Remember")); + m_remember->SetHelpText(_("Check if you would like to save credentials")); + m_sb_credentials_vert->Add(m_remember, 0, wxALL|wxEXPAND, 5); + } else + m_remember = NULL; } virtual void SetRemember(bool val) { - return m_remember->SetValue(val); + if (m_remember) + m_remember->SetValue(val); } virtual bool GetRemember() const { - return m_remember->GetValue(); + return m_remember ? + m_remember->GetValue() : + !m_cfg.m_use_cred && m_cfg.m_allow_save; } -protected: - /// \cond internal - - virtual bool TransferDataToWindow() - { - if (m_is_config) { - // Configuration mode - // Always store credentials (somewhere). - m_remember->SetValue(true); - m_remember->Enable(false); - } else if (m_cfg.m_use_cred) { - // Credential prompt mode & Using configured credentials - m_remember->SetValue(false); - m_remember->Enable(false); - } else if (!m_cfg.m_allow_save) { - // Credential prompt mode & using own credentials & saving is not allowed - m_remember->SetValue(false); - m_remember->Enable(false); - } - - return _Tbase::TransferDataToWindow(); - } - - /// \endcond - protected: const eap::config_provider &m_prov; ///< Provider configuration const eap::config_method_with_cred &m_cfg; ///< Method configuration _Tcred &m_cred; ///< Credentials bool m_is_config; ///< Is this a configuration dialog? + wxCheckBox *m_remember; ///< "Remember" checkbox }; diff --git a/lib/EAPBase_UI/res/wxEAP_UI.cpp b/lib/EAPBase_UI/res/wxEAP_UI.cpp index 65a1d98..5521415 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.cpp +++ b/lib/EAPBase_UI/res/wxEAP_UI.cpp @@ -351,21 +351,19 @@ wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase() wxEAPCredentialsPromptPassPanelBase::wxEAPCredentialsPromptPassPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxEAPCredentialsPanelBase( parent, id, pos, size, style ) { - wxStaticBoxSizer* sb_credentials; - sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Client Credentials") ), wxVERTICAL ); + m_sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Client Credentials") ), wxVERTICAL ); wxBoxSizer* sb_credentials_horiz; sb_credentials_horiz = new wxBoxSizer( wxHORIZONTAL ); - m_credentials_icon = new wxStaticBitmap( sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_credentials_icon = new wxStaticBitmap( m_sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); sb_credentials_horiz->Add( m_credentials_icon, 0, wxALL, 5 ); - wxBoxSizer* sb_credentials_vert; - sb_credentials_vert = new wxBoxSizer( wxVERTICAL ); + m_sb_credentials_vert = new wxBoxSizer( wxVERTICAL ); - m_credentials_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Please provide your user ID and password."), wxDefaultPosition, wxDefaultSize, 0 ); + m_credentials_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Please provide your user ID and password."), wxDefaultPosition, wxDefaultSize, 0 ); m_credentials_label->Wrap( 440 ); - sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 ); + m_sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 ); wxFlexGridSizer* sb_credentials_tbl; sb_credentials_tbl = new wxFlexGridSizer( 0, 2, 5, 5 ); @@ -373,40 +371,35 @@ wxEAPCredentialsPromptPassPanelBase::wxEAPCredentialsPromptPassPanelBase( wxWind sb_credentials_tbl->SetFlexibleDirection( wxBOTH ); sb_credentials_tbl->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_identity_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("User ID:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_identity_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("User ID:"), wxDefaultPosition, wxDefaultSize, 0 ); m_identity_label->Wrap( -1 ); sb_credentials_tbl->Add( m_identity_label, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - m_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_identity = new wxTextCtrl( m_sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_identity->SetToolTip( _("Enter your user name here (user@domain.org, DOMAIN\\User, etc.)") ); sb_credentials_tbl->Add( m_identity, 2, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - m_password_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Password:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_password_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Password:"), wxDefaultPosition, wxDefaultSize, 0 ); m_password_label->Wrap( -1 ); sb_credentials_tbl->Add( m_password_label, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - m_password = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); + m_password = new wxTextCtrl( m_sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); m_password->SetToolTip( _("Enter your password here") ); sb_credentials_tbl->Add( m_password, 2, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - sb_credentials_vert->Add( sb_credentials_tbl, 0, wxEXPAND|wxALL, 5 ); - - m_remember = new wxCheckBox( sb_credentials->GetStaticBox(), wxID_ANY, _("&Remember"), wxDefaultPosition, wxDefaultSize, 0 ); - m_remember->SetHelpText( _("Check if you would like to save username and password") ); - - sb_credentials_vert->Add( m_remember, 0, wxALL|wxEXPAND, 5 ); + m_sb_credentials_vert->Add( sb_credentials_tbl, 0, wxEXPAND|wxALL, 5 ); - sb_credentials_horiz->Add( sb_credentials_vert, 1, wxEXPAND, 5 ); + sb_credentials_horiz->Add( m_sb_credentials_vert, 1, wxEXPAND, 5 ); - sb_credentials->Add( sb_credentials_horiz, 0, wxEXPAND, 5 ); + m_sb_credentials->Add( sb_credentials_horiz, 0, wxEXPAND, 5 ); - this->SetSizer( sb_credentials ); + this->SetSizer( m_sb_credentials ); this->Layout(); } diff --git a/lib/EAPBase_UI/res/wxEAP_UI.fbp b/lib/EAPBase_UI/res/wxEAP_UI.fbp index 495a924..9332af4 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.fbp +++ b/lib/EAPBase_UI/res/wxEAP_UI.fbp @@ -2419,9 +2419,9 @@ wxID_ANY Client Credentials - sb_credentials + m_sb_credentials wxVERTICAL - none + protected 5 @@ -2519,9 +2519,9 @@ 1 - sb_credentials_vert + m_sb_credentials_vert wxVERTICAL - none + protected 5 wxALL|wxEXPAND @@ -2971,94 +2971,6 @@ - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - Check if you would like to save username and password - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Remember - - 0 - - - 0 - - 1 - m_remember - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/EAPBase_UI/res/wxEAP_UI.h b/lib/EAPBase_UI/res/wxEAP_UI.h index 78f56a5..b875a1e 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.h +++ b/lib/EAPBase_UI/res/wxEAP_UI.h @@ -34,8 +34,8 @@ class wxEAPBannerPanel; #include #include #include -#include #include +#include /////////////////////////////////////////////////////////////////////////// @@ -199,13 +199,14 @@ class wxEAPCredentialsPromptPassPanelBase : public wxEAPCredentialsPanelBase private: protected: + wxStaticBoxSizer* m_sb_credentials; wxStaticBitmap* m_credentials_icon; + wxBoxSizer* m_sb_credentials_vert; wxStaticText* m_credentials_label; wxStaticText* m_identity_label; wxTextCtrl* m_identity; wxStaticText* m_password_label; wxTextCtrl* m_password; - wxCheckBox* m_remember; public: diff --git a/lib/TLS_UI/res/wxTLS_UI.cpp b/lib/TLS_UI/res/wxTLS_UI.cpp index 458f3c9..1d3daab 100644 --- a/lib/TLS_UI/res/wxTLS_UI.cpp +++ b/lib/TLS_UI/res/wxTLS_UI.cpp @@ -116,61 +116,54 @@ wxEAPTLSServerTrustConfigPanelBase::~wxEAPTLSServerTrustConfigPanelBase() wxEAPCredentialsPromptTLSPanelBase::wxEAPCredentialsPromptTLSPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxEAPCredentialsPanelBase( parent, id, pos, size, style ) { - wxStaticBoxSizer* sb_credentials; - sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("TLS Client Certificate") ), wxVERTICAL ); + m_sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("TLS Client Certificate") ), wxVERTICAL ); wxBoxSizer* sb_credentials_horiz; sb_credentials_horiz = new wxBoxSizer( wxHORIZONTAL ); - m_credentials_icon = new wxStaticBitmap( sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_credentials_icon = new wxStaticBitmap( m_sb_credentials->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); sb_credentials_horiz->Add( m_credentials_icon, 0, wxALL, 5 ); - wxBoxSizer* sb_credentials_vert; - sb_credentials_vert = new wxBoxSizer( wxVERTICAL ); + m_sb_credentials_vert = new wxBoxSizer( wxVERTICAL ); - m_certificate_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Please select your client &certificate to use for authentication."), wxDefaultPosition, wxDefaultSize, 0 ); + m_certificate_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Please select your client &certificate to use for authentication."), wxDefaultPosition, wxDefaultSize, 0 ); m_certificate_label->Wrap( 440 ); - sb_credentials_vert->Add( m_certificate_label, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_sb_credentials_vert->Add( m_certificate_label, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); wxArrayString m_certificateChoices; - m_certificate = new wxChoice( sb_credentials->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_certificateChoices, wxCB_SORT ); + m_certificate = new wxChoice( m_sb_credentials->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_certificateChoices, wxCB_SORT ); m_certificate->SetSelection( 0 ); m_certificate->SetToolTip( _("Client certificate to use for authentication") ); - sb_credentials_vert->Add( m_certificate, 0, wxEXPAND|wxALL, 5 ); + m_sb_credentials_vert->Add( m_certificate, 0, wxEXPAND|wxALL, 5 ); wxBoxSizer* sb_identity; sb_identity = new wxBoxSizer( wxVERTICAL ); - m_identity_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Custom &identity:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_identity_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Custom &identity:"), wxDefaultPosition, wxDefaultSize, 0 ); m_identity_label->Wrap( -1 ); sb_identity->Add( m_identity_label, 0, wxBOTTOM, 5 ); - m_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_identity = new wxTextCtrl( m_sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_identity->SetToolTip( _("Your identity (username@domain) to override one from certificate; or blank to use one provided in certificate") ); sb_identity->Add( m_identity, 0, wxEXPAND|wxBOTTOM, 5 ); - m_identity_note = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("(Example: user@contoso.com)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_identity_note = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("(Example: user@contoso.com)"), wxDefaultPosition, wxDefaultSize, 0 ); m_identity_note->Wrap( -1 ); sb_identity->Add( m_identity_note, 0, wxALIGN_RIGHT, 5 ); - sb_credentials_vert->Add( sb_identity, 0, wxEXPAND|wxALL, 5 ); - - m_remember = new wxCheckBox( sb_credentials->GetStaticBox(), wxID_ANY, _("&Remember"), wxDefaultPosition, wxDefaultSize, 0 ); - m_remember->SetHelpText( _("Check if you would like to save certificate selection") ); - - sb_credentials_vert->Add( m_remember, 0, wxALL|wxEXPAND, 5 ); + m_sb_credentials_vert->Add( sb_identity, 0, wxEXPAND|wxALL, 5 ); - sb_credentials_horiz->Add( sb_credentials_vert, 1, wxEXPAND, 5 ); + sb_credentials_horiz->Add( m_sb_credentials_vert, 1, wxEXPAND, 5 ); - sb_credentials->Add( sb_credentials_horiz, 0, wxEXPAND, 5 ); + m_sb_credentials->Add( sb_credentials_horiz, 0, wxEXPAND, 5 ); - this->SetSizer( sb_credentials ); + this->SetSizer( m_sb_credentials ); this->Layout(); // Connect Events diff --git a/lib/TLS_UI/res/wxTLS_UI.fbp b/lib/TLS_UI/res/wxTLS_UI.fbp index 2a6a06b..575750d 100644 --- a/lib/TLS_UI/res/wxTLS_UI.fbp +++ b/lib/TLS_UI/res/wxTLS_UI.fbp @@ -1055,9 +1055,9 @@ wxID_ANY TLS Client Certificate - sb_credentials + m_sb_credentials wxVERTICAL - none + protected 5 @@ -1155,9 +1155,9 @@ 1 - sb_credentials_vert + m_sb_credentials_vert wxVERTICAL - none + protected 5 wxEXPAND|wxTOP|wxRIGHT|wxLEFT @@ -1597,94 +1597,6 @@ - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - Check if you would like to save certificate selection - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Remember - - 0 - - - 0 - - 1 - m_remember - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/TLS_UI/res/wxTLS_UI.h b/lib/TLS_UI/res/wxTLS_UI.h index 591983b..31e851c 100644 --- a/lib/TLS_UI/res/wxTLS_UI.h +++ b/lib/TLS_UI/res/wxTLS_UI.h @@ -31,7 +31,6 @@ class wxEAPCredentialsPanelBase; #include #include #include -#include /////////////////////////////////////////////////////////////////////////// @@ -77,13 +76,14 @@ class wxEAPCredentialsPromptTLSPanelBase : public wxEAPCredentialsPanelBase private: protected: + wxStaticBoxSizer* m_sb_credentials; wxStaticBitmap* m_credentials_icon; + wxBoxSizer* m_sb_credentials_vert; wxStaticText* m_certificate_label; wxChoice* m_certificate; wxStaticText* m_identity_label; wxTextCtrl* m_identity; wxStaticText* m_identity_note; - wxCheckBox* m_remember; // Virtual event handlers, overide them in your derived class virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }