void CQuickconnectBar::OnMenu(wxCommandEvent& event) { const int id = event.GetId(); if (id == 1) OnQuickconnect(event); else if (id == 2) ClearFields(); else if (id == 3) CRecentServerList::Clear(); if (id < 10) return; unsigned int index = id - 10; if (index >= m_recentServers.size()) return; std::list<CServer>::const_iterator iter; for (iter = m_recentServers.begin(); index; index--, iter++); m_pState->Connect(*iter, true); }
void CQuickconnectBar::OnMenu(wxCommandEvent& event) { const int id = event.GetId(); if (id == 1) OnQuickconnect(event); else if (id == 2) ClearFields(); else if (id == 3) CRecentServerList::Clear(); if (id < 10) return; unsigned int index = id - 10; if (index >= m_recentServers.size()) return; std::list<CServer>::const_iterator iter = m_recentServers.begin(); std::advance(iter, index); CServer server = *iter; if (server.GetLogonType() == ASK) { if (!CLoginManager::Get().GetPassword(server, false)) return; } CState* pState = CContextManager::Get()->GetCurrentContext(); if (!pState || !pState->m_pEngine) { wxMessageBoxEx(_("FTP Engine not initialized, can't connect"), _("FileZilla Error"), wxICON_EXCLAMATION); return; } m_pMainFrame->ConnectToServer(server); }