summaryrefslogtreecommitdiff
authorhash <hash>2002-10-07 08:18:40 (UTC)
committer hash <hash>2002-10-07 08:18:40 (UTC)
commited032e9e5b7a260e9ec05a0cc13a138dad5085d5 (patch) (side-by-side diff)
tree125a7b068f592ccc0d5a2d21feaeb84bac25d007
parent4202539e8a50bad62e6ee0cbf3965e00e9ff156a (diff)
downloadopie-ed032e9e5b7a260e9ec05a0cc13a138dad5085d5.zip
opie-ed032e9e5b7a260e9ec05a0cc13a138dad5085d5.tar.gz
opie-ed032e9e5b7a260e9ec05a0cc13a138dad5085d5.tar.bz2
separated from the interface
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp54
-rw-r--r--noncore/apps/opie-console/sz_transfer.h33
-rw-r--r--noncore/apps/opie-console/sz_transfer.obin0 -> 112884 bytes
3 files changed, 87 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp
new file mode 100644
index 0000000..de321ae
--- a/dev/null
+++ b/noncore/apps/opie-console/sz_transfer.cpp
@@ -0,0 +1,54 @@
+
+#include "sz_transfer.h"
+#include <qfile.h>
+#include <opie/oprocess.h>
+
+SzTransfer::SzTransfer(IOLayer *layer) : FileTransferLayer(layer)
+{
+}
+
+SzTransfer::~SzTransfer() {
+}
+
+void SzTransfer::sendFile(const QFile& file) {
+
+ sendFile(file.name());
+}
+
+void SzTransfer::sendFile(const QString& file) {
+
+ proc = new OProcess;
+ *proc << "sz";
+ *proc << "-vv" << file;
+ connect(proc, SIGNAL(processExited(OProcess *)),
+ this, SLOT(sent()));
+ connect(proc, SIGNAL(processRecievedStdout(OProcess *, char *, int)),
+ this, SLOT(SzRecievedStdout(OProcess *, char *, int)));
+ connect(proc, SIGNAL(processRecievedStderr(OProcess *, char *, int)),
+ this, SLOT(SzRecievedStderr(OProcess *, char *, int)));
+ connect(layer(), SIGNAL(received(QByteArray &)),
+ this, SLOT(recievedStdin(QByteArray &)));
+ proc->start(OProcess::NotifyOnExit, OProcess::All);
+
+}
+
+void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) {
+
+ QByteArray data(buflen);
+ data.fill(*buffer, buflen);
+
+ // send out through the io layer
+ (layer())->send(data);
+}
+
+void SzTransfer::SzRecievedStderr(OProcess *, char *, int) {
+
+ // parse and show data in a progress dialog/widget
+}
+
+void SzTransfer::recievedStdin(QByteArray &data) {
+
+ // recieved data from the io layer goes to sz
+ proc->writeStdin(data.data(), data.size());
+
+}
diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h
new file mode 100644
index 0000000..778d1d3
--- a/dev/null
+++ b/noncore/apps/opie-console/sz_transfer.h
@@ -0,0 +1,33 @@
+#ifndef OPIE_FL_SZ_H
+#define OPIE_FL_SZ_H
+
+#include "file_layer.h"
+#include <opie/oprocess.h>
+
+class SzTransfer : public FileTransferLayer {
+
+ Q_OBJECT
+
+public:
+
+ SzTransfer( IOLayer * );
+ ~SzTransfer();
+
+public slots:
+ /**
+ * send a file over the layer
+ */
+ void sendFile( const QString& file ) = 0;
+ void sendFile( const QFile& ) = 0;
+
+private slots:
+ void SzRecievedStdout(OProcess *, char *, int);
+ void SzRecievedStderr(OProcess *, char *, int);
+ void recievedStdin(QByteArray &);
+
+private:
+ OProcess *proc;
+
+};
+
+#endif
diff --git a/noncore/apps/opie-console/sz_transfer.o b/noncore/apps/opie-console/sz_transfer.o
new file mode 100644
index 0000000..8eb4fbf
--- a/dev/null
+++ b/noncore/apps/opie-console/sz_transfer.o
Binary files differ