blob: ed3afa970c6a5b0e5017785148915d33b4d7ff45 [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 Syrovatsky555884d2005-12-14 11:56:25 +000031#include <rfb_win32/Dialog.h>
Dennis Syrovatsky4ab41852005-11-07 09:52:36 +000032#include <vncviewer/FileTransfer.h>
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000033#include <vncviewer/FTListView.h>
34#include <vncviewer/FTProgress.h>
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000035#include <vncviewer/resource.h>
36
37namespace rfb {
38 namespace win32 {
Dennis Syrovatsky4ab41852005-11-07 09:52:36 +000039 class FileTransfer;
40
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000041 class FTDialog
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000042 {
43 public:
44 FTDialog(HINSTANCE hInst, FileTransfer *pFT);
45 ~FTDialog();
46
Dennis Syrovatsky4905c8f2005-11-21 15:52:46 +000047 bool createFTDialog(HWND hwndParent);
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000048 bool closeFTDialog();
49 void destroyFTDialog();
Dennis Syrovatsky7b53c662005-12-14 10:18:21 +000050
51 void processDlgMsgs();
52
53 void cancelTransfer(bool bResult);
Dennis Syrovatsky2142b4a2005-12-14 11:03:19 +000054 void afterCancelTransfer();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000055
56 static BOOL CALLBACK FTDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
57
Dennis Syrovatskyd6febeb2005-11-10 04:27:49 +000058 void addRemoteLVItems(FileInfo *pFI);
Dennis Syrovatsky8b194ee2005-11-10 08:56:34 +000059 void reqFolderUnavailable();
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000060
Dennis Syrovatskyc4ed9b72005-11-28 07:10:27 +000061 void setStatusText(LPCSTR format,...);
62
63 HWND getWndHandle() { return m_hwndFTDialog; }
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000064
Dennis Syrovatsky092d9982005-12-05 09:57:05 +000065 void postCheckDeleteQueueMsg();
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +000066 void postCheckTransferQueueMsg();
67 void postUploadFilePortionMsg();
68 void postDownloadFilePortionMsg();
69
Dennis Syrovatsky5ae73f12005-11-30 04:15:40 +000070 char *getLocalPath() { return m_szLocalPath; }
71 char *getRemotePath() { return m_szRemotePath; }
72
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000073 FTProgress *m_pProgress;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000074
75 private:
76 FileTransfer *m_pFileTransfer;
77
78 HWND m_hwndFTDialog;
Dennis Syrovatskyb595e032005-11-09 06:24:25 +000079 HWND m_hwndLocalPath;
80 HWND m_hwndRemotePath;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000081 HINSTANCE m_hInstance;
82
Dennis Syrovatsky8b194ee2005-11-10 08:56:34 +000083 void showLocalLVItems();
84 void showRemoteLVItems();
85
Dennis Syrovatsky2142b4a2005-12-14 11:03:19 +000086 void onClose();
87
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000088 void onLocalItemActivate(LPNMITEMACTIVATE lpnmia);
89 void onRemoteItemActivate(LPNMITEMACTIVATE lpnmia);
90
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +000091 void onLocalReload();
92 void onRemoteReload();
93
Dennis Syrovatsky3f079e72005-11-23 05:23:50 +000094 void onLocalRButton();
95 void onRemoteRButton();
Dennis Syrovatsky05c424e2005-12-14 11:19:19 +000096
97 void onLocalCreateFolder();
98 void onRemoteCreateFolder();
99
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000100 void showFTMenu(bool copyBtnState, bool createFldBtnState,
101 bool renameBtnState, bool deleteBtnState,
102 bool cancelBtnState);
103 void onFTMenuCommand(int command);
Dennis Syrovatsky3f079e72005-11-23 05:23:50 +0000104
Dennis Syrovatskyabc2cc52005-11-23 03:52:07 +0000105 void onUpload();
106 void onDownload();
107
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000108 void onLocalRename();
109 void onRemoteRename();
110
111 void onLocalDelete();
112 void onRemoteDelete();
113
114 void onFTCancel();
115
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +0000116 void setIcon(int dest, int idIcon);
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000117 bool initFTDialog();
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000118 bool initFTWndMsgs();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000119
Dennis Syrovatskyb595e032005-11-09 06:24:25 +0000120 void onLocalOneUpFolder();
121 void onRemoteOneUpFolder();
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +0000122 int makeOneUpFolder(char *pPath);
Dennis Syrovatskyabc2cc52005-11-23 03:52:07 +0000123
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000124 void refreshBtnState();
125 void setButtonsState();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000126
127 bool m_bDlgShown;
Dennis Syrovatsky2142b4a2005-12-14 11:03:19 +0000128 bool m_bCloseDlgAfterCancel;
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +0000129
Dennis Syrovatsky092d9982005-12-05 09:57:05 +0000130 UINT m_msgCheckDeleteQueue;
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000131 UINT m_msgCheckTransferQueue;
132 UINT m_msgUploadFilePortion;
133 UINT m_msgDownloadFilePortion;
134
Dennis Syrovatsky922ee6a2005-12-05 10:55:51 +0000135 DWORD m_dwNumStatusStrings;
136
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +0000137 FTListView *m_pLocalLV;
138 FTListView *m_pRemoteLV;
139
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000140 int m_FTMenuSource;
141
Dennis Syrovatskyd6febeb2005-11-10 04:27:49 +0000142 char m_szLocalPath[FT_FILENAME_SIZE];
143 char m_szRemotePath[FT_FILENAME_SIZE];
144 char m_szLocalPathTmp[FT_FILENAME_SIZE];
145 char m_szRemotePathTmp[FT_FILENAME_SIZE];
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000146
Dennis Syrovatsky092d9982005-12-05 09:57:05 +0000147 static const char szCheckDeleteQueueText[];
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000148 static const char szCheckTransferQueueText[];
149 static const char szUploadFilePortionText[];
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000150
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000151 typedef struct tagFTBUTTONSSTATE
152 {
153 bool uploadBtn;
154 bool downloadBtn;
155 bool createLocalFldBtn;
156 bool createRemoteFldBtn;
157 bool renameLocalBtn;
158 bool renameRemoteBtn;
159 bool deleteLocalBtn;
160 bool deleteRemoteBtn;
161 bool cancelBtn;
162 } FTBUTTONSSTATE;
163
164 FTBUTTONSSTATE m_BtnState;
Dennis Syrovatsky7b53c662005-12-14 10:18:21 +0000165
166 public:
167 class CancelingDlg
168 {
169 public:
170 CancelingDlg(FTDialog *pFTDlg);
171 ~CancelingDlg();
172
173 static BOOL CALLBACK cancelingDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
174
175 bool create();
176 bool destroy();
177
178 private:
179 FTDialog *m_pFTDlg;
180 HWND m_hwndDlg;
181
182 bool close(bool bResult);
183 };
184
Dennis Syrovatsky555884d2005-12-14 11:56:25 +0000185 private:
Dennis Syrovatsky7b53c662005-12-14 10:18:21 +0000186 CancelingDlg *m_pCancelingDlg;
Dennis Syrovatsky555884d2005-12-14 11:56:25 +0000187
188 public:
189 class CreateFolderDlg : public Dialog
190 {
191 public:
192 CreateFolderDlg(FTDialog *pFTDlg);
193 ~CreateFolderDlg();
194
195 };
196
197 private:
198 CreateFolderDlg *m_pCreateFolderDlg;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000199 };
200 }
201}
202
203#endif // __RFB_WIN32_FTDIALOG_H__