summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp51
-rw-r--r--core/obex/obexsendbase.ui8
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
@@ -1,43 +1,44 @@
// 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one
// generated via QT2 Designer. The new form supports
// selection of target devices, as opposed to sending to
// all.
#include "obex.h"
#include "btobex.h"
#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() {
}
void SendWidget::initUI() {
m_obex = new Obex(this, "obex");
connect(m_obex, SIGNAL(error(int) ),
this, SLOT(slotIrError(int) ) );
connect(m_obex, SIGNAL(sent(bool) ),
this, SLOT(slotIrSent(bool) ) );
connect(m_obex, SIGNAL(currentTry(unsigned int) ),
this, SLOT(slotIrTry(unsigned int) ) );
QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) );
@@ -117,118 +118,122 @@ void SendWidget::slotSelectedDevice( int, int ) {
QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
}*/
}
void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
if ( str == "devices(QStringList)" ) {
QDataStream stream( ar, IO_ReadOnly );
QStringList list;
stream >> list;
slotIrDaDevices( list );
}
}
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;
slotBTDevices( btmap );
}
}
void SendWidget::slotBtError( int ) {
btStatus->setText(tr("error :("));
}
void SendWidget::slotBtSent( bool b) {
QString text = b ? tr("Sent") : tr("Failure");
setReceiverStatus( m_btIt.key(), text );
++m_btIt;
slotStartBt();
}
void SendWidget::slotBtTry(unsigned int trI) {
setReceiverStatus( m_btIt.key(), tr("Try %1").arg( QString::number( 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."));
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"));
}
void SendWidget::closeEvent( QCloseEvent* e) {
e->accept(); // make sure
QTimer::singleShot(0, this, SLOT(userDone() ) );
}
void SendWidget::userDone() {
QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()");
QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()");
emit done();
}
QString SendWidget::file()const {
return m_file;
}
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
@@ -1,43 +1,43 @@
<!DOCTYPE UI><UI>
<class>obexSendBase</class>
<comment>Manage send via OBEX over both IrDA and Bluetooth
The form provides status information, and method
for selecting destination hosts.</comment>
<author>Michael Haynie &lt;mbh@sdgsystems.com&gt;</author>
<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>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout1</cstring>
</property>
<hbox>
<property stdset="1">
@@ -276,71 +276,71 @@ for selecting destination hosts.</comment>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<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>&amp;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>&amp;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>&amp;Close</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<images>
<image>
<name>image0</name>
<data format="XPM.GZ" length="356">789c5d8f410a02310c45f73d456876453a0aeec423282e05719156075d8c82332e44bcbb4d52eb4c435bf25ffe6f69e360bfdb806b4c3fd0708d102ff400777a76ddeb705cbf8d5d2c21ad74d899b11e226cefb733f721f5389762492c6391c8b26d7fd24f2a13a49a7844ac88f79499120d118eef1126a8a4248393141b789794e23f91a952212148afa64c823acaeb42ea5f8cc86765bebe81454c</data>
</image>
<image>
<name>image1</name>
<data format="XPM.GZ" length="2334">789c9dd5596f1b390c00e0f7fc0a237c0b0a7634a363068b3ee4be9da467da451f6674c44ee238877316fdef2b93f4a02db258606de4e10365511425e5edcae0f4f870b0f276e96ed6cec67ee047eded6025dc4f26cf7f7f7ff7636959e981aa07aa708372f9cdd2f2c96ce007c3e9559c03eb0c28e83337ccc4aaa0c1b0df5b9337c4baf0e423b1291279280e258f3f14a7b2251fb095aa38dfb9d85681bc27f686f3dfb14be778fc7a6f8ae3963838ceefd95555b377c5b669c86be2baadc89be2b635e455b16fb9bedbdebc3e1087d6517edd9be71f89a38cbf59b8a3f5a313a74e9187bd693df899ad8b8eeb7f11971dcd8fa637ed277e12575d47e3dbde9c7f6b61cff9bf887547fd87c7853df76b476cbc254fc4d673bdd23f5d7bce2ffdd58de7f9c60b07aa0f1ec46da0f9d08a3bf1a9d8879ac66ff7e6fdec7af3f9b9ec4df5a2f453c740fd46399f3a45de5f392fa688541f4abf4d1979fe6bb2cafde2f9beb2b5eab8de477190fcf7e218b8de0b769e9ffb37162bc927f39b9c803c12dbc4e7b7ebcdbf6fc86536afffac379f874836793dfc7beeb731b5cc5792ad6964be6f64675a897fe8cd7145ee4c10f3f90e2689df93a32d12d7f334b72a4c8abcdf05db2a999fde0355da4ac6533f95b65aeaa1fb99cbad229d4facc8d6941ddd37dc17b781f79fee8f7256478ed37ba16a6bc4811c6c13b91fcfe4681a3ebf48ef4959d890d827e4d226f14772654de0f5d0efe7db2df51d93ad2b793c50fd65639d9cd7200e520f9d87b2758b7ae9fd283b67647fe87ee5d7ca257a6f90dea74abb90f87ed3f9ae8c8b89eba7fb5fb9ba48940fe97dae52ad793c4ce7d6b5b39ee3f45eeaa66e653c9d17edeb5af24d7b733d74be74748de738dd579df2ef293f5ccd6d8adaca7d496217f9beb0eba690f148f6d95c3fdd17131a23eba1f7c4c4def4dedaae0962ca97e8c3ffacfefdfb7b1c015bec5e8fa3c78011139ee108c77fc6f11c2ff01227788553ecf2f7fad738dee02ddee10cef73fc0a1f727c848f8b383ee133be506435ffade5bf75dcc04ddc92f836eee02eeed188f9771f0ff0308f1b4afc088ff104dfe3078a7ec44ff819bfe0297e95f8372c5061d9ffbe428d062d3ae4fd1a6193579423809c1f005ae8c0f7ebcf1541800889469dc128c7c770be88c3458e5fc204e6d1295cc30ddcc21dfcb23f700f0ff0084ff00c2fb00a6bb00e1bbfef2f6cc216aec136ecc02eecc1fe6bfd81033884211c61fd7afffeabbfff23fef3afa57f00b9561583</data>
</image>
</images>
<connections>
<connection>
<sender>scanButton</sender>
<signal>clicked()</signal>
<receiver>obexSendBase</receiver>
<slot>scan_for_receivers()</slot>
</connection>
<connection>