blob: e3d1d37678df53658d755f3e61309fc7527c5987 [file] [log] [blame]
Dennis Syrovatsky139d7832005-11-02 05:36:05 +00001/* Copyright (C) 2005 TightVNC Team. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 *
18 * TightVNC distribution homepage on the Web: http://www.tightvnc.com/
19 *
20 */
21
22// -=- FTDialog.h
23
24#ifndef __RFB_WIN32_FTDIALOG_H__
25#define __RFB_WIN32_FTDIALOG_H__
26
27#include <windows.h>
28#include <commctrl.h>
29
30#include <rfb/FileInfo.h>
Dennis Syrovatsky4ab41852005-11-07 09:52:36 +000031#include <vncviewer/FileTransfer.h>
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000032#include <vncviewer/FTListView.h>
33#include <vncviewer/FTProgress.h>
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000034#include <vncviewer/resource.h>
35
36namespace rfb {
37 namespace win32 {
Dennis Syrovatsky4ab41852005-11-07 09:52:36 +000038 class FileTransfer;
39
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000040 class FTDialog
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000041 {
42 public:
43 FTDialog(HINSTANCE hInst, FileTransfer *pFT);
44 ~FTDialog();
45
Dennis Syrovatsky4905c8f2005-11-21 15:52:46 +000046 bool createFTDialog(HWND hwndParent);
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000047 bool closeFTDialog();
48 void destroyFTDialog();
Dennis Syrovatsky7b53c662005-12-14 10:18:21 +000049
50 void processDlgMsgs();
51
52 void cancelTransfer(bool bResult);
Dennis Syrovatsky2142b4a2005-12-14 11:03:19 +000053 void afterCancelTransfer();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000054
55 static BOOL CALLBACK FTDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
56
Dennis Syrovatskyd6febeb2005-11-10 04:27:49 +000057 void addRemoteLVItems(FileInfo *pFI);
Dennis Syrovatsky8b194ee2005-11-10 08:56:34 +000058 void reqFolderUnavailable();
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000059
Dennis Syrovatskyc4ed9b72005-11-28 07:10:27 +000060 void setStatusText(LPCSTR format,...);
61
62 HWND getWndHandle() { return m_hwndFTDialog; }
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000063
Dennis Syrovatsky092d9982005-12-05 09:57:05 +000064 void postCheckDeleteQueueMsg();
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +000065 void postCheckTransferQueueMsg();
66 void postUploadFilePortionMsg();
67 void postDownloadFilePortionMsg();
68
Dennis Syrovatsky5ae73f12005-11-30 04:15:40 +000069 char *getLocalPath() { return m_szLocalPath; }
70 char *getRemotePath() { return m_szRemotePath; }
71
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000072 FTProgress *m_pProgress;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000073
74 private:
75 FileTransfer *m_pFileTransfer;
76
77 HWND m_hwndFTDialog;
Dennis Syrovatskyb595e032005-11-09 06:24:25 +000078 HWND m_hwndLocalPath;
79 HWND m_hwndRemotePath;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000080 HINSTANCE m_hInstance;
81
Dennis Syrovatsky8b194ee2005-11-10 08:56:34 +000082 void showLocalLVItems();
83 void showRemoteLVItems();
84
Dennis Syrovatsky2142b4a2005-12-14 11:03:19 +000085 void onClose();
86
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000087 void onLocalItemActivate(LPNMITEMACTIVATE lpnmia);
88 void onRemoteItemActivate(LPNMITEMACTIVATE lpnmia);
89
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +000090 void onLocalReload();
91 void onRemoteReload();
92
Dennis Syrovatsky3f079e72005-11-23 05:23:50 +000093 void onLocalRButton();
94 void onRemoteRButton();
Dennis Syrovatsky05c424e2005-12-14 11:19:19 +000095
96 void onLocalCreateFolder();
97 void onRemoteCreateFolder();
98
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +000099 void showFTMenu(bool copyBtnState, bool createFldBtnState,
100 bool renameBtnState, bool deleteBtnState,
101 bool cancelBtnState);
102 void onFTMenuCommand(int command);
Dennis Syrovatsky3f079e72005-11-23 05:23:50 +0000103
Dennis Syrovatskyabc2cc52005-11-23 03:52:07 +0000104 void onUpload();
105 void onDownload();
106
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000107 void onLocalRename();
108 void onRemoteRename();
109
110 void onLocalDelete();
111 void onRemoteDelete();
112
113 void onFTCancel();
114
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +0000115 void setIcon(int dest, int idIcon);
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000116 bool initFTDialog();
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000117 bool initFTWndMsgs();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000118
Dennis Syrovatskyb595e032005-11-09 06:24:25 +0000119 void onLocalOneUpFolder();
120 void onRemoteOneUpFolder();
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +0000121 int makeOneUpFolder(char *pPath);
Dennis Syrovatskyabc2cc52005-11-23 03:52:07 +0000122
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000123 void refreshBtnState();
124 void setButtonsState();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000125
126 bool m_bDlgShown;
Dennis Syrovatsky2142b4a2005-12-14 11:03:19 +0000127 bool m_bCloseDlgAfterCancel;
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +0000128
Dennis Syrovatsky092d9982005-12-05 09:57:05 +0000129 UINT m_msgCheckDeleteQueue;
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000130 UINT m_msgCheckTransferQueue;
131 UINT m_msgUploadFilePortion;
132 UINT m_msgDownloadFilePortion;
133
Dennis Syrovatsky922ee6a2005-12-05 10:55:51 +0000134 DWORD m_dwNumStatusStrings;
135
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +0000136 FTListView *m_pLocalLV;
137 FTListView *m_pRemoteLV;
138
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000139 int m_FTMenuSource;
140
Dennis Syrovatskyd6febeb2005-11-10 04:27:49 +0000141 char m_szLocalPath[FT_FILENAME_SIZE];
142 char m_szRemotePath[FT_FILENAME_SIZE];
143 char m_szLocalPathTmp[FT_FILENAME_SIZE];
144 char m_szRemotePathTmp[FT_FILENAME_SIZE];
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000145
Dennis Syrovatsky092d9982005-12-05 09:57:05 +0000146 static const char szCheckDeleteQueueText[];
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000147 static const char szCheckTransferQueueText[];
148 static const char szUploadFilePortionText[];
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000149
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000150 typedef struct tagFTBUTTONSSTATE
151 {
152 bool uploadBtn;
153 bool downloadBtn;
154 bool createLocalFldBtn;
155 bool createRemoteFldBtn;
156 bool renameLocalBtn;
157 bool renameRemoteBtn;
158 bool deleteLocalBtn;
159 bool deleteRemoteBtn;
160 bool cancelBtn;
161 } FTBUTTONSSTATE;
162
163 FTBUTTONSSTATE m_BtnState;
Dennis Syrovatsky7b53c662005-12-14 10:18:21 +0000164
165 public:
166 class CancelingDlg
167 {
168 public:
169 CancelingDlg(FTDialog *pFTDlg);
170 ~CancelingDlg();
171
172 static BOOL CALLBACK cancelingDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
173
174 bool create();
175 bool destroy();
176
177 private:
178 FTDialog *m_pFTDlg;
179 HWND m_hwndDlg;
180
181 bool close(bool bResult);
182 };
183
184 private:
185 CancelingDlg *m_pCancelingDlg;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000186 };
187 }
188}
189
190#endif // __RFB_WIN32_FTDIALOG_H__