-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 @@ | |||
1 | |||
2 | #include "sz_transfer.h" | ||
3 | #include <qfile.h> | ||
4 | #include <opie/oprocess.h> | ||
5 | |||
6 | SzTransfer::SzTransfer(IOLayer *layer) : FileTransferLayer(layer) | ||
7 | { | ||
8 | } | ||
9 | |||
10 | SzTransfer::~SzTransfer() { | ||
11 | } | ||
12 | |||
13 | void SzTransfer::sendFile(const QFile& file) { | ||
14 | |||
15 | sendFile(file.name()); | ||
16 | } | ||
17 | |||
18 | void SzTransfer::sendFile(const QString& file) { | ||
19 | |||
20 | proc = new OProcess; | ||
21 | *proc << "sz"; | ||
22 | *proc << "-vv" << file; | ||
23 | connect(proc, SIGNAL(processExited(OProcess *)), | ||
24 | this, SLOT(sent())); | ||
25 | connect(proc, SIGNAL(processRecievedStdout(OProcess *, char *, int)), | ||
26 | this, SLOT(SzRecievedStdout(OProcess *, char *, int))); | ||
27 | connect(proc, SIGNAL(processRecievedStderr(OProcess *, char *, int)), | ||
28 | this, SLOT(SzRecievedStderr(OProcess *, char *, int))); | ||
29 | connect(layer(), SIGNAL(received(QByteArray &)), | ||
30 | this, SLOT(recievedStdin(QByteArray &))); | ||
31 | proc->start(OProcess::NotifyOnExit, OProcess::All); | ||
32 | |||
33 | } | ||
34 | |||
35 | void SzTransfer::SzRecievedStdout(OProcess *, char *buffer, int buflen) { | ||
36 | |||
37 | QByteArray data(buflen); | ||
38 | data.fill(*buffer, buflen); | ||
39 | |||
40 | // send out through the io layer | ||
41 | (layer())->send(data); | ||
42 | } | ||
43 | |||
44 | void SzTransfer::SzRecievedStderr(OProcess *, char *, int) { | ||
45 | |||
46 | // parse and show data in a progress dialog/widget | ||
47 | } | ||
48 | |||
49 | void SzTransfer::recievedStdin(QByteArray &data) { | ||
50 | |||
51 | // recieved data from the io layer goes to sz | ||
52 | proc->writeStdin(data.data(), data.size()); | ||
53 | |||
54 | } | ||
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 @@ | |||
1 | #ifndef OPIE_FL_SZ_H | ||
2 | #define OPIE_FL_SZ_H | ||
3 | |||
4 | #include "file_layer.h" | ||
5 | #include <opie/oprocess.h> | ||
6 | |||
7 | class SzTransfer : public FileTransferLayer { | ||
8 | |||
9 | Q_OBJECT | ||
10 | |||
11 | public: | ||
12 | |||
13 | SzTransfer( IOLayer * ); | ||
14 | ~SzTransfer(); | ||
15 | |||
16 | public slots: | ||
17 | /** | ||
18 | * send a file over the layer | ||
19 | */ | ||
20 | void sendFile( const QString& file ) = 0; | ||
21 | void sendFile( const QFile& ) = 0; | ||
22 | |||
23 | private slots: | ||
24 | void SzRecievedStdout(OProcess *, char *, int); | ||
25 | void SzRecievedStderr(OProcess *, char *, int); | ||
26 | void recievedStdin(QByteArray &); | ||
27 | |||
28 | private: | ||
29 | OProcess *proc; | ||
30 | |||
31 | }; | ||
32 | |||
33 | #endif | ||
diff --git a/noncore/apps/opie-console/sz_transfer.o b/noncore/apps/opie-console/sz_transfer.o new file mode 100644 index 0000000..8eb4fbf --- a/dev/null +++ b/noncore/apps/opie-console/sz_transfer.o | |||
Binary files differ | |||