summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/receive_layer.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/receive_layer.h b/noncore/apps/opie-console/receive_layer.h
new file mode 100644
index 0000000..0cfe16d
--- a/dev/null
+++ b/noncore/apps/opie-console/receive_layer.h
@@ -0,0 +1,113 @@
1#ifndef OPIE_RECEIVE_LAYER_H
2#define OPIE_RECEIVE_LAYER_H
3
4#include <qobject.h>
5
6/**
7 * An abstract Layer for receiving files
8 * from an IOLayer connection
9 * It gives us the possibility to listen
10 * to get progress to stop listen
11 * to get errors
12 */
13class IOLayer;
14class ReceiveLayer : public QObject {
15 Q_OBJECT
16public:
17 /**
18 * How to receive files
19 * How handhel \r\n?
20 * ASCII or binary
21 */
22 enum Mode {
23 Ascii = 0l,
24 Binary
25 };
26
27 /**
28 * What features to use
29 * DISCUSS IT!!!!
30 * see rz --help for more info
31 */
32 enum Features {
33 Append = 0,
34 AllowRemoteCommands = 1,
35 WriteToNull = 2,
36 Escape = 4,
37 Rename = 8,
38 OpenSync = 16,
39 ProtectExisting = 32,
40 Resume = 64,
41 KeepUppercase = 128,
42 DisableRestrict = 256,
43 Restricted = 512,
44 Overwrite = 1024
45 };
46
47 /**
48 * which protocol to use?
49 */
50 enum Type{
51 SZ = 0,
52 SX,
53 SY
54 };
55
56 /**
57 * C'tor constructs an new Object
58 * @param lay The Layer to be used
59 * @param t The Type
60 * @param startDir In which dir should files be received?
61 */
62 ReceiveLayer( IOLayer* lay, Type t, const QString& startDir = QString::null );
63 virtual ~ReceiveLayer();
64
65public slots:
66 /**
67 * start receiving in current dir
68 * with protocol from the c'tor
69 */
70 virtual void receive() = 0;
71
72 /**
73 * start to receive in dir with type
74 * from the c'tor
75 */
76 virtual void receive( const QString& dir ) = 0;
77
78 /**
79 * advanced method with features and Mode
80 */
81 virtual void receive( const QString& dir, Mode, Features ) {}
82
83 /**
84 * cancel receive
85 */
86 virtual void cancel();
87
88signals:
89 /**
90 * error happend
91 * error code as int
92 * and a QString for UI translated string
93 */
94 void error(int, const QString& );
95
96 /**
97 * progress
98 * @param file The completed path to the file which is received
99 * @param speed the speed in bps
100 * @param hour The hours remaining
101 * @param minutes The miniutes remaining
102 * @param seconds The seconds remaining
103 */
104 void progress( const QString& file, int progress, int speed, int hour, int min, int seconds );
105
106 /**
107 * completely received a file
108 */
109 void received( const QString& file );
110
111};
112
113#endif