Skip to content

Commit

Permalink
SFTP: when using "Quick Connect" to a new account, offer to save the …
Browse files Browse the repository at this point in the history
…connect details in the account manager

SFTP: fixed: wrong icon used to mark remote files in the editor
  • Loading branch information
eranif committed Jan 4, 2018
1 parent 59cf9b0 commit 5ce20fe
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 37 deletions.
Binary file modified Runtime/codelite-bitmaps.zip
Binary file not shown.
39 changes: 23 additions & 16 deletions SFTP/SFTPTreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,42 +609,49 @@ void SFTPTreeView::DoOpenSession()
clSSH::Ptr_t ssh(
new clSSH(m_account.GetHost(), m_account.GetUsername(), m_account.GetPassword(), m_account.GetPort()));
ssh->Connect(5);
#ifndef _WIN64
dlg.Update(5, _("Connected!"));
dlg.Update(6, _("Authenticating server..."));
#endif

if(!ssh->AuthenticateServer(message)) {
if(::wxMessageBox(message, "SSH", wxYES_NO | wxCENTER | wxICON_QUESTION) == wxYES) {
#ifndef _WIN64
dlg.Update(7, _("Accepting server authentication server..."));
#endif
ssh->AcceptServerAuthentication();
}
} else {
#ifndef _WIN64
dlg.Update(7, _("Server authenticated"));
#endif
}

#ifndef _WIN64
dlg.Update(8, _("Logging..."));
#endif
dlg.Update(8, _("Logging in.."));
ssh->Login();
m_sftp.reset(new clSFTP(ssh));
m_sftp->Initialize();
m_sftp->SetAccount(m_account.GetAccountName());
m_plugin->GetManager()->SetStatusMessage(wxString() << _("Done!"));

#ifndef _WIN64
dlg.Update(9, _("Fetching directory list..."));
#endif
DoBuildTree(m_account.GetDefaultFolder().IsEmpty() ? "/" : m_account.GetDefaultFolder());
#ifndef _WIN64
dlg.Update(10, _("Done"));
#endif

// If this is a new account, offer the user to save it
SFTPSettings s;
s.Load();
SSHAccountInfo dummy;
if(!s.GetAccount(m_account.GetAccountName(), dummy)) {
wxString message;
message << _("Would you like to save this account?\n") << _("It will be saved as '")
<< m_account.GetAccountName() << "'";
wxStandardID res = ::PromptForYesNoCancelDialogWithCheckbox(message, "SFTPQuickConnectSaveDlg");
if(res == wxID_YES) {
// This 'Connect' was via Quick Connect option
SSHAccountInfo::Vect_t accounts = s.GetAccounts();
accounts.push_back(m_account);
s.SetAccounts(accounts);
s.Save();
}
}

} catch(clException& e) {
::wxMessageBox(e.What(), "codelite", wxICON_ERROR | wxOK);
::wxMessageBox(e.What(), "CodeLite", wxICON_ERROR | wxOK);
DoCloseSession();
}
}
Expand Down Expand Up @@ -739,10 +746,10 @@ void SFTPTreeView::OnOpenTerminal(wxAuiToolBarEvent& event)

wxString connectString;
connectString << account.GetUsername() << "@" << account.GetHost();

SFTPSettings settings;
settings.Load();

const wxString& sshClient = settings.GetSshClient();
FileUtils::OpenSSHTerminal(sshClient, connectString, account.GetPassword(), account.GetPort());
}
Expand Down
46 changes: 25 additions & 21 deletions svgs/download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5ce20fe

Please sign in to comment.