]> source.dussan.org Git - tigervnc.git/commitdiff
Added checkDeleteQueue() method to the FileTransfer class.
authorDennis Syrovatsky <dennis@tightvnc.com>
Mon, 5 Dec 2005 09:57:05 +0000 (09:57 +0000)
committerDennis Syrovatsky <dennis@tightvnc.com>
Mon, 5 Dec 2005 09:57:05 +0000 (09:57 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@433 3789f03b-4d11-0410-bbf8-ca57d06f2519

vncviewer/FTDialog.cxx
vncviewer/FTDialog.h
vncviewer/FileTransfer.cxx

index 8734060641f42f7637e0aebe98c869ea345a9baf..683547b007714b238f470c9a7849fc65b44b7c6a 100644 (file)
@@ -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);
+}
index c8e9f0a83fe1d9b86ab105c385ddcbe26a14c5de..82c32349d2ac4f948f84e67a3db8706eea008267 100644 (file)
@@ -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[];
index a9c4738f126fbb3720549a18d7cc0def9259bea7..4adceac49f6d88fd8d1ed148f16ea2e141c45468 100644 (file)
@@ -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