diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index 9760ca0..68e3018 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -46,6 +46,7 @@ template class wxEAPCredentialsPanel; template class wxIdentityCredentialsPanel; template class wxPasswordCredentialsPanel; class wxEAPProviderSelectDialog; +class wxEAPIdentityConfigPanel; class wxInitializerPeer; /// @@ -412,6 +413,30 @@ protected: }; +/// +/// EAP identity configuration panel +/// +class wxEAPIdentityConfigPanel : public wxEAPIdentityConfigPanelBase +{ +public: + /// + /// Constructs a configuration panel + /// + wxEAPIdentityConfigPanel(const eap::config_provider &prov, eap::config_method_with_cred &cfg, wxWindow* parent); + +protected: + /// \cond internal + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + virtual void OnUpdateUI(wxUpdateUIEvent& event); + /// \endcond + +protected: + const eap::config_provider &m_prov; ///< EAP provider + eap::config_method_with_cred &m_cfg; ///< EAP configuration +}; + + /// /// Peer initializer /// diff --git a/lib/EAPBase_UI/res/wxEAP_UI.cpp b/lib/EAPBase_UI/res/wxEAP_UI.cpp index befeaf7..8bdadf8 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.cpp +++ b/lib/EAPBase_UI/res/wxEAP_UI.cpp @@ -720,3 +720,74 @@ wxEAPProviderSelectDialogBase::~wxEAPProviderSelectDialogBase() this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPProviderSelectDialogBase::OnInitDialog ) ); } + +wxEAPIdentityConfigPanelBase::wxEAPIdentityConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, long style ) : wxPanel( parent, id, pos, parent->FromDIP(wxSize( 500,-1 )), style ) +{ + wxStaticBoxSizer* sb_outer_identity; + sb_outer_identity = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outer Identity") ), wxVERTICAL ); + + wxBoxSizer* sb_outer_identity_horiz; + sb_outer_identity_horiz = new wxBoxSizer( wxHORIZONTAL ); + + m_outer_identity_icon = new wxStaticBitmap( sb_outer_identity->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + sb_outer_identity_horiz->Add( m_outer_identity_icon, 0, wxALL, FromDIP(5) ); + + wxBoxSizer* sb_outer_identity_vert; + sb_outer_identity_vert = new wxBoxSizer( wxVERTICAL ); + + m_outer_identity_label = new wxStaticText( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Select the user ID supplicant introduces itself as to authenticator:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_outer_identity_label->Wrap( FromDIP(440) ); + sb_outer_identity_vert->Add( m_outer_identity_label, 0, wxALL|wxEXPAND, FromDIP(5) ); + + wxBoxSizer* sb_outer_identity_radio; + sb_outer_identity_radio = new wxBoxSizer( wxVERTICAL ); + + m_outer_identity_same = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&True identity"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_outer_identity_same->SetToolTip( _("Use my true user name") ); + + sb_outer_identity_radio->Add( m_outer_identity_same, 1, wxEXPAND, FromDIP(5) ); + + m_outer_identity_empty = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Use &empty outer identity"), wxDefaultPosition, wxDefaultSize, 0 ); + m_outer_identity_empty->SetToolTip( _("Omit my user name and use @mydomain.org only") ); + + sb_outer_identity_radio->Add( m_outer_identity_empty, 1, wxEXPAND, FromDIP(5) ); + + wxBoxSizer* sb_outer_identity_custom; + sb_outer_identity_custom = new wxBoxSizer( wxHORIZONTAL ); + + m_outer_identity_custom = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&Custom outer identity:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_outer_identity_custom->SetToolTip( _("Specify custom outer identity") ); + + sb_outer_identity_custom->Add( m_outer_identity_custom, 0, wxEXPAND, FromDIP(5) ); + + m_outer_identity_custom_val = new wxTextCtrl( sb_outer_identity->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_outer_identity_custom_val->SetToolTip( _("Custom outer identity to use") ); + + sb_outer_identity_custom->Add( m_outer_identity_custom_val, 1, wxEXPAND, FromDIP(5) ); + + + sb_outer_identity_radio->Add( sb_outer_identity_custom, 1, wxEXPAND, FromDIP(5) ); + + + sb_outer_identity_vert->Add( sb_outer_identity_radio, 0, wxEXPAND|wxALL, FromDIP(5) ); + + + sb_outer_identity_horiz->Add( sb_outer_identity_vert, 1, wxEXPAND, FromDIP(5) ); + + + sb_outer_identity->Add( sb_outer_identity_horiz, 0, wxEXPAND, FromDIP(5) ); + + + this->SetSizer( sb_outer_identity ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPIdentityConfigPanelBase::OnUpdateUI ) ); +} + +wxEAPIdentityConfigPanelBase::~wxEAPIdentityConfigPanelBase() +{ + // Disconnect Events + this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPIdentityConfigPanelBase::OnUpdateUI ) ); + +} diff --git a/lib/EAPBase_UI/res/wxEAP_UI.fbp b/lib/EAPBase_UI/res/wxEAP_UI.fbp index 365cc14..b8e097b 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.fbp +++ b/lib/EAPBase_UI/res/wxEAP_UI.fbp @@ -6514,5 +6514,630 @@ + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + wxEAPIdentityConfigPanelBase + + 500,-1 + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUpdateUI + + wxID_ANY + Outer Identity + + sb_outer_identity + wxVERTICAL + none + + + 5 + wxEXPAND + 0 + + + sb_outer_identity_horiz + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + Load From Icon Resource; ; [32; 32] + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_outer_identity_icon + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + sb_outer_identity_vert + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Select the user ID supplicant introduces itself as to authenticator: + + 0 + + + 0 + + 1 + m_outer_identity_label + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + 440 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + + sb_outer_identity_radio + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &True identity + + 0 + + + 0 + + 1 + m_outer_identity_same + 1 + + + protected + 1 + + Resizable + 1 + + wxRB_GROUP + + 0 + Use my true user name + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use &empty outer identity + + 0 + + + 0 + + 1 + m_outer_identity_empty + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Omit my user name and use @mydomain.org only + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + sb_outer_identity_custom + wxHORIZONTAL + none + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Custom outer identity: + + 0 + + + 0 + + 1 + m_outer_identity_custom + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Specify custom outer identity + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_outer_identity_custom_val + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Custom outer identity to use + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/EAPBase_UI/res/wxEAP_UI.h b/lib/EAPBase_UI/res/wxEAP_UI.h index 1182079..60390c0 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.h +++ b/lib/EAPBase_UI/res/wxEAP_UI.h @@ -336,4 +336,30 @@ class wxEAPProviderSelectDialogBase : public wxDialog }; +/////////////////////////////////////////////////////////////////////////////// +/// Class wxEAPIdentityConfigPanelBase +/////////////////////////////////////////////////////////////////////////////// +class wxEAPIdentityConfigPanelBase : public wxPanel +{ + private: + + protected: + wxStaticBitmap* m_outer_identity_icon; + wxStaticText* m_outer_identity_label; + wxRadioButton* m_outer_identity_same; + wxRadioButton* m_outer_identity_empty; + wxRadioButton* m_outer_identity_custom; + wxTextCtrl* m_outer_identity_custom_val; + + // Virtual event handlers, overide them in your derived class + virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } + + + public: + + wxEAPIdentityConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, long style = wxTAB_TRAVERSAL ); + ~wxEAPIdentityConfigPanelBase(); + +}; + #endif //__WXEAP_UI_H__ diff --git a/lib/EAPBase_UI/src/EAP_UI.cpp b/lib/EAPBase_UI/src/EAP_UI.cpp index d7176dd..efb7d6f 100644 --- a/lib/EAPBase_UI/src/EAP_UI.cpp +++ b/lib/EAPBase_UI/src/EAP_UI.cpp @@ -469,6 +469,80 @@ void wxEAPProviderSelectDialog::OnProvSelect(wxCommandEvent& event) /// \endcond +////////////////////////////////////////////////////////////////////// +// wxEAPIdentityConfigPanel +////////////////////////////////////////////////////////////////////// + +wxEAPIdentityConfigPanel::wxEAPIdentityConfigPanel(const eap::config_provider &prov, eap::config_method_with_cred &cfg, wxWindow* parent) : + m_prov(prov), + m_cfg(cfg), + wxEAPIdentityConfigPanelBase(parent) +{ + // Load and set icon. + winstd::library lib_shell32; + if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE)) + m_outer_identity_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(265))); +} + + +/// \cond internal + +bool wxEAPIdentityConfigPanel::TransferDataToWindow() +{ + // Populate identity controls. + if (m_cfg.m_anonymous_identity.empty()) { + m_outer_identity_same->SetValue(true); + } else if (m_cfg.m_anonymous_identity == L"@") { + m_outer_identity_empty->SetValue(true); + } else { + m_outer_identity_custom->SetValue(true); + m_outer_identity_custom_val->SetValue(m_cfg.m_anonymous_identity); + } + + return wxEAPIdentityConfigPanelBase::TransferDataToWindow(); +} + + +bool wxEAPIdentityConfigPanel::TransferDataFromWindow() +{ + wxCHECK(wxEAPIdentityConfigPanelBase::TransferDataFromWindow(), false); + + if (!m_prov.m_read_only) { + // This is not a provider-locked configuration. Save the data. + if (m_outer_identity_same->GetValue()) + m_cfg.m_anonymous_identity.clear(); + else if (m_outer_identity_empty->GetValue()) + m_cfg.m_anonymous_identity = L"@"; + else + m_cfg.m_anonymous_identity = m_outer_identity_custom_val->GetValue(); + } + + return true; +} + + +void wxEAPIdentityConfigPanel::OnUpdateUI(wxUpdateUIEvent& event) +{ + wxEAPIdentityConfigPanelBase::OnUpdateUI(event); + + if (m_prov.m_read_only) { + // This is provider-locked configuration. Disable controls. + m_outer_identity_same ->Enable(false); + m_outer_identity_empty ->Enable(false); + m_outer_identity_custom ->Enable(false); + m_outer_identity_custom_val->Enable(false); + } else { + // This is not a provider-locked configuration. Selectively enable/disable controls. + m_outer_identity_same ->Enable(true); + m_outer_identity_empty ->Enable(true); + m_outer_identity_custom ->Enable(true); + m_outer_identity_custom_val->Enable(m_outer_identity_custom->GetValue()); + } +} + +/// \endcond + + ////////////////////////////////////////////////////////////////////// // wxInitializerPeer ////////////////////////////////////////////////////////////////////// diff --git a/lib/TTLS_UI/build/TTLS_UI.vcxproj b/lib/TTLS_UI/build/TTLS_UI.vcxproj index a8d9372..8540fe9 100644 --- a/lib/TTLS_UI/build/TTLS_UI.vcxproj +++ b/lib/TTLS_UI/build/TTLS_UI.vcxproj @@ -103,20 +103,15 @@ - - Create - - - {d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b} diff --git a/lib/TTLS_UI/build/TTLS_UI.vcxproj.filters b/lib/TTLS_UI/build/TTLS_UI.vcxproj.filters index 7c91fa9..351d8cd 100644 --- a/lib/TTLS_UI/build/TTLS_UI.vcxproj.filters +++ b/lib/TTLS_UI/build/TTLS_UI.vcxproj.filters @@ -21,9 +21,6 @@ Header Files - - Header Files - Header Files @@ -32,9 +29,6 @@ Source Files - - Source Files - Source Files @@ -42,9 +36,4 @@ Source Files - - - Resource Files - - \ No newline at end of file diff --git a/lib/TTLS_UI/res/wxTTLS_UI.cpp b/lib/TTLS_UI/res/wxTTLS_UI.cpp deleted file mode 100644 index 8a9fc00..0000000 --- a/lib/TTLS_UI/res/wxTTLS_UI.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 17 2015) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include - -#include "wxTTLS_UI.h" - -/////////////////////////////////////////////////////////////////////////// - -wxTTLSConfigPanelBase::wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, long style ) : wxPanel( parent, id, pos, parent->FromDIP(wxSize( 500,-1 )), style ) -{ - wxStaticBoxSizer* sb_outer_identity; - sb_outer_identity = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outer Identity") ), wxVERTICAL ); - - wxBoxSizer* sb_outer_identity_horiz; - sb_outer_identity_horiz = new wxBoxSizer( wxHORIZONTAL ); - - m_outer_identity_icon = new wxStaticBitmap( sb_outer_identity->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - sb_outer_identity_horiz->Add( m_outer_identity_icon, 0, wxALL, FromDIP(5) ); - - wxBoxSizer* sb_outer_identity_vert; - sb_outer_identity_vert = new wxBoxSizer( wxVERTICAL ); - - m_outer_identity_label = new wxStaticText( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Select the user ID supplicant introduces itself as to authenticator:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_outer_identity_label->Wrap( FromDIP(440) ); - sb_outer_identity_vert->Add( m_outer_identity_label, 0, wxALL|wxEXPAND, FromDIP(5) ); - - wxBoxSizer* sb_outer_identity_radio; - sb_outer_identity_radio = new wxBoxSizer( wxVERTICAL ); - - m_outer_identity_same = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&True identity"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_outer_identity_same->SetToolTip( _("Use my true user name") ); - - sb_outer_identity_radio->Add( m_outer_identity_same, 1, wxEXPAND, FromDIP(5) ); - - m_outer_identity_empty = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("Use &empty outer identity"), wxDefaultPosition, wxDefaultSize, 0 ); - m_outer_identity_empty->SetToolTip( _("Omit my user name and use @mydomain.org only") ); - - sb_outer_identity_radio->Add( m_outer_identity_empty, 1, wxEXPAND, FromDIP(5) ); - - wxBoxSizer* sb_outer_identity_custom; - sb_outer_identity_custom = new wxBoxSizer( wxHORIZONTAL ); - - m_outer_identity_custom = new wxRadioButton( sb_outer_identity->GetStaticBox(), wxID_ANY, _("&Custom outer identity:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_outer_identity_custom->SetToolTip( _("Specify custom outer identity") ); - - sb_outer_identity_custom->Add( m_outer_identity_custom, 0, wxEXPAND, FromDIP(5) ); - - m_outer_identity_custom_val = new wxTextCtrl( sb_outer_identity->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_outer_identity_custom_val->SetToolTip( _("Custom outer identity to use") ); - - sb_outer_identity_custom->Add( m_outer_identity_custom_val, 1, wxEXPAND, FromDIP(5) ); - - - sb_outer_identity_radio->Add( sb_outer_identity_custom, 1, wxEXPAND, FromDIP(5) ); - - - sb_outer_identity_vert->Add( sb_outer_identity_radio, 0, wxEXPAND|wxALL, FromDIP(5) ); - - - sb_outer_identity_horiz->Add( sb_outer_identity_vert, 1, wxEXPAND, FromDIP(5) ); - - - sb_outer_identity->Add( sb_outer_identity_horiz, 0, wxEXPAND, FromDIP(5) ); - - - this->SetSizer( sb_outer_identity ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxTTLSConfigPanelBase::OnUpdateUI ) ); -} - -wxTTLSConfigPanelBase::~wxTTLSConfigPanelBase() -{ - // Disconnect Events - this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxTTLSConfigPanelBase::OnUpdateUI ) ); - -} diff --git a/lib/TTLS_UI/res/wxTTLS_UI.fbp b/lib/TTLS_UI/res/wxTTLS_UI.fbp deleted file mode 100644 index ac13915..0000000 --- a/lib/TTLS_UI/res/wxTTLS_UI.fbp +++ /dev/null @@ -1,655 +0,0 @@ - - - - - ; - C++ - 1 - source_name - 0 - 0 - . - UTF-8 - connect - wxTTLS_UI - 1000 - none - 1 - wxTTLS_UI - - . - #include <StdAfx.h> - 1 - 1 - 1 - 1 - UI - 1 - 1 - - 0 - wxAUI_MGR_DEFAULT - - - 1 - 1 - impl_virtual - - - 0 - wxID_ANY - - - wxTTLSConfigPanelBase - - 500,-1 - - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnUpdateUI - - wxID_ANY - Outer Identity - - sb_outer_identity - wxVERTICAL - none - - - 5 - wxEXPAND - 0 - - - sb_outer_identity_horiz - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - Load From Icon Resource; ; [32; 32] - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_outer_identity_icon - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - sb_outer_identity_vert - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Select the user ID supplicant introduces itself as to authenticator: - - 0 - - - 0 - - 1 - m_outer_identity_label - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - 440 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - - sb_outer_identity_radio - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &True identity - - 0 - - - 0 - - 1 - m_outer_identity_same - 1 - - - protected - 1 - - Resizable - 1 - - wxRB_GROUP - - 0 - Use my true user name - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Use &empty outer identity - - 0 - - - 0 - - 1 - m_outer_identity_empty - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Omit my user name and use @mydomain.org only - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - sb_outer_identity_custom - wxHORIZONTAL - none - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Custom outer identity: - - 0 - - - 0 - - 1 - m_outer_identity_custom - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Specify custom outer identity - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_outer_identity_custom_val - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Custom outer identity to use - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/TTLS_UI/res/wxTTLS_UI.h b/lib/TTLS_UI/res/wxTTLS_UI.h deleted file mode 100644 index 596c2e8..0000000 --- a/lib/TTLS_UI/res/wxTTLS_UI.h +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 17 2015) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __WXTTLS_UI_H__ -#define __WXTTLS_UI_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -/// Class wxTTLSConfigPanelBase -/////////////////////////////////////////////////////////////////////////////// -class wxTTLSConfigPanelBase : public wxPanel -{ - private: - - protected: - wxStaticBitmap* m_outer_identity_icon; - wxStaticText* m_outer_identity_label; - wxRadioButton* m_outer_identity_same; - wxRadioButton* m_outer_identity_empty; - wxRadioButton* m_outer_identity_custom; - wxTextCtrl* m_outer_identity_custom_val; - - // Virtual event handlers, overide them in your derived class - virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - - - public: - - wxTTLSConfigPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, long style = wxTAB_TRAVERSAL ); - ~wxTTLSConfigPanelBase(); - -}; - -#endif //__WXTTLS_UI_H__ diff --git a/lib/TTLS_UI/src/TTLS_UI.cpp b/lib/TTLS_UI/src/TTLS_UI.cpp index f06794b..cbf0c57 100644 --- a/lib/TTLS_UI/src/TTLS_UI.cpp +++ b/lib/TTLS_UI/src/TTLS_UI.cpp @@ -21,80 +21,6 @@ #include "StdAfx.h" -////////////////////////////////////////////////////////////////////// -// wxTTLSConfigPanel -////////////////////////////////////////////////////////////////////// - -wxTTLSConfigPanel::wxTTLSConfigPanel(const eap::config_provider &prov, eap::config_method_tls_tunnel &cfg, wxWindow* parent) : - m_prov(prov), - m_cfg(cfg), - wxTTLSConfigPanelBase(parent) -{ - // Load and set icon. - winstd::library lib_shell32; - if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE)) - m_outer_identity_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(265))); -} - - -/// \cond internal - -bool wxTTLSConfigPanel::TransferDataToWindow() -{ - // Populate identity controls. - if (m_cfg.m_anonymous_identity.empty()) { - m_outer_identity_same->SetValue(true); - } else if (m_cfg.m_anonymous_identity == L"@") { - m_outer_identity_empty->SetValue(true); - } else { - m_outer_identity_custom->SetValue(true); - m_outer_identity_custom_val->SetValue(m_cfg.m_anonymous_identity); - } - - return wxTTLSConfigPanelBase::TransferDataToWindow(); -} - - -bool wxTTLSConfigPanel::TransferDataFromWindow() -{ - wxCHECK(wxTTLSConfigPanelBase::TransferDataFromWindow(), false); - - if (!m_prov.m_read_only) { - // This is not a provider-locked configuration. Save the data. - if (m_outer_identity_same->GetValue()) - m_cfg.m_anonymous_identity.clear(); - else if (m_outer_identity_empty->GetValue()) - m_cfg.m_anonymous_identity = L"@"; - else - m_cfg.m_anonymous_identity = m_outer_identity_custom_val->GetValue(); - } - - return true; -} - - -void wxTTLSConfigPanel::OnUpdateUI(wxUpdateUIEvent& event) -{ - wxTTLSConfigPanelBase::OnUpdateUI(event); - - if (m_prov.m_read_only) { - // This is provider-locked configuration. Disable controls. - m_outer_identity_same ->Enable(false); - m_outer_identity_empty ->Enable(false); - m_outer_identity_custom ->Enable(false); - m_outer_identity_custom_val->Enable(false); - } else { - // This is not a provider-locked configuration. Selectively enable/disable controls. - m_outer_identity_same ->Enable(true); - m_outer_identity_empty ->Enable(true); - m_outer_identity_custom ->Enable(true); - m_outer_identity_custom_val->Enable(m_outer_identity_custom->GetValue()); - } -} - -/// \endcond - - ////////////////////////////////////////////////////////////////////// // wxTTLSConfigWindow ////////////////////////////////////////////////////////////////////// @@ -143,7 +69,7 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_m m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) ); sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, FromDIP(5)); - m_outer_identity = new wxTTLSConfigPanel(m_prov, dynamic_cast(m_cfg), this); + m_outer_identity = new wxEAPIdentityConfigPanel(m_prov, dynamic_cast(m_cfg), this); sb_content->Add(m_outer_identity, 0, wxALL|wxEXPAND, FromDIP(5)); m_tls = new wxTLSConfigPanel(m_prov, dynamic_cast(m_cfg), this);