summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-08-22 09:36:38 (UTC)
committer mickeyl <mickeyl>2005-08-22 09:36:38 (UTC)
commit7202ac536ac98e7e433984d98cb9236330b25cc8 (patch) (unidiff)
treec8b5d4e57dd4b9b302999d1f88a89c28e4ee0e5e
parent140e4dc44a29678de1ae8b2cef5b1d081993223e (diff)
downloadopie-7202ac536ac98e7e433984d98cb9236330b25cc8.zip
opie-7202ac536ac98e7e433984d98cb9236330b25cc8.tar.gz
opie-7202ac536ac98e7e433984d98cb9236330b25cc8.tar.bz2
Replace the existing, apparently non-working, OBEX Send form with a
completely new implementation. The new implementation supports selective send over both IrDA and Bluetooth, to selected receivers (which are discovered as the form pops up). The form also indicates transfer status as the transfers progress. There is a new QT Designer UI form file, integrated into the build. There are also two new source files for the form to supply the abstract methods (typical of QT2). Patch courtesy Michael Haynie - thanks!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/btobex.cpp (renamed from core/obex/obex.cc)42
-rw-r--r--core/obex/btobex.h (renamed from core/obex/obex.h)26
-rw-r--r--core/obex/obex.pro10
-rw-r--r--core/obex/obexsend.cpp289
-rw-r--r--core/obex/obexsend.h125
5 files changed, 42 insertions, 450 deletions
diff --git a/core/obex/obex.cc b/core/obex/btobex.cpp
index 36634ec..a2866f6 100644
--- a/core/obex/obex.cc
+++ b/core/obex/btobex.cpp
@@ -1,4 +1,4 @@
1 1
2#include "obex.h" 2#include "btobex.h"
3 3
4/* OPIE */ 4/* OPIE */
@@ -16,5 +16,5 @@ using namespace Opie::Core;
16/* TRANSLATOR OpieObex::Obex */ 16/* TRANSLATOR OpieObex::Obex */
17 17
18Obex::Obex( QObject *parent, const char* name ) 18BtObex::BtObex( QObject *parent, const char* name )
19 : QObject(parent, name ) 19 : QObject(parent, name )
20{ 20{
@@ -28,13 +28,15 @@ Obex::Obex( QObject *parent, const char* name )
28 SLOT(slotError() ) ); 28 SLOT(slotError() ) );
29}; 29};
30Obex::~Obex() { 30BtObex::~BtObex() {
31 delete m_rec; 31 delete m_rec;
32 delete m_send; 32 delete m_send;
33} 33}
34void Obex::receive() { 34void BtObex::receive() {
35 m_receive = true; 35 m_receive = true;
36 m_outp = QString::null; 36 m_outp = QString::null;
37 m_rec = new OProcess(); 37 m_rec = new OProcess();
38 *m_rec << "irobex_palm3"; 38
39 // TODO mbhaynie: No idea if this actually works -- maybe opd is better.
40 *m_rec << "obexftpd" << "-b";
39 // connect to the necessary slots 41 // connect to the necessary slots
40 connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), 42 connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ),
@@ -51,7 +53,9 @@ void Obex::receive() {
51} 53}
52 54
53void Obex::send( const QString& fileName) { // if currently receiving stop it send receive 55void BtObex::send( const QString& fileName, const QString& bdaddr) {
56 // if currently receiving stop it send receive
54 m_count = 0; 57 m_count = 0;
55 m_file = fileName; 58 m_file = fileName;
59 m_bdaddr = bdaddr;
56 if (m_rec != 0 ) { 60 if (m_rec != 0 ) {
57 if (m_rec->isRunning() ) { 61 if (m_rec->isRunning() ) {
@@ -67,5 +71,5 @@ void Obex::send( const QString& fileName) { // if currently receiving stop it se
67 sendNow(); 71 sendNow();
68} 72}
69void Obex::sendNow(){ 73void BtObex::sendNow(){
70 if ( m_count >= 25 ) { // could not send 74 if ( m_count >= 25 ) { // could not send
71 emit error(-1 ); 75 emit error(-1 );
@@ -77,6 +81,10 @@ void Obex::sendNow(){
77 m_send->setWorkingDirectory( QFileInfo(m_file).dirPath(true) ); 81 m_send->setWorkingDirectory( QFileInfo(m_file).dirPath(true) );
78 82
79 *m_send << "irobex_palm3"; 83 // obextool push file <bdaddr> [channel]
84 // 9 for phones.
85 // Palm T3 accepts pictures on 1
86 *m_send << "obextool" << "push";
80 *m_send << QFile::encodeName(QFileInfo(m_file).fileName()); 87 *m_send << QFile::encodeName(QFileInfo(m_file).fileName());
88 *m_send << m_bdaddr << "9";
81 89
82 // connect to slots Exited and and StdOut 90 // connect to slots Exited and and StdOut
@@ -98,5 +106,5 @@ void Obex::sendNow(){
98} 106}
99 107
100void Obex::slotExited(OProcess* proc ){ 108void BtObex::slotExited(OProcess* proc ){
101 if (proc == m_rec ) // receive process 109 if (proc == m_rec ) // receive process
102 received(); 110 received();
@@ -105,5 +113,5 @@ void Obex::slotExited(OProcess* proc ){
105 113
106} 114}
107void Obex::slotStdOut(OProcess* proc, char* buf, int len){ 115void BtObex::slotStdOut(OProcess* proc, char* buf, int len){
108 if ( proc == m_rec ) { // only receive 116 if ( proc == m_rec ) { // only receive
109 QByteArray ar( len ); 117 QByteArray ar( len );
@@ -113,5 +121,5 @@ void Obex::slotStdOut(OProcess* proc, char* buf, int len){
113} 121}
114 122
115void Obex::received() { 123void BtObex::received() {
116 if (m_rec->normalExit() ) { 124 if (m_rec->normalExit() ) {
117 if ( m_rec->exitStatus() == 0 ) { // we got one 125 if ( m_rec->exitStatus() == 0 ) { // we got one
@@ -127,5 +135,5 @@ void Obex::received() {
127} 135}
128 136
129void Obex::sendEnd() { 137void BtObex::sendEnd() {
130 if (m_send->normalExit() ) { 138 if (m_send->normalExit() ) {
131 if ( m_send->exitStatus() == 0 ) { 139 if ( m_send->exitStatus() == 0 ) {
@@ -145,5 +153,7 @@ void Obex::sendEnd() {
145 } 153 }
146} 154}
147QString Obex::parseOut( ){ 155
156// This probably doesn't do anything useful for bt.
157QString BtObex::parseOut( ){
148 QString path; 158 QString path;
149 QStringList list = QStringList::split("\n", m_outp); 159 QStringList list = QStringList::split("\n", m_outp);
@@ -165,9 +175,9 @@ QString Obex::parseOut( ){
165 * when sent is done slotError is called we will start receive again 175 * when sent is done slotError is called we will start receive again
166 */ 176 */
167void Obex::slotError() { 177void BtObex::slotError() {
168 if ( m_receive ) 178 if ( m_receive )
169 receive(); 179 receive();
170}; 180};
171void Obex::setReceiveEnabled( bool receive ) { 181void BtObex::setReceiveEnabled( bool receive ) {
172 if ( !receive ) { // 182 if ( !receive ) { //
173 m_receive = false; 183 m_receive = false;
@@ -176,5 +186,5 @@ void Obex::setReceiveEnabled( bool receive ) {
176} 186}
177 187
178void Obex::shutDownReceive() { 188void BtObex::shutDownReceive() {
179 if (m_rec != 0 ) { 189 if (m_rec != 0 ) {
180 if (m_rec->isRunning() ) { 190 if (m_rec->isRunning() ) {
diff --git a/core/obex/obex.h b/core/obex/btobex.h
index 5993976..5ab591c 100644
--- a/core/obex/obex.h
+++ b/core/obex/btobex.h
@@ -1,6 +1,6 @@
1 1
2 2
3#ifndef OpieObex_H 3#ifndef OpieBtObex_H
4#define OpieObex_H 4#define OpieBtObex_H
5 5
6#include <qobject.h> 6#include <qobject.h>
@@ -9,22 +9,23 @@ namespace Opie {namespace Core {class OProcess;}}
9class QCopChannel; 9class QCopChannel;
10namespace OpieObex { 10namespace OpieObex {
11 class Obex : public QObject { 11 // Maybe this should be derved from Obex.
12 class BtObex : public QObject {
12 Q_OBJECT 13 Q_OBJECT
13 public: 14 public:
14 /** 15 /**
15 * Obex c'tor look 16 * BtObex c'tor look
16 */ 17 */
17 Obex( QObject *parent, const char* name); 18 BtObex( QObject *parent, const char* name);
18 /** 19 /**
19 * d'tor 20 * d'tor
20 */ 21 */
21 ~Obex(); 22 ~BtObex();
22 23
23 /** 24 /** TODO mbhaynie -- Maybe opd would be a better way to receive.
24 * Starting listening to irda after enabled by the applet 25 * Starting listening to Bluetooth after enabled by the applet
25 * a signal gets emitted when received a file 26 * a signal gets emitted when received a file
26 */ 27 */
27 void receive(); 28 void receive();
28 void send( const QString& ); 29 void send( const QString&, const QString& );
29 void setReceiveEnabled( bool = false ); 30 void setReceiveEnabled( bool = false );
30 signals: 31 signals:
@@ -54,4 +55,5 @@ namespace OpieObex {
54 QString m_file; 55 QString m_file;
55 QString m_outp; 56 QString m_outp;
57 QString m_bdaddr;
56 Opie::Core::OProcess *m_send; 58 Opie::Core::OProcess *m_send;
57 Opie::Core::OProcess *m_rec; 59 Opie::Core::OProcess *m_rec;
@@ -61,10 +63,4 @@ namespace OpieObex {
61private slots: 63private slots:
62 64
63 /**
64 * send over palm obex
65 */
66
67 //void send(const QString&);
68
69 // the process exited 65 // the process exited
70 void slotExited(Opie::Core::OProcess* proc) ; 66 void slotExited(Opie::Core::OProcess* proc) ;
diff --git a/core/obex/obex.pro b/core/obex/obex.pro
index 4e72bc4..1f4f486 100644
--- a/core/obex/obex.pro
+++ b/core/obex/obex.pro
@@ -1,12 +1,12 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 HEADERS= obex.h obexhandler.h obexsend.h receiver.h obeximpl.h 3 HEADERS = btobex.h obexhandler.h receiver.h obeximpl.h
4 SOURCES= obex.cc obexsend.cpp obexhandler.cpp receiver.cpp obeximpl.cpp 4 SOURCES = btobex.cpp obexhandler.cpp receiver.cpp obeximpl.cpp
5 TARGET = opieobex 5 TARGET = opieobex
6 DESTDIR = $(OPIEDIR)/plugins/obex 6 DESTDIR = $(OPIEDIR)/plugins/obex
7INTERFACES = obexsendbase.ui
7INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher 8INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher
8DEPENDPATH += 9 LIBS += -lqpe -lopiecore2
9LIBS += -lqpe -lopiecore2 10 VERSION = 0.0.3
10 VERSION = 0.0.2
11 11
12include( $(OPIEDIR)/include.pro ) 12include( $(OPIEDIR)/include.pro )
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
deleted file mode 100644
index 675c5e4..0000000
--- a/core/obex/obexsend.cpp
+++ b/dev/null
@@ -1,289 +0,0 @@
1#include "obex.h"
2#include "obexsend.h"
3using namespace OpieObex;
4
5/* OPIE */
6#include <opie2/odebug.h>
7#include <qpe/qcopenvelope_qws.h>
8using namespace Opie::Core;
9
10/* QT */
11#include <qpushbutton.h>
12#include <qlabel.h>
13#include <qlayout.h>
14#include <qtimer.h>
15
16/* TRANSLATOR OpieObex::SendWidget */
17
18SendWidget::SendWidget( QWidget* parent, const char* name )
19 : QWidget( parent, name ) {
20 initUI();
21}
22SendWidget::~SendWidget() {
23}
24void SendWidget::initUI() {
25 m_obex = new Obex(this, "obex");
26 connect(m_obex, SIGNAL(error(int) ),
27 this, SLOT(slotIrError(int) ) );
28 connect(m_obex, SIGNAL(sent(bool) ),
29 this, SLOT(slotIrSent(bool) ) );
30 connect(m_obex, SIGNAL(currentTry(unsigned int) ),
31 this, SLOT(slotIrTry(unsigned int) ) );
32
33 QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this );
34 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
35 this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) );
36
37 chan = new QCopChannel("QPE/BluetoothBack", this );
38 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
39 this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) );
40
41 QVBoxLayout* lay = new QVBoxLayout(this);
42
43 QHBox* nameBox = new QHBox(this);
44 QLabel* name = new QLabel(nameBox);
45 name->setText( tr("<qt><h1>Sending:</h1></qt>") );
46 name->setAlignment( AlignLeft | AlignTop );
47 m_lblFile = new QLabel(nameBox);
48 lay->addWidget(nameBox, 0);
49
50 QFrame* frame = new QFrame(this);
51 frame->setFrameShape( QFrame::HLine );
52 frame->setFrameShadow( QFrame::Sunken );
53 lay->addWidget(frame, 10);
54
55 QLabel* devices = new QLabel(this);
56 devices->setText("<qt><b>Devices:</b></qt>");
57 devices->setAlignment( AlignLeft | AlignTop );
58 lay->addWidget( devices,10 );
59
60 m_devBox = new DeviceBox(this);
61 lay->addWidget( m_devBox, 50 );
62 connect(m_devBox, SIGNAL(selectedDevice(int,int) ),
63 this, SLOT(slotSelectedDevice(int,int) ) );
64
65 QPushButton *but = new QPushButton(this);
66 but->setText(tr("Done") );
67 connect(but, SIGNAL(clicked() ),
68 this, SLOT(slotDone() ) );
69
70 lay->addWidget( but );
71 m_lay = lay;
72
73 // QT does not like if you add items to an layout which already exits....
74 // and was layouted invalidate() does not help too
75 // so we use RichText....
76}
77
78/*
79 * in send we'll first set everything up
80 * and then wait for a list of devices.
81 */
82void SendWidget::send( const QString& file, const QString& desc ) {
83 m_file = file;
84 m_irDa.clear();
85 m_start = 0;
86 m_lblFile->setText(desc.isEmpty() ? file : desc );
87
88 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) {
89 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error );
90 m_start++;
91 }else
92 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search );
93
94 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) {
95 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error );
96 m_start++;
97 }else
98 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search );
99
100 if (m_start != 2 ) {
101 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()");
102 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
103 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
104 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
105 }
106}
107void SendWidget::slotIrDaDevices( const QStringList& list) {
108 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
109 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") );
110 m_irDa.insert( id, (*it) );
111 }
112 m_devBox->removeDevice( m_irDeSearch );
113 m_irDaIt = m_irDa.begin();
114
115 slotStartIrda();
116}
117
118void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) {
119 for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) {
120 int id = m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") );
121 m_bt.insert( id, Pair( it.key(), it.data() ) );
122 }
123 m_devBox->removeDevice( m_btDeSearch );
124}
125void SendWidget::slotSelectedDevice( int name, int ) {
126 if ( name == m_irDeSearch ) {
127 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it )
128 m_devBox->removeDevice( it.key() );
129
130 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
131 }
132}
133void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
134 if ( str == "devices(QStringList)" ) {
135 QDataStream stream( ar, IO_ReadOnly );
136 QStringList list;
137 stream >> list;
138 slotIrDaDevices( list );
139 }
140}
141void SendWidget::dispatchBt( const QCString&, const QByteArray& ) {
142
143}
144void SendWidget::slotIrError( int ) {
145
146}
147void SendWidget::slotIrSent( bool b) {
148 QString text = b ? tr("Sent") : tr("Failure");
149 m_devBox->setStatus( m_irDaIt.key(), text );
150 ++m_irDaIt;
151 slotStartIrda();
152}
153void SendWidget::slotIrTry(unsigned int trI) {
154 m_devBox->setStatus( m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) ) );
155}
156void SendWidget::slotStartIrda() {
157 if (m_irDaIt == m_irDa.end() ) {
158 m_irDeSearch = m_devBox->addDevice(tr("Search again for IrDa."), DeviceBox::Search );
159 return;
160 }
161 m_devBox->setStatus( m_irDaIt.key(), tr("Start sending") );
162 m_obex->send( m_file );
163}
164void SendWidget::closeEvent( QCloseEvent* e) {
165 e->accept(); // make sure
166 QTimer::singleShot(0, this, SLOT(slotDone() ) );
167}
168void SendWidget::slotDone() {
169 QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()");
170 QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()");
171 emit done();
172}
173QString SendWidget::file()const {
174 return m_file;
175}
176DeviceBox::DeviceBox( QWidget* parent )
177 : QTextBrowser( parent ) {
178
179}
180DeviceBox::~DeviceBox() {
181
182}
183int DeviceBox::addDevice( const QString& name, int dev, const QString& status ) {
184 /* return a id for a range of devices */
185 int id = idFor ( dev );
186 DeviceItem item( name, status, dev,id );
187 m_dev.insert( id, item );
188 setText( allText() );
189
190 return id;
191}
192void DeviceBox::removeDevice( int id ) {
193 if (!m_dev.contains(id) ) return;
194
195 m_dev.remove( id );
196 setText( allText() );
197}
198void DeviceBox::setStatus( int id, const QString& status ) {
199 if ( !m_dev.contains(id) ) return;
200 m_dev[id].setStatus(status );
201 setText( allText() );
202}
203void DeviceBox::setSource( const QString& str ) {
204 int id = str.toInt();
205 emit selectedDevice( id, m_dev[id].device() );
206}
207int DeviceBox::idFor ( int id ) {
208 static int irId = 1501;
209 static int irBT = 1001;
210 static int irSr = 501;
211 static int irEr = 0;
212
213 int ret = -1;
214 switch(id ) {
215 case IrDa:
216 ret = irId;
217 irId++;
218 break;
219 case BT:
220 ret = irBT;
221 irBT++;
222 break;
223 case Search:
224 ret = irSr;
225 irSr++;
226 break;
227 case Error:
228 ret = irEr;
229 irEr++;
230 break;
231 }
232 return ret;
233}
234QString DeviceBox::allText() {
235 QString str;
236 typedef QMap<int, DeviceItem> DeviceMap;
237
238 for (QMap<int, DeviceItem>::Iterator it = m_dev.begin(); it != m_dev.end(); ++it ) {
239 str += it.data().toString() + "<br>";
240 }
241 return str;
242}
243
244DeviceItem::DeviceItem( const QString& name,
245 const QString& status, int dev, int id)
246{
247 m_name = name;
248 m_status = status;
249 m_dev = dev;
250 m_id = id;
251}
252int DeviceItem::id()const {
253 return m_id;
254}
255QString DeviceItem::name()const {
256 return m_name;
257}
258QString DeviceItem::status()const {
259 return m_status;
260}
261int DeviceItem::device()const {
262 return m_dev;
263}
264QString DeviceItem::pixmap()const{
265 QString str;
266 switch(m_dev) {
267 case DeviceBox::IrDa:
268 str ="obex/irda";
269 break;
270 case DeviceBox::BT:
271 str ="obex/bt";
272 break;
273 case DeviceBox::Search:
274 str = "mag";
275 break;
276 case DeviceBox::Error:
277 str = "editdelete";
278 break;
279 };
280 return str;
281}
282DeviceItem::~DeviceItem() {
283}
284void DeviceItem::setStatus(const QString& status ) {
285 m_status = status;
286}
287QString DeviceItem::toString()const {
288 return "<p><a href=\""+QString::number(m_id) +"\" ><img src=\""+pixmap()+"\" >"+m_name+" "+m_status+" </a></p>" ;
289}
diff --git a/core/obex/obexsend.h b/core/obex/obexsend.h
deleted file mode 100644
index bf901cb..0000000
--- a/core/obex/obexsend.h
+++ b/dev/null
@@ -1,125 +0,0 @@
1#ifndef OPIE_OBEX_SEND_WIDGET_H
2#define OPIE_OBEX_SEND_WIDGET_H
3
4#include <qstring.h>
5#include <qstringlist.h>
6#include <qwidget.h>
7#include <qvbox.h>
8#include <qmap.h>
9#include <qtextbrowser.h>
10
11class QLabel;
12class QVBoxLayout;
13/**
14 * This is the new sending widget for Obex
15 * It will attemp to smart and be able to send
16 * it to multiple devices.
17 * It'll support BT + IrDa
18 */
19namespace OpieObex {
20 class DeviceBox;
21 class Obex;
22
23 struct Pair {
24 Pair(const QString& first = QString::null,
25 const QString& second = QString::null)
26 : m_first(first), m_second(second ) {
27 }
28 QString first()const{ return m_first; }
29 QString second()const { return m_second; }
30 private:
31 QString m_first;
32 QString m_second;
33 };
34 class SendWidget : public QWidget{
35 Q_OBJECT
36 public:
37 SendWidget( QWidget* parent = 0, const char* name = 0);
38 ~SendWidget();
39
40 QString file()const;
41
42 protected:
43 void closeEvent( QCloseEvent* );
44
45 public slots:
46 void send( const QString& file, const QString& desc );
47
48 signals:
49 void done();
50
51 private slots: // QCOP slots
52 /* IrDa Names*/
53 void slotIrDaDevices( const QStringList& );
54 /* Bt Names + BD-Addr */
55 void slotBTDevices( const QMap<QString, QString>& );
56 void slotSelectedDevice( int id, int dev );
57 void dispatchIrda( const QCString& str, const QByteArray& ar );
58 void dispatchBt( const QCString& str, const QByteArray& ar );
59
60 void slotIrError( int );
61 void slotIrSent(bool);
62 void slotIrTry(unsigned int );
63 void slotStartIrda();
64 void slotDone();
65 private:
66 void initUI();
67 QLabel* m_lblFile;
68 DeviceBox* m_devBox;
69 QVBoxLayout* m_lay;
70 int m_start;
71 QMap<int, QString> m_irDa;
72 QMap<int, QString>::Iterator m_irDaIt;
73 QMap<int, Pair > m_bt;
74 QString m_file;
75 Obex* m_obex;
76 int m_irDeSearch; // search of irda and bt devices
77 int m_btDeSearch;
78 };
79 class DeviceItem {
80 public:
81 DeviceItem( const QString& name = QString::null,
82 const QString& status = QString::null, int dev = 3, int id = -1);
83 ~DeviceItem();
84 void setStatus( const QString& text );
85
86 QString name()const;
87 QString status()const;
88 QString pixmap()const;
89 int device()const;
90 int id()const;
91 QString toString()const;
92 private:
93 QString m_name;
94 QString m_status;
95 int m_dev;
96 int m_id;
97 };
98
99 /*
100 * The text field which contains the information about sending...
101 *
102 */
103 class DeviceBox : public QTextBrowser {
104 Q_OBJECT
105 public:
106 enum Device { IrDa, BT, Search, Error };
107 DeviceBox( QWidget* parent );
108 ~DeviceBox();
109
110 void setSource( const QString& str );
111 int addDevice( const QString& name, int dev,
112 const QString& status = QString::null );
113 void removeDevice( int );
114 void setStatus( int, const QString& );
115 signals:
116 void selectedDevice( int id, int dev );
117 private:
118 /* returns a id for a device from a device range */
119 int idFor (int deviceType );
120 QString allText();
121 QMap<int, DeviceItem> m_dev;
122 };
123}
124
125#endif