]> source.dussan.org Git - tigervnc.git/commitdiff
Added create folder possibility.
authorDennis Syrovatsky <dennis@tightvnc.com>
Wed, 14 Dec 2005 15:12:45 +0000 (15:12 +0000)
committerDennis Syrovatsky <dennis@tightvnc.com>
Wed, 14 Dec 2005 15:12:45 +0000 (15:12 +0000)
Now the user can create folders on the local and remote sides.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@448 3789f03b-4d11-0410-bbf8-ca57d06f2519

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

index 11f24a0f4d37ab7ef67690d5c3fbebea71dd3e8b..64c8f3ab1ca097215c32417461f7f3427c5d4166 100644 (file)
@@ -42,6 +42,7 @@ FTDialog::FTDialog(HINSTANCE hInst, FileTransfer *pFT)
   m_pRemoteLV = NULL;
   m_pProgress = NULL;
   m_pCancelingDlg = NULL;
+  m_pCreateFolderDlg = NULL;
 
   m_hwndFTDialog = NULL;
   m_hwndLocalPath = NULL;
@@ -54,6 +55,7 @@ FTDialog::FTDialog(HINSTANCE hInst, FileTransfer *pFT)
   m_szRemotePath[0] = '\0';
   m_szLocalPathTmp[0] = '\0';
   m_szRemotePathTmp[0] = '\0';
+  m_szCreateFolderName[0] = '\0';
 }
 
 FTDialog::~FTDialog()
@@ -471,16 +473,46 @@ FTDialog::onRemoteDelete()
   setButtonsState();
 }
 
+bool
+FTDialog::getCreateFolderName()
+{
+  if (m_pCreateFolderDlg != NULL) return false;
+
+  bool bResult = false;
+
+  m_pCreateFolderDlg = new FTDialog::CreateFolderDlg(this);
+  m_pCreateFolderDlg->create();
+  if (strlen(m_pCreateFolderDlg->getFolderName()) != 0) {
+    strcpy(m_szCreateFolderName, m_pCreateFolderDlg->getFolderName());
+    bResult = true;
+  } else {
+    m_szCreateFolderName[0] = '\0';
+    bResult = false;
+  }
+  delete m_pCreateFolderDlg;
+  m_pCreateFolderDlg = NULL;
+
+  return bResult;
+}
+
 void 
 FTDialog::onLocalCreateFolder()
 {
-
+  if (getCreateFolderName()) {
+    char path[FT_FILENAME_SIZE];
+    sprintf(path, "%s\\%s", m_szLocalPath, m_szCreateFolderName);
+    setStatusText("Creating Local Folder: %s", path);
+    FolderManager fm;
+    if (fm.createDir(path)) showLocalLVItems();
+  }
 }
 
 void 
 FTDialog::onRemoteCreateFolder()
 {
-
+  if (getCreateFolderName()) {
+    m_pFileTransfer->createRemoteFolder(m_szRemotePath, m_szCreateFolderName);
+  }
 }
 
 void 
@@ -882,3 +914,27 @@ FTDialog::CancelingDlg::cancelingDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
   }
   return FALSE;
 }
+
+FTDialog::CreateFolderDlg::CreateFolderDlg(FTDialog *pFTDlg) : Dialog(GetModuleHandle(0))
+{
+  m_pFTDlg = pFTDlg;
+  m_szFolderName[0] = '\0';
+}
+
+FTDialog::CreateFolderDlg::~CreateFolderDlg()
+{
+
+}
+
+bool
+FTDialog::CreateFolderDlg::create()
+{
+  return showDialog(MAKEINTRESOURCE(IDD_FTCREATEFOLDER), m_pFTDlg->getWndHandle());
+}
+
+bool 
+FTDialog::CreateFolderDlg::onOk()
+{
+  strcpy(m_szFolderName, getItemString(IDC_FTFOLDERNAME));
+  return true;
+}
index ed3afa970c6a5b0e5017785148915d33b4d7ff45..e362f95d049a3a677eff770200edcd0e58a2a27d 100644 (file)
@@ -94,6 +94,7 @@ namespace rfb {
       void onLocalRButton();
       void onRemoteRButton();
 
+      bool getCreateFolderName();
       void onLocalCreateFolder();
       void onRemoteCreateFolder();
 
@@ -143,6 +144,7 @@ namespace rfb {
       char m_szRemotePath[FT_FILENAME_SIZE];
       char m_szLocalPathTmp[FT_FILENAME_SIZE];
       char m_szRemotePathTmp[FT_FILENAME_SIZE];
+      char m_szCreateFolderName[FT_FILENAME_SIZE];
 
       static const char szCheckDeleteQueueText[];
       static const char szCheckTransferQueueText[];
@@ -192,6 +194,13 @@ namespace rfb {
         CreateFolderDlg(FTDialog *pFTDlg);
         ~CreateFolderDlg();
 
+        bool onOk();
+        bool create();
+        char *getFolderName() { return m_szFolderName; }
+
+      private:
+        FTDialog *m_pFTDlg;
+        char m_szFolderName[FT_FILENAME_SIZE];
       };
 
       private:
index 5d074f3a38d7ddb2d59d569f444dfac0d2d1cd88..37475060fc5c589ce8aa3f337f4034a0a760897a 100644 (file)
@@ -361,6 +361,17 @@ FileTransfer::uploadFilePortion()
   }
 }
 
+void 
+FileTransfer::createRemoteFolder(char *pPath, char *pName)
+{
+  char fullPath[FT_FILENAME_SIZE];
+  sprintf(fullPath, "%s\\%s", pPath, pName);
+  m_pFTDialog->setStatusText("Creating Remote Folder: %s", fullPath);
+  m_pWriter->writeFileCreateDirRqst(strlen(fullPath), fullPath);
+  m_queueFileListRqst.add(pPath, 0, 0, FT_FLR_DEST_MAIN);
+  m_pWriter->writeFileListRqst(strlen(pPath), pPath, false);
+}
+
 bool 
 FileTransfer::procFileListDataMsg()
 {
index 13908d39bdb0d64f5c04386233f27b34e8832a5b..eccdcd6e8b04936cf9b330128054431feb352c10 100644 (file)
@@ -64,6 +64,8 @@ namespace rfb {
 
       void uploadFilePortion();
 
+      void createRemoteFolder(char *pPath, char *pName);
+
       bool m_bCancel;
 
     private:
index 5335294202ae359151928aa01950d3b13619f307..90171badc17e3eeb123f44b8e545c89389c41cfe 100644 (file)
@@ -366,10 +366,10 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Create a New Folder"
 FONT 8, "MS Sans Serif"
 BEGIN
+    EDITTEXT        IDC_FTFOLDERNAME,7,19,179,14,ES_AUTOHSCROLL
     DEFPUSHBUTTON   "OK",IDOK,80,42,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,136,42,50,14
     LTEXT           "New Folder Name",IDC_STATIC,7,7,179,8
-    EDITTEXT        IDC_FTFOLDERNAME,7,19,179,14,ES_AUTOHSCROLL
 END