summaryrefslogtreecommitdiff
authorzecke <zecke>2002-06-12 17:08:42 (UTC)
committer zecke <zecke>2002-06-12 17:08:42 (UTC)
commitd57ced2b9c8f3ac79bae54bef7d5026d24e2bb98 (patch) (unidiff)
tree2db69c92fb707834b798f815f812cbf30b9f09b1
parentac707e366de561cabc8074b62025d143200869d7 (diff)
downloadopie-d57ced2b9c8f3ac79bae54bef7d5026d24e2bb98.zip
opie-d57ced2b9c8f3ac79bae54bef7d5026d24e2bb98.tar.gz
opie-d57ced2b9c8f3ac79bae54bef7d5026d24e2bb98.tar.bz2
Send Receive working now it's time for a gui
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/obex/obex.cc11
-rw-r--r--core/applets/obex/obeximpl.cc3
2 files changed, 11 insertions, 3 deletions
diff --git a/core/applets/obex/obex.cc b/core/applets/obex/obex.cc
index 582ebbc..f35d57a 100644
--- a/core/applets/obex/obex.cc
+++ b/core/applets/obex/obex.cc
@@ -1,4 +1,5 @@
1 1
2#include <qapplication.h>
2 3
3#include <opie/oprocess.h> 4#include <opie/oprocess.h>
4#include "obex.h" 5#include "obex.h"
@@ -17,6 +18,7 @@ Obex::~Obex() {
17 delete m_send; 18 delete m_send;
18} 19}
19void Obex::receive() { 20void Obex::receive() {
21 qWarning("Receive" );
20 m_rec = new OProcess(); 22 m_rec = new OProcess();
21 *m_rec << "irobex_palm3"; 23 *m_rec << "irobex_palm3";
22 // connect to the necessary slots 24 // connect to the necessary slots
@@ -39,8 +41,9 @@ void Obex::send( const QString& fileName) {
39 sendNow(); 41 sendNow();
40} 42}
41void Obex::sendNow(){ 43void Obex::sendNow(){
42 if ( m_count >= 15 ) { // could not send 44 if ( m_count >= 25 ) { // could not send
43 emit error(-1 ); 45 emit error(-1 );
46 return;
44 } 47 }
45 // OProcess inititialisation 48 // OProcess inititialisation
46 m_send = new OProcess(); 49 m_send = new OProcess();
@@ -54,7 +57,8 @@ void Obex::sendNow(){
54 this, SLOT(slotStdOut(OProcess*, char*, int) ) ); 57 this, SLOT(slotStdOut(OProcess*, char*, int) ) );
55 // now start it 58 // now start it
56 if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { 59 if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
57 m_count = 15; 60 qWarning("could not send" );
61 m_count = 25;
58 emit error(-1 ); 62 emit error(-1 );
59 } 63 }
60 // end 64 // end
@@ -92,11 +96,13 @@ void Obex::sendEnd() {
92 if ( m_send->exitStatus() == 0 ) { 96 if ( m_send->exitStatus() == 0 ) {
93 delete m_send; 97 delete m_send;
94 m_send=0; 98 m_send=0;
99 qWarning("done" );
95 emit sent(); 100 emit sent();
96 }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready 101 }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready
97 // let's try it again 102 // let's try it again
98 delete m_send; 103 delete m_send;
99 m_send = 0; 104 m_send = 0;
105 qWarning("try sending again" );
100 sendNow(); 106 sendNow();
101 } 107 }
102 }else { 108 }else {
@@ -113,6 +119,7 @@ QString Obex::parseOut( ){
113 if ( (*it).startsWith("Wrote" ) ) { 119 if ( (*it).startsWith("Wrote" ) ) {
114 QStringList pathes = QStringList::split(' ', (*it) ); 120 QStringList pathes = QStringList::split(' ', (*it) );
115 path = pathes[1]; 121 path = pathes[1];
122 qWarning("path %s", path.latin1() );
116 } 123 }
117 } 124 }
118 return path; 125 return path;
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc
index fa2a30a..82ff1a1 100644
--- a/core/applets/obex/obeximpl.cc
+++ b/core/applets/obex/obeximpl.cc
@@ -46,7 +46,8 @@ void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) {
46 m_obex->send(filename ); 46 m_obex->send(filename );
47 QCopEnvelope e ("QPE/Obex", "done(QString)" ); 47 QCopEnvelope e ("QPE/Obex", "done(QString)" );
48 e << filename; 48 e << filename;
49 }else if(msg == "receive(bool)" ) { 49 }else if(msg == "receive(bool)" ) { // open a GUI
50 m_obex->receive();
50 ; 51 ;
51 } 52 }
52} 53}