-rw-r--r-- | core/obex/obex.cc | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/core/obex/obex.cc b/core/obex/obex.cc index 595fed9..2a306de 100644 --- a/core/obex/obex.cc +++ b/core/obex/obex.cc | |||
@@ -1,29 +1,31 @@ | |||
1 | 1 | ||
2 | #include <qapplication.h> | 2 | #include <qapplication.h> |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qfileinfo.h> | 4 | #include <qfileinfo.h> |
5 | #include <qtextcodec.h> | 5 | #include <qtextcodec.h> |
6 | 6 | ||
7 | #include <qpe/qcopenvelope_qws.h> | 7 | #include <qpe/qcopenvelope_qws.h> |
8 | 8 | ||
9 | #include <opie/oprocess.h> | 9 | #include <opie/oprocess.h> |
10 | #include "obex.h" | 10 | #include "obex.h" |
11 | 11 | ||
12 | using namespace OpieObex; | 12 | using namespace OpieObex; |
13 | 13 | ||
14 | /* TRANSLATOR OpieObex::Obex */ | ||
15 | |||
14 | Obex::Obex( QObject *parent, const char* name ) | 16 | Obex::Obex( QObject *parent, const char* name ) |
15 | : QObject(parent, name ) | 17 | : QObject(parent, name ) |
16 | { | 18 | { |
17 | m_rec = 0; | 19 | m_rec = 0; |
18 | m_send=0; | 20 | m_send=0; |
19 | m_count = 0; | 21 | m_count = 0; |
20 | m_receive = false; | 22 | m_receive = false; |
21 | connect( this, SIGNAL(error(int) ), // for recovering to receive | 23 | connect( this, SIGNAL(error(int) ), // for recovering to receive |
22 | SLOT(slotError() ) ); | 24 | SLOT(slotError() ) ); |
23 | connect( this, SIGNAL(sent(bool) ), | 25 | connect( this, SIGNAL(sent(bool) ), |
24 | SLOT(slotError() ) ); | 26 | SLOT(slotError() ) ); |
25 | }; | 27 | }; |
26 | Obex::~Obex() { | 28 | Obex::~Obex() { |
27 | delete m_rec; | 29 | delete m_rec; |
28 | delete m_send; | 30 | delete m_send; |
29 | } | 31 | } |
@@ -96,55 +98,44 @@ void Obex::sendNow(){ | |||
96 | m_send=0; | 98 | m_send=0; |
97 | } | 99 | } |
98 | // end | 100 | // end |
99 | m_count++; | 101 | m_count++; |
100 | emit currentTry( m_count ); | 102 | emit currentTry( m_count ); |
101 | } | 103 | } |
102 | 104 | ||
103 | void Obex::slotExited(OProcess* proc ){ | 105 | void Obex::slotExited(OProcess* proc ){ |
104 | if (proc == m_rec ) { // receive process | 106 | if (proc == m_rec ) { // receive process |
105 | received(); | 107 | received(); |
106 | }else if ( proc == m_send ) { | 108 | }else if ( proc == m_send ) { |
107 | sendEnd(); | 109 | sendEnd(); |
108 | } | 110 | } |
109 | } | 111 | } |
110 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ | 112 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ |
111 | if ( proc == m_rec ) { // only receive | 113 | if ( proc == m_rec ) { // only receive |
112 | for (int i = 0; i < len; i++ ) { | 114 | QByteArray ar( len ); |
113 | printf("%c", buf[i] ); | ||
114 | } | ||
115 | printf("\n"); | ||
116 | QByteArray ar( len ); | ||
117 | memcpy( ar.data(), buf, len ); | 115 | memcpy( ar.data(), buf, len ); |
118 | qWarning("parsed: %s", ar.data() ); | 116 | qWarning("parsed: %s", ar.data() ); |
119 | m_outp.append( ar ); | 117 | m_outp.append( ar ); |
120 | } | 118 | } |
121 | } | 119 | } |
122 | 120 | ||
123 | void Obex::received() { | 121 | void Obex::received() { |
124 | if (m_rec->normalExit() ) { | 122 | if (m_rec->normalExit() ) { |
125 | if ( m_rec->exitStatus() == 0 ) { // we got one | 123 | if ( m_rec->exitStatus() == 0 ) { // we got one |
126 | QString filename = parseOut(); | 124 | QString filename = parseOut(); |
127 | qWarning("ACHTUNG %s", filename.latin1() ); | 125 | qWarning("ACHTUNG %s", filename.latin1() ); |
128 | if (filename.contains( 'ö' ) || filename.contains( 'ä' ) || filename.contains('ü' ) ) { | ||
129 | qWarning("renaming!!!!"); | ||
130 | QFileInfo inf( filename ); | ||
131 | QString newName = "/tmp/opie-obex." + inf.extension(); | ||
132 | ::rename( QFile::encodeName( filename ).data(), newName ); | ||
133 | qWarning("name is %s", QFile::encodeName( filename ).data() ); | ||
134 | } | ||
135 | emit receivedFile( filename ); | 126 | emit receivedFile( filename ); |
136 | } | 127 | } |
137 | }else{ | 128 | }else{ |
138 | emit done(false); | 129 | emit done(false); |
139 | }; | 130 | }; |
140 | delete m_rec; | 131 | delete m_rec; |
141 | m_rec = 0; | 132 | m_rec = 0; |
142 | receive(); | 133 | receive(); |
143 | } | 134 | } |
144 | 135 | ||
145 | void Obex::sendEnd() { | 136 | void Obex::sendEnd() { |
146 | if (m_send->normalExit() ) { | 137 | if (m_send->normalExit() ) { |
147 | if ( m_send->exitStatus() == 0 ) { | 138 | if ( m_send->exitStatus() == 0 ) { |
148 | delete m_send; | 139 | delete m_send; |
149 | m_send=0; | 140 | m_send=0; |
150 | qWarning("done" ); | 141 | qWarning("done" ); |