File: ViewWindow.h

package info (click to toggle)
bsc 2.27-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,640 kB
  • ctags: 2,610
  • sloc: cpp: 14,100; perl: 114; makefile: 46
file content (317 lines) | stat: -rw-r--r-- 9,737 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/********************************************************************
 * Copyright (C) 2005, 2006 Piotr Pszczolkowski
 *-------------------------------------------------------------------
 * This file is part of BSCommander (Beesoft Commander).
 *
 * BsC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * BsC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with BsC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *******************************************************************/
#ifndef INCLUDED_VIEWWINDOW_H
#define INCLUDED_VIEWWINDOW_H

/*------- include files:
-------------------------------------------------------------------*/
#ifndef INCLUDED_QFRAME_H
#include <qframe.h>
#define INCLUDED_QFRAME_H
#endif // INCLUDED_QFRAME_H

#ifndef INCLUDED_QCOLOR_H
#include <qcolor.h>
#define INCLUDED_QCOLOR_H
#endif // INCLUDED_QCOLOR_H

#ifndef INCLUDED_QDIR_H
#include <qdir.h>
#define INCLUDED_QDIR_H
#endif // INCLUDED_QDIR_H

#ifndef INCLUDED_QFILEINFO_H
#include <qfileinfo.h>
#define INCLUDED_QFILEINFO_H
#endif // INCLUDED_QFILEINFO_H

#ifndef INCLUDED_VECTOR
#include <vector>
#define INCLUDED_VECTOR
#endif // INCLUDED_VECTOR

#ifndef INCLUDED_SET
#include <set>
#define INCLUDED_SET
#endif // INCLUDED_SET

#include <stack>

#ifndef INCLUDED_QSTRINGLIST_H
#include <qstringlist.h> 
#define INCLUDED_QSTRINGLIST_H
#endif // INCLUDED_QSTRINGLIST_H

#ifndef INCLUDED_QTIMER_H
#include <qtimer.h>
#define INCLUDED_QTIMER_H
#endif // INCLUDED_QTIMER_H


#ifndef INCLUDED_SELECTION_H
#include "Selection.h"
#endif // INCLUDED_SELECTION_H

#ifndef INCLUDED_FTPSERVERINFO_H
#include "FtpServerInfo.h"
#endif // INCLUDED_FTPSERVERINFO_H

#ifndef INCLUDED_VIEWTABLE_H
#include "ViewTable.h"
#endif // INCLUDED_VIEWTABLE_H


/*------- forward declarations:
-------------------------------------------------------------------*/
class QComboBox;
class InfoField;
class Searcher;
class ViewTableItem;
class QFtp;
class QLineEdit;
class QLabel;
class SFtp;
class PleaseWait;
class FTPDeleter;

/*------- class declaration:
-------------------------------------------------------------------*/
class ViewWindow : public QFrame
{
	Q_OBJECT

/******* TYPES *******/
public:
	typedef enum {
		REMOVE_SELECTION = 1,
		STAY_SELECTION
	} SELECTION_CHANGE;
	typedef enum {
		FTP_CMD_NONE = 0,
		FTP_CMD_LOGIN,
		FTP_CMD_CLOSE,
		FTP_CMD_CD,
		FTP_CMD_CDUP,
		FTP_CMD_LIST,
		FTP_CMD_PWD,
		FTP_CMD_RENAME,
		FTP_CMD_MKDIR,
		FTP_CMD_RMDIR,
		FTP_CMD_REMOVE
	} FTP_CMD;
	typedef enum {
		NO_PACKED = 0,
		TAR,
		GZIP,
		BZIP2,
		ZIP
	} CompressType;

/******* CONSTRUCTION *******/
public:
	ViewWindow( QWidget* const in_parent );
	~ViewWindow();
private:
	ViewWindow( const ViewWindow& );
	ViewWindow& operator=( const ViewWindow& );
	
/******* MEMBERS *******/
private:
	static const int     OVER_STRETCH;
	static const int     SPACING_WIDTH;
	static const int     MARGIN_WIDTH;
	static const int     MAX_ITEMS_ON_LIST;
	static const QString DIR_INFO_LABEL;
	static const QString FILE_INFO_LABEL;
	static const QString SELECTION_INFO_LABEL;
	static const QString UP_PIXNAME;
	static const QString MSGBOX_DEL_QUEST_CAPTION;
	static const QString MSGBOX_DEL_QUEST_MSG;
	static const QString MSGBOX_EMPTY_QUEST_CAPTION;
	static const QString MSGBOX_EMPTY_QUEST_MSG;
	static const QString INDLG_F6_CAPTION;
	static const QString INDLG_F6_MSG;
	static const QString MSGBOX_F6_CAPTION;
	static const QString MSGBOX_F6_MSG;
	static const QString INDLG_F7_CAPTION;
	static const QString INDLG_F7_MSG;
	static const QString MSGBOX_F7_CAPTION;
	static const QString MSGBOX_F7_MSG;
	static const QString CANT_SAVE_FILE;
	static const QString CANT_READ_FILE;
	static const QString BINARY_FILE;
	static const QString TOUCH_CAPTION;
	static const QString TOUCH_PROMPT;
	static const QString TOUCH_FILE_EXISTS;
	static const QString TOUCH_CANT_CREATE;
	static const QString FTP_MSG_CAPTION;
	static const QString KDE_EXECUTE;
	static const QString MD5Caption;
	static const QString MD5Msg;
	static const QString MD5Ok;
	static const QString MD5Error;
	static const QString TarExt;
	static const QString GzipExt;
	static const QString Bzip2Ext;
	static const QString ZipExt;
	static const QString DeletingCaption;
	static const QString PleaseWaitMsg;
public:
	static const QString CONFIG_KEY_PATH;
	static const QString CONFIG_KEY_FILE;
	static const QString CONFIG_KEY_COMBO;

	//....................................
	static int    s_pack_idx;
	//....................................
	QComboBox* const d_path;
	QComboBox* const d_fstab;
	ViewTable*       d_table;
	QLineEdit* const d_status;
	QFtp*      const d_ftp;
	SFtp*            d_sftp;
	QDir             d_dir;
	QLabel*          d_dir_info_lbl;
	QLabel*          d_file_info_lbl;
	QLabel*          d_sel_info_lbl;
	InfoField*       d_dir_number;
	InfoField*       d_file_number;
	InfoField*       d_selection_number;
	int              d_dir_counter;
	int              d_file_counter;
	QString          d_tmp_packed_path;
	QString          d_src_packed_path;
	CompressType     d_compress_type;
	bool             d_is_ftp_dir;
	bool             d_is_ftp_root;
	QString          d_prv_dir;
	QString          d_prv_item;
	int              d_max_items_on_list;
	FTP_CMD          d_ftp_cmd;
	FtpServerInfo    d_fsi;
	int              d_pwd_cmd_id;
	QTimer           d_timer;
	bool             d_loop;
	QString          d_devname;
	PleaseWait*      d_please_wait;
	FTPDeleter*      d_ftp_deleter;
	
/******* METHODS *******/
public:
	void    disp_this_location  ( const QString& in_dname, const QString& in_fname );
	QString get_dir             ();
	QString get_current_fname   ();
	QStringList get_combox_items();
	ViewTableItem* current_item () { return d_table->current_item(); }
	void    set_combox_items    ( const QStringList& in_data );
	const ViewTable::SelectedItems& selections() { return d_table->selections(); }
	void    update_view         ( const SELECTION_CHANGE in_selection_change );
	bool    has_focus           () const { return d_table->hasFocus(); }
	void    set_focus           () { d_table->setFocus(); }
	bool    is_ftp_dir          () const { return d_is_ftp_dir; }
	const FtpServerInfo& get_fsi() const { return d_fsi; }
	void    wait_start          () { d_timer.start( 2000 ); }
	void    wait_stop           () { d_timer.stop();        }
	void    lang_changed        ();
	void    looks_refresh       ();
private:
	void     ctrl_return      ();
	void     ctrl_K           ();
	void     ctrl_L           ();
	Q_ULLONG read_dir_size    ( const QString& );
	QWidget* make_info_area   ();
	void     keyPressEvent    ( QKeyEvent* e );
	void     open_packed      ( const QString&, const CompressType );
	void     close_packed     ();
	void     start_finder     ( const char in_char );
	void     finish_finder    ();
	void     read_dir         ();
	void     refresh_dir      ();
	void     update_start     ();
	void     next_item        ( const QFileInfo& in_fi );
	void     update_finish    ();
	void     start_searcher   ();
	void     read_fstab       ();
	bool     is_mounted       ( const QString& );
	void     F6_ftp           ( const QString&, const QString& );
	void     F6_lfs           ( const QString&, const QString& );
	void     F7_ftp           ( const QString& );
	void     F7_lfs           ( const QString& );
	void     F8_ftp           ( const ViewTable::SelectedItems& );
	void     F8_lfs           ( const ViewTable::SelectedItems&, const bool );
	// FTP
	void ftp_connect       ();
	void ftp_cd            ( const QString&, const bool = TRUE );
	void ftp_rmdir         ( const QString& );
	void ftp_list          ( const bool = TRUE );
	void ftp_pwd           ( const bool = TRUE );
private slots:
    void break_work        ();
	void filter            ( bool in_on );
	void cd_up             ();
	void cd_home           ();
	void cd_root           ();
	void cd_refresh        ();
	void execute           ( QListViewItem* );
	void execute           ( QListViewItem*, const QPoint&, int );
	void return_pressed    ();
	void activated         ( int );
	void fstab             ( int );
	void touch             ();
	void slot_ftp_start    ();
	void slot_ftp_end      ();
	// OBSLUGA LICZNIKOW
	void selections_changed( int );
	void inc_dir_counter   ();
	void inc_file_counter  ();
	// OBSLUGA ZAZNACZEN
	void slot_select       ();
	void slot_unselect     ();
	void slot_revers       ();
	// OBSLUGA KLAWISZY FUNKCYJNYCH
	void F2                ();
	void F3                ();
	void F4                ();
	void F6                ();
	void F7                ();
	void F8                ();
	void empty             ();
	void disp_dir_size     ( ViewTableItem* );
	// FTP
	void ftp_done          ( bool );
	void ftp_state_changed ( int );
	void ftp_list_info     ( const QUrlInfo& );
	void ftp_cmd_finish    ( int, bool );
	void ftp_cmd_reply     ( int, const QString& );
	void timeout           ();
	void tree              ();
	void md5_create        ();
	void md5_check         ();
	void ftp_remove_done   ();
signals:
	void F5                ();
	void F9                ();
	void ftp_rejected      ();
	void selection_changed ();
	void tab_update        ( const QString& );
	void open_new_tab      ( const QString& );
};

#endif // INCLUDED_VIEWWINDOW_H