summaryrefslogtreecommitdiff
path: root/core/obex/obexsend.cpp
Side-by-side diff
Diffstat (limited to 'core/obex/obexsend.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/obex/obexsend.cpp41
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
@@ -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,24 +130,25 @@ 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_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;
@@ -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;
+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))
item->setPixmap(2,QPixmap());
else
item->setPixmap(2,Resource::loadPixmap("backup/check.png"));
}