summaryrefslogtreecommitdiff
path: root/core/applets/obex/obex.cc
authorzecke <zecke>2002-06-13 22:19:26 (UTC)
committer zecke <zecke>2002-06-13 22:19:26 (UTC)
commit2002b1a7a8e4122a2e2a02049c2ad584fb511eb9 (patch) (side-by-side diff)
treeeae66dc19f9b79e92a0bbfe7f1684a9cfcd00336 /core/applets/obex/obex.cc
parent8764c71b50fab1e4dcbc61f23dbd4fd3969e4090 (diff)
downloadopie-2002b1a7a8e4122a2e2a02049c2ad584fb511eb9.zip
opie-2002b1a7a8e4122a2e2a02049c2ad584fb511eb9.tar.gz
opie-2002b1a7a8e4122a2e2a02049c2ad584fb511eb9.tar.bz2
Fix PPC beaming
Diffstat (limited to 'core/applets/obex/obex.cc') (more/less context) (show whitespace changes)
-rw-r--r--core/applets/obex/obex.cc13
1 files changed, 11 insertions, 2 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
@@ -4,48 +4,49 @@
#include <qpe/qcopenvelope_qws.h>
#include <opie/oprocess.h>
#include "obex.h"
using namespace OpieObex;
Obex::Obex( QObject *parent, const char* name )
: QObject(parent, name )
{
m_rec = 0;
m_send=0;
m_count = 0;
m_receive = false;
connect( this, SIGNAL(error(int) ), // for recovering to receive
SLOT(slotError() ) );
connect( this, SIGNAL(sent() ),
SLOT(slotError() ) );
};
Obex::~Obex() {
delete m_rec;
delete m_send;
}
void Obex::receive() {
m_receive = true;
+ m_outp = QString::null;
qWarning("Receive" );
m_rec = new OProcess();
*m_rec << "irobex_palm3";
// connect to the necessary slots
connect(m_rec, SIGNAL(processExited(OProcess*) ),
this, SLOT(slotExited(OProcess*) ) );
connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
this, SLOT(slotStdOut(OProcess*, char*, int) ) );
if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
qWarning("could not start :(");
emit done( false );
delete m_rec;
m_rec = 0;
}
// emit currentTry(m_count );
}
void Obex::send( const QString& fileName) { // if currently receiving stop it send receive
m_count = 0;
m_file = fileName;
qWarning("send");
if (m_rec != 0 ) {
@@ -127,53 +128,61 @@ void Obex::sendEnd() {
if ( m_send->exitStatus() == 0 ) {
delete m_send;
m_send=0;
qWarning("done" );
emit sent();
}else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready
// let's try it again
delete m_send;
m_send = 0;
qWarning("try sending again" );
sendNow();
}
}else {
emit error( -1 );
delete m_send;
m_send = 0;
}
}
QString Obex::parseOut( ){
QString path;
QStringList list = QStringList::split("\n", m_outp);
QStringList::Iterator it;
for (it = list.begin(); it != list.end(); ++it ) {
if ( (*it).startsWith("Wrote" ) ) {
- QStringList pathes = QStringList::split(' ', (*it) );
- path = pathes[1];
+ int pos = (*it).findRev('(' );
+ if ( pos > 0 ) {
+ qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ;
+ qWarning("%d %d", (*it).length(), (*it).length()-pos );
+
+ path = (*it).remove( pos, (*it).length() - pos );
+ qWarning("%s", path.latin1() );
+ path = path.mid(6 );
+ path = path.stripWhiteSpace();
qWarning("path %s", path.latin1() );
}
}
+ }
return path;
}
/**
* when sent is done slotError is called we will start receive again
*/
void Obex::slotError() {
qWarning("slotError");
if ( m_receive )
receive();
};
void Obex::setReceiveEnabled( bool receive ) {
if ( !receive ) { //
m_receive = false;
shutDownReceive();
}
}
void Obex::shutDownReceive() {
if (m_rec != 0 ) {
qWarning("running");
if (m_rec->isRunning() ) {
emit error(-1 );
qWarning("is running");
delete m_rec;