-rw-r--r-- | core/obex/btobex.h | 3 | ||||
-rw-r--r-- | core/obex/obex.pro | 10 | ||||
-rw-r--r-- | core/obex/obexsend.cpp | 45 | ||||
-rw-r--r-- | core/obex/obexsend.h | 9 | ||||
-rw-r--r-- | core/obex/receiver.cpp | 2 |
5 files changed, 62 insertions, 7 deletions
diff --git a/core/obex/btobex.h b/core/obex/btobex.h index 7e91c06..d9bd886 100644 --- a/core/obex/btobex.h +++ b/core/obex/btobex.h | |||
@@ -29,12 +29,13 @@ | |||
29 | * The Bluetooth OBEX manipulating class declaration | 29 | * The Bluetooth OBEX manipulating class declaration |
30 | */ | 30 | */ |
31 | 31 | ||
32 | 32 | ||
33 | #ifndef OpieBtObex_H | 33 | #ifndef OpieBtObex_H |
34 | #define OpieBtObex_H | 34 | #define OpieBtObex_H |
35 | #ifdef BLUETOOTH | ||
35 | 36 | ||
36 | #include "obexbase.h" | 37 | #include "obexbase.h" |
37 | #include <qobject.h> | 38 | #include <qobject.h> |
38 | #include <services.h> | 39 | #include <services.h> |
39 | #include <manager.h> | 40 | #include <manager.h> |
40 | #include <obexpush.h> | 41 | #include <obexpush.h> |
@@ -111,8 +112,8 @@ private slots: | |||
111 | void sendNow(); | 112 | void sendNow(); |
112 | QString parseOut(); | 113 | QString parseOut(); |
113 | void received(); | 114 | void received(); |
114 | }; | 115 | }; |
115 | }; | 116 | }; |
116 | 117 | ||
117 | 118 | #endif //BLUETOOTH | |
118 | #endif | 119 | #endif |
diff --git a/core/obex/obex.pro b/core/obex/obex.pro index 1fc6958..05118ab 100644 --- a/core/obex/obex.pro +++ b/core/obex/obex.pro | |||
@@ -1,20 +1,24 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | HEADERS= obex.h btobex.h obexhandler.h obexsend.h receiver.h obeximpl.h obexbase.h obexserver.h | 3 | HEADERS= obex.h obexhandler.h obexsend.h receiver.h obeximpl.h obexbase.h obexserver.h |
4 | SOURCES= obex.cpp btobex.cpp obexsend.cpp obexhandler.cpp receiver.cpp obeximpl.cpp obexbase.cpp obexserver.cpp | 4 | SOURCES= obex.cpp obexsend.cpp obexhandler.cpp receiver.cpp obeximpl.cpp obexbase.cpp obexserver.cpp |
5 | TARGET = opieobex | 5 | TARGET = opieobex |
6 | DESTDIR = $(OPIEDIR)/plugins/obex | 6 | DESTDIR = $(OPIEDIR)/plugins/obex |
7 | INTERFACES = obexsendbase.ui | 7 | INTERFACES = obexsendbase.ui |
8 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher | 8 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher |
9 | DEPENDPATH += | 9 | DEPENDPATH += |
10 | LIBS += -lqpe -lopiecore2 | 10 | LIBS += -lqpe -lopiecore2 |
11 | VERSION = 0.0.4 | 11 | VERSION = 0.0.4 |
12 | 12 | ||
13 | include( $(OPIEDIR)/include.pro ) | 13 | include( $(OPIEDIR)/include.pro ) |
14 | target.path = $$prefix/plugins/applets | 14 | target.path = $$prefix/plugins/applets |
15 | 15 | ||
16 | #FIXME: These parameters are used if bluetooth is used | 16 | #FIXME: These parameters are used if bluetooth is used |
17 | CONFTEST = $$system( echo $CONFIG_LIBOPIETOOTH ) | ||
18 | contains( CONFTEST, y ){ | ||
19 | HEADERS += btobex.h | ||
20 | SOURCES += btobex.cpp | ||
17 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib | 21 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib |
18 | LIBS += -lopietooth1 -lbluetooth -lopenobex | 22 | LIBS += -lopietooth1 -lbluetooth -lopenobex |
19 | DEFINES += BLUETOOTH | 23 | DEFINES += BLUETOOTH |
20 | 24 | } | |
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp index 45754e3..d58b4e9 100644 --- a/core/obex/obexsend.cpp +++ b/core/obex/obexsend.cpp | |||
@@ -1,24 +1,30 @@ | |||
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 | #ifdef BLUETOOTH | ||
7 | #include "btobex.h" | 8 | #include "btobex.h" |
9 | #endif | ||
8 | #include "obexsend.h" | 10 | #include "obexsend.h" |
9 | using namespace OpieObex; | 11 | using namespace OpieObex; |
12 | #ifdef BLUETOOTH | ||
10 | using namespace OpieTooth; | 13 | using namespace OpieTooth; |
14 | #endif | ||
11 | 15 | ||
12 | /* OPIE */ | 16 | /* OPIE */ |
13 | #include <opie2/odebug.h> | 17 | #include <opie2/odebug.h> |
14 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
15 | #include <opie2/oresource.h> | 19 | #include <opie2/oresource.h> |
16 | #include <qpe/version.h> | 20 | #include <qpe/version.h> |
21 | #ifdef BLUETOOTH | ||
17 | #include <devicehandler.h> | 22 | #include <devicehandler.h> |
18 | #include "remotedevice.h" | 23 | #include "remotedevice.h" |
24 | #endif | ||
19 | 25 | ||
20 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
21 | 27 | ||
22 | /* QT */ | 28 | /* QT */ |
23 | #include <qlabel.h> | 29 | #include <qlabel.h> |
24 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
@@ -49,34 +55,37 @@ void SendWidget::initUI() { | |||
49 | this, SLOT(slotIrTry(unsigned int) ) ); | 55 | this, SLOT(slotIrTry(unsigned int) ) ); |
50 | 56 | ||
51 | QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this ); | 57 | QCopChannel* chan = new QCopChannel("QPE/IrDaAppletBack", this ); |
52 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), | 58 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), |
53 | this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) ); | 59 | this, SLOT(dispatchIrda(const QCString&,const QByteArray&) ) ); |
54 | 60 | ||
61 | #ifdef BLUETOOTH | ||
55 | m_btobex = new BtObex(this, "btobex"); | 62 | m_btobex = new BtObex(this, "btobex"); |
56 | connect(m_btobex, SIGNAL(error(int) ), | 63 | connect(m_btobex, SIGNAL(error(int) ), |
57 | this, SLOT(slotBtError(int) ) ); | 64 | this, SLOT(slotBtError(int) ) ); |
58 | connect(m_btobex, SIGNAL(sent(bool) ), | 65 | connect(m_btobex, SIGNAL(sent(bool) ), |
59 | this, SLOT(slotBtSent(bool) ) ); | 66 | this, SLOT(slotBtSent(bool) ) ); |
60 | connect(m_btobex, SIGNAL(currentTry(unsigned int) ), | 67 | connect(m_btobex, SIGNAL(currentTry(unsigned int) ), |
61 | this, SLOT(slotBtTry(unsigned int) ) ); | 68 | this, SLOT(slotBtTry(unsigned int) ) ); |
62 | 69 | ||
63 | chan = new QCopChannel("QPE/BluetoothBack", this ); | 70 | chan = new QCopChannel("QPE/BluetoothBack", this ); |
64 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), | 71 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), |
65 | this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) ); | 72 | this, SLOT(dispatchBt(const QCString&,const QByteArray&) ) ); |
66 | 73 | #endif | |
67 | } | 74 | } |
68 | 75 | ||
69 | /* | 76 | /* |
70 | * in send we'll first set everything up | 77 | * in send we'll first set everything up |
71 | * and then wait for a list of devices. | 78 | * and then wait for a list of devices. |
72 | */ | 79 | */ |
73 | void SendWidget::send( const QString& file, const QString& desc ) { | 80 | void SendWidget::send( const QString& file, const QString& desc ) { |
74 | m_file = file; | 81 | m_file = file; |
75 | m_irDa.clear(); | 82 | m_irDa.clear(); |
83 | #ifdef BLUETOOTH | ||
76 | m_bt.clear(); | 84 | m_bt.clear(); |
85 | #endif | ||
77 | m_start = 0; | 86 | m_start = 0; |
78 | 87 | ||
79 | fileToSend->setText(desc.isEmpty() ? file : desc ); | 88 | fileToSend->setText(desc.isEmpty() ? file : desc ); |
80 | 89 | ||
81 | if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) | 90 | if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) |
82 | { | 91 | { |
@@ -85,23 +94,25 @@ void SendWidget::send( const QString& file, const QString& desc ) { | |||
85 | else | 94 | else |
86 | { | 95 | { |
87 | QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); | 96 | QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); |
88 | irdaStatus->setText(tr("ready")); | 97 | irdaStatus->setText(tr("ready")); |
89 | sendButton->setEnabled( true ); | 98 | sendButton->setEnabled( true ); |
90 | } | 99 | } |
100 | #ifdef BLUETOOTH | ||
91 | if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) | 101 | if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) |
92 | { | 102 | { |
93 | btStatus->setText(tr("not enabled.")); | 103 | btStatus->setText(tr("not enabled.")); |
94 | } | 104 | } |
95 | else | 105 | else |
96 | { | 106 | { |
97 | QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); | 107 | QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); |
98 | btStatus->setText(tr("ready.")); | 108 | btStatus->setText(tr("ready.")); |
99 | sendButton->setEnabled( true ); | 109 | sendButton->setEnabled( true ); |
100 | } | 110 | } |
101 | read_receivers(); | 111 | read_receivers(); |
112 | #endif | ||
102 | } | 113 | } |
103 | 114 | ||
104 | int SendWidget::addReceiver(const QString& str, const char *icon) | 115 | int SendWidget::addReceiver(const QString& str, const char *icon) |
105 | { | 116 | { |
106 | QListViewItem * item = new QListViewItem( receiverList, 0 ); | 117 | QListViewItem * item = new QListViewItem( receiverList, 0 ); |
107 | item->setText( 0, str ); | 118 | item->setText( 0, str ); |
@@ -131,20 +142,24 @@ void SendWidget::slotIrDaDevices( const QStringList& list) { | |||
131 | irdaStatus->setText( tr("ready.")); | 142 | irdaStatus->setText( tr("ready.")); |
132 | m_irDaIt = m_irDa.begin(); | 143 | m_irDaIt = m_irDa.begin(); |
133 | 144 | ||
134 | } | 145 | } |
135 | 146 | ||
136 | void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) { | 147 | void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) { |
148 | #ifdef BLUETOOTH | ||
137 | for(QMap<QString, QString>::ConstIterator it = str.begin(); | 149 | for(QMap<QString, QString>::ConstIterator it = str.begin(); |
138 | it != str.end(); ++it ) { | 150 | it != str.end(); ++it ) { |
139 | int id = addReceiver(it.key(), "obex/bt.png"); | 151 | int id = addReceiver(it.key(), "obex/bt.png"); |
140 | m_bt.insert( id, Pair( it.key(), it.data() ) ); | 152 | m_bt.insert( id, Pair( it.key(), it.data() ) ); |
141 | } | 153 | } |
142 | btStatus->setText(tr("ready.")); | 154 | btStatus->setText(tr("ready.")); |
143 | m_btIt = m_bt.begin(); | 155 | m_btIt = m_bt.begin(); |
144 | 156 | ||
157 | #else | ||
158 | (void)str; | ||
159 | #endif | ||
145 | } | 160 | } |
146 | void SendWidget::slotSelectedDevice( int, int ) { | 161 | void SendWidget::slotSelectedDevice( int, int ) { |
147 | /* if ( name == m_irDeSearch ) { | 162 | /* if ( name == m_irDeSearch ) { |
148 | for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it ) | 163 | for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it ) |
149 | m_devBox->removeDevice( it.key() ); | 164 | m_devBox->removeDevice( it.key() ); |
150 | 165 | ||
@@ -160,16 +175,20 @@ void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) { | |||
160 | } | 175 | } |
161 | } | 176 | } |
162 | void SendWidget::slotIrError( int ) { | 177 | void SendWidget::slotIrError( int ) { |
163 | irdaStatus->setText(tr("error :(")); | 178 | irdaStatus->setText(tr("error :(")); |
164 | } | 179 | } |
165 | void SendWidget::slotIrSent( bool b) { | 180 | void SendWidget::slotIrSent( bool b) { |
181 | #ifdef BLUETOOTH | ||
166 | QString text = b ? tr("Sent") : tr("Failure"); | 182 | QString text = b ? tr("Sent") : tr("Failure"); |
167 | setReceiverStatus( m_irDaIt.key(), text ); | 183 | setReceiverStatus( m_irDaIt.key(), text ); |
168 | ++m_irDaIt; | 184 | ++m_irDaIt; |
169 | slotStartIrda(); | 185 | slotStartIrda(); |
186 | #else | ||
187 | (void)b; | ||
188 | #endif | ||
170 | } | 189 | } |
171 | void SendWidget::slotIrTry(unsigned int trI) { | 190 | void SendWidget::slotIrTry(unsigned int trI) { |
172 | setReceiverStatus(m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) )); | 191 | setReceiverStatus(m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) )); |
173 | } | 192 | } |
174 | void SendWidget::slotStartIrda() { | 193 | void SendWidget::slotStartIrda() { |
175 | if ( !m_irDa.count() ) | 194 | if ( !m_irDa.count() ) |
@@ -193,21 +212,30 @@ void SendWidget::dispatchBt( const QCString& str, const QByteArray& ar ) { | |||
193 | } | 212 | } |
194 | } | 213 | } |
195 | void SendWidget::slotBtError( int ) { | 214 | void SendWidget::slotBtError( int ) { |
196 | btStatus->setText(tr("error :(")); | 215 | btStatus->setText(tr("error :(")); |
197 | } | 216 | } |
198 | void SendWidget::slotBtSent( bool b) { | 217 | void SendWidget::slotBtSent( bool b) { |
218 | #ifdef BLUETOOTH | ||
199 | QString text = b ? tr("Sent") : tr("Failure"); | 219 | QString text = b ? tr("Sent") : tr("Failure"); |
200 | setReceiverStatus( m_btIt.key(), text ); | 220 | setReceiverStatus( m_btIt.key(), text ); |
201 | ++m_btIt; | 221 | ++m_btIt; |
202 | slotStartBt(); | 222 | slotStartBt(); |
223 | #else | ||
224 | (void)b; | ||
225 | #endif | ||
203 | } | 226 | } |
204 | void SendWidget::slotBtTry(unsigned int trI) { | 227 | void SendWidget::slotBtTry(unsigned int trI) { |
228 | #ifdef BLUETOOTH | ||
205 | setReceiverStatus( m_btIt.key(), tr("Try %1").arg( QString::number( trI ) ) ); | 229 | setReceiverStatus( m_btIt.key(), tr("Try %1").arg( QString::number( trI ) ) ); |
230 | #else | ||
231 | (void)trI; | ||
232 | #endif | ||
206 | } | 233 | } |
207 | void SendWidget::slotStartBt() { | 234 | void SendWidget::slotStartBt() { |
235 | #ifdef BLUETOOTH | ||
208 | // skip past unselected receivers | 236 | // skip past unselected receivers |
209 | if ( !m_bt.count() ) | 237 | if ( !m_bt.count() ) |
210 | return; | 238 | return; |
211 | while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) | 239 | while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) |
212 | ++m_btIt; | 240 | ++m_btIt; |
213 | if (m_btIt == m_bt.end() ) { | 241 | if (m_btIt == m_bt.end() ) { |
@@ -215,19 +243,23 @@ void SendWidget::slotStartBt() { | |||
215 | m_btIt = m_bt.begin(); | 243 | m_btIt = m_bt.begin(); |
216 | return; | 244 | return; |
217 | } | 245 | } |
218 | setReceiverStatus( m_btIt.key(), tr("Start sending") ); | 246 | setReceiverStatus( m_btIt.key(), tr("Start sending") ); |
219 | btStatus->setText(tr("sending.")); | 247 | btStatus->setText(tr("sending.")); |
220 | m_btobex->send( m_file, m_btIt.data().second() ); | 248 | m_btobex->send( m_file, m_btIt.data().second() ); |
249 | #endif | ||
221 | } | 250 | } |
222 | 251 | ||
223 | void SendWidget::send_to_receivers() { | 252 | void SendWidget::send_to_receivers() { |
253 | #ifdef BLUETOOTH | ||
224 | slotStartBt(); | 254 | slotStartBt(); |
255 | #endif | ||
225 | slotStartIrda(); | 256 | slotStartIrda(); |
226 | } | 257 | } |
227 | 258 | ||
259 | #ifdef BLUETOOTH | ||
228 | /** | 260 | /** |
229 | * Read receivers saved by bluetooth manager | 261 | * Read receivers saved by bluetooth manager |
230 | */ | 262 | */ |
231 | void SendWidget::read_receivers() | 263 | void SendWidget::read_receivers() |
232 | { | 264 | { |
233 | QValueList<RemoteDevice> devices; | 265 | QValueList<RemoteDevice> devices; |
@@ -250,35 +282,38 @@ void SendWidget::read_receivers() | |||
250 | } | 282 | } |
251 | btStatus->setText(tr("ready.")); | 283 | btStatus->setText(tr("ready.")); |
252 | m_btIt = m_bt.begin(); | 284 | m_btIt = m_bt.begin(); |
253 | sendButton->setEnabled( true ); | 285 | sendButton->setEnabled( true ); |
254 | } | 286 | } |
255 | } | 287 | } |
256 | 288 | #endif | |
257 | 289 | ||
258 | void SendWidget::scan_for_receivers() | 290 | void SendWidget::scan_for_receivers() |
259 | { | 291 | { |
260 | sendButton->setDisabled( true ); | 292 | sendButton->setDisabled( true ); |
261 | receiverList->clear(); | 293 | receiverList->clear(); |
262 | receivers.clear(); | 294 | receivers.clear(); |
263 | m_irDa.clear(); | 295 | m_irDa.clear(); |
296 | #ifdef BLUETOOTH | ||
264 | m_bt.clear(); | 297 | m_bt.clear(); |
265 | 298 | #endif | |
266 | if ( QCopChannel::isRegistered("QPE/IrDaApplet") ) | 299 | if ( QCopChannel::isRegistered("QPE/IrDaApplet") ) |
267 | { | 300 | { |
268 | irdaStatus->setText(tr("searching...")); | 301 | irdaStatus->setText(tr("searching...")); |
269 | sendButton->setEnabled( true ); | 302 | sendButton->setEnabled( true ); |
270 | QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); | 303 | QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); |
271 | } | 304 | } |
272 | 305 | ||
306 | #ifdef BLUETOOTH | ||
273 | if ( QCopChannel::isRegistered("QPE/Bluetooth") ) | 307 | if ( QCopChannel::isRegistered("QPE/Bluetooth") ) |
274 | { | 308 | { |
275 | btStatus->setText(tr("searching...")); | 309 | btStatus->setText(tr("searching...")); |
276 | sendButton->setEnabled( true ); | 310 | sendButton->setEnabled( true ); |
277 | QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); | 311 | QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); |
278 | } | 312 | } |
313 | #endif | ||
279 | } | 314 | } |
280 | 315 | ||
281 | void SendWidget::toggle_receiver(QListViewItem* item) | 316 | void SendWidget::toggle_receiver(QListViewItem* item) |
282 | { | 317 | { |
283 | if (!item) | 318 | if (!item) |
284 | return; | 319 | return; |
@@ -290,21 +325,25 @@ void SendWidget::toggle_receiver(QListViewItem* item) | |||
290 | } | 325 | } |
291 | 326 | ||
292 | 327 | ||
293 | void SendWidget::closeEvent( QCloseEvent* evt) { | 328 | void SendWidget::closeEvent( QCloseEvent* evt) { |
294 | delete m_obex; | 329 | delete m_obex; |
295 | m_obex = NULL; | 330 | m_obex = NULL; |
331 | #ifdef BLUETOOTH | ||
296 | delete m_btobex; | 332 | delete m_btobex; |
297 | m_btobex = NULL; | 333 | m_btobex = NULL; |
334 | #endif | ||
298 | obexSendBase::closeEvent(evt); | 335 | obexSendBase::closeEvent(evt); |
299 | { | 336 | { |
300 | QCopEnvelope e("QPE/IrDaApplet", "disableIrda()"); | 337 | QCopEnvelope e("QPE/IrDaApplet", "disableIrda()"); |
301 | } | 338 | } |
339 | #ifdef BLUETOOTH | ||
302 | { | 340 | { |
303 | QCopEnvelope e("QPE/Bluetooth", "disableBluetooth()"); | 341 | QCopEnvelope e("QPE/Bluetooth", "disableBluetooth()"); |
304 | } | 342 | } |
343 | #endif | ||
305 | } | 344 | } |
306 | 345 | ||
307 | void SendWidget::userDone() { | 346 | void SendWidget::userDone() { |
308 | close(); | 347 | close(); |
309 | } | 348 | } |
310 | 349 | ||
diff --git a/core/obex/obexsend.h b/core/obex/obexsend.h index f9ba340..cc27354 100644 --- a/core/obex/obexsend.h +++ b/core/obex/obexsend.h | |||
@@ -18,13 +18,15 @@ class QVBoxLayout; | |||
18 | * It will attemp to smart and be able to send | 18 | * It will attemp to smart and be able to send |
19 | * it to multiple (selected) devices. | 19 | * it to multiple (selected) devices. |
20 | * It'll support BT + IrDa | 20 | * It'll support BT + IrDa |
21 | */ | 21 | */ |
22 | namespace OpieObex { | 22 | namespace OpieObex { |
23 | class Obex; | 23 | class Obex; |
24 | #ifdef BLUETOOTH | ||
24 | class BtObex; | 25 | class BtObex; |
26 | #endif | ||
25 | 27 | ||
26 | struct Pair { | 28 | struct Pair { |
27 | Pair(const QString& first = QString::null, | 29 | Pair(const QString& first = QString::null, |
28 | const QString& second = QString::null) | 30 | const QString& second = QString::null) |
29 | : m_first(first), m_second(second ) { | 31 | : m_first(first), m_second(second ) { |
30 | } | 32 | } |
@@ -41,13 +43,15 @@ namespace OpieObex { | |||
41 | ~SendWidget(); | 43 | ~SendWidget(); |
42 | 44 | ||
43 | QString file()const; | 45 | QString file()const; |
44 | 46 | ||
45 | protected: | 47 | protected: |
46 | void closeEvent( QCloseEvent* ); | 48 | void closeEvent( QCloseEvent* ); |
49 | #ifdef BLUETOOTH | ||
47 | void read_receivers(); | 50 | void read_receivers(); |
51 | #endif | ||
48 | 52 | ||
49 | public slots: | 53 | public slots: |
50 | void send( const QString& file, const QString& desc ); | 54 | void send( const QString& file, const QString& desc ); |
51 | 55 | ||
52 | signals: | 56 | signals: |
53 | void done(); | 57 | void done(); |
@@ -60,12 +64,13 @@ namespace OpieObex { | |||
60 | 64 | ||
61 | private slots: // QCOP slots | 65 | private slots: // QCOP slots |
62 | /* IrDa Names*/ | 66 | /* IrDa Names*/ |
63 | void slotIrDaDevices( const QStringList& ); | 67 | void slotIrDaDevices( const QStringList& ); |
64 | /* Bt Names + BD-Addr */ | 68 | /* Bt Names + BD-Addr */ |
65 | void slotBTDevices( const QMap<QString, QString>& ); | 69 | void slotBTDevices( const QMap<QString, QString>& ); |
70 | |||
66 | void slotSelectedDevice( int id, int dev ); | 71 | void slotSelectedDevice( int id, int dev ); |
67 | 72 | ||
68 | void dispatchIrda( const QCString& str, const QByteArray& ar ); | 73 | void dispatchIrda( const QCString& str, const QByteArray& ar ); |
69 | 74 | ||
70 | void slotIrError( int ); | 75 | void slotIrError( int ); |
71 | void slotIrSent(bool); | 76 | void slotIrSent(bool); |
@@ -84,16 +89,20 @@ namespace OpieObex { | |||
84 | void setReceiverStatus( int id, const QString& status ); | 89 | void setReceiverStatus( int id, const QString& status ); |
85 | bool receiverSelected(int id); | 90 | bool receiverSelected(int id); |
86 | 91 | ||
87 | int m_start; | 92 | int m_start; |
88 | QMap<int, QString> m_irDa; | 93 | QMap<int, QString> m_irDa; |
89 | QMap<int, QString>::Iterator m_irDaIt; | 94 | QMap<int, QString>::Iterator m_irDaIt; |
95 | #ifdef BLUETOOTH | ||
90 | QMap<int, Pair > m_bt; | 96 | QMap<int, Pair > m_bt; |
91 | QMap<int, Pair>::Iterator m_btIt; | 97 | QMap<int, Pair>::Iterator m_btIt; |
98 | #endif | ||
92 | QMap<int, QListViewItem *> receivers; | 99 | QMap<int, QListViewItem *> receivers; |
93 | QString m_file; | 100 | QString m_file; |
94 | Obex* m_obex; | 101 | Obex* m_obex; |
102 | #ifdef BLUETOOTH | ||
95 | BtObex* m_btobex; | 103 | BtObex* m_btobex; |
104 | #endif | ||
96 | }; | 105 | }; |
97 | } | 106 | } |
98 | 107 | ||
99 | #endif | 108 | #endif |
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp index e153152..3190353 100644 --- a/core/obex/receiver.cpp +++ b/core/obex/receiver.cpp | |||
@@ -28,14 +28,16 @@ using namespace Opie::Core; | |||
28 | 28 | ||
29 | /* TRANSLATOR OpieObex::Receiver */ | 29 | /* TRANSLATOR OpieObex::Receiver */ |
30 | 30 | ||
31 | Receiver::Receiver(RecType type) { | 31 | Receiver::Receiver(RecType type) { |
32 | if (type == REC_IRDA) | 32 | if (type == REC_IRDA) |
33 | m_obex = new Obex(this, "Receiver"); | 33 | m_obex = new Obex(this, "Receiver"); |
34 | #ifdef BLUETOOTH | ||
34 | else | 35 | else |
35 | m_obex = new BtObex(this, "Receiver"); | 36 | m_obex = new BtObex(this, "Receiver"); |
37 | #endif | ||
36 | connect(m_obex, SIGNAL(receivedFile(const QString&) ), | 38 | connect(m_obex, SIGNAL(receivedFile(const QString&) ), |
37 | this, SLOT(slotReceived(const QString&) ) ); | 39 | this, SLOT(slotReceived(const QString&) ) ); |
38 | m_obex->receive(); | 40 | m_obex->receive(); |
39 | } | 41 | } |
40 | Receiver::~Receiver() { | 42 | Receiver::~Receiver() { |
41 | m_obex->setReceiveEnabled( false ); | 43 | m_obex->setReceiveEnabled( false ); |