void SFTPTreeView::OnOpenTerminal(wxAuiToolBarEvent& event) { // Open terminal to the selected account if(event.IsDropDownClicked()) { SFTPTreeViewBase::ShowAuiToolMenu(event); } else { SFTPSettings settings; settings.Load(); wxString accountName = m_choiceAccount->GetStringSelection(); if(accountName.IsEmpty()) { ::wxMessageBox(_("Please select an account to connect to"), "CodeLite", wxICON_ERROR | wxOK); return; } SSHAccountInfo account; if(!settings.GetAccount(accountName, account)) { ::wxMessageBox(wxString() << _("Could not find account: ") << accountName, "CodeLite", wxICON_ERROR | wxOK); return; } wxString connectString; connectString << account.GetUsername() << "@" << account.GetHost(); const wxString& sshClient = settings.GetSshClient(); FileUtils::OpenSSHTerminal(sshClient, connectString, account.GetPassword(), account.GetPort()); } }
void SSHAccountManagerDlg::DoAddAccount(const SSHAccountInfo& account) { wxVector<wxVariant> cols; cols.push_back( account.GetAccountName() ); cols.push_back( account.GetUsername() ); m_dvListCtrlAccounts->AppendItem( cols, (wxUIntPtr)(new SSHAccountInfo(account))); }
void SSHAccountManagerDlg::OnEditAccount(wxDataViewEvent& event) { SSHAccountInfo *account = (SSHAccountInfo*)(m_dvListCtrlAccounts->GetItemData( event.GetItem() )); AddSSHAcountDlg dlg(this, *account); if ( dlg.ShowModal() == wxID_OK ) { // update the user info dlg.GetAccountInfo(*account); // update the UI m_dvListCtrlAccounts->GetStore()->SetValue(account->GetAccountName(), event.GetItem(), 0); m_dvListCtrlAccounts->GetStore()->SetValue(account->GetUsername(), event.GetItem(), 1); m_dvListCtrlAccounts->Refresh(); } }
void SSHAccountManagerDlg::DoEditAccount(const wxDataViewItem& item) { SSHAccountInfo* account = (SSHAccountInfo*)(m_dvListCtrlAccounts->GetItemData(item)); if(account) { AddSSHAcountDlg dlg(this, *account); if(dlg.ShowModal() == wxID_OK) { // update the user info dlg.GetAccountInfo(*account); // update the UI m_dvListCtrlAccounts->GetStore()->SetValue(account->GetAccountName(), item, 0); m_dvListCtrlAccounts->GetStore()->SetValue(account->GetHost(), item, 1); m_dvListCtrlAccounts->GetStore()->SetValue(account->GetUsername(), item, 2); m_dvListCtrlAccounts->Refresh(); } } }
void SFTPTreeView::OnOpenTerminal(wxAuiToolBarEvent& event) { // Open terminal to the selected account if(event.IsDropDownClicked()) { SFTPTreeViewBase::ShowAuiToolMenu(event); } else { SSHAccountInfo account; if(!GetAccountFromUser(account)) { return; } wxString connectString; connectString << account.GetUsername() << "@" << account.GetHost(); SFTPSettings settings; settings.Load(); const wxString& sshClient = settings.GetSshClient(); FileUtils::OpenSSHTerminal(sshClient, connectString, account.GetPassword(), account.GetPort()); } }