GUI updated to show "<Your Provider>" when provider ID is blank

This commit is contained in:
Simon Rozman 2016-08-18 06:30:02 +02:00
parent 92460c571f
commit 076c6b77d7
2 changed files with 18 additions and 4 deletions

View File

@ -95,6 +95,11 @@ template <class _Tcred, class _Tbase> 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 <wx/msw/winundef.h> // 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 : _("<Your Organization>");
}

View File

@ -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));
}