summaryrefslogtreecommitdiff
path: root/core/obex/obexsend.cpp
Unidiff
Diffstat (limited to 'core/obex/obexsend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 9a30a0a..2512de3 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -1,38 +1,38 @@
1// 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one 1// 7-Jul-2005 mbh@sdgsystems.com: replace hand coded form with one
2// generated via QT2 Designer. The new form supports 2// generated via QT2 Designer. The new form supports
3// selection of target devices, as opposed to sending to 3// selection of target devices, as opposed to sending to
4// all. 4// all.
5 5
6#include "obex.h" 6#include "obex.h"
7#include "btobex.h" 7#include "btobex.h"
8#include "obexsend.h" 8#include "obexsend.h"
9using namespace OpieObex; 9using namespace OpieObex;
10 10
11/* OPIE */ 11/* OPIE */
12#include <opie2/odebug.h> 12#include <opie2/odebug.h>
13#include <qpe/qcopenvelope_qws.h> 13#include <qpe/qcopenvelope_qws.h>
14#include <qpe/resource.h> 14#include <opie2/oresource.h>
15 15
16using namespace Opie::Core; 16using namespace Opie::Core;
17 17
18/* QT */ 18/* QT */
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qpushbutton.h> 20#include <qpushbutton.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include <qlistview.h> 22#include <qlistview.h>
23 23
24#include <unistd.h> 24#include <unistd.h>
25/* TRANSLATOR OpieObex::SendWidget */ 25/* TRANSLATOR OpieObex::SendWidget */
26 26
27SendWidget::SendWidget( QWidget* parent, const char* name ) 27SendWidget::SendWidget( QWidget* parent, const char* name )
28 : obexSendBase( parent, name ) { 28 : obexSendBase( parent, name ) {
29 initUI(); 29 initUI();
30} 30}
31SendWidget::~SendWidget() { 31SendWidget::~SendWidget() {
32} 32}
33void SendWidget::initUI() { 33void SendWidget::initUI() {
34 m_obex = new Obex(this, "obex"); 34 m_obex = new Obex(this, "obex");
35 connect(m_obex, SIGNAL(error(int) ), 35 connect(m_obex, SIGNAL(error(int) ),
36 this, SLOT(slotIrError(int) ) ); 36 this, SLOT(slotIrError(int) ) );
37 connect(m_obex, SIGNAL(sent(bool) ), 37 connect(m_obex, SIGNAL(sent(bool) ),
38 this, SLOT(slotIrSent(bool) ) ); 38 this, SLOT(slotIrSent(bool) ) );
@@ -53,49 +53,49 @@ void SendWidget::initUI() {
53 53
54 chan = new QCopChannel("QPE/BluetoothBack", this ); 54 chan = new QCopChannel("QPE/BluetoothBack", this );
55 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 55 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
56 this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) ); 56 this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) );
57 57
58} 58}
59 59
60/* 60/*
61 * in send we'll first set everything up 61 * in send we'll first set everything up
62 * and then wait for a list of devices. 62 * and then wait for a list of devices.
63 */ 63 */
64void SendWidget::send( const QString& file, const QString& desc ) { 64void SendWidget::send( const QString& file, const QString& desc ) {
65 m_file = file; 65 m_file = file;
66 m_irDa.clear(); 66 m_irDa.clear();
67 m_start = 0; 67 m_start = 0;
68 68
69 fileToSend->setText(desc.isEmpty() ? file : desc ); 69 fileToSend->setText(desc.isEmpty() ? file : desc );
70 scan_for_receivers(); 70 scan_for_receivers();
71} 71}
72 72
73int SendWidget::addReceiver(const char *r, const char *icon) 73int SendWidget::addReceiver(const char *r, const char *icon)
74{ 74{
75 QListViewItem * item = new QListViewItem( receiverList, 0 ); 75 QListViewItem * item = new QListViewItem( receiverList, 0 );
76 item->setText( 0, r); 76 item->setText( 0, r);
77 item->setPixmap( 1, Resource::loadPixmap( icon ) ); 77 item->setPixmap( 1, OResource::loadPixmap( icon ) );
78 78
79 int id=receivers.count(); 79 int id=receivers.count();
80 receivers[id]=item; 80 receivers[id]=item;
81 return id; 81 return id;
82} 82}
83 83
84bool SendWidget::receiverSelected(int id) 84bool SendWidget::receiverSelected(int id)
85{ 85{
86 return (bool)(receivers[id]->pixmap(2) != NULL); 86 return (bool)(receivers[id]->pixmap(2) != NULL);
87} 87}
88 88
89void SendWidget::setReceiverStatus( int id, const QString& status ) { 89void SendWidget::setReceiverStatus( int id, const QString& status ) {
90 if ( !receivers.contains(id) ) return; 90 if ( !receivers.contains(id) ) return;
91 receivers[id]->setText(3, status ); 91 receivers[id]->setText(3, status );
92} 92}
93 93
94void SendWidget::slotIrDaDevices( const QStringList& list) { 94void SendWidget::slotIrDaDevices( const QStringList& list) {
95 for (QStringList::ConstIterator it = list.begin(); 95 for (QStringList::ConstIterator it = list.begin();
96 it != list.end(); ++it ) { 96 it != list.end(); ++it ) {
97 int id = addReceiver(*it, "obex/irda.png"); 97 int id = addReceiver(*it, "obex/irda.png");
98 m_irDa.insert( id, (*it) ); 98 m_irDa.insert( id, (*it) );
99 } 99 }
100 irdaStatus->setText( tr("ready.")); 100 irdaStatus->setText( tr("ready."));
101 m_irDaIt = m_irDa.begin(); 101 m_irDaIt = m_irDa.begin();
@@ -201,52 +201,52 @@ void SendWidget::scan_for_receivers()
201 else 201 else
202 { 202 {
203 QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); 203 QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()");
204 irdaStatus->setText(tr("searching...")); 204 irdaStatus->setText(tr("searching..."));
205 sendButton->setEnabled( true ); 205 sendButton->setEnabled( true );
206 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 206 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
207 } 207 }
208 208
209 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) 209 if ( !QCopChannel::isRegistered("QPE/Bluetooth") )
210 { 210 {
211 btStatus->setText(tr("not enabled.")); 211 btStatus->setText(tr("not enabled."));
212 } 212 }
213 else 213 else
214 { 214 {
215 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); 215 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
216 btStatus->setText(tr("searching...")); 216 btStatus->setText(tr("searching..."));
217 sendButton->setEnabled( true ); 217 sendButton->setEnabled( true );
218 QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); 218 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
219 } 219 }
220} 220}
221 221
222void SendWidget::toggle_receiver(QListViewItem* item) 222void SendWidget::toggle_receiver(QListViewItem* item)
223{ 223{
224 // toggle the state of an individual receiver. 224 // toggle the state of an individual receiver.
225 if(item->pixmap(2)) 225 if (item->pixmap(2))
226 item->setPixmap(2,QPixmap()); 226 item->setPixmap(2, QPixmap());
227 else 227 else
228 item->setPixmap(2,Resource::loadPixmap("obex/check.png")); 228 item->setPixmap(2, OResource::loadPixmap("obex/check.png"));
229} 229}
230 230
231 231
232void SendWidget::closeEvent( QCloseEvent* evt) { 232void SendWidget::closeEvent( QCloseEvent* evt) {
233 delete m_obex; 233 delete m_obex;
234 m_obex = NULL; 234 m_obex = NULL;
235 delete m_btobex; 235 delete m_btobex;
236 m_btobex = NULL; 236 m_btobex = NULL;
237 obexSendBase::closeEvent(evt); 237 obexSendBase::closeEvent(evt);
238 { 238 {
239 QCopEnvelope e("QPE/IrDaApplet", "disableIrda()"); 239 QCopEnvelope e("QPE/IrDaApplet", "disableIrda()");
240 } 240 }
241 { 241 {
242 QCopEnvelope e("QPE/Bluetooth", "disableBluetooth()"); 242 QCopEnvelope e("QPE/Bluetooth", "disableBluetooth()");
243 } 243 }
244} 244}
245 245
246void SendWidget::userDone() { 246void SendWidget::userDone() {
247 close(); 247 close();
248} 248}
249 249
250QString SendWidget::file()const { 250QString SendWidget::file()const {
251 return m_file; 251 return m_file;
252} 252}