Example #1
0
ConnectForm::ConnectForm(wxWindow *parent, const Url::Ptr& url)
	: ConnectFormBase(parent)
{
#ifdef _WIN32
	SetIcon(wxICON(icinga));
#endif /* _WIN32 */

	std::string authority = url->GetAuthority();

	std::vector<std::string> tokens;
	boost::algorithm::split(tokens, authority, boost::is_any_of("@"));

	if (tokens.size() > 1) {
		std::vector<std::string> userinfo;
		boost::algorithm::split(userinfo, tokens[0], boost::is_any_of(":"));

		m_UserText->SetValue(userinfo[0]);
		m_PasswordText->SetValue(userinfo[1]);
	}

	std::vector<std::string> hostport;
	boost::algorithm::split(hostport, tokens.size() > 1 ? tokens[1] : tokens[0], boost::is_any_of(":"));

	m_HostText->SetValue(hostport[0]);

	if (hostport.size() > 1)
		m_PortText->SetValue(hostport[1]);
	else
		m_PortText->SetValue("5665");

	SetDefaultItem(m_ButtonsOK);
}