author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/apps/opie-console/sz_transfer.cpp | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
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 | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index c47e73e..2f82417 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp | |||
@@ -1,84 +1,84 @@ | |||
1 | 1 | ||
2 | #include "sz_transfer.h" | 2 | #include "sz_transfer.h" |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | #include <sys/termios.h> | 5 | #include <sys/termios.h> |
6 | 6 | ||
7 | 7 | ||
8 | 8 | ||
9 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) | 9 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) |
10 | { | 10 | { |
11 | } | 11 | } |
12 | 12 | ||
13 | SzTransfer::~SzTransfer() { | 13 | SzTransfer::~SzTransfer() { |
14 | } | 14 | } |
15 | 15 | ||
16 | void SzTransfer::sendFile(const QFile& file) { | 16 | void SzTransfer::sendFile(const QFile& file) { |
17 | 17 | ||
18 | sendFile(file.name()); | 18 | sendFile(file.name()); |
19 | } | 19 | } |
20 | 20 | ||
21 | void SzTransfer::sendFile(const QString& file) { | 21 | void SzTransfer::sendFile(const QString& file) { |
22 | 22 | ||
23 | //setcbreak(2); /* raw no echo */ | 23 | //setcbreak(2); /* raw no echo */ |
24 | 24 | ||
25 | proc = new OProcess; | 25 | proc = new OProcess; |
26 | *proc << "sz"; | 26 | *proc << "sz"; |
27 | *proc << "-v" << "-v" << "-b" << file; | 27 | *proc << "-v" << "-v" << "-b" << file; |
28 | connect(proc, SIGNAL(processExited(OProcess *)), | 28 | connect(proc, SIGNAL(processExited(OProcess*)), |
29 | this, SLOT(sent())); | 29 | this, SLOT(sent())); |
30 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), | 30 | connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), |
31 | this, SLOT(SzReceivedStdout(OProcess *, char *, int))); | 31 | this, SLOT(SzReceivedStdout(OProcess*,char*,int))); |
32 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), | 32 | connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), |
33 | this, SLOT(SzReceivedStderr(OProcess *, char *, int))); | 33 | this, SLOT(SzReceivedStderr(OProcess*,char*,int))); |
34 | connect(layer(), SIGNAL(received(const QByteArray &)), | 34 | connect(layer(), SIGNAL(received(const QByteArray&)), |
35 | this, SLOT(receivedStdin(const QByteArray &))); | 35 | this, SLOT(receivedStdin(const QByteArray&))); |
36 | proc->start(OProcess::NotifyOnExit, OProcess::All); | 36 | proc->start(OProcess::NotifyOnExit, OProcess::All); |
37 | 37 | ||
38 | } | 38 | } |
39 | 39 | ||
40 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { | 40 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { |
41 | 41 | ||
42 | qWarning("recieved from sz on stdout %d bytes", buflen); | 42 | qWarning("recieved from sz on stdout %d bytes", buflen); |
43 | 43 | ||
44 | QByteArray data(buflen); | 44 | QByteArray data(buflen); |
45 | data.fill(*buffer, buflen); | 45 | data.fill(*buffer, buflen); |
46 | for (uint i = 0; i < data.count(); i++ ) { | 46 | for (uint i = 0; i < data.count(); i++ ) { |
47 | printf("%c", buffer[i] ); | 47 | printf("%c", buffer[i] ); |
48 | } | 48 | } |
49 | printf("\n"); | 49 | printf("\n"); |
50 | 50 | ||
51 | // send out through the io layer | 51 | // send out through the io layer |
52 | layer()->send(data); | 52 | layer()->send(data); |
53 | } | 53 | } |
54 | 54 | ||
55 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { | 55 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { |
56 | 56 | ||
57 | // parse and show data in a progress dialog/widget | 57 | // parse and show data in a progress dialog/widget |
58 | printf("stderr:\n"); | 58 | printf("stderr:\n"); |
59 | //for (int i = 0; i < length; i++) | 59 | //for (int i = 0; i < length; i++) |
60 | // printf("%c", buffer[i]); | 60 | // printf("%c", buffer[i]); |
61 | //printf("\n"); | 61 | //printf("\n"); |
62 | } | 62 | } |
63 | 63 | ||
64 | void SzTransfer::receivedStdin(const QByteArray &data) { | 64 | void SzTransfer::receivedStdin(const QByteArray &data) { |
65 | 65 | ||
66 | qWarning("recieved from io_serial %d bytes", data.size()); | 66 | qWarning("recieved from io_serial %d bytes", data.size()); |
67 | 67 | ||
68 | // recieved data from the io layer goes to sz | 68 | // recieved data from the io layer goes to sz |
69 | proc->writeStdin(data.data(), data.size()); | 69 | proc->writeStdin(data.data(), data.size()); |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | void SzTransfer::sent() { | 73 | void SzTransfer::sent() { |
74 | 74 | ||
75 | qWarning("sent file"); | 75 | qWarning("sent file"); |
76 | 76 | ||
77 | //setcbreak(0); /* default */ | 77 | //setcbreak(0); /* default */ |
78 | 78 | ||
79 | 79 | ||
80 | delete proc; | 80 | delete proc; |
81 | disconnect(layer(), SIGNAL(received(const QByteArray &)), | 81 | disconnect(layer(), SIGNAL(received(const QByteArray&)), |
82 | this, SLOT(receivedStdin(const QByteArray &))); | 82 | this, SLOT(receivedStdin(const QByteArray&))); |
83 | 83 | ||
84 | } | 84 | } |