summaryrefslogtreecommitdiff
path: root/core/obex/obex.cc
Unidiff
Diffstat (limited to 'core/obex/obex.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obex.cc15
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
@@ -2,24 +2,26 @@
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
12using namespace OpieObex; 12using namespace OpieObex;
13 13
14/* TRANSLATOR OpieObex::Obex */
15
14Obex::Obex( QObject *parent, const char* name ) 16Obex::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};
@@ -100,47 +102,36 @@ void Obex::sendNow(){
100 emit currentTry( m_count ); 102 emit currentTry( m_count );
101} 103}
102 104
103void Obex::slotExited(OProcess* proc ){ 105void 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}
110void Obex::slotStdOut(OProcess* proc, char* buf, int len){ 112void 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
123void Obex::received() { 121void 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
145void Obex::sendEnd() { 136void Obex::sendEnd() {
146 if (m_send->normalExit() ) { 137 if (m_send->normalExit() ) {