-rw-r--r-- | noncore/apps/opie-console/sz_transfer.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.h | 7 |
2 files changed, 29 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index 10f3f7a..a5af2be 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp @@ -3,4 +3,5 @@ #include <qfile.h> #include <opie/oprocess.h> +#include <stdio.h> SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) @@ -20,18 +21,20 @@ void SzTransfer::sendFile(const QString& file) { proc = new OProcess; *proc << "sz"; - *proc << "-vv" << file; + *proc << "-v" << "-v" << "-v" << "-b" << 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 &))); + connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), + this, SLOT(SzReceivedStdout(OProcess *, char *, int))); + connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), + this, SLOT(SzReceivedStderr(OProcess *, char *, int))); + connect(layer(), SIGNAL(received(const QByteArray &)), + this, SLOT(receivedStdin(const QByteArray &))); proc->start(OProcess::NotifyOnExit, OProcess::All); } -void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) { +void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { + + qWarning("recieved from sz %d bytes", buflen); QByteArray data(buflen); @@ -42,13 +45,25 @@ void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) { } -void SzTransfer::SzRecievedStderr(OProcess *, char *, int) { +void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { // parse and show data in a progress dialog/widget + printf("\n"); + for (int i = 0; i < length; i++) + printf("%c", buffer[i]); } -void SzTransfer::recievedStdin(QByteArray &data) { +void SzTransfer::receivedStdin(const QByteArray &data) { + qWarning("recieved from io_serial %d bytes", data.size()); // recieved data from the io layer goes to sz proc->writeStdin(data.data(), data.size()); } + +void SzTransfer::sent() { + + qWarning("sent file"); + delete proc; + disconnect(layer(), SIGNAL(received(const QByteArray &)), + this, SLOT(receivedStdin(const QByteArray &))); +} diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h index 825680d..d3e6621 100644 --- a/noncore/apps/opie-console/sz_transfer.h +++ b/noncore/apps/opie-console/sz_transfer.h @@ -25,9 +25,10 @@ public slots: void sendFile( const QString& file ) ; void sendFile( const QFile& ); + void sent(); private slots: - void SzRecievedStdout(OProcess *, char *, int); - void SzRecievedStderr(OProcess *, char *, int); - void recievedStdin(QByteArray &); + void SzReceivedStdout(OProcess *, char *, int); + void SzReceivedStderr(OProcess *, char *, int); + void receivedStdin(const QByteArray &); private: |