summaryrefslogtreecommitdiff
authorkorovkin <korovkin>2006-11-10 20:49:54 (UTC)
committer korovkin <korovkin>2006-11-10 20:49:54 (UTC)
commit961e5561b24452d9cfc2bf7400f6f5952b31431c (patch) (unidiff)
tree44439765333edad675966ce33f88427240cdbb0e
parentb742daec72bbef07039b785dcadca9dca9a0dc1c (diff)
downloadopie-961e5561b24452d9cfc2bf7400f6f5952b31431c.zip
opie-961e5561b24452d9cfc2bf7400f6f5952b31431c.tar.gz
opie-961e5561b24452d9cfc2bf7400f6f5952b31431c.tar.bz2
Made list of receivers loaded form files saved by bt-manager.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp53
-rw-r--r--core/obex/obexsend.h3
2 files changed, 52 insertions, 4 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 5c177e3..bca6784 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -9,2 +9,3 @@
9using namespace OpieObex; 9using namespace OpieObex;
10using namespace OpieTooth;
10 11
@@ -15,2 +16,4 @@ using namespace OpieObex;
15#include <qpe/version.h> 16#include <qpe/version.h>
17#include <devicehandler.h>
18#include "remotedevice.h"
16 19
@@ -75,9 +78,9 @@ void SendWidget::send( const QString& file, const QString& desc ) {
75 fileToSend->setText(desc.isEmpty() ? file : desc ); 78 fileToSend->setText(desc.isEmpty() ? file : desc );
76 scan_for_receivers(); 79 read_receivers();
77} 80}
78 81
79int SendWidget::addReceiver(const char *r, const char *icon) 82int SendWidget::addReceiver(const QString& str, const char *icon)
80{ 83{
81 QListViewItem * item = new QListViewItem( receiverList, 0 ); 84 QListViewItem * item = new QListViewItem( receiverList, 0 );
82 item->setText( 0, r); 85 item->setText( 0, str );
83 item->setPixmap( 1, OResource::loadPixmap( icon ) ); 86 item->setPixmap( 1, OResource::loadPixmap( icon ) );
@@ -196,2 +199,46 @@ void SendWidget::send_to_receivers() {
196 199
200/**
201 * Read receivers saved by bluetooth manager
202 */
203void SendWidget::read_receivers()
204{
205 QValueList<RemoteDevice> devices;
206 DeviceHandler handler;
207 QValueList<RemoteDevice>::ConstIterator it;
208
209 receiverList->clear();
210 receivers.clear();
211 sendButton->setDisabled( true );
212
213 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") )
214 {
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();
232 for( it = devices.begin(); it != devices.end() ; ++it )
233 {
234 int id = addReceiver((*it).name(), "obex/bt.png");
235 m_bt.insert(id, Pair((*it).name(), (*it).mac()));
236 }
237 btStatus->setText(tr("ready."));
238 m_btIt = m_bt.begin();
239 sendButton->setEnabled( true );
240 }
241}
242
243
197void SendWidget::scan_for_receivers() 244void SendWidget::scan_for_receivers()
diff --git a/core/obex/obexsend.h b/core/obex/obexsend.h
index 030e180..f9ba340 100644
--- a/core/obex/obexsend.h
+++ b/core/obex/obexsend.h
@@ -46,2 +46,3 @@ namespace OpieObex {
46 void closeEvent( QCloseEvent* ); 46 void closeEvent( QCloseEvent* );
47 void read_receivers();
47 48
@@ -81,3 +82,3 @@ namespace OpieObex {
81 void initUI(); 82 void initUI();
82 int addReceiver(const char *r, const char *icon); 83 int addReceiver(const QString& str, const char *icon);
83 void setReceiverStatus( int id, const QString& status ); 84 void setReceiverStatus( int id, const QString& status );