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))); }
bool SFTPSettings::UpdateAccount(const SSHAccountInfo& account) { for( size_t i=0; i<m_accounts.size(); ++i ) { SSHAccountInfo& currentAccount = m_accounts.at(i); if ( account.GetAccountName() == currentAccount.GetAccountName() ) { currentAccount = account; return true; } } return false; }
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(); } } }