summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/sz_transfer.cpp
Unidiff
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.cpp35
1 files changed, 25 insertions, 10 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 @@
3#include <qfile.h> 3#include <qfile.h>
4#include <opie/oprocess.h> 4#include <opie/oprocess.h>
5#include <stdio.h>
5 6
6SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) 7SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t)
@@ -20,18 +21,20 @@ void SzTransfer::sendFile(const QString& file) {
20 proc = new OProcess; 21 proc = new OProcess;
21 *proc << "sz"; 22 *proc << "sz";
22 *proc << "-vv" << file; 23 *proc << "-v" << "-v" << "-v" << "-b" << file;
23 connect(proc, SIGNAL(processExited(OProcess *)), 24 connect(proc, SIGNAL(processExited(OProcess *)),
24 this, SLOT(sent())); 25 this, SLOT(sent()));
25 connect(proc, SIGNAL(processRecievedStdout(OProcess *, char *, int)), 26 connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)),
26 this, SLOT(SzRecievedStdout(OProcess *, char *, int))); 27 this, SLOT(SzReceivedStdout(OProcess *, char *, int)));
27 connect(proc, SIGNAL(processRecievedStderr(OProcess *, char *, int)), 28 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)),
28 this, SLOT(SzRecievedStderr(OProcess *, char *, int))); 29 this, SLOT(SzReceivedStderr(OProcess *, char *, int)));
29 connect(layer(), SIGNAL(received(QByteArray &)), 30 connect(layer(), SIGNAL(received(const QByteArray &)),
30 this, SLOT(recievedStdin(QByteArray &))); 31 this, SLOT(receivedStdin(const QByteArray &)));
31 proc->start(OProcess::NotifyOnExit, OProcess::All); 32 proc->start(OProcess::NotifyOnExit, OProcess::All);
32 33
33} 34}
34 35
35void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) { 36void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) {
37
38 qWarning("recieved from sz %d bytes", buflen);
36 39
37 QByteArray data(buflen); 40 QByteArray data(buflen);
@@ -42,13 +45,25 @@ void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) {
42} 45}
43 46
44void SzTransfer::SzRecievedStderr(OProcess *, char *, int) { 47void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) {
45 48
46 // parse and show data in a progress dialog/widget 49 // parse and show data in a progress dialog/widget
50 printf("\n");
51 for (int i = 0; i < length; i++)
52 printf("%c", buffer[i]);
47} 53}
48 54
49void SzTransfer::recievedStdin(QByteArray &data) { 55void SzTransfer::receivedStdin(const QByteArray &data) {
50 56
57 qWarning("recieved from io_serial %d bytes", data.size());
51 // recieved data from the io layer goes to sz 58 // recieved data from the io layer goes to sz
52 proc->writeStdin(data.data(), data.size()); 59 proc->writeStdin(data.data(), data.size());
53 60
54} 61}
62
63void SzTransfer::sent() {
64
65 qWarning("sent file");
66 delete proc;
67 disconnect(layer(), SIGNAL(received(const QByteArray &)),
68 this, SLOT(receivedStdin(const QByteArray &)));
69}