author | mickeyl <mickeyl> | 2006-05-02 08:57:25 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2006-05-02 08:57:25 (UTC) |
commit | d5b6868cb4f99d2c3dc3587115cd37c09e4610eb (patch) (unidiff) | |
tree | 1397f12f885c849419e511ad203d19696c4ae07e /core/obex/obexsend.cpp | |
parent | 1295db77f2ab7e9125183e4240de0b92f72940e4 (diff) | |
download | opie-d5b6868cb4f99d2c3dc3587115cd37c09e4610eb.zip opie-d5b6868cb4f99d2c3dc3587115cd37c09e4610eb.tar.gz opie-d5b6868cb4f99d2c3dc3587115cd37c09e4610eb.tar.bz2 |
bluetooth patches courtesy Dmitriy Korovkin (thanks!):
* When sending data to a device, do service discovery in order to get port number.
* Switched to ussp-push for sending.
* Clear receivers list on rescan.
* Changed the way of window closing in order to shut down IRDA and bluetooth correctly.
-rw-r--r-- | core/obex/obexsend.cpp | 26 |
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 | |||
@@ -20,8 +20,8 @@ using namespace Opie::Core; | |||
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 | #include <qtimer.h> | ||
24 | 23 | ||
24 | #include <unistd.h> | ||
25 | /* TRANSLATOR OpieObex::SendWidget */ | 25 | /* TRANSLATOR OpieObex::SendWidget */ |
26 | 26 | ||
27 | SendWidget::SendWidget( QWidget* parent, const char* name ) | 27 | SendWidget::SendWidget( QWidget* parent, const char* name ) |
@@ -83,7 +83,7 @@ int SendWidget::addReceiver(const char *r, const char *icon) | |||
83 | 83 | ||
84 | bool SendWidget::receiverSelected(int id) | 84 | bool SendWidget::receiverSelected(int id) |
85 | { | 85 | { |
86 | return receivers[id]->pixmap(2); | 86 | return (bool)(receivers[id]->pixmap(2) != NULL); |
87 | } | 87 | } |
88 | 88 | ||
89 | void SendWidget::setReceiverStatus( int id, const QString& status ) { | 89 | void SendWidget::setReceiverStatus( int id, const QString& status ) { |
@@ -141,7 +141,7 @@ void SendWidget::slotIrTry(unsigned int trI) { | |||
141 | void SendWidget::slotStartIrda() { | 141 | void SendWidget::slotStartIrda() { |
142 | if ( !m_irDa.count() ) return; | 142 | if ( !m_irDa.count() ) return; |
143 | if ( m_irDaIt == m_irDa.end() ) { | 143 | if ( m_irDaIt == m_irDa.end() ) { |
144 | irdaStatus->setText(tr("complete.")); | 144 | irdaStatus->setText(tr("complete.")); |
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); | 147 | setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); |
@@ -173,7 +173,7 @@ void SendWidget::slotStartBt() { | |||
173 | while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) | 173 | while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) |
174 | ++m_btIt; | 174 | ++m_btIt; |
175 | if (m_btIt == m_bt.end() ) { | 175 | if (m_btIt == m_bt.end() ) { |
176 | btStatus->setText(tr("complete.")); | 176 | btStatus->setText(tr("complete.")); |
177 | return; | 177 | return; |
178 | } | 178 | } |
179 | setReceiverStatus( m_btIt.key(), tr("Start sending") ); | 179 | setReceiverStatus( m_btIt.key(), tr("Start sending") ); |
@@ -187,7 +187,8 @@ void SendWidget::send_to_receivers() { | |||
187 | 187 | ||
188 | void SendWidget::scan_for_receivers() | 188 | void SendWidget::scan_for_receivers() |
189 | { | 189 | { |
190 | //FIXME: Clean ListBox prior to (re)scan | 190 | receiverList->clear(); |
191 | receivers.clear(); | ||
191 | sendButton->setDisabled( true ); | 192 | sendButton->setDisabled( true ); |
192 | 193 | ||
193 | if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) | 194 | if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) |
@@ -219,21 +220,22 @@ void SendWidget::toggle_receiver(QListViewItem* item) | |||
219 | { | 220 | { |
220 | // toggle the state of an individual receiver. | 221 | // toggle the state of an individual receiver. |
221 | if(item->pixmap(2)) | 222 | if(item->pixmap(2)) |
222 | item->setPixmap(2,QPixmap()); | 223 | item->setPixmap(2,QPixmap()); |
223 | else | 224 | else |
224 | item->setPixmap(2,Resource::loadPixmap("backup/check.png")); | 225 | item->setPixmap(2,Resource::loadPixmap("backup/check.png")); |
225 | } | 226 | } |
226 | 227 | ||
227 | 228 | ||
228 | void SendWidget::closeEvent( QCloseEvent* e) { | 229 | void SendWidget::closeEvent( QCloseEvent* e) { |
229 | e->accept(); // make sure | 230 | obexSendBase::closeEvent(e); |
230 | QTimer::singleShot(0, this, SLOT(userDone() ) ); | ||
231 | } | ||
232 | void SendWidget::userDone() { | ||
233 | QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()"); | 231 | QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()"); |
234 | QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()"); | 232 | QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()"); |
235 | emit done(); | ||
236 | } | 233 | } |
234 | |||
235 | void SendWidget::userDone() { | ||
236 | close(); | ||
237 | } | ||
238 | |||
237 | QString SendWidget::file()const { | 239 | QString SendWidget::file()const { |
238 | return m_file; | 240 | return m_file; |
239 | } | 241 | } |