summaryrefslogtreecommitdiff
authorzecke <zecke>2003-02-16 17:12:10 (UTC)
committer zecke <zecke>2003-02-16 17:12:10 (UTC)
commite9e20c4e64b8b228af928822e3d4a49ed773dc2e (patch) (side-by-side diff)
tree17cdd250d08093d4c1564b7e61015d764da7e590
parent7280d00082163307ecc09d8f4b98397dda460dd5 (diff)
downloadopie-e9e20c4e64b8b228af928822e3d4a49ed773dc2e.zip
opie-e9e20c4e64b8b228af928822e3d4a49ed773dc2e.tar.gz
opie-e9e20c4e64b8b228af928822e3d4a49ed773dc2e.tar.bz2
Debug output
disabled some features inside the QTextView.. fixed two typos and the order of filename + description it's sending now again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obex.cc5
-rw-r--r--core/obex/obexhandler.cpp2
-rw-r--r--core/obex/obexsend.cpp19
3 files changed, 15 insertions, 11 deletions
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 83d1faf..92cd317 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -1,14 +1,15 @@
#include <qapplication.h>
+#include <qfile.h>
#include <qmessagebox.h>
#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;
@@ -39,25 +40,25 @@ void Obex::receive() {
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");
+ qWarning("send %s", fileName.latin1() );
if (m_rec != 0 ) {
qWarning("running");
if (m_rec->isRunning() ) {
emit error(-1 );
qWarning("is running");
delete m_rec;
m_rec = 0;
}else{
qWarning("is not running");
emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
return;
@@ -66,25 +67,25 @@ void Obex::send( const QString& fileName) { // if currently receiving stop it se
sendNow();
}
void Obex::sendNow(){
qWarning("sendNow");
if ( m_count >= 25 ) { // could not send
emit error(-1 );
emit sent(false);
return;
}
// OProcess inititialisation
m_send = new OProcess();
*m_send << "irobex_palm3";
- *m_send << m_file;
+ *m_send << QFile::encodeName(m_file);
// connect to slots Exited and and StdOut
connect(m_send, SIGNAL(processExited(OProcess*) ),
this, SLOT(slotExited(OProcess*)) );
connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )),
this, SLOT(slotStdOut(OProcess*, char*, int) ) );
// now start it
if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
qWarning("could not send" );
m_count = 25;
emit error(-1 );
diff --git a/core/obex/obexhandler.cpp b/core/obex/obexhandler.cpp
index f71a233..16e1c2f 100644
--- a/core/obex/obexhandler.cpp
+++ b/core/obex/obexhandler.cpp
@@ -47,19 +47,19 @@ void ObexHandler::slotSent() {
e << file;
doReceive(m_wasRec );
m_wasRec = false;
}
void ObexHandler::irdaMessage( const QCString& msg, const QByteArray& data) {
QDataStream stream( data, IO_ReadOnly );
if ( msg == "send(QString,QString,QString)" ) {
QString name, desc;
stream >> name;
stream >> desc;
m_wasRec = (m_receiver != 0 );
doReceive( false );
- doSend(name, desc);
+ doSend(desc, name);
}else if (msg == "receive(int)") {
int rec;
stream >> rec;
doReceive(rec);
}
}
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index a2e4c16..d5ebd81 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -23,29 +23,29 @@ SendWidget::~SendWidget() {
}
void SendWidget::initUI() {
m_obex = new Obex(this, "obex");
connect(m_obex, SIGNAL(error(int) ),
this, SLOT(slotIrError(int) ) );
connect(m_obex, SIGNAL(sent(bool) ),
this, SLOT(slotIrSent(bool) ) );
connect(m_obex, SIGNAL(currentTry(unsigned int ) ),
this, SLOT(slotIrTry(unsigned int ) ) );
QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
- this, SLOT(dispatchBt(const QCString&, const QByteArray& ) ) );
+ this, SLOT(dispatchIrda(const QCString&, const QByteArray& ) ) );
chan = new QCopChannel("QPE/BluetoothBack", this );
connect(chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
- this, SLOT(dispatchIrda(const QCString&, const QByteArray& ) ) );
+ this, SLOT(dispatchBt(const QCString&, const QByteArray& ) ) );
QVBoxLayout* lay = new QVBoxLayout(this);
QHBox* nameBox = new QHBox(this);
QLabel* name = new QLabel(nameBox);
name->setText( tr("<qt><h1>Sending:</h1></qt>") );
name->setAlignment( AlignLeft | AlignTop );
m_lblFile = new QLabel(nameBox);
lay->addWidget(nameBox, 0);
QFrame* frame = new QFrame(this);
frame->setFrameShape( QFrame::HLine );
@@ -94,80 +94,83 @@ void SendWidget::send( const QString& file, const QString& desc ) {
if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) {
m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error );
m_start++;
}else
m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search );
if (m_start != 2 ) {
QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()");
QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
}
- QTimer::singleShot(5000, this, SLOT(testIt() ) );
}
void SendWidget::slotIrDaDevices( const QStringList& list) {
+ qWarning("slot it irda devices ");
m_irDa = list;
m_start = 0;
for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it )
m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") );
- m_devBox->removeDevice( tr("Search for IrDa Devices.") );
+
+ m_devBox->removeDevice( tr("Searching for IrDa Devices.") );
slotStartIrda();
}
void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) {
m_bt = str;
for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) {
m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") );
}
m_devBox->removeDevice( tr("Searching for bluetooth Devices.") );
}
void SendWidget::slotSelectedDevice( const QString& name, int dev ) {
qWarning("Start beam? %s %d", name.latin1(), dev );
if ( name == tr("Search again for IrDa.") ) {
for (QStringList::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it )
m_devBox->removeDevice( (*it) );
+
QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
}
}
void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
qWarning("dispatch irda %s", str.data() );
- if ( str == "listDevices(QStringList)" ) {
+ if ( str == "devices(QStringList)" ) {
QDataStream stream( ar, IO_ReadOnly );
QStringList list;
stream >> list;
slotIrDaDevices( list );
}
}
void SendWidget::dispatchBt( const QCString& str, const QByteArray& ar ) {
}
void SendWidget::slotIrError( int ) {
}
void SendWidget::slotIrSent( bool b) {
+ qWarning("irda sent!!");
QString text = b ? tr("Sent") : tr("Failure");
- m_devBox->setStatus( m_irDa[m_start], text );
+// m_devBox->setStatus( m_irDa[m_start], text );
m_start++;
slotStartIrda();
}
void SendWidget::slotIrTry(unsigned int trI) {
- m_devBox->setStatus( m_irDa[m_start], tr("Try %1").arg( QString::number( trI ) ) );
+// m_devBox->setStatus( m_irDa[m_start], tr("Try %1").arg( QString::number( trI ) ) );
}
void SendWidget::slotStartIrda() {
if (m_start >= m_irDa.count() ) {
m_devBox->addDevice(tr("Search again for IrDa."), DeviceBox::Search );
return;
}
- m_devBox->setStatus( m_irDa[m_start], tr("Start sending") );
+// m_devBox->setStatus( m_irDa[m_start], tr("Start sending") );
m_obex->send( m_file );
}
void SendWidget::slotDone() {
QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()");
QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()");
emit done();
}
QString SendWidget::file()const {
return m_file;
}
DeviceBox::DeviceBox( QWidget* parent )
: QTextBrowser( parent ) {