-rw-r--r-- | core/obex/obexsend.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp index a80a48b..9cd9972 100644 --- a/core/obex/obexsend.cpp +++ b/core/obex/obexsend.cpp @@ -14,12 +14,13 @@ using namespace OpieObex; #include <qpe/resource.h> using namespace Opie::Core; /* QT */ #include <qlabel.h> +#include <qpushbutton.h> #include <qpixmap.h> #include <qlistview.h> #include <qtimer.h> /* TRANSLATOR OpieObex::SendWidget */ @@ -135,12 +136,13 @@ void SendWidget::slotIrSent( bool b) { slotStartIrda(); } void SendWidget::slotIrTry(unsigned int trI) { setReceiverStatus(m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) )); } void SendWidget::slotStartIrda() { + if ( !m_irDa.count() ) return; if (m_irDaIt == m_irDa.end() ) { irdaStatus->setText(tr("complete.")); return; } setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); m_obex->send( m_file ); @@ -180,37 +182,40 @@ void SendWidget::slotStartBt() { void SendWidget::send_to_receivers() { slotStartIrda(); slotStartBt(); } -void SendWidget::scan_for_receivers() { - - bool enable_irda=false; - bool enable_bt=false; +void SendWidget::scan_for_receivers() +{ + //FIXME: Clean ListBox prior to (re)scan + sendButton->setDisabled( true ); - if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) { + if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) + { irdaStatus->setText(tr("not enabled.")); - enable_irda=true; - } else + } + else + { + QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); irdaStatus->setText(tr("searching...")); + sendButton->setEnabled( true ); + QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); + } - if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) { + if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) + { btStatus->setText(tr("not enabled.")); - enable_bt=true; - } else - btStatus->setText(tr("searching...")); - - if (enable_irda) - QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()"); - if (enable_bt) + } + else + { QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); - - QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); + btStatus->setText(tr("searching...")); + sendButton->setEnabled( true ); QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); - + } } void SendWidget::toggle_receiver(QListViewItem* item) { // toggle the state of an individual receiver. if(item->pixmap(2)) |