From 68c01ad5f6e7dc12192c9ce77f0a2ee48b813831 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Tue, 23 Aug 2005 20:37:03 +0000 Subject: - fix SIGSEGV when trying to send but IrDA is not enabled - rename 'scan' button to 'rescan' - disable 'send' button if IrDA and BT is both disabled --- (limited to 'core/obex') 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 @@ -17,6 +17,7 @@ using namespace Opie::Core; /* QT */ #include +#include #include #include #include @@ -138,7 +139,8 @@ void SendWidget::slotIrTry(unsigned int trI) { setReceiverStatus(m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) )); } void SendWidget::slotStartIrda() { - if (m_irDaIt == m_irDa.end() ) { + if ( !m_irDa.count() ) return; + if ( m_irDaIt == m_irDa.end() ) { irdaStatus->setText(tr("complete.")); return; } @@ -183,31 +185,34 @@ void SendWidget::send_to_receivers() { slotStartBt(); } -void SendWidget::scan_for_receivers() { - - bool enable_irda=false; - bool enable_bt=false; - - if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) { - irdaStatus->setText(tr("not enabled.")); - enable_irda=true; - } else - irdaStatus->setText(tr("searching...")); +void SendWidget::scan_for_receivers() +{ + //FIXME: Clean ListBox prior to (re)scan + sendButton->setDisabled( true ); - if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) { - btStatus->setText(tr("not enabled.")); - enable_bt=true; - } else - btStatus->setText(tr("searching...")); + if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) + { + irdaStatus->setText(tr("not enabled.")); + } + else + { + QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); + irdaStatus->setText(tr("searching...")); + sendButton->setEnabled( true ); + QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); + } - if (enable_irda) - QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()"); - if (enable_bt) + if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) + { + btStatus->setText(tr("not enabled.")); + } + else + { QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); - - QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); - QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); - + btStatus->setText(tr("searching...")); + sendButton->setEnabled( true ); + QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); + } } void SendWidget::toggle_receiver(QListViewItem* item) diff --git a/core/obex/obexsendbase.ui b/core/obex/obexsendbase.ui index a192dd3..4619842 100644 --- a/core/obex/obexsendbase.ui +++ b/core/obex/obexsendbase.ui @@ -16,7 +16,7 @@ for selecting destination hosts. 0 0 - 363 + 359 221 @@ -297,7 +297,7 @@ for selecting destination hosts. text - Scan + &Rescan @@ -308,7 +308,7 @@ for selecting destination hosts. text - Send + &Send @@ -319,7 +319,7 @@ for selecting destination hosts. text - Done + &Close -- cgit v0.9.0.2