author | hash <hash> | 2002-10-07 08:18:40 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-07 08:18:40 (UTC) |
commit | ed032e9e5b7a260e9ec05a0cc13a138dad5085d5 (patch) (side-by-side diff) | |
tree | 125a7b068f592ccc0d5a2d21feaeb84bac25d007 /noncore/apps/opie-console/sz_transfer.cpp | |
parent | 4202539e8a50bad62e6ee0cbf3965e00e9ff156a (diff) | |
download | opie-ed032e9e5b7a260e9ec05a0cc13a138dad5085d5.zip opie-ed032e9e5b7a260e9ec05a0cc13a138dad5085d5.tar.gz opie-ed032e9e5b7a260e9ec05a0cc13a138dad5085d5.tar.bz2 |
separated from the interface
Diffstat (limited to 'noncore/apps/opie-console/sz_transfer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.cpp | 54 |
1 files changed, 54 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()); + +} |