author | mickeyl <mickeyl> | 2005-08-23 20:37:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-08-23 20:37:03 (UTC) |
commit | 68c01ad5f6e7dc12192c9ce77f0a2ee48b813831 (patch) (side-by-side diff) | |
tree | 054dd974156c8e49400979eb9b226bb7bd32fd31 | |
parent | 95210ac41729a4c264e830963cdae3a4cdd218fb (diff) | |
download | opie-68c01ad5f6e7dc12192c9ce77f0a2ee48b813831.zip opie-68c01ad5f6e7dc12192c9ce77f0a2ee48b813831.tar.gz opie-68c01ad5f6e7dc12192c9ce77f0a2ee48b813831.tar.bz2 |
- 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
-rw-r--r-- | core/obex/obexsend.cpp | 51 | ||||
-rw-r--r-- | core/obex/obexsendbase.ui | 8 |
2 files changed, 32 insertions, 27 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 @@ -16,8 +16,9 @@ using namespace OpieObex; using namespace Opie::Core; /* QT */ #include <qlabel.h> +#include <qpushbutton.h> #include <qpixmap.h> #include <qlistview.h> #include <qtimer.h> @@ -137,9 +138,10 @@ void SendWidget::slotIrSent( bool b) { 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; } setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); @@ -182,33 +184,36 @@ void SendWidget::send_to_receivers() { slotStartIrda(); 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 @@ -15,9 +15,9 @@ for selecting destination hosts.</comment> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>363</width> + <width>359</width> <height>221</height> </rect> </property> <property stdset="1"> @@ -296,9 +296,9 @@ for selecting destination hosts.</comment> <cstring>scanButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Scan</string> + <string>&Rescan</string> </property> </widget> <widget> <class>QPushButton</class> @@ -307,9 +307,9 @@ for selecting destination hosts.</comment> <cstring>sendButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Send</string> + <string>&Send</string> </property> </widget> <widget> <class>QPushButton</class> @@ -318,9 +318,9 @@ for selecting destination hosts.</comment> <cstring>doneButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Done</string> + <string>&Close</string> </property> </widget> </hbox> </widget> |