1 #ifndef __BF_GUI_FTPPANEL_H__
2 #define __BF_GUI_FTPPANEL_H__
3
4 #include "FtpClient.h"
5 #include "BF_GUI_NodePanel.h"
6
7
8 enum{
9 BF_FTP_MSG = 'BF10',
10
11 BF_FTP_MSG_EDIT_BOOKMARK,
12 BF_FTP_MSG_BOOKMARK_EDIT,
13 BF_FTP_MSG_BOOKMARK_DELETE,
14 BF_FTP_MSG_BOOKMARK_DELETE_ANSWER,
15 BF_FTP_MSG_BOOKMARK_CREATE,
16
17 BF_FTP_MSG_CONNECT_BREAK,
18 BF_FTP_MSG_CONNECTED,
19 BF_FTP_MSG_MESSAGE,
20 BF_FTP_MSG_DIR_CHANGED,
21 BF_FTP_MSG_DISCONNECT,
22 BF_FTP_MSG_DIR_RELOAD_START,
23 BF_FTP_MSG_DIR_RELOAD,
24
25 BF_FTP_MSG_LAST
26 };
27
28
29 class BF_FtpPath:public BF_Path{
30 public:
31 void SetFromFtp(const char *pc_Path);
32 };
33
34
35 class BF_GUI_FtpPanel_Bookmark:public BL_Object{
36 public:
37 BL_String sTitle,sHost,sUserName,sUserPassword;
38 BL_String sProxy;
39 BL_String sFolder;
40 int32 iPort;
41 bool bPassive,bAscii_Mode;
42
43 BF_GUI_FtpPanel_Bookmark();
44 virtual void operator = (BF_GUI_FtpPanel_Bookmark & o_Source);
45 };
46
47
48
49 class BF_GUI_FtpPanel_NodeBookmark:public BF_Node{
50 public:
51 BF_GUI_FtpPanel_Bookmark *poBookmark;
52 BF_GUI_FtpPanel_NodeBookmark();
53 ~BF_GUI_FtpPanel_NodeBookmark();
54 };
55
56
57
58
59 #define BF_FTPPANEL_VISMODE_BOOKMARKS 0
60 #define BF_FTPPANEL_VISMODE_FTPLIST 1
61
62 #define BF_FTPPANEL_STATE_DEFAULT 0
63 #define BF_FTPPANEL_STATE_CONNECTING 1
64 #define BF_FTPPANEL_STATE_CONNECTED 2
65 #define BF_FTPPANEL_STATE_DIR_CHANGING 3
66 #define BF_FTPPANEL_STATE_DIR_RELOAD 4
67
68 class BF_GUI_FtpPanel:public BF_GUI_NodePanel{
69 public:
70 BF_GUI_FtpPanel(const BRect & o_Rect,bool b_WinPos_OnLeft);
71 ~BF_GUI_FtpPanel();
72
73
74 virtual bool NavEnter();
75 virtual void MessageReceived(BMessage* po_Message);
76
77 private:
78
79 virtual const BL_String Path() const;
80 virtual void PrepareKeysMenu();
81 virtual void PrepareTopMenuItem(BF_GUI_TopMenu_HItem *po_HItem);
82 virtual void Action_SwitchShowIcons();
83
84 virtual void ActionMakeDir_Run(BL_String & s_Title);
85 virtual void ActionCopyTo_Run(BL_String & s_Path,BF_NodeCollection & lo_Node);
86 virtual void ActionCopyFrom_Run(BL_String & s_Path,BF_NodeCollection & lo_Node,bool b_Move);
87 virtual void ActionDelete_Run(BF_NodeCollection & lo_Node);
88
89
90 virtual void RefreshNodeList();
91
92 void LoadBookmarks();
93 void Bookmark_Create();
94 void Bookmark_Edit();
95 void Bookmark_Delete();
96 void Bookmark_Delete_Yes();
97 void Bookmark_Save(const char *pc_OldTitle,BF_GUI_FtpPanel_NodeBookmark *po_Node);
98
99 void Act_Connect();
100 void Act_ChangeDir_Start(BF_Node *po_Node);
101 void Act_ReloadDir_Start();
102
103 void Ftp_ListLoaded(const BL_String & s_List);
104 void Ftp_LoadIcons();
105 void Ftp_Disconnect();
106
107 int32 iVisMode;
108 int32 iState;
109
110 FtpClient *poClient;
111 BF_FtpPath oPath;
112 BF_FilesPath oBookmarkDir;
113 BF_GUI_FtpPanel_Bookmark *poBookmark;
114
115 BBitmap *poFolderSIcon,*poBookmarkSIcon;
116 BBitmap *poDocSIcon;
117
118 thread_id uConnectThread;
119
120 friend int32 BF_GUI_FtpPanel__Act_Connect_Thread(void *data);
121 friend int32 BF_GUI_FtpPanel__Act_ChangeDir_Thread(void *data);
122 friend int32 BF_GUI_FtpPanel__Act_ReloadDir_Thread(void *data);
123 friend int32 BF_GUI_FtpPanel__Act_MakeDir_Thread(void *data);
124 friend class BF_GUI_FtpPanel_UploadTask;
125 friend class BF_GUI_FtpPanel_DeleteTask;
126 friend class BF_GUI_FtpPanel_DownloadTask;
127
128 };
129
130 int32 BF_GUI_FtpPanel__Act_Connect_Thread(void *data);
131 int32 BF_GUI_FtpPanel__Act_ChangeDir_Thread(void *data);
132 int32 BF_GUI_FtpPanel__Act_ReloadDir_Thread(void *data);
133 int32 BF_GUI_FtpPanel__Act_MakeDir_Thread(void* data);
134