summaryrefslogtreecommitdiff
path: root/core/obex
authorar <ar>2004-05-02 21:32:48 (UTC)
committer ar <ar>2004-05-02 21:32:48 (UTC)
commit0a4cac124105a5732e55cb34c6b37be75083a395 (patch) (side-by-side diff)
tree33b4d2cab08c9b58893540b4ddee089b69fc9c61 /core/obex
parent109ed5f2a1cdfeb3680c9ec057a1083fcf8fab95 (diff)
downloadopie-0a4cac124105a5732e55cb34c6b37be75083a395.zip
opie-0a4cac124105a5732e55cb34c6b37be75083a395.tar.gz
opie-0a4cac124105a5732e55cb34c6b37be75083a395.tar.bz2
- convert qWarning to owarn
Diffstat (limited to 'core/obex') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obex.cc47
1 files changed, 26 insertions, 21 deletions
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 3c99af6..7c40b90 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -1,12 +1,17 @@
+#include "obex.h"
+
+/* OPIE */
+#include <opie2/oprocess.h>
+#include <opie2/odebug.h>
+
+/* QT */
#include <qfileinfo.h>
-#include <opie2/oprocess.h>
-#include "obex.h"
using namespace OpieObex;
using namespace Opie::Core;
/* TRANSLATOR OpieObex::Obex */
@@ -26,53 +31,53 @@ Obex::~Obex() {
delete m_rec;
delete m_send;
}
void Obex::receive() {
m_receive = true;
m_outp = QString::null;
- qWarning("Receive" );
+ owarn << "Receive" << oendl;
m_rec = new OProcess();
*m_rec << "irobex_palm3";
// connect to the necessary slots
connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ),
this, SLOT(slotExited(Opie::Core::OProcess*) ) );
connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- qWarning("could not start :(");
+ owarn << "could not start :(" oendl;
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 %s", fileName.latin1() );
+ owarn << "send " << fileName.latin1() << oendl;
if (m_rec != 0 ) {
- qWarning("running");
+ owarn << "running" oendl;
if (m_rec->isRunning() ) {
emit error(-1 );
- qWarning("is running");
+ owarn << "is running" << oendl;
delete m_rec;
m_rec = 0;
}else{
- qWarning("is not running");
+ owarn << "is not running" << oendl;
emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
return;
}
}
sendNow();
}
void Obex::sendNow(){
- qWarning("sendNow");
+ owarn << "sendNow" << oendl;
if ( m_count >= 25 ) { // could not send
emit error(-1 );
emit sent(false);
return;
}
// OProcess inititialisation
@@ -85,13 +90,13 @@ void Obex::sendNow(){
this, SLOT(slotExited(Opie::Core::OProcess*)) );
connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )),
this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
// now start it
if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
- qWarning("could not send" );
+ owarn << "could not send" << oendl;
m_count = 25;
emit error(-1 );
delete m_send;
m_send=0;
}
// end
@@ -107,22 +112,22 @@ void Obex::slotExited(OProcess* proc ){
}
}
void Obex::slotStdOut(OProcess* proc, char* buf, int len){
if ( proc == m_rec ) { // only receive
QByteArray ar( len );
memcpy( ar.data(), buf, len );
- qWarning("parsed: %s", ar.data() );
+ owarn << "parsed: " << ar.data() << oendl;
m_outp.append( ar );
}
}
void Obex::received() {
if (m_rec->normalExit() ) {
if ( m_rec->exitStatus() == 0 ) { // we got one
QString filename = parseOut();
- qWarning("ACHTUNG %s", filename.latin1() );
+ owarn << "ACHTUNG " << filename.latin1() << oendl;
emit receivedFile( filename );
}
}else{
emit done(false);
};
delete m_rec;
@@ -132,19 +137,19 @@ void Obex::received() {
void Obex::sendEnd() {
if (m_send->normalExit() ) {
if ( m_send->exitStatus() == 0 ) {
delete m_send;
m_send=0;
- qWarning("done" );
+ owarn << "done" << oendl;
emit sent(true);
}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" );
+ owarn << "try sending again" << oendl;
sendNow();
}
}else {
emit error( -1 );
delete m_send;
m_send = 0;
@@ -155,46 +160,46 @@ QString Obex::parseOut( ){
QStringList list = QStringList::split("\n", m_outp);
QStringList::Iterator it;
for (it = list.begin(); it != list.end(); ++it ) {
if ( (*it).startsWith("Wrote" ) ) {
int pos = (*it).findRev('(' );
if ( pos > 0 ) {
- qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ;
- qWarning("%d %d", (*it).length(), (*it).length()-pos );
+ owarn << pos << " " << (*it).mid(6 ).latin1() << oendl;
+ owarn << (*it).length() << " " << (*it).length()-pos << oendl;
path = (*it).remove( pos, (*it).length() - pos );
- qWarning("%s", path.latin1() );
+ owarn << path.latin1() << oendl;
path = path.mid(6 );
path = path.stripWhiteSpace();
- qWarning("path %s", path.latin1() );
+ owarn << "path " << path.latin1() << oendl;
}
}
}
return path;
}
/**
* when sent is done slotError is called we will start receive again
*/
void Obex::slotError() {
- qWarning("slotError");
+ owarn << "slotError" << oendl;
if ( m_receive )
receive();
};
void Obex::setReceiveEnabled( bool receive ) {
if ( !receive ) { //
m_receive = false;
shutDownReceive();
}
}
void Obex::shutDownReceive() {
if (m_rec != 0 ) {
- qWarning("running");
+ owarn << "running" << oendl;
if (m_rec->isRunning() ) {
emit error(-1 );
- qWarning("is running");
+ owarn << "is running" << oendl;
delete m_rec;
m_rec = 0;
}
}
}