diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index bec34c3..a15a8ed 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -95,6 +95,11 @@ template class wxPasswordCredentialsPanel; /// inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName); +/// +/// Returns GUI displayable provider name +/// +inline wxString wxEAPGetProviderName(const std::wstring &id); + #pragma once #include // Fixes `CreateDialog` name collision @@ -158,7 +163,9 @@ public: *method->get(), provider->m_id.c_str(), m_providers), - is_single ? provider->m_id : winstd::tstring_printf(_T("%s (%u)"), provider->m_id.c_str(), count)); + is_single ? + wxEAPGetProviderName(provider->m_id) : + winstd::tstring_printf(_T("%s (%u)"), wxEAPGetProviderName(provider->m_id), count)); } this->Layout(); @@ -794,3 +801,10 @@ inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE h } else return false; } + + +inline wxString wxEAPGetProviderName(const std::wstring &id) +{ + return + !id.empty() ? id : _(""); +} diff --git a/lib/EAPBase_UI/src/EAP_UI.cpp b/lib/EAPBase_UI/src/EAP_UI.cpp index 32c4a98..1903b4f 100644 --- a/lib/EAPBase_UI/src/EAP_UI.cpp +++ b/lib/EAPBase_UI/src/EAP_UI.cpp @@ -83,7 +83,7 @@ void wxEAPGeneralDialog::OnInitDialog(wxInitDialogEvent& event) wxEAPCredentialsDialog::wxEAPCredentialsDialog(const eap::config_provider &prov, wxWindow* parent) : wxEAPGeneralDialog(parent, _("EAP Credentials")) { // Set banner title. - m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), prov.m_id.c_str())); + m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), wxEAPGetProviderName(prov.m_id).c_str())); } @@ -248,9 +248,9 @@ void wxEAPConfigWindow::OnUpdateUI(wxUpdateUIEvent& event) wxNotebook *notebook = (wxNotebook*)m_parent; int idx = notebook->FindPage(this); if (idx != wxNOT_FOUND) - notebook->SetPageText(idx, m_prov.m_id); + notebook->SetPageText(idx, wxEAPGetProviderName(m_prov.m_id)); } else - this->SetLabel(m_prov.m_id); + this->SetLabel(wxEAPGetProviderName(m_prov.m_id)); }