summaryrefslogtreecommitdiffstats
path: root/src/eventhandler.h
blob: a49ee362783dc420126ec27adb1807af95bcdd71 (plain)
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
/***************************************************************************
 *   Copyright (C) 2004 by Magnus Kulke                                    *
 *   mkulke@magnusmachine                                                  *
 *                                                                         *
 *   This program 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.                                   *
 *                                                                         *
 *   This program 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 this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef EVENTHANDLER_H
#define EVENTHANDLER_H

#include <tqobject.h>
#include <tqvaluelist.h>
#include <list>
#include "kbfileinfo.h"

using namespace std;

class KbDirInfo;
class FtpThread;

/**
@author Magnus Kulke
*/

typedef list<KbFileInfo*> filist;
typedef pair<filist, filist> contentpair;

class EventHandler : public TQObject
{
TQ_OBJECT
public:
    EventHandler(TQObject *parent = 0, const char *name = 0);
    ~EventHandler();
	 void SetFtpThread(FtpThread* thread);
public:
	enum EventType
	{
		error = 1001,
		outlog,
		inlog,
		xfered,
		finished,
		connectionlost,
		misc_success,
		misc_failure,		
		connect_success,
		connect_failure,
		login_success,
		login_failure,
		pwd_success,
		pwd_failure,
		chdir_success,
		chdir_failure,
		dir_success,
		dir_failure,
		scandir_success,
		scandir_failure,
		rm_success,
		rm_failure,
		rmdir_success,
		rmdir_failure,
		quit_success,
		quit_failure,
		authtls_success,
		authtls_failure,
		encryptdata_success,
		encryptdata_failure,
		get_success,
		get_failure,
		mkdir_success,
		mkdir_failure,
		rename_success,
		rename_failure,
		raw_success,
		raw_failure,
		put_success,
		put_failure,
		fxp_success,
		fxp_failure,
		transfer_success,
		transfer_failure
	};
private:
	bool eventFilter(TQObject* o, TQEvent *e);
private:
	FtpThread* mp_thread;
signals:
	void ftp_error(TQString error);
	void ftp_log(TQString log, bool out);
	void ftp_xfered(off64_t xfered, bool encrypted);
	void ftp_misc(bool success);
	void ftp_finished();
	void ftp_connect(bool success);
	void ftp_login(bool success);
	void ftp_quit(bool success);
	void ftp_pwd(bool success, TQString path);
	void ftp_chdir(bool success);
	void ftp_dir(bool success, list<KbFileInfo*> dirlist, list<KbFileInfo*> filelist);
	void ftp_scandir(bool success, KbDirInfo* dir);
	void ftp_rm(bool success);
	void ftp_rmdir(bool success);
	void ftp_authtls(bool success);
	void ftp_encryptdata(bool success);
	void ftp_get(bool success);
	void ftp_mkdir(bool success);
	void ftp_rename(bool success);
	void ftp_raw(bool success);
	void ftp_put(bool success);
	void ftp_transfer(bool success);
	void ftp_fxp(bool success);
	void ftp_connectionlost();
};

#endif