Rename wxTTLSConfigPanel and move upstream

wxTTLSConfigPanel is about anonymizing inner identity and was renamed to
wxEAPIdentityConfigPanel and moved upstream to make reusable.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2020-01-15 11:51:50 +01:00
parent 18184a2762
commit bacd4fd8d8
11 changed files with 822 additions and 887 deletions

View File

@@ -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
//////////////////////////////////////////////////////////////////////