-rw-r--r-- | core/obex/obexsend.cpp | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp index bca6784..45754e3 100644 --- a/core/obex/obexsend.cpp +++ b/core/obex/obexsend.cpp @@ -75,2 +75,3 @@ void SendWidget::send( const QString& file, const QString& desc ) { m_irDa.clear(); + m_bt.clear(); m_start = 0; @@ -78,2 +79,23 @@ void SendWidget::send( const QString& file, const QString& desc ) { fileToSend->setText(desc.isEmpty() ? file : desc ); + + if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) + { + irdaStatus->setText(tr("not enabled.")); + } + else + { + QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); + irdaStatus->setText(tr("ready")); + sendButton->setEnabled( true ); + } + if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) + { + btStatus->setText(tr("not enabled.")); + } + else + { + QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); + btStatus->setText(tr("ready.")); + sendButton->setEnabled( true ); + } read_receivers(); @@ -87,4 +109,4 @@ int SendWidget::addReceiver(const QString& str, const char *icon) - int id=receivers.count(); - receivers[id]=item; + int id = receivers.count(); + receivers[id] = item; return id; @@ -156,2 +178,3 @@ void SendWidget::slotStartIrda() { irdaStatus->setText(tr("complete.")); + m_irDaIt = m_irDa.begin(); return; @@ -159,2 +182,3 @@ void SendWidget::slotStartIrda() { setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); + irdaStatus->setText(tr("sending.")); m_obex->send( m_file, tr("noaddress") ); @@ -184,2 +208,4 @@ void SendWidget::slotStartBt() { // skip past unselected receivers + if ( !m_bt.count() ) + return; while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) @@ -188,2 +214,3 @@ void SendWidget::slotStartBt() { btStatus->setText(tr("complete.")); + m_btIt = m_bt.begin(); return; @@ -191,2 +218,3 @@ void SendWidget::slotStartBt() { setReceiverStatus( m_btIt.key(), tr("Start sending") ); + btStatus->setText(tr("sending.")); m_btobex->send( m_file, m_btIt.data().second() ); @@ -195,4 +223,4 @@ void SendWidget::slotStartBt() { void SendWidget::send_to_receivers() { - slotStartIrda(); slotStartBt(); + slotStartIrda(); } @@ -211,21 +239,7 @@ void SendWidget::read_receivers() sendButton->setDisabled( true ); + btStatus->setText(tr("load.")); + m_bt.clear(); - if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) + if ( QCopChannel::isRegistered("QPE/Bluetooth") ) { - irdaStatus->setText(tr("not enabled.")); - } - else - { - QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); - irdaStatus->setText(tr("ready")); - sendButton->setEnabled( true ); - } - if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) - { - btStatus->setText(tr("not enabled.")); - } - else - { - QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); - devices = handler.load(); @@ -245,13 +259,10 @@ void SendWidget::scan_for_receivers() { + sendButton->setDisabled( true ); receiverList->clear(); receivers.clear(); - sendButton->setDisabled( true ); + m_irDa.clear(); + m_bt.clear(); - if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) - { - irdaStatus->setText(tr("not enabled.")); - } - else + if ( QCopChannel::isRegistered("QPE/IrDaApplet") ) { - QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); irdaStatus->setText(tr("searching...")); @@ -261,9 +272,4 @@ void SendWidget::scan_for_receivers() - if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) + if ( QCopChannel::isRegistered("QPE/Bluetooth") ) { - btStatus->setText(tr("not enabled.")); - } - else - { - QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); btStatus->setText(tr("searching...")); @@ -276,2 +282,4 @@ void SendWidget::toggle_receiver(QListViewItem* item) { + if (!item) + return; // toggle the state of an individual receiver. |