Ticket #8013: 8013.patch
File 8013.patch, 20.9 KB (added by , 12 years ago) |
---|
-
src/engine/ControlSocket.cpp
diff -r c04cba15ffba -r 92b83b739411 src/engine/ControlSocket.cpp
a b 468 468 469 469 CFileExistsNotification *pNotification = new CFileExistsNotification; 470 470 471 pNotification->localFileAlias = pData->localFileAlias; 471 472 pNotification->download = pData->download; 472 473 pNotification->localFile = pData->localFile; 473 474 pNotification->remoteFile = pData->remoteFile; … … 1271 1272 } 1272 1273 else 1273 1274 { 1274 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 1275 LogMessage( 1276 Status, _("Skipping upload of %s"), 1277 (pData->localFileAlias.empty() ? pData->localFile : pData->localFileAlias).c_str() 1278 ); 1275 1279 } 1276 1280 ResetOperation(FZ_REPLY_OK); 1277 1281 } … … 1290 1294 } 1291 1295 else 1292 1296 { 1293 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 1297 LogMessage( 1298 Status, _("Skipping upload of %s"), 1299 (pData->localFileAlias.empty() ? pData->localFile : pData->localFileAlias).c_str() 1300 ); 1294 1301 } 1295 1302 ResetOperation(FZ_REPLY_OK); 1296 1303 } … … 1315 1322 } 1316 1323 else 1317 1324 { 1318 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 1325 LogMessage( 1326 Status, _("Skipping upload of %s"), 1327 (pData->localFileAlias.empty() ? pData->localFile : pData->localFileAlias).c_str() 1328 ); 1319 1329 } 1320 1330 ResetOperation(FZ_REPLY_OK); 1321 1331 } … … 1381 1391 } 1382 1392 else 1383 1393 { 1384 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 1394 LogMessage( 1395 Status, _("Skipping upload of %s"), 1396 (pData->localFileAlias.empty() ? pData->localFile : pData->localFileAlias).c_str() 1397 ); 1385 1398 } 1386 1399 ResetOperation(FZ_REPLY_OK); 1387 1400 break; -
src/engine/ControlSocket.h
diff -r c04cba15ffba -r 92b83b739411 src/engine/ControlSocket.h
a b 39 39 CFileTransferOpData(bool is_download, const wxString& local_file, const wxString& remote_file, const CServerPath& remote_path); 40 40 virtual ~CFileTransferOpData(); 41 41 // Transfer data 42 wxString localFile , remoteFile;42 wxString localFileAlias, localFile, remoteFile; 43 43 CServerPath remotePath; 44 44 const bool download; 45 45 … … 124 124 virtual int List(CServerPath path = CServerPath(), wxString subDir = _T(""), int flags = 0) { return FZ_REPLY_NOTSUPPORTED; } 125 125 virtual int FileTransfer(const wxString localFile, const CServerPath &remotePath, 126 126 const wxString &remoteFile, bool download, 127 const CFileTransferCommand::t_transferSettings& transferSettings) { return FZ_REPLY_NOTSUPPORTED; } 127 const CFileTransferCommand::t_transferSettings& transferSettings, 128 const wxString& localFileAlias) { return FZ_REPLY_NOTSUPPORTED; } 128 129 virtual int RawCommand(const wxString& command = _T("")) { return FZ_REPLY_NOTSUPPORTED; } 129 130 virtual int Delete(const CServerPath& path, const std::list<wxString>& files) { return FZ_REPLY_NOTSUPPORTED; } 130 131 virtual int RemoveDir(const CServerPath& path = CServerPath(), const wxString& subDir = _T("")) { return FZ_REPLY_NOTSUPPORTED; } -
src/engine/commands.cpp
diff -r c04cba15ffba -r 92b83b739411 src/engine/commands.cpp
a b 33 33 34 34 CFileTransferCommand::CFileTransferCommand(const wxString &localFile, const CServerPath& remotePath, 35 35 const wxString &remoteFile, bool download, 36 const CFileTransferCommand::t_transferSettings& transferSettings) 37 : m_localFile(localFile), m_remotePath(remotePath), m_remoteFile(remoteFile) 36 const CFileTransferCommand::t_transferSettings& transferSettings, 37 const wxString& localFileAlias) 38 : m_localFile(localFile), m_remotePath(remotePath), m_remoteFile(remoteFile), 39 m_localFileAlias(localFileAlias) 38 40 { 39 41 m_download = download; 40 42 m_transferSettings = transferSettings; … … 45 47 return m_localFile; 46 48 } 47 49 50 wxString CFileTransferCommand::GetLocalFileAlias() const 51 { 52 return m_localFileAlias; 53 } 54 48 55 CServerPath CFileTransferCommand::GetRemotePath() const 49 56 { 50 57 return m_remotePath; -
src/engine/engineprivate.cpp
diff -r c04cba15ffba -r 92b83b739411 src/engine/engineprivate.cpp
a b 400 400 return FZ_REPLY_BUSY; 401 401 402 402 m_pCurrentCommand = command.Clone(); 403 return m_pControlSocket->FileTransfer(command.GetLocalFile(), command.GetRemotePath(), command.GetRemoteFile(), command.Download(), command.GetTransferSettings()); 403 return m_pControlSocket->FileTransfer( 404 command.GetLocalFile(), command.GetRemotePath(), command.GetRemoteFile(), command.Download(), 405 command.GetTransferSettings(), command.GetLocalFileAlias() 406 ); 404 407 } 405 408 406 409 int CFileZillaEnginePrivate::RawCommand(const CRawCommand& command) -
src/engine/ftpcontrolsocket.cpp
diff -r c04cba15ffba -r 92b83b739411 src/engine/ftpcontrolsocket.cpp
a b 2206 2206 2207 2207 int CFtpControlSocket::FileTransfer(const wxString localFile, const CServerPath &remotePath, 2208 2208 const wxString &remoteFile, bool download, 2209 const CFileTransferCommand::t_transferSettings& transferSettings) 2209 const CFileTransferCommand::t_transferSettings& transferSettings, 2210 const wxString& localFileAlias) 2210 2211 { 2211 2212 LogMessage(Debug_Verbose, _T("CFtpControlSocket::FileTransfer()")); 2212 2213 … … 2226 2227 } 2227 2228 else 2228 2229 { 2229 LogMessage(Status, _("Starting upload of %s"), localFile.c_str()); 2230 LogMessage( 2231 Status, _("Starting upload of %s"), 2232 (localFileAlias.empty() ? localFile : localFileAlias).c_str() 2233 ); 2230 2234 } 2231 2235 if (m_pCurOpData) 2232 2236 { … … 2235 2239 } 2236 2240 2237 2241 CFtpFileTransferOpData *pData = new CFtpFileTransferOpData(download, localFile, remoteFile, remotePath); 2242 pData->localFileAlias = localFileAlias; 2238 2243 m_pCurOpData = pData; 2239 2244 2240 2245 pData->transferSettings = transferSettings; -
src/engine/ftpcontrolsocket.h
diff -r c04cba15ffba -r 92b83b739411 src/engine/ftpcontrolsocket.h
a b 40 40 41 41 virtual int FileTransfer(const wxString localFile, const CServerPath &remotePath, 42 42 const wxString &remoteFile, bool download, 43 const CFileTransferCommand::t_transferSettings& transferSettings); 43 const CFileTransferCommand::t_transferSettings& transferSettings, 44 const wxString& localFileAlias); 44 45 int FileTransferParseResponse(); 45 46 int FileTransferSubcommandResult(int prevResult); 46 47 int FileTransferSend(); -
src/engine/httpcontrolsocket.cpp
diff -r c04cba15ffba -r 92b83b739411 src/engine/httpcontrolsocket.cpp
a b 351 351 352 352 int CHttpControlSocket::FileTransfer(const wxString localFile, const CServerPath &remotePath, 353 353 const wxString &remoteFile, bool download, 354 const CFileTransferCommand::t_transferSettings& transferSettings) 354 const CFileTransferCommand::t_transferSettings& transferSettings, 355 const wxString& localFileAlias) 355 356 { 356 357 LogMessage(Debug_Verbose, _T("CHttpControlSocket::FileTransfer()")); 357 358 … … 370 371 } 371 372 372 373 CHttpFileTransferOpData *pData = new CHttpFileTransferOpData(download, localFile, remoteFile, remotePath); 374 pData->localFileAlias = localFileAlias; 373 375 m_pCurOpData = pData; 374 376 m_pHttpOpData = pData; 375 377 -
src/engine/httpcontrolsocket.h
diff -r c04cba15ffba -r 92b83b739411 src/engine/httpcontrolsocket.h
a b 19 19 20 20 virtual int FileTransfer(const wxString localFile, const CServerPath &remotePath, 21 21 const wxString &remoteFile, bool download, 22 const CFileTransferCommand::t_transferSettings& transferSettings); 22 const CFileTransferCommand::t_transferSettings& transferSettings, 23 const wxString& localFileAlias); 23 24 virtual int FileTransferSend(); 24 25 virtual int FileTransferParseResponse(char* p, unsigned int len); 25 26 virtual int FileTransferSubcommandResult(int prevResult); -
src/engine/sftpcontrolsocket.cpp
diff -r c04cba15ffba -r 92b83b739411 src/engine/sftpcontrolsocket.cpp
a b 1614 1614 1615 1615 int CSftpControlSocket::FileTransfer(const wxString localFile, const CServerPath &remotePath, 1616 1616 const wxString &remoteFile, bool download, 1617 const CFileTransferCommand::t_transferSettings& transferSettings) 1617 const CFileTransferCommand::t_transferSettings& transferSettings, 1618 const wxString& localFileAlias 1619 ) 1618 1620 { 1619 1621 LogMessage(Debug_Verbose, _T("CSftpControlSocket::FileTransfer(...)")); 1620 1622 … … 1634 1636 } 1635 1637 else 1636 1638 { 1637 LogMessage(Status, _("Starting upload of %s"), localFile.c_str()); 1639 LogMessage( 1640 Status, _("Starting upload of %s"), 1641 (localFileAlias.empty() ? localFile : localFileAlias).c_str() 1642 ); 1638 1643 } 1639 1644 if (m_pCurOpData) 1640 1645 { … … 1643 1648 } 1644 1649 1645 1650 CSftpFileTransferOpData *pData = new CSftpFileTransferOpData(download, localFile, remoteFile, remotePath); 1651 pData->localFileAlias = localFileAlias; 1646 1652 m_pCurOpData = pData; 1647 1653 1648 1654 pData->transferSettings = transferSettings; … … 1850 1856 wxString localFile = QuoteFilename(pData->localFile) + _T(" "); 1851 1857 wxString remoteFile = QuoteFilename(pData->remotePath.FormatFilename(pData->remoteFile, !pData->tryAbsolutePath)); 1852 1858 1853 logstr += localFile;1854 logstr += remoteFile;1859 logstr += (pData->localFileAlias.empty() ? pData->localFile : pData->localFileAlias); 1860 logstr += _T(" ") + remoteFile; 1855 1861 LogMessageRaw(Command, logstr); 1856 1862 1857 1863 if (!AddToStream(cmd) || !AddToStream(localFile, true) || -
src/engine/sftpcontrolsocket.h
diff -r c04cba15ffba -r 92b83b739411 src/engine/sftpcontrolsocket.h
a b 81 81 82 82 virtual int FileTransfer(const wxString localFile, const CServerPath &remotePath, 83 83 const wxString &remoteFile, bool download, 84 const CFileTransferCommand::t_transferSettings& transferSettings); 84 const CFileTransferCommand::t_transferSettings& transferSettings, 85 const wxString& localFileAlias); 85 86 int FileTransferSubcommandResult(int prevResult); 86 87 int FileTransferSend(); 87 88 int FileTransferParseResponse(bool successful, const wxString& reply); -
src/include/commands.h
diff -r c04cba15ffba -r 92b83b739411 src/include/commands.h
a b 133 133 // For downloads, localFile can be left empty if supported by protocol. 134 134 // Check for nId_data notification. 135 135 // FIXME: localFile empty iff protocol is HTTP. 136 CFileTransferCommand(const wxString &localFile, const CServerPath& remotePath, const wxString &remoteFile, bool download, const t_transferSettings& m_transferSettings); 136 CFileTransferCommand( 137 const wxString &localFile, const CServerPath& remotePath, const wxString &remoteFile, 138 bool download, const t_transferSettings& m_transferSettings, const wxString& localFileAlias 139 ); 137 140 138 141 wxString GetLocalFile() const; 142 wxString GetLocalFileAlias() const; 139 143 CServerPath GetRemotePath() const; 140 144 wxString GetRemoteFile() const; 141 145 bool Download() const; 142 146 const t_transferSettings& GetTransferSettings() const { return m_transferSettings; } 143 147 144 148 protected: 149 wxString m_localFileAlias; 145 150 wxString m_localFile; 146 151 CServerPath m_remotePath; 147 152 wxString m_remoteFile; -
src/include/notification.h
diff -r c04cba15ffba -r 92b83b739411 src/include/notification.h
a b 136 136 137 137 bool download; 138 138 139 wxString localFileAlias; 139 140 wxString localFile; 140 141 wxLongLong localSize; 141 142 wxDateTime localTime; -
src/interface/QueueView.cpp
diff -r c04cba15ffba -r 92b83b739411 src/interface/QueueView.cpp
a b 529 529 bool CQueueView::QueueFile(const bool queueOnly, const bool download, 530 530 const wxString& sourceFile, const wxString& targetFile, 531 531 const CLocalPath& localPath, const CServerPath& remotePath, 532 const CServer& server, const wxLongLong size, enum CEditHandler::fileType edit /*=CEditHandler::none*/) 532 const CServer& server, const wxLongLong size, 533 enum CEditHandler::fileType edit /*=CEditHandler::none*/, 534 const wxString& sourceFileAlias 535 ) 533 536 { 534 537 CServerItem* pServerItem = CreateServerItem(server); 535 538 … … 549 552 else 550 553 { 551 554 fileItem = new CFileItem(pServerItem, queueOnly, download, sourceFile, targetFile, localPath, remotePath, size); 555 fileItem->SetSourceAlias(sourceFileAlias); 552 556 if (download) 553 557 fileItem->m_transferSettings.binary = !CAutoAsciiFiles::TransferRemoteAsAscii(sourceFile, remotePath.GetType()); 554 558 else … … 1492 1496 RefreshItem(engineData.pItem); 1493 1497 1494 1498 int res = engineData.pEngine->Command(CFileTransferCommand(fileItem->GetLocalPath().GetPath() + fileItem->GetLocalFile(), fileItem->GetRemotePath(), 1495 fileItem->GetRemoteFile(), fileItem->Download(), fileItem->m_transferSettings));1499 fileItem->GetRemoteFile(), fileItem->Download(), fileItem->m_transferSettings, fileItem->GetSourceAlias())); 1496 1500 wxASSERT((res & FZ_REPLY_BUSY) != FZ_REPLY_BUSY); 1497 1501 if (res == FZ_REPLY_WOULDBLOCK) 1498 1502 return; -
src/interface/QueueView.h
diff -r c04cba15ffba -r 92b83b739411 src/interface/QueueView.h
a b 98 98 bool QueueFile(const bool queueOnly, const bool download, 99 99 const wxString& localFile, const wxString& remoteFile, 100 100 const CLocalPath& localPath, const CServerPath& remotePath, 101 const CServer& server, const wxLongLong size, enum CEditHandler::fileType edit = CEditHandler::none); 101 const CServer& server, const wxLongLong size, 102 enum CEditHandler::fileType edit = CEditHandler::none, const wxString& sourceFileAlias = _T("") 103 ); 102 104 103 105 void QueueFile_Finish(const bool start); // Need to be called after QueueFile 104 106 bool QueueFiles(const bool queueOnly, const CLocalPath& localPath, const CRemoteDataObject& dataObject); -
src/interface/RemoteListView.cpp
diff -r c04cba15ffba -r 92b83b739411 src/interface/RemoteListView.cpp
a b 338 338 EVT_MENU(XRCID("ID_DOWNLOAD"), CRemoteListView::OnMenuDownload) 339 339 EVT_MENU(XRCID("ID_ADDTOQUEUE"), CRemoteListView::OnMenuDownload) 340 340 EVT_MENU(XRCID("ID_MKDIR"), CRemoteListView::OnMenuMkdir) 341 EVT_MENU(XRCID("ID_MKFILE"), CRemoteListView::OnMenuMkfile) 341 342 EVT_MENU(XRCID("ID_DELETE"), CRemoteListView::OnMenuDelete) 342 343 EVT_MENU(XRCID("ID_RENAME"), CRemoteListView::OnMenuRename) 343 344 EVT_MENU(XRCID("ID_CHMOD"), CRemoteListView::OnMenuChmod) … … 1409 1410 pMenu->Enable(XRCID("ID_DOWNLOAD"), false); 1410 1411 pMenu->Enable(XRCID("ID_ADDTOQUEUE"), false); 1411 1412 pMenu->Enable(XRCID("ID_MKDIR"), false); 1413 pMenu->Enable(XRCID("ID_MKFILE"), false); 1412 1414 pMenu->Enable(XRCID("ID_DELETE"), false); 1413 1415 pMenu->Enable(XRCID("ID_RENAME"), false); 1414 1416 pMenu->Enable(XRCID("ID_CHMOD"), false); … … 1654 1656 m_pState->m_pCommandQueue->ProcessCommand(new CMkdirCommand(path)); 1655 1657 } 1656 1658 1659 void CRemoteListView::OnMenuMkfile(wxCommandEvent& event) { 1660 if (!m_pDirectoryListing || !m_pState->IsRemoteIdle()) 1661 { 1662 wxBell(); 1663 return; 1664 } 1665 1666 CInputDialog dlg; 1667 if (!dlg.Create(this, _("Create file"), _("Please enter the name of the file which should be created:"))) 1668 return; 1669 1670 CServerPath path = m_pDirectoryListing->path; 1671 wxString newName = _("New file"); 1672 wxString pathName = path.GetPath() + _T("/"); 1673 int pos = pathName.Length(); 1674 pathName += newName; 1675 wxASSERT(pos != -1); 1676 dlg.SetValue(pathName); 1677 dlg.SelectText(pos, pos + newName.Length()); 1678 1679 const CServerPath oldPath = m_pDirectoryListing->path; 1680 1681 if (dlg.ShowModal() != wxID_OK) 1682 return; 1683 1684 if ( 1685 path.GetParent().GetPath().compare(dlg.GetValue()) == 0 || 1686 wxString(path.GetParent().GetPath() + _T("/")).compare(dlg.GetValue()) == 0 1687 ) { 1688 wxBell(); 1689 return; 1690 } 1691 1692 if (!m_pDirectoryListing || oldPath != m_pDirectoryListing->path || 1693 !m_pState->IsRemoteIdle()) 1694 { 1695 wxBell(); 1696 return; 1697 } 1698 1699 path = m_pDirectoryListing->path; 1700 if (!path.ChangePath(dlg.GetValue())) 1701 { 1702 wxBell(); 1703 return; 1704 } 1705 1706 CLocalPath pathLocal(wxGetApp().GetResourceDir()); 1707 wxString filename(_T("dummy")); 1708 wxString pathDummy(pathLocal.GetPath() + filename); 1709 if (!wxFile::Exists(pathDummy)) { 1710 wxFile tempFile; 1711 if (!tempFile.Create(pathDummy)) { 1712 wxBell(); 1713 return; 1714 } 1715 tempFile.Close(); 1716 } 1717 m_pQueue->QueueFile( 1718 false, false, 1719 filename, path.GetLastSegment(), pathLocal, path.GetParent(), 1720 *(m_pState->GetServer()), 0, CEditHandler::none, _T("New empty file") 1721 ); 1722 m_pQueue->QueueFile_Finish(true); 1723 } 1724 1657 1725 void CRemoteListView::OnMenuDelete(wxCommandEvent& event) 1658 1726 { 1659 1727 if (!m_pState->IsRemoteIdle()) -
src/interface/RemoteListView.h
diff -r c04cba15ffba -r 92b83b739411 src/interface/RemoteListView.h
a b 105 105 void OnContextMenu(wxContextMenuEvent& event); 106 106 void OnMenuDownload(wxCommandEvent& event); 107 107 void OnMenuMkdir(wxCommandEvent& event); 108 void OnMenuMkfile(wxCommandEvent& event); 108 109 void OnMenuDelete(wxCommandEvent& event); 109 110 void OnMenuRename(wxCommandEvent& event); 110 111 void OnKeyDown(wxKeyEvent& event); -
src/interface/fileexistsdlg.cpp
diff -r c04cba15ffba -r 92b83b739411 src/interface/fileexistsdlg.cpp
a b 44 44 m_pAction6 = wxDynamicCast(FindWindow(XRCID("ID_ACTION6")), wxRadioButton); 45 45 m_pAction7 = wxDynamicCast(FindWindow(XRCID("ID_ACTION7")), wxRadioButton); 46 46 47 wxString localFile = m_pNotification->localFile; 47 wxString localFile = m_pNotification->localFileAlias.empty() ? 48 m_pNotification->localFile : m_pNotification->localFileAlias; 48 49 49 50 wxString remoteFile = m_pNotification->remotePath.FormatFilename(m_pNotification->remoteFile); 50 51 localFile = GetPathEllipsis(localFile, FindWindow(XRCID("ID_FILE1_NAME"))); -
src/interface/queue.cpp
diff -r c04cba15ffba -r 92b83b739411 src/interface/queue.cpp
a b 885 885 switch (column) 886 886 { 887 887 case colLocalName: 888 return pFileItem->GetIndent() + pFileItem->GetLocalPath().GetPath() + pFileItem->GetLocalFile(); 888 return pFileItem->GetIndent() + 889 ( 890 pFileItem->GetSourceAlias().empty() ? 891 pFileItem->GetLocalPath().GetPath() + pFileItem->GetLocalFile() : 892 pFileItem->GetSourceAlias() 893 ); 889 894 case colDirection: 890 895 if (pFileItem->Download()) 891 896 if (pFileItem->queued()) -
src/interface/queue.h
diff -r c04cba15ffba -r 92b83b739411 src/interface/queue.h
a b 162 162 const CServerPath& GetRemotePath() const { return m_remotePath; } 163 163 const wxLongLong& GetSize() const { return m_size; } 164 164 void SetSize(wxLongLong size) { m_size = size; } 165 166 const wxString& GetSourceAlias() const { return m_sourceAlias; } 167 void SetSourceAlias(wxString alias) { 168 m_sourceAlias = alias.empty() ? alias : _T("[") + alias + _T("]"); 169 } 170 165 171 inline bool Download() const { return flags & flag_download; } 166 172 167 173 inline bool queued() const { return (flags & flag_queued) != 0; } … … 234 240 const CLocalPath m_localPath; 235 241 const CServerPath m_remotePath; 236 242 wxLongLong m_size; 243 wxString m_sourceAlias; 237 244 }; 238 245 239 246 class CFolderItem : public CFileItem -
src/interface/resources/menus.xrc
diff -r c04cba15ffba -r 92b83b739411 src/interface/resources/menus.xrc
a b 299 299 <label>&Create directory</label> 300 300 <help>Create a new subdirectory in the current directory</help> 301 301 </object> 302 <object class="wxMenuItem" name="ID_MKFILE"> 303 <label>&Create empty file</label> 304 <help>Create a empty file in the current directory</help> 305 </object> 302 306 <object class="wxMenuItem" name="ID_CONTEXT_REFRESH"> 303 307 <label>Re&fresh</label> 304 308 </object> -
src/interface/updatewizard.cpp
diff -r c04cba15ffba -r 92b83b739411 src/interface/updatewizard.cpp
a b 1139 1139 wxString file = m_urlFile; 1140 1140 path.SetPath(file, true); 1141 1141 1142 CFileTransferCommand cmd(m_localFile, path, file, true, transferSettings );1142 CFileTransferCommand cmd(m_localFile, path, file, true, transferSettings, _T("")); 1143 1143 return m_pEngine->Command(cmd); 1144 1144 } 1145 1145