-rw-r--r-- | core/applets/obex/obex.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/applets/obex/obex.cc b/core/applets/obex/obex.cc index 2218dbc..fc0be3b 100644 --- a/core/applets/obex/obex.cc +++ b/core/applets/obex/obex.cc | |||
@@ -16,24 +16,25 @@ Obex::Obex( QObject *parent, const char* name ) | |||
16 | m_receive = false; | 16 | m_receive = false; |
17 | connect( this, SIGNAL(error(int) ), // for recovering to receive | 17 | connect( this, SIGNAL(error(int) ), // for recovering to receive |
18 | SLOT(slotError() ) ); | 18 | SLOT(slotError() ) ); |
19 | connect( this, SIGNAL(sent() ), | 19 | connect( this, SIGNAL(sent() ), |
20 | SLOT(slotError() ) ); | 20 | SLOT(slotError() ) ); |
21 | }; | 21 | }; |
22 | Obex::~Obex() { | 22 | Obex::~Obex() { |
23 | delete m_rec; | 23 | delete m_rec; |
24 | delete m_send; | 24 | delete m_send; |
25 | } | 25 | } |
26 | void Obex::receive() { | 26 | void Obex::receive() { |
27 | m_receive = true; | 27 | m_receive = true; |
28 | m_outp = QString::null; | ||
28 | qWarning("Receive" ); | 29 | qWarning("Receive" ); |
29 | m_rec = new OProcess(); | 30 | m_rec = new OProcess(); |
30 | *m_rec << "irobex_palm3"; | 31 | *m_rec << "irobex_palm3"; |
31 | // connect to the necessary slots | 32 | // connect to the necessary slots |
32 | connect(m_rec, SIGNAL(processExited(OProcess*) ), | 33 | connect(m_rec, SIGNAL(processExited(OProcess*) ), |
33 | this, SLOT(slotExited(OProcess*) ) ); | 34 | this, SLOT(slotExited(OProcess*) ) ); |
34 | 35 | ||
35 | connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 36 | connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ), |
36 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | 37 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); |
37 | 38 | ||
38 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 39 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
39 | qWarning("could not start :("); | 40 | qWarning("could not start :("); |
@@ -139,27 +140,35 @@ void Obex::sendEnd() { | |||
139 | }else { | 140 | }else { |
140 | emit error( -1 ); | 141 | emit error( -1 ); |
141 | delete m_send; | 142 | delete m_send; |
142 | m_send = 0; | 143 | m_send = 0; |
143 | } | 144 | } |
144 | } | 145 | } |
145 | QString Obex::parseOut( ){ | 146 | QString Obex::parseOut( ){ |
146 | QString path; | 147 | QString path; |
147 | QStringList list = QStringList::split("\n", m_outp); | 148 | QStringList list = QStringList::split("\n", m_outp); |
148 | QStringList::Iterator it; | 149 | QStringList::Iterator it; |
149 | for (it = list.begin(); it != list.end(); ++it ) { | 150 | for (it = list.begin(); it != list.end(); ++it ) { |
150 | if ( (*it).startsWith("Wrote" ) ) { | 151 | if ( (*it).startsWith("Wrote" ) ) { |
151 | QStringList pathes = QStringList::split(' ', (*it) ); | 152 | int pos = (*it).findRev('(' ); |
152 | path = pathes[1]; | 153 | if ( pos > 0 ) { |
153 | qWarning("path %s", path.latin1() ); | 154 | qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ; |
155 | qWarning("%d %d", (*it).length(), (*it).length()-pos ); | ||
156 | |||
157 | path = (*it).remove( pos, (*it).length() - pos ); | ||
158 | qWarning("%s", path.latin1() ); | ||
159 | path = path.mid(6 ); | ||
160 | path = path.stripWhiteSpace(); | ||
161 | qWarning("path %s", path.latin1() ); | ||
162 | } | ||
154 | } | 163 | } |
155 | } | 164 | } |
156 | return path; | 165 | return path; |
157 | } | 166 | } |
158 | /** | 167 | /** |
159 | * when sent is done slotError is called we will start receive again | 168 | * when sent is done slotError is called we will start receive again |
160 | */ | 169 | */ |
161 | void Obex::slotError() { | 170 | void Obex::slotError() { |
162 | qWarning("slotError"); | 171 | qWarning("slotError"); |
163 | if ( m_receive ) | 172 | if ( m_receive ) |
164 | receive(); | 173 | receive(); |
165 | }; | 174 | }; |