summaryrefslogtreecommitdiff
path: root/core
authorkorovkin <korovkin>2006-11-14 21:31:46 (UTC)
committer korovkin <korovkin>2006-11-14 21:31:46 (UTC)
commit9813113f0024205e09af9e54328287dd859fa2e8 (patch) (unidiff)
tree399134d6f3f601c9112df009bd4102751df24d1d /core
parent663a33f463ac184b10cb3adc354f62a6a5c3e2b0 (diff)
downloadopie-9813113f0024205e09af9e54328287dd859fa2e8.zip
opie-9813113f0024205e09af9e54328287dd859fa2e8.tar.gz
opie-9813113f0024205e09af9e54328287dd859fa2e8.tar.bz2
Clear both IRDA and BT lists at startup.
Enable IRDA and bluetooth at startup only. Move index to the beginning after send. Added status line change. Added checks for NULL pointers and empty list of bluetooth devices.
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp74
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
@@ -75,2 +75,3 @@ void SendWidget::send( const QString& file, const QString& desc ) {
75 m_irDa.clear(); 75 m_irDa.clear();
76 m_bt.clear();
76 m_start = 0; 77 m_start = 0;
@@ -78,2 +79,23 @@ void SendWidget::send( const QString& file, const QString& desc ) {
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();
@@ -87,4 +109,4 @@ int SendWidget::addReceiver(const QString& str, const char *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;
@@ -156,2 +178,3 @@ void SendWidget::slotStartIrda() {
156 irdaStatus->setText(tr("complete.")); 178 irdaStatus->setText(tr("complete."));
179 m_irDaIt = m_irDa.begin();
157 return; 180 return;
@@ -159,2 +182,3 @@ void SendWidget::slotStartIrda() {
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") );
@@ -184,2 +208,4 @@ 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()))
@@ -188,2 +214,3 @@ void SendWidget::slotStartBt() {
188 btStatus->setText(tr("complete.")); 214 btStatus->setText(tr("complete."));
215 m_btIt = m_bt.begin();
189 return; 216 return;
@@ -191,2 +218,3 @@ void SendWidget::slotStartBt() {
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() );
@@ -195,4 +223,4 @@ void SendWidget::slotStartBt() {
195void SendWidget::send_to_receivers() { 223void SendWidget::send_to_receivers() {
196 slotStartIrda();
197 slotStartBt(); 224 slotStartBt();
225 slotStartIrda();
198} 226}
@@ -211,21 +239,7 @@ void SendWidget::read_receivers()
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();
@@ -245,13 +259,10 @@ 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..."));
@@ -261,9 +272,4 @@ void SendWidget::scan_for_receivers()
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..."));
@@ -276,2 +282,4 @@ 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.