OnUpdateUI() event handlers optimized to reduce ridiculous CPU consumption of GUI & Incorrect page-provider mapping in wxEAPConfigDialog<> fixed
This commit is contained in:
parent
497f4eca8a
commit
7c938fe291
@ -223,19 +223,22 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& event)
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
int idx = m_providers->GetSelection();
|
||||
eap::config_provider &cfg_provider = ((_wxT*)m_providers->GetPage(idx))->GetProvider();
|
||||
|
||||
m_advanced->Enable(!m_cfg.m_providers.at(m_providers->GetSelection()).m_read_only);
|
||||
m_advanced->Enable(!cfg_provider.m_read_only);
|
||||
}
|
||||
|
||||
virtual void OnAdvanced(wxCommandEvent& event)
|
||||
virtual void OnAdvanced(wxCommandEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
int idx = m_providers->GetSelection();
|
||||
eap::config_provider &cfg_provider = ((_wxT*)m_providers->GetPage(idx))->GetProvider();
|
||||
|
||||
wxEAPConfigProvider dlg(m_cfg.m_providers.at(m_providers->GetSelection()), this);
|
||||
dlg.ShowModal();
|
||||
wxEAPConfigProvider dlg(cfg_provider, this);
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
m_providers->SetPageText(idx, wxEAPGetProviderName(cfg_provider.m_id));
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
@ -360,21 +363,24 @@ public:
|
||||
/// \param[inout] cfg Configuration data
|
||||
/// \param[in] parent Parent window
|
||||
///
|
||||
wxEAPConfigWindow(const eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent);
|
||||
wxEAPConfigWindow(eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent);
|
||||
|
||||
///
|
||||
/// Destructs the configuration window
|
||||
///
|
||||
virtual ~wxEAPConfigWindow();
|
||||
|
||||
public:
|
||||
inline eap::config_provider& GetProvider() const { return m_prov; }
|
||||
inline eap::config_method & GetConfig () const { return m_cfg ; }
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event);
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& event);
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
const eap::config_provider &m_prov; ///< EAP provider
|
||||
eap::config_provider &m_prov; ///< EAP provider
|
||||
eap::config_method &m_cfg; ///< Method configuration
|
||||
};
|
||||
|
||||
@ -459,6 +465,7 @@ public:
|
||||
m_prov(prov),
|
||||
m_cfg(cfg),
|
||||
m_target(pszCredTarget),
|
||||
m_has_own(false),
|
||||
m_cred_own(cfg.m_module),
|
||||
m_cred_preshared(cfg.m_module),
|
||||
wxEAPCredentialsConfigPanelBase(parent)
|
||||
@ -480,32 +487,6 @@ public:
|
||||
protected:
|
||||
/// \cond internal
|
||||
|
||||
bool RetrieveCredentials()
|
||||
{
|
||||
try {
|
||||
m_cred_own.retrieve(m_target.c_str());
|
||||
if (m_cred_own.empty())
|
||||
m_own_identity->SetValue(_T("<empty credentials>"));
|
||||
else {
|
||||
wxString identity(m_cred_own.get_name());
|
||||
m_own_identity->SetValue(!identity.empty() ? identity : _("<blank identity>"));
|
||||
}
|
||||
return true;
|
||||
} catch (winstd::win_runtime_error &err) {
|
||||
if (err.number() == ERROR_NOT_FOUND) {
|
||||
m_own_identity->Clear();
|
||||
return false;
|
||||
} else {
|
||||
m_own_identity->SetValue(wxString::Format(_("<error %u>"), err.number()));
|
||||
return true;
|
||||
}
|
||||
} catch (...) {
|
||||
m_own_identity->SetValue(_("<error>"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool TransferDataToWindow()
|
||||
{
|
||||
if (!m_cfg.m_use_preshared)
|
||||
@ -513,7 +494,13 @@ protected:
|
||||
else
|
||||
m_preshared->SetValue(true);
|
||||
|
||||
if (m_cfg.m_allow_save) {
|
||||
RetrieveOwnCredentials();
|
||||
m_timer_own.Start(3000);
|
||||
}
|
||||
|
||||
m_cred_preshared = *(_Tcred*)m_cfg.m_preshared.get();
|
||||
UpdatePresharedIdentity();
|
||||
|
||||
return wxEAPCredentialsConfigPanelBase::TransferDataToWindow();
|
||||
}
|
||||
@ -533,34 +520,24 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& event)
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
if (m_cfg.m_allow_save) {
|
||||
if (m_own->GetValue()) {
|
||||
m_own_identity->Enable(true);
|
||||
m_own_set ->Enable(true);
|
||||
m_own_clear ->Enable(RetrieveCredentials());
|
||||
m_own_clear ->Enable(m_has_own);
|
||||
} else {
|
||||
m_own_identity->Enable(false);
|
||||
m_own_set ->Enable(false);
|
||||
m_own_clear ->Enable(false);
|
||||
}
|
||||
} else {
|
||||
m_own_identity->Clear();
|
||||
m_own_identity->Enable(false);
|
||||
m_own_set ->Enable(false);
|
||||
m_own_clear ->Enable(false);
|
||||
}
|
||||
|
||||
if (m_cred_preshared.empty())
|
||||
m_preshared_identity->SetValue(_T("<empty credentials>"));
|
||||
else {
|
||||
wxString identity(m_cred_preshared.get_name());
|
||||
m_preshared_identity->SetValue(!identity.empty() ? identity : _("<blank identity>"));
|
||||
}
|
||||
|
||||
if (m_prov.m_read_only) {
|
||||
// This is provider-locked configuration. Disable controls.
|
||||
// To avoid run-away selection of radio buttons, disable the selected one last.
|
||||
@ -576,7 +553,7 @@ protected:
|
||||
} else {
|
||||
// This is not a provider-locked configuration. Selectively enable/disable controls.
|
||||
m_own ->Enable(true);
|
||||
m_preshared ->Enable(true);
|
||||
m_preshared->Enable(true);
|
||||
if (m_own->GetValue()) {
|
||||
m_preshared_identity->Enable(false);
|
||||
m_preshared_set ->Enable(false);
|
||||
@ -588,12 +565,10 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnSetOwn(wxCommandEvent& event)
|
||||
virtual void OnSetOwn(wxCommandEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
// Read credentials from Credential Manager.
|
||||
RetrieveCredentials();
|
||||
RetrieveOwnCredentials();
|
||||
|
||||
// Display credential prompt.
|
||||
wxEAPCredentialsDialog dlg(m_prov, this);
|
||||
@ -603,37 +578,87 @@ protected:
|
||||
// Write credentials to credential manager.
|
||||
try {
|
||||
m_cred_own.store(m_target.c_str());
|
||||
|
||||
// Re-read credentials from Credential Manager. To test if they load!
|
||||
RetrieveCredentials();
|
||||
m_has_own = TRUE;
|
||||
UpdateOwnIdentity();
|
||||
} catch (winstd::win_runtime_error &err) {
|
||||
wxLogError(winstd::tstring_printf(_("Error writing credentials to Credential Manager: %hs (error %u)"), err.what(), err.number()).c_str());
|
||||
RetrieveOwnCredentials();
|
||||
} catch (...) {
|
||||
wxLogError(_("Writing credentials failed."));
|
||||
RetrieveOwnCredentials();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnClearOwn(wxCommandEvent& event)
|
||||
virtual void OnClearOwn(wxCommandEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
if (!CredDelete(m_cred_own.target_name(m_target.c_str()).c_str(), CRED_TYPE_GENERIC, 0))
|
||||
if (CredDelete(m_cred_own.target_name(m_target.c_str()).c_str(), CRED_TYPE_GENERIC, 0)) {
|
||||
m_own_identity->Clear();
|
||||
m_has_own = false;
|
||||
} else
|
||||
wxLogError(_("Deleting credentials failed (error %u)."), GetLastError());
|
||||
}
|
||||
|
||||
|
||||
virtual void OnSetPreshared(wxCommandEvent& event)
|
||||
virtual void OnSetPreshared(wxCommandEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
wxEAPCredentialsDialog dlg(m_prov, this);
|
||||
|
||||
_wxT *panel = new _wxT(m_prov, m_cfg, m_cred_preshared, _T(""), &dlg, true);
|
||||
|
||||
dlg.AddContent(panel);
|
||||
dlg.ShowModal();
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
UpdatePresharedIdentity();
|
||||
}
|
||||
|
||||
|
||||
virtual void OnTimerOwn(wxTimerEvent& /*event*/)
|
||||
{
|
||||
RetrieveOwnCredentials();
|
||||
}
|
||||
|
||||
|
||||
void RetrieveOwnCredentials()
|
||||
{
|
||||
try {
|
||||
m_cred_own.retrieve(m_target.c_str());
|
||||
m_has_own = true;
|
||||
UpdateOwnIdentity();
|
||||
} catch (winstd::win_runtime_error &err) {
|
||||
if (err.number() == ERROR_NOT_FOUND) {
|
||||
m_own_identity->Clear();
|
||||
m_has_own = false;
|
||||
} else {
|
||||
m_own_identity->SetValue(wxString::Format(_("<error %u>"), err.number()));
|
||||
m_has_own = true;
|
||||
}
|
||||
} catch (...) {
|
||||
m_own_identity->SetValue(_("<error>"));
|
||||
m_has_own = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void UpdateOwnIdentity()
|
||||
{
|
||||
if (m_cred_own.empty())
|
||||
m_own_identity->SetValue(_T("<empty credentials>"));
|
||||
else {
|
||||
wxString identity(m_cred_own.get_name());
|
||||
m_own_identity->SetValue(!identity.empty() ? identity : _("<blank identity>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void UpdatePresharedIdentity()
|
||||
{
|
||||
if (m_cred_preshared.empty())
|
||||
m_preshared_identity->SetValue(_T("<empty credentials>"));
|
||||
else {
|
||||
wxString identity(m_cred_preshared.get_name());
|
||||
m_preshared_identity->SetValue(!identity.empty() ? identity : _("<blank identity>"));
|
||||
}
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
@ -644,6 +669,7 @@ protected:
|
||||
winstd::tstring m_target; ///< Credential Manager target
|
||||
|
||||
private:
|
||||
bool m_has_own; ///< Does the user has (some sort of) credentials stored in Credential Manager?
|
||||
_Tcred m_cred_own; ///< Temporary own credential data
|
||||
_Tcred m_cred_preshared; ///< Temporary pre-shared credential data
|
||||
};
|
||||
@ -676,12 +702,6 @@ public:
|
||||
m_is_config(is_config),
|
||||
_Tbase(parent)
|
||||
{
|
||||
this->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(_Tthis::OnUpdateUI));
|
||||
}
|
||||
|
||||
virtual ~wxEAPCredentialsPanel()
|
||||
{
|
||||
this->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(_Tthis::OnUpdateUI));
|
||||
}
|
||||
|
||||
virtual void SetRemember(bool val)
|
||||
@ -697,10 +717,8 @@ public:
|
||||
protected:
|
||||
/// \cond internal
|
||||
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& event)
|
||||
virtual bool TransferDataToWindow()
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
if (m_is_config) {
|
||||
// Configuration mode
|
||||
// Always store credentials (somewhere).
|
||||
@ -715,6 +733,8 @@ protected:
|
||||
m_remember->SetValue(false);
|
||||
m_remember->Enable(false);
|
||||
}
|
||||
|
||||
return _Tbase::TransferDataToWindow();
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
@ -780,6 +800,14 @@ protected:
|
||||
m_identity->SetSelection(0, -1);
|
||||
m_password->SetValue(m_cred.m_password.empty() ? wxEmptyString : s_dummy_password);
|
||||
|
||||
if (!m_is_config && m_cfg.m_use_preshared) {
|
||||
// Credential prompt mode & Using pre-shared credentials
|
||||
m_identity_label->Enable(false);
|
||||
m_identity ->Enable(false);
|
||||
m_password_label->Enable(false);
|
||||
m_password ->Enable(false);
|
||||
}
|
||||
|
||||
return wxEAPCredentialsPanel<_Tcred, wxEAPCredentialsPassPanelBase>::TransferDataToWindow();
|
||||
}
|
||||
|
||||
@ -798,19 +826,6 @@ protected:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (!m_is_config && m_cfg.m_use_preshared) {
|
||||
// Credential prompt mode & Using pre-shared credentials
|
||||
m_identity_label->Enable(false);
|
||||
m_identity ->Enable(false);
|
||||
m_password_label->Enable(false);
|
||||
m_password ->Enable(false);
|
||||
}
|
||||
|
||||
wxEAPCredentialsPanel<_Tcred, wxEAPCredentialsPassPanelBase>::OnUpdateUI(event);
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
private:
|
||||
|
@ -272,12 +272,14 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare
|
||||
|
||||
this->SetSizer( sb_credentials );
|
||||
this->Layout();
|
||||
m_timer_own.SetOwner( this, wxID_ANY );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) );
|
||||
m_own_clear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearOwn ), NULL, this );
|
||||
m_own_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetOwn ), NULL, this );
|
||||
m_preshared_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetPreshared ), NULL, this );
|
||||
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerOwn ) );
|
||||
}
|
||||
|
||||
wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase()
|
||||
@ -287,6 +289,7 @@ wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase()
|
||||
m_own_clear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearOwn ), NULL, this );
|
||||
m_own_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetOwn ), NULL, this );
|
||||
m_preshared_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetPreshared ), NULL, this );
|
||||
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerOwn ) );
|
||||
|
||||
}
|
||||
|
||||
@ -453,16 +456,10 @@ wxEAPProviderIdentityPanelBase::wxEAPProviderIdentityPanelBase( wxWindow* parent
|
||||
|
||||
this->SetSizer( sb_provider_id );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPProviderIdentityPanelBase::OnUpdateUI ) );
|
||||
}
|
||||
|
||||
wxEAPProviderIdentityPanelBase::~wxEAPProviderIdentityPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPProviderIdentityPanelBase::OnUpdateUI ) );
|
||||
|
||||
}
|
||||
|
||||
wxEAPProviderLockPanelBase::wxEAPProviderLockPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
@ -505,14 +502,8 @@ wxEAPProviderLockPanelBase::wxEAPProviderLockPanelBase( wxWindow* parent, wxWind
|
||||
|
||||
this->SetSizer( sb_provider_lock );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPProviderLockPanelBase::OnUpdateUI ) );
|
||||
}
|
||||
|
||||
wxEAPProviderLockPanelBase::~wxEAPProviderLockPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPProviderLockPanelBase::OnUpdateUI ) );
|
||||
|
||||
}
|
||||
|
@ -1913,6 +1913,15 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxTimer" expanded="1">
|
||||
<property name="enabled">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="name">m_timer_own</property>
|
||||
<property name="oneshot">0</property>
|
||||
<property name="period">3000</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnTimer">OnTimerOwn</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="Panel" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
@ -2667,7 +2676,7 @@
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI">OnUpdateUI</event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Your Organization</property>
|
||||
@ -3817,7 +3826,7 @@
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI">OnUpdateUI</event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Configuration Lock</property>
|
||||
|
@ -33,6 +33,7 @@ class wxEAPBannerPanel;
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/checkbox.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -143,12 +144,14 @@ class wxEAPCredentialsConfigPanelBase : public wxPanel
|
||||
wxRadioButton* m_preshared;
|
||||
wxTextCtrl* m_preshared_identity;
|
||||
wxButton* m_preshared_set;
|
||||
wxTimer m_timer_own;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnClearOwn( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetOwn( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetPreshared( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTimerOwn( wxTimerEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
@ -202,10 +205,6 @@ class wxEAPProviderIdentityPanelBase : public wxPanel
|
||||
wxStaticText* m_provider_phone_icon;
|
||||
wxTextCtrl* m_provider_phone;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPProviderIdentityPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
@ -226,10 +225,6 @@ class wxEAPProviderLockPanelBase : public wxPanel
|
||||
wxCheckBox* m_provider_lock;
|
||||
wxStaticText* m_provider_lock_note;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPProviderLockPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
|
@ -223,7 +223,7 @@ wxEAPCredentialWarningPanel::wxEAPCredentialWarningPanel(const eap::config_provi
|
||||
// wxEAPConfigWindow
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPConfigWindow::wxEAPConfigWindow(const eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent) :
|
||||
wxEAPConfigWindow::wxEAPConfigWindow(eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent) :
|
||||
m_prov(prov),
|
||||
m_cfg(cfg),
|
||||
wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
||||
@ -232,42 +232,23 @@ wxEAPConfigWindow::wxEAPConfigWindow(const eap::config_provider &prov, eap::conf
|
||||
|
||||
// Connect Events
|
||||
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPConfigWindow::OnInitDialog));
|
||||
this->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEAPConfigWindow::OnUpdateUI));
|
||||
}
|
||||
|
||||
|
||||
wxEAPConfigWindow::~wxEAPConfigWindow()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEAPConfigWindow::OnUpdateUI));
|
||||
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPConfigWindow::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
void wxEAPConfigWindow::OnInitDialog(wxInitDialogEvent& event)
|
||||
void wxEAPConfigWindow::OnInitDialog(wxInitDialogEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
// Call TransferDataToWindow() manually, as wxScrolledWindow somehow skips that.
|
||||
TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
void wxEAPConfigWindow::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
if (m_parent && m_parent->IsKindOf(wxCLASSINFO(wxNotebook))) {
|
||||
// We're a notebook page. Set the ID of our provider as our page label.
|
||||
wxNotebook *notebook = (wxNotebook*)m_parent;
|
||||
int idx = notebook->FindPage(this);
|
||||
if (idx != wxNOT_FOUND)
|
||||
notebook->SetPageText(idx, wxEAPGetProviderName(m_prov.m_id));
|
||||
} else
|
||||
this->SetLabel(wxEAPGetProviderName(m_prov.m_id));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPProviderIdentityPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -194,8 +194,14 @@ wxTLSCredentialsPanelBase::wxTLSCredentialsPanelBase( wxWindow* parent, wxWindow
|
||||
|
||||
this->SetSizer( sb_credentials );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxTLSCredentialsPanelBase::OnUpdateUI ) );
|
||||
}
|
||||
|
||||
wxTLSCredentialsPanelBase::~wxTLSCredentialsPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxTLSCredentialsPanelBase::OnUpdateUI ) );
|
||||
|
||||
}
|
||||
|
@ -1050,7 +1050,7 @@
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<event name="OnUpdateUI">OnUpdateUI</event>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">TLS Client Certificate</property>
|
||||
|
@ -85,6 +85,10 @@ class wxTLSCredentialsPanelBase : public wxPanel
|
||||
wxStaticText* m_identity_note;
|
||||
wxCheckBox* m_remember;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxTLSCredentialsPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
|
@ -25,3 +25,5 @@
|
||||
#include "../../../include/Version.h"
|
||||
|
||||
#include "../include/TLS_UI.h"
|
||||
|
||||
#include <WindowsX.h>
|
||||
|
@ -385,7 +385,7 @@ bool wxTLSCredentialsPanel::TransferDataFromWindow()
|
||||
}
|
||||
|
||||
|
||||
void wxTLSCredentialsPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
void wxTLSCredentialsPanel::OnUpdateUI(wxUpdateUIEvent& /*event*/)
|
||||
{
|
||||
if (!m_is_config && m_cfg.m_use_preshared) {
|
||||
// Credential prompt mode & Using pre-shared credentials
|
||||
@ -404,8 +404,6 @@ void wxTLSCredentialsPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
m_cert_select_val->Enable(m_cert_select->GetValue());
|
||||
m_identity->Enable(true);
|
||||
}
|
||||
|
||||
wxEAPCredentialsPanel<eap::credentials_tls, wxTLSCredentialsPanelBase>::OnUpdateUI(event);
|
||||
}
|
||||
|
||||
|
||||
@ -465,10 +463,8 @@ bool wxTLSServerTrustPanel::TransferDataFromWindow()
|
||||
}
|
||||
|
||||
|
||||
void wxTLSServerTrustPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
void wxTLSServerTrustPanel::OnUpdateUI(wxUpdateUIEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
if (m_prov.m_read_only) {
|
||||
// This is provider-locked configuration. Disable controls.
|
||||
m_root_ca_add_store->Enable(false);
|
||||
@ -479,9 +475,12 @@ void wxTLSServerTrustPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
// This is not a provider-locked configuration. Selectively enable/disable controls.
|
||||
m_root_ca_add_store->Enable(true);
|
||||
m_root_ca_add_file ->Enable(true);
|
||||
wxArrayInt selections;
|
||||
m_root_ca_remove->Enable(m_root_ca->GetSelections(selections) ? true : false);
|
||||
m_root_ca_remove ->Enable(ListBox_GetSelCount(m_root_ca->GetHWND()) ? true : false); // *
|
||||
m_server_names ->Enable(true);
|
||||
|
||||
// * ListBox_GetSelCount() is not cross-platform, but this is Windows EAP Supplicant,
|
||||
// and this is the fastest way to find out if there is a selection in the list box,
|
||||
// observing wxWidgets 3.0.2 has nothing faster to offer.
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,10 +493,8 @@ void wxTLSServerTrustPanel::OnRootCADClick(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxTLSServerTrustPanel::OnRootCAAddStore(wxCommandEvent& event)
|
||||
void wxTLSServerTrustPanel::OnRootCAAddStore(wxCommandEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
winstd::cert_store store;
|
||||
if (store.create(NULL, _T("ROOT"))) {
|
||||
winstd::cert_context cert;
|
||||
@ -510,8 +507,6 @@ void wxTLSServerTrustPanel::OnRootCAAddStore(wxCommandEvent& event)
|
||||
|
||||
void wxTLSServerTrustPanel::OnRootCAAddFile(wxCommandEvent& event)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
const wxString separator(wxT("|"));
|
||||
wxFileDialog open_dialog(this, _("Add Certificate"), wxEmptyString, wxEmptyString,
|
||||
_("Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)") + separator + wxT("*.cer;*.crt;*.der;*.p7b;*.pem") + separator +
|
||||
@ -538,10 +533,8 @@ void wxTLSServerTrustPanel::OnRootCAAddFile(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxTLSServerTrustPanel::OnRootCARemove(wxCommandEvent& event)
|
||||
void wxTLSServerTrustPanel::OnRootCARemove(wxCommandEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
wxArrayInt selections;
|
||||
for (int i = m_root_ca->GetSelections(selections); i--; )
|
||||
m_root_ca->Delete(selections[i]);
|
||||
|
@ -76,14 +76,19 @@ class wxTTLSConfigWindow : public wxEAPConfigWindow
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a configuration panel
|
||||
/// Constructs a configuration window
|
||||
///
|
||||
/// \param[in] prov Provider configuration data
|
||||
/// \param[inout] cfg Configuration data
|
||||
/// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name.
|
||||
/// \param[in] parent Parent window
|
||||
///
|
||||
wxTTLSConfigWindow(const eap::config_provider &prov, eap::config_method &cfg, LPCTSTR pszCredTarget, wxWindow* parent);
|
||||
wxTTLSConfigWindow(eap::config_provider &prov, eap::config_method &cfg, LPCTSTR pszCredTarget, wxWindow* parent);
|
||||
|
||||
///
|
||||
/// Destructs the configuration window
|
||||
///
|
||||
virtual ~wxTTLSConfigWindow();
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
|
@ -71,10 +71,8 @@ bool wxTTLSConfigPanel::TransferDataFromWindow()
|
||||
}
|
||||
|
||||
|
||||
void wxTTLSConfigPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
void wxTTLSConfigPanel::OnUpdateUI(wxUpdateUIEvent& /*event*/)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(event);
|
||||
|
||||
if (m_prov.m_read_only) {
|
||||
// This is provider-locked configuration. Disable controls.
|
||||
m_outer_identity_same ->Enable(false);
|
||||
@ -95,7 +93,7 @@ void wxTTLSConfigPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
// wxTTLSConfigWindow
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxTTLSConfigWindow::wxTTLSConfigWindow(const eap::config_provider &prov, eap::config_method &cfg, LPCTSTR pszCredTarget, wxWindow* parent) :
|
||||
wxTTLSConfigWindow::wxTTLSConfigWindow(eap::config_provider &prov, eap::config_method &cfg, LPCTSTR pszCredTarget, wxWindow* parent) :
|
||||
m_cfg((eap::config_method_ttls&)cfg),
|
||||
m_cfg_pap(cfg.m_module),
|
||||
wxEAPConfigWindow(prov, cfg, parent)
|
||||
@ -143,6 +141,14 @@ wxTTLSConfigWindow::wxTTLSConfigWindow(const eap::config_provider &prov, eap::co
|
||||
|
||||
// m_inner_type->SetFocusFromKbd(); // This control steals mouse-wheel scrolling for itself
|
||||
panel_pap->SetFocusFromKbd();
|
||||
|
||||
this->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxTTLSConfigWindow::OnUpdateUI));
|
||||
}
|
||||
|
||||
|
||||
wxTTLSConfigWindow::~wxTTLSConfigWindow()
|
||||
{
|
||||
this->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxTTLSConfigWindow::OnUpdateUI));
|
||||
}
|
||||
|
||||
|
||||
@ -193,10 +199,8 @@ void wxTTLSConfigWindow::OnInitDialog(wxInitDialogEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxTTLSConfigWindow::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
void wxTTLSConfigWindow::OnUpdateUI(wxUpdateUIEvent& /*event*/)
|
||||
{
|
||||
wxEAPConfigWindow::OnUpdateUI(event);
|
||||
|
||||
m_inner_type->GetChoiceCtrl()->Enable(!m_prov.m_read_only);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user