summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-19 22:24:52 (UTC)
committer harlekin <harlekin>2002-06-19 22:24:52 (UTC)
commit3cff4da41a61679e0222be190af8a98682f07393 (patch) (unidiff)
tree6b791ffc929c1347826b949935d37e046e8a9930
parent6afbacb8353e539b9e6d279d20220445614b42c2 (diff)
downloadopie-3cff4da41a61679e0222be190af8a98682f07393.zip
opie-3cff4da41a61679e0222be190af8a98682f07393.tar.gz
opie-3cff4da41a61679e0222be190af8a98682f07393.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp29
-rw-r--r--noncore/net/opietooth/manager/bluebase.h8
2 files changed, 20 insertions, 17 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index c7e1fe4..6328b59 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -41,34 +41,33 @@
41 41
42#include <remotedevice.h> 42#include <remotedevice.h>
43 43
44 44
45namespace OpieTooth { 45namespace OpieTooth {
46 46
47 47
48 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 48 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
49 : BluetoothBase( parent, name, fl ) { 49 : BluetoothBase( parent, name, fl ) {
50 50
51 localDevice = new Manager( "hci0" ); 51 localDevice = new Manager( "hci0" );
52 52
53 QObject::connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 53 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
54 QObject::connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 54 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
55 QObject::connect( ListView2, SIGNAL( expanded( QListViewItem * item ) ), 55 connect( ListView2, SIGNAL( expanded ( QListViewItem *item ) ),
56 this, SLOT( addServicesToDevice( QListViewItem * item ) ) ); 56 this, SLOT( addServicesToDevice( QListViewItem *item ) ) );
57 QObject::connect( ListView2, SIGNAL( clicked( QListViewItem * )), 57 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
58 this, SLOT( startServiceActionClicked( QListViewItem * item ) ) ); 58 this, SLOT( startServiceActionClicked( QListViewItem *item ) ) );
59 connect( localDevice, SIGNAL( foundServices( const QString& device, Services::ValueList ) ), 59 connect( localDevice, SIGNAL( foundServices( const QString& device, Services::ValueList ) ),
60 this, SLOT( addServicesToDevice( const QString& device, Services::ValueList ) ) ); 60 this, SLOT( addServicesToDevice( const QString& device, Services::ValueList ) ) );
61 61
62 // QObject::connect( (QObject*) Manager, SIGNAL (foundServices( const QString& device, Services::ValueList ), this () ) );
63 62
64 //Load all icons needed 63 //Load all icons needed
65 64
66 65
67 QPixmap offPix = Resource::loadPixmap( "editdelete" ); 66 QPixmap offPix = Resource::loadPixmap( "editdelete" );
68 QPixmap onPix = Resource::loadPixmap( "installed" ); 67 QPixmap onPix = Resource::loadPixmap( "installed" );
69 68
70 QPalette pal = this->palette(); 69 QPalette pal = this->palette();
71 QColor col = pal.color(QPalette::Active, QColorGroup::Background); 70 QColor col = pal.color(QPalette::Active, QColorGroup::Background);
72 pal.setColor(QPalette::Active, QColorGroup::Button, col); 71 pal.setColor(QPalette::Active, QColorGroup::Button, col);
73 pal.setColor(QPalette::Inactive, QColorGroup::Button, col); 72 pal.setColor(QPalette::Inactive, QColorGroup::Button, col);
74 pal.setColor(QPalette::Normal, QColorGroup::Button, col); 73 pal.setColor(QPalette::Normal, QColorGroup::Button, col);
@@ -78,26 +77,26 @@ namespace OpieTooth {
78 setCaption( tr( "Bluetooth Manager" ) ); 77 setCaption( tr( "Bluetooth Manager" ) );
79 78
80 readConfig(); 79 readConfig();
81 initGui(); 80 initGui();
82 81
83 82
84 //TESTING 83 //TESTING
85 84
86 ListView2->setRootIsDecorated(true); 85 ListView2->setRootIsDecorated(true);
87 86
88 QListViewItem *topLV = new QListViewItem( ListView2, "Harlekins Dongle" , "yes"); 87 QListViewItem *topLV = new QListViewItem( ListView2, "Harlekins Dongle" , "yes");
89 topLV->setPixmap( 0, offPix ); 88 topLV->setPixmap( 0, offPix );
90 (void) new QListViewItem( topLV, "on" ); 89 // (void) new QListViewItem( topLV, "on" );
91 (void) new QListViewItem( topLV, "off" ); 90 //(void) new QListViewItem( topLV, "off" );
92 91
93 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); 92 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" );
94 topLV2->setPixmap( 0, onPix ); 93 topLV2->setPixmap( 0, onPix );
95 (void) new QListViewItem( topLV2, "on" ); 94 (void) new QListViewItem( topLV2, "on" );
96 (void) new QListViewItem( topLV2, "off" ); 95 (void) new QListViewItem( topLV2, "off" );
97 96
98 } 97 }
99 98
100 99
101 /** 100 /**
102 * Reads all options from the config file 101 * Reads all options from the config file
103 */ 102 */
@@ -230,33 +229,36 @@ namespace OpieTooth {
230 * 229 *
231 */ 230 */
232 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { 231 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) {
233 232
234 QListViewItem * deviceItem; 233 QListViewItem * deviceItem;
235 234
236 QListIterator<RemoteDevice> it( newDevices ); 235 QListIterator<RemoteDevice> it( newDevices );
237 236
238 for( ; it.current() ; ++it ) { 237 for( ; it.current() ; ++it ) {
239 238
240 239
241 RemoteDevice *dev = it.current(); 240 RemoteDevice *dev = it.current();
242 deviceItem = new QListViewItem( ListView2, dev->name() ); 241 deviceItem = new QListViewItem( ListView2 , dev->name() );
243 242
244 if ( deviceActive( dev ) ) { 243 if ( deviceActive( dev ) ) {
245 deviceItem->setPixmap( 1 , onPix ); 244 deviceItem->setPixmap( 1 , onPix );
246 } else { 245 } else {
247 deviceItem->setPixmap( 1, offPix ); 246 deviceItem->setPixmap( 1, offPix );
248 } 247 }
249 248
250 deviceItem->setText( 3, dev->mac() ); 249 deviceItem->setText( 3, dev->mac() );
250
251 // ggf auch hier?
252 addServicesToDevice( deviceItem );
251 } 253 }
252 } 254 }
253 255
254 256
255 /* 257 /*
256 * Action that is toggled on entrys on click 258 * Action that is toggled on entrys on click
257 */ 259 */
258 void BlueBase::startServiceActionClicked( QListViewItem * item ) { 260 void BlueBase::startServiceActionClicked( QListViewItem * item ) {
259 261
260 262
261 } 263 }
262 264
@@ -265,24 +267,25 @@ namespace OpieTooth {
265 */ 267 */
266 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { 268 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) {
267 269
268 270
269 } 271 }
270 272
271 /* 273 /*
272 * Search and display avail. services for a device (on expand from device listing) 274 * Search and display avail. services for a device (on expand from device listing)
273 * 275 *
274 */ 276 */
275 void BlueBase::addServicesToDevice( QListViewItem * item ) { 277 void BlueBase::addServicesToDevice( QListViewItem * item ) {
276 278
279 qDebug("addServicesToDevice");
277 // row of mac adress 280 // row of mac adress
278 RemoteDevice *device = new RemoteDevice(item->text(3), item->text(0)); 281 RemoteDevice *device = new RemoteDevice(item->text(3), item->text(0));
279 282
280 deviceList.insert( item->text(3) , item ); 283 deviceList.insert( item->text(3) , item );
281 284
282// and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 285// and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
283 localDevice->searchServices( *device ); 286 localDevice->searchServices( *device );
284 287
285 // delete 288 // delete
286 } 289 }
287 290
288 291
@@ -304,26 +307,26 @@ namespace OpieTooth {
304 if (it.key() == device ) { 307 if (it.key() == device ) {
305 deviceItem = it.data(); 308 deviceItem = it.data();
306 } 309 }
307 } 310 }
308 311
309 QValueList<OpieTooth::Services>::Iterator it2; 312 QValueList<OpieTooth::Services>::Iterator it2;
310 313
311 314
312 315
313 QListViewItem * serviceItem; 316 QListViewItem * serviceItem;
314 317
315 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 318 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
316 it2.serviceName() 319// it2.serviceName()
317 serviceItem = new QListViewItem( deviceItem , it2.serviceName() ); 320 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() );
318 } 321 }
319 322
320 } 323 }
321 324
322 325
323 /* 326 /*
324 * Find out if a device can currently be reached 327 * Find out if a device can currently be reached
325 */ 328 */
326 bool BlueBase::deviceActive( RemoteDevice *device ) { 329 bool BlueBase::deviceActive( RemoteDevice *device ) {
327 return true; 330 return true;
328 } 331 }
329 332
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index dcb7681..d20d05c 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -56,25 +56,25 @@ namespace OpieTooth {
56 bool deviceActive( RemoteDevice *device ); 56 bool deviceActive( RemoteDevice *device );
57 57
58 QString deviceName; 58 QString deviceName;
59 QString defaultPasskey; 59 QString defaultPasskey;
60 int useEncryption; 60 int useEncryption;
61 int enableAuthentification; 61 int enableAuthentification;
62 int enablePagescan; 62 int enablePagescan;
63 int enableInquiryscan; 63 int enableInquiryscan;
64 64
65 QPixmap offPix; 65 QPixmap offPix;
66 QPixmap onPix; 66 QPixmap onPix;
67 67
68 private slots: 68 public slots:
69 void addSearchedDevices( QList<RemoteDevice> &newDevices ); 69 void addSearchedDevices( QList<RemoteDevice> &newDevices );
70 void addServicesToDevice( QListViewItem * item ); 70 void addServicesToDevice( QListViewItem *item );
71 void addServicesToDevice( const QString& device, Services::ValueList ); 71 void addServicesToDevice( const QString& device, Services::ValueList );
72 void startServiceActionClicked( QListViewItem * item ); 72 void startServiceActionClicked( QListViewItem *item );
73 void startServiceActionHold( QListViewItem * item, const QPoint & point, int column); 73 void startServiceActionHold( QListViewItem *item, const QPoint &point, int column);
74 void applyConfigChanges(); 74 void applyConfigChanges();
75 75
76 }; 76 };
77 77
78} 78}
79 79
80#endif 80#endif