summaryrefslogtreecommitdiff
path: root/core/obex/obexsend.cpp
Side-by-side diff
Diffstat (limited to 'core/obex/obexsend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 9cd9972..dbbb7b3 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -17,14 +17,14 @@ using namespace Opie::Core;
/* QT */
#include <qlabel.h>
#include <qpushbutton.h>
#include <qpixmap.h>
#include <qlistview.h>
-#include <qtimer.h>
+#include <unistd.h>
/* TRANSLATOR OpieObex::SendWidget */
SendWidget::SendWidget( QWidget* parent, const char* name )
: obexSendBase( parent, name ) {
initUI();
}
@@ -80,13 +80,13 @@ int SendWidget::addReceiver(const char *r, const char *icon)
receivers[id]=item;
return id;
}
bool SendWidget::receiverSelected(int id)
{
- return receivers[id]->pixmap(2);
+ return (bool)(receivers[id]->pixmap(2) != NULL);
}
void SendWidget::setReceiverStatus( int id, const QString& status ) {
if ( !receivers.contains(id) ) return;
receivers[id]->setText(3, status );
}
@@ -138,13 +138,13 @@ 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_irDa.count() ) return;
if ( m_irDaIt == m_irDa.end() ) {
- irdaStatus->setText(tr("complete."));
+ irdaStatus->setText(tr("complete."));
return;
}
setReceiverStatus( m_irDaIt.key(), tr("Start sending") );
m_obex->send( m_file );
}
@@ -170,13 +170,13 @@ void SendWidget::slotBtTry(unsigned int trI) {
}
void SendWidget::slotStartBt() {
// skip past unselected receivers
while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key()))
++m_btIt;
if (m_btIt == m_bt.end() ) {
- btStatus->setText(tr("complete."));
+ btStatus->setText(tr("complete."));
return;
}
setReceiverStatus( m_btIt.key(), tr("Start sending") );
m_btobex->send( m_file, m_btIt.data().second() );
}
@@ -184,13 +184,14 @@ void SendWidget::send_to_receivers() {
slotStartIrda();
slotStartBt();
}
void SendWidget::scan_for_receivers()
{
- //FIXME: Clean ListBox prior to (re)scan
+ receiverList->clear();
+ receivers.clear();
sendButton->setDisabled( true );
if ( !QCopChannel::isRegistered("QPE/IrDaApplet") )
{
irdaStatus->setText(tr("not enabled."));
}
@@ -216,24 +217,25 @@ void SendWidget::scan_for_receivers()
}
void SendWidget::toggle_receiver(QListViewItem* item)
{
// toggle the state of an individual receiver.
if(item->pixmap(2))
- item->setPixmap(2,QPixmap());
+ item->setPixmap(2,QPixmap());
else
- item->setPixmap(2,Resource::loadPixmap("backup/check.png"));
+ item->setPixmap(2,Resource::loadPixmap("backup/check.png"));
}
void SendWidget::closeEvent( QCloseEvent* e) {
- e->accept(); // make sure
- QTimer::singleShot(0, this, SLOT(userDone() ) );
-}
-void SendWidget::userDone() {
+ obexSendBase::closeEvent(e);
QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()");
QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()");
- emit done();
}
+
+void SendWidget::userDone() {
+ close();
+}
+
QString SendWidget::file()const {
return m_file;
}