-rw-r--r-- | core/obex/obexsend.cpp | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp index bca6784..45754e3 100644 --- a/core/obex/obexsend.cpp +++ b/core/obex/obexsend.cpp | |||
@@ -74,7 +74,29 @@ void SendWidget::send( const QString& file, const QString& desc ) { | |||
74 | m_file = file; | 74 | m_file = file; |
75 | m_irDa.clear(); | 75 | m_irDa.clear(); |
76 | m_bt.clear(); | ||
76 | m_start = 0; | 77 | m_start = 0; |
77 | 78 | ||
78 | fileToSend->setText(desc.isEmpty() ? file : desc ); | 79 | fileToSend->setText(desc.isEmpty() ? file : desc ); |
80 | |||
81 | if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) | ||
82 | { | ||
83 | irdaStatus->setText(tr("not enabled.")); | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); | ||
88 | irdaStatus->setText(tr("ready")); | ||
89 | sendButton->setEnabled( true ); | ||
90 | } | ||
91 | if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) | ||
92 | { | ||
93 | btStatus->setText(tr("not enabled.")); | ||
94 | } | ||
95 | else | ||
96 | { | ||
97 | QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); | ||
98 | btStatus->setText(tr("ready.")); | ||
99 | sendButton->setEnabled( true ); | ||
100 | } | ||
79 | read_receivers(); | 101 | read_receivers(); |
80 | } | 102 | } |
@@ -86,6 +108,6 @@ int SendWidget::addReceiver(const QString& str, const char *icon) | |||
86 | item->setPixmap( 1, OResource::loadPixmap( icon ) ); | 108 | item->setPixmap( 1, OResource::loadPixmap( icon ) ); |
87 | 109 | ||
88 | int id=receivers.count(); | 110 | int id = receivers.count(); |
89 | receivers[id]=item; | 111 | receivers[id] = item; |
90 | return id; | 112 | return id; |
91 | } | 113 | } |
@@ -155,7 +177,9 @@ void SendWidget::slotStartIrda() { | |||
155 | if ( m_irDaIt == m_irDa.end() || !receiverSelected(m_irDaIt.key())) { | 177 | if ( m_irDaIt == m_irDa.end() || !receiverSelected(m_irDaIt.key())) { |
156 | irdaStatus->setText(tr("complete.")); | 178 | irdaStatus->setText(tr("complete.")); |
179 | m_irDaIt = m_irDa.begin(); | ||
157 | return; | 180 | return; |
158 | } | 181 | } |
159 | setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); | 182 | setReceiverStatus( m_irDaIt.key(), tr("Start sending") ); |
183 | irdaStatus->setText(tr("sending.")); | ||
160 | m_obex->send( m_file, tr("noaddress") ); | 184 | m_obex->send( m_file, tr("noaddress") ); |
161 | } | 185 | } |
@@ -183,17 +207,21 @@ void SendWidget::slotBtTry(unsigned int trI) { | |||
183 | void SendWidget::slotStartBt() { | 207 | void SendWidget::slotStartBt() { |
184 | // skip past unselected receivers | 208 | // skip past unselected receivers |
209 | if ( !m_bt.count() ) | ||
210 | return; | ||
185 | while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) | 211 | while((m_btIt != m_bt.end()) && !receiverSelected(m_btIt.key())) |
186 | ++m_btIt; | 212 | ++m_btIt; |
187 | if (m_btIt == m_bt.end() ) { | 213 | if (m_btIt == m_bt.end() ) { |
188 | btStatus->setText(tr("complete.")); | 214 | btStatus->setText(tr("complete.")); |
215 | m_btIt = m_bt.begin(); | ||
189 | return; | 216 | return; |
190 | } | 217 | } |
191 | setReceiverStatus( m_btIt.key(), tr("Start sending") ); | 218 | setReceiverStatus( m_btIt.key(), tr("Start sending") ); |
219 | btStatus->setText(tr("sending.")); | ||
192 | m_btobex->send( m_file, m_btIt.data().second() ); | 220 | m_btobex->send( m_file, m_btIt.data().second() ); |
193 | } | 221 | } |
194 | 222 | ||
195 | void SendWidget::send_to_receivers() { | 223 | void SendWidget::send_to_receivers() { |
196 | slotStartIrda(); | ||
197 | slotStartBt(); | 224 | slotStartBt(); |
225 | slotStartIrda(); | ||
198 | } | 226 | } |
199 | 227 | ||
@@ -210,23 +238,9 @@ void SendWidget::read_receivers() | |||
210 | receivers.clear(); | 238 | receivers.clear(); |
211 | sendButton->setDisabled( true ); | 239 | sendButton->setDisabled( true ); |
240 | btStatus->setText(tr("load.")); | ||
241 | m_bt.clear(); | ||
212 | 242 | ||
213 | if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) | 243 | if ( QCopChannel::isRegistered("QPE/Bluetooth") ) |
214 | { | 244 | { |
215 | irdaStatus->setText(tr("not enabled.")); | ||
216 | } | ||
217 | else | ||
218 | { | ||
219 | QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); | ||
220 | irdaStatus->setText(tr("ready")); | ||
221 | sendButton->setEnabled( true ); | ||
222 | } | ||
223 | if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) | ||
224 | { | ||
225 | btStatus->setText(tr("not enabled.")); | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); | ||
230 | |||
231 | devices = handler.load(); | 245 | devices = handler.load(); |
232 | for( it = devices.begin(); it != devices.end() ; ++it ) | 246 | for( it = devices.begin(); it != devices.end() ; ++it ) |
@@ -244,15 +258,12 @@ void SendWidget::read_receivers() | |||
244 | void SendWidget::scan_for_receivers() | 258 | void SendWidget::scan_for_receivers() |
245 | { | 259 | { |
260 | sendButton->setDisabled( true ); | ||
246 | receiverList->clear(); | 261 | receiverList->clear(); |
247 | receivers.clear(); | 262 | receivers.clear(); |
248 | sendButton->setDisabled( true ); | 263 | m_irDa.clear(); |
264 | m_bt.clear(); | ||
249 | 265 | ||
250 | if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) | 266 | if ( QCopChannel::isRegistered("QPE/IrDaApplet") ) |
251 | { | ||
252 | irdaStatus->setText(tr("not enabled.")); | ||
253 | } | ||
254 | else | ||
255 | { | 267 | { |
256 | QCopEnvelope e1("QPE/IrDaApplet", "enableIrda()"); | ||
257 | irdaStatus->setText(tr("searching...")); | 268 | irdaStatus->setText(tr("searching...")); |
258 | sendButton->setEnabled( true ); | 269 | sendButton->setEnabled( true ); |
@@ -260,11 +271,6 @@ void SendWidget::scan_for_receivers() | |||
260 | } | 271 | } |
261 | 272 | ||
262 | if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) | 273 | if ( QCopChannel::isRegistered("QPE/Bluetooth") ) |
263 | { | 274 | { |
264 | btStatus->setText(tr("not enabled.")); | ||
265 | } | ||
266 | else | ||
267 | { | ||
268 | QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); | ||
269 | btStatus->setText(tr("searching...")); | 275 | btStatus->setText(tr("searching...")); |
270 | sendButton->setEnabled( true ); | 276 | sendButton->setEnabled( true ); |
@@ -275,4 +281,6 @@ void SendWidget::scan_for_receivers() | |||
275 | void SendWidget::toggle_receiver(QListViewItem* item) | 281 | void SendWidget::toggle_receiver(QListViewItem* item) |
276 | { | 282 | { |
283 | if (!item) | ||
284 | return; | ||
277 | // toggle the state of an individual receiver. | 285 | // toggle the state of an individual receiver. |
278 | if (item->pixmap(2)) | 286 | if (item->pixmap(2)) |