-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 @@ -8,24 +8,25 @@ #include "obexsend.h" using namespace OpieObex; /* OPIE */ #include <opie2/odebug.h> #include <qpe/qcopenvelope_qws.h> #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 */ SendWidget::SendWidget( QWidget* parent, const char* name ) : obexSendBase( parent, name ) { initUI(); } SendWidget::~SendWidget() { } @@ -129,25 +130,26 @@ void SendWidget::slotIrError( int ) { irdaStatus->setText(tr("error :(")); } void SendWidget::slotIrSent( bool b) { QString text = b ? tr("Sent") : tr("Failure"); setReceiverStatus( m_irDaIt.key(), text ); ++m_irDaIt; slotStartIrda(); } 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") ); m_obex->send( m_file ); } void SendWidget::dispatchBt( const QCString& str, const QByteArray& ar ) { if ( str == "devices(QStringMap)" ) { QDataStream stream( ar, IO_ReadOnly ); QMap<QString, QString> btmap; stream >> btmap; @@ -174,49 +176,52 @@ void SendWidget::slotStartBt() { btStatus->setText(tr("complete.")); return; } setReceiverStatus( m_btIt.key(), tr("Start sending") ); m_btobex->send( m_file, m_btIt.data().second() ); } 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) { // toggle the state of an individual receiver. if(item->pixmap(2)) item->setPixmap(2,QPixmap()); else item->setPixmap(2,Resource::loadPixmap("backup/check.png")); } 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 @@ -7,25 +7,25 @@ for selecting destination hosts.</comment> <include location="global">qlistview.h</include> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>obexSendBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>363</width> + <width>359</width> <height>221</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Send via OBEX</string> </property> <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> @@ -288,47 +288,47 @@ for selecting destination hosts.</comment> <height>20</height> </size> </property> </spacer> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>scanButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Scan</string> + <string>&Rescan</string> </property> </widget> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>sendButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Send</string> + <string>&Send</string> </property> </widget> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>doneButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Done</string> + <string>&Close</string> </property> </widget> </hbox> </widget> </vbox> </widget> <images> <image> <name>image0</name> <data format="XPM.GZ" length="356">789c5d8f410a02310c45f73d456876453a0aeec423282e05719156075d8c82332e44bcbb4d52eb4c435bf25ffe6f69e360bfdb806b4c3fd0708d102ff400777a76ddeb705cbf8d5d2c21ad74d899b11e226cefb733f721f5389762492c6391c8b26d7fd24f2a13a49a7844ac88f79499120d118eef1126a8a4248393141b789794e23f91a952212148afa64c823acaeb42ea5f8cc86765bebe81454c</data> </image> <image> |