summaryrefslogtreecommitdiff
Side-by-side diff
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 @@
+#ifndef OPIE_RECEIVE_LAYER_H
+#define OPIE_RECEIVE_LAYER_H
+
+#include <qobject.h>
+
+/**
+ * An abstract Layer for receiving files
+ * from an IOLayer connection
+ * It gives us the possibility to listen
+ * to get progress to stop listen
+ * to get errors
+ */
+class IOLayer;
+class ReceiveLayer : public QObject {
+ Q_OBJECT
+public:
+ /**
+ * How to receive files
+ * How handhel \r\n?
+ * ASCII or binary
+ */
+ enum Mode {
+ Ascii = 0l,
+ Binary
+ };
+
+ /**
+ * What features to use
+ * DISCUSS IT!!!!
+ * see rz --help for more info
+ */
+ enum Features {
+ Append = 0,
+ AllowRemoteCommands = 1,
+ WriteToNull = 2,
+ Escape = 4,
+ Rename = 8,
+ OpenSync = 16,
+ ProtectExisting = 32,
+ Resume = 64,
+ KeepUppercase = 128,
+ DisableRestrict = 256,
+ Restricted = 512,
+ Overwrite = 1024
+ };
+
+ /**
+ * which protocol to use?
+ */
+ enum Type{
+ SZ = 0,
+ SX,
+ SY
+ };
+
+ /**
+ * C'tor constructs an new Object
+ * @param lay The Layer to be used
+ * @param t The Type
+ * @param startDir In which dir should files be received?
+ */
+ ReceiveLayer( IOLayer* lay, Type t, const QString& startDir = QString::null );
+ virtual ~ReceiveLayer();
+
+public slots:
+ /**
+ * start receiving in current dir
+ * with protocol from the c'tor
+ */
+ virtual void receive() = 0;
+
+ /**
+ * start to receive in dir with type
+ * from the c'tor
+ */
+ virtual void receive( const QString& dir ) = 0;
+
+ /**
+ * advanced method with features and Mode
+ */
+ virtual void receive( const QString& dir, Mode, Features ) {}
+
+ /**
+ * cancel receive
+ */
+ virtual void cancel();
+
+signals:
+ /**
+ * error happend
+ * error code as int
+ * and a QString for UI translated string
+ */
+ void error(int, const QString& );
+
+ /**
+ * progress
+ * @param file The completed path to the file which is received
+ * @param speed the speed in bps
+ * @param hour The hours remaining
+ * @param minutes The miniutes remaining
+ * @param seconds The seconds remaining
+ */
+ void progress( const QString& file, int progress, int speed, int hour, int min, int seconds );
+
+ /**
+ * completely received a file
+ */
+ void received( const QString& file );
+
+};
+
+#endif