-rw-r--r-- | noncore/apps/opie-console/sz_transfer.cpp | 54 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.h | 33 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.o | bin | 0 -> 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 Binary files differnew file mode 100644 index 0000000..8eb4fbf --- a/dev/null +++ b/noncore/apps/opie-console/sz_transfer.o |