From: Dennis Syrovatsky Date: Mon, 5 Dec 2005 09:57:05 +0000 (+0000) Subject: Added checkDeleteQueue() method to the FileTransfer class. X-Git-Tag: v0.0.90~384^2~402 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=092d9983fccb47d3a5ce1bf8959a36e7ff2c1210;p=tigervnc.git Added checkDeleteQueue() method to the FileTransfer class. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@433 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/vncviewer/FTDialog.cxx b/vncviewer/FTDialog.cxx index 87340606..683547b0 100644 --- a/vncviewer/FTDialog.cxx +++ b/vncviewer/FTDialog.cxx @@ -26,6 +26,7 @@ using namespace rfb; using namespace rfb::win32; +const char FTDialog::szCheckDeleteQueueText[] = "TightVNC.Viewer.CheckDeleteQueue.Msg"; const char FTDialog::szCheckTransferQueueText[] = "TightVNC.Viewer.CheckTransferQueue.Msg"; const char FTDialog::szDownloadFilePortionText[] = "TightVNC.Viewer.DownloadFilePortion.Msg"; const char FTDialog::szUploadFilePortionText[] = "TightVNC.Viewer.UploadFilePortion.Msg"; @@ -125,13 +126,13 @@ FTDialog::initFTDialog() bool FTDialog::initFTWndMsgs() { + m_msgCheckDeleteQueue = RegisterWindowMessage(szCheckDeleteQueueText); m_msgCheckTransferQueue = RegisterWindowMessage(szCheckTransferQueueText); m_msgUploadFilePortion = RegisterWindowMessage(szUploadFilePortionText); m_msgDownloadFilePortion = RegisterWindowMessage(szDownloadFilePortionText); - if ((m_msgCheckTransferQueue) && - (m_msgUploadFilePortion) && - (m_msgDownloadFilePortion)) return true; + if ((m_msgCheckDeleteQueue) && (m_msgCheckTransferQueue) && + (m_msgUploadFilePortion) && (m_msgDownloadFilePortion)) return true; return false; } @@ -289,6 +290,9 @@ FTDialog::FTDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == _this->m_msgDownloadFilePortion) _this->m_pFileTransfer->downloadFilePortion(); + + if (uMsg == _this->m_msgCheckDeleteQueue) + _this->m_pFileTransfer->checkDeleteQueue(); } return FALSE; @@ -690,3 +694,9 @@ FTDialog::postDownloadFilePortionMsg() { PostMessage(m_hwndFTDialog, m_msgDownloadFilePortion, 0, 0); } + +void +FTDialog::postCheckDeleteQueueMsg() +{ + PostMessage(m_hwndFTDialog, m_msgCheckDeleteQueue, 0, 0); +} diff --git a/vncviewer/FTDialog.h b/vncviewer/FTDialog.h index c8e9f0a8..82c32349 100644 --- a/vncviewer/FTDialog.h +++ b/vncviewer/FTDialog.h @@ -56,6 +56,7 @@ namespace rfb { HWND getWndHandle() { return m_hwndFTDialog; } + void postCheckDeleteQueueMsg(); void postCheckTransferQueueMsg(); void postUploadFilePortionMsg(); void postDownloadFilePortionMsg(); @@ -113,6 +114,7 @@ namespace rfb { bool m_bDlgShown; + UINT m_msgCheckDeleteQueue; UINT m_msgCheckTransferQueue; UINT m_msgUploadFilePortion; UINT m_msgDownloadFilePortion; @@ -127,6 +129,7 @@ namespace rfb { char m_szLocalPathTmp[FT_FILENAME_SIZE]; char m_szRemotePathTmp[FT_FILENAME_SIZE]; + static const char szCheckDeleteQueueText[]; static const char szCheckTransferQueueText[]; static const char szUploadFilePortionText[]; static const char szDownloadFilePortionText[]; diff --git a/vncviewer/FileTransfer.cxx b/vncviewer/FileTransfer.cxx index a9c4738f..4adceac4 100644 --- a/vncviewer/FileTransfer.cxx +++ b/vncviewer/FileTransfer.cxx @@ -107,7 +107,7 @@ FileTransfer::isTransferEnable() void FileTransfer::addDeleteQueue(char *pPathPrefix, FileInfo *pFI, unsigned int flags) { - m_DeleteQueue.add(pPathPrefix, "", pFI, flags); + m_DeleteQueue.add(pPathPrefix, pPathPrefix, pFI, flags); checkDeleteQueue(); } @@ -115,7 +115,29 @@ FileTransfer::addDeleteQueue(char *pPathPrefix, FileInfo *pFI, unsigned int flag void FileTransfer::checkDeleteQueue() { + if (m_DeleteQueue.getNumEntries() > 0) { + if (m_DeleteQueue.getFlagsAt(0) & FT_ATTR_DELETE_LOCAL) { + FolderManager fm; + if (!fm.deleteIt(m_DeleteQueue.getLocNameAt(0))) { + if (m_bFTDlgShown) m_pFTDialog->setStatusText("Delete Operation Failed"); + } else { + if (m_bFTDlgShown) m_pFTDialog->setStatusText("Delete Operation Completed"); + } + m_DeleteQueue.deleteAt(0); + m_pFTDialog->postCheckDeleteQueueMsg(); + } else { + if (m_DeleteQueue.getFlagsAt(0) & FT_ATTR_DELETE_REMOTE) { + m_pWriter->writeFileDeleteRqst(strlen(m_DeleteQueue.getFullLocPathAt(0)), + m_DeleteQueue.getFullLocPathAt(0)); + char *pPath = m_DeleteQueue.getRemPathAt(0); + m_queueFileListRqst.add(pPath, 0, 0, FT_FLR_DEST_DELETE); + m_pWriter->writeFileListRqst(strlen(pPath), pPath, false); + } + } + } else { + if (m_bFTDlgShown) m_pFTDialog->setStatusText("Delete Operation Completed Successfully"); + } } void