コード例 #1
0
ファイル: SFTPTreeView.cpp プロジェクト: Jactry/codelite
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());
    }
}
コード例 #2
0
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)));
}
コード例 #3
0
ファイル: sftp_settings.cpp プロジェクト: 292388900/codelite
void SFTPSettings::FromJSON(const JSONElement& json)
{
    m_accounts.clear();
    m_sshClient = json.namedObject("sshClient").toString(m_sshClient);
    JSONElement arrAccounts = json.namedObject("accounts");
    int size = arrAccounts.arraySize();
    for(int i=0; i<size; ++i) {
        SSHAccountInfo account;
        account.FromJSON(arrAccounts.arrayItem(i));
        m_accounts.push_back( account );
    }
}
コード例 #4
0
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();
    }
}
コード例 #5
0
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();
        }
    }
}
コード例 #6
0
ファイル: sftp_settings.cpp プロジェクト: 292388900/codelite
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;
}
コード例 #7
0
ファイル: SFTPTreeView.cpp プロジェクト: lpc1996/codelite
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());
    }
}