void SFTP::AddRemoteFile(const RemoteFileInfo& remoteFile) { if(m_remoteFiles.count(remoteFile.GetLocalFile())) { m_remoteFiles.erase(remoteFile.GetLocalFile()); } m_remoteFiles.insert(std::make_pair(remoteFile.GetLocalFile(), remoteFile)); }
SFTPThreadRequet::SFTPThreadRequet(const RemoteFileInfo& remoteFile) : m_account(remoteFile.GetAccount()) , m_remoteFile(remoteFile.GetRemoteFile()) , m_localFile(remoteFile.GetLocalFile()) , m_retryCounter(0) , m_uploadSuccess(false) , m_direction(kDownload) { }
bool SFTPTreeView::DoOpenFile(const wxTreeItemId& item) { MyClientData* cd = GetItemData(item); if(!cd || cd->IsFolder()) { return false; } RemoteFileInfo remoteFile; remoteFile.SetAccount(m_account); remoteFile.SetRemoteFile(cd->GetFullPath()); SFTPThreadRequet* req = new SFTPThreadRequet(remoteFile); SFTPWorkerThread::Instance()->Add(req); m_plugin->AddRemoteFile(remoteFile); return true; }
void SFTPTreeView::DoOpenFile(const wxString& path) { RemoteFileInfo remoteFile; remoteFile.SetAccount(m_account); remoteFile.SetRemoteFile(path); SFTPThreadRequet* req = new SFTPThreadRequet(remoteFile); SFTPWorkerThread::Instance()->Add(req); m_plugin->AddRemoteFile(remoteFile); // Update the session SFTPSessionInfo& sess = GetSession(false); if(sess.IsOk()) { sess.AddFile(path); m_sessions.Save(); } }
void SFTPTreeView::OnMenuOpenContainingFolder(wxCommandEvent& event) { wxArrayTreeItemIds items; m_treeCtrl->GetSelections(items); if(items.empty()) return; for(size_t i = 0; i < items.size(); ++i) { MyClientData* cd = GetItemData(items.Item(i)); if(!cd || cd->IsFolder()) { continue; } RemoteFileInfo remoteFile; remoteFile.SetAccount(m_account); remoteFile.SetRemoteFile(cd->GetFullPath()); SFTPThreadRequet* req = new SFTPThreadRequet(remoteFile); req->SetAction(eSFTPActions::kDownloadAndOpenContainingFolder); SFTPWorkerThread::Instance()->Add(req); } }
void SFTPTreeView::OnItemActivated(wxTreeListEvent& event) { event.Skip(); MyClientData* cd = GetItemData(event.GetItem()); CHECK_PTR_RET(cd); if(cd->IsFolder()) { m_treeListCtrl->Expand(event.GetItem()); } else { RemoteFileInfo remoteFile; remoteFile.SetAccount(m_account); remoteFile.SetRemoteFile(cd->GetFullPath()); SFTPThreadRequet* req = new SFTPThreadRequet(remoteFile); SFTPWorkerThread::Instance()->Add(req); m_plugin->AddRemoteFile(remoteFile); } }
void SFTPTreeView::OnMenuOpenWithDefaultApplication(wxCommandEvent& event) { wxTreeListItems items; m_treeListCtrl->GetSelections(items); if(items.empty()) return; for(size_t i = 0; i < items.size(); ++i) { MyClientData* cd = GetItemData(items.at(i)); if(!cd || cd->IsFolder()) { continue; } RemoteFileInfo remoteFile; remoteFile.SetAccount(m_account); remoteFile.SetRemoteFile(cd->GetFullPath()); SFTPThreadRequet* req = new SFTPThreadRequet(remoteFile); req->SetDirection(SFTPThreadRequet::kDownloadAndOpenWithDefaultApp); SFTPWorkerThread::Instance()->Add(req); } }
void SFTP::DoSaveRemoteFile(const RemoteFileInfo& remoteFile) { SFTPWorkerThread::Instance()->Add( new SFTPThreadRequet(remoteFile.GetAccount(), remoteFile.GetRemoteFile(), remoteFile.GetLocalFile())); }