summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-23 20:07:29 (UTC)
committer harlekin <harlekin>2002-06-23 20:07:29 (UTC)
commit7b861d2f14bdb50558863354522dee7c7a9ef34d (patch) (unidiff)
treebb7633ab55e6564f47e9fd16321fa5841c055671
parented7e4fe3f0f838957c0830b8357d2252327dc938 (diff)
downloadopie-7b861d2f14bdb50558863354522dee7c7a9ef34d.zip
opie-7b861d2f14bdb50558863354522dee7c7a9ef34d.tar.gz
opie-7b861d2f14bdb50558863354522dee7c7a9ef34d.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp8
-rw-r--r--noncore/net/opietooth/manager/bluebase.h2
-rw-r--r--noncore/net/opietooth/manager/btlistitem.cpp11
-rw-r--r--noncore/net/opietooth/manager/btlistitem.h6
-rw-r--r--noncore/net/opietooth/manager/manager.pro4
5 files changed, 17 insertions, 14 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 772dbd1..77eb62b 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,430 +1,434 @@
1/* 1/*
2 * bluebase.cpp * 2 * bluebase.cpp *
3 * --------------------- 3 * ---------------------
4 * 4 *
5 * copyright : (c) 2002 by Maximilian Reiß 5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : max.reiss@gmx.de 6 * email : max.reiss@gmx.de
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "bluebase.h" 18#include "bluebase.h"
19#include "scandialog.h" 19#include "scandialog.h"
20 20
21#include <qframe.h> 21#include <qframe.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qvariant.h> 25#include <qvariant.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qimage.h> 27#include <qimage.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qscrollview.h> 30#include <qscrollview.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qlistview.h> 36#include <qlistview.h>
37#include <qdir.h> 37#include <qdir.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39 39
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/config.h> 41#include <qpe/config.h>
42 42
43#include <remotedevice.h> 43#include <remotedevice.h>
44 44
45 45
46namespace OpieTooth { 46namespace OpieTooth {
47 47
48 48
49 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 49 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
50 : BluetoothBase( parent, name, fl ) { 50 : BluetoothBase( parent, name, fl ) {
51 51
52 localDevice = new Manager( "hci0" ); 52 localDevice = new Manager( "hci0" );
53 53
54 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 54 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
55 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 55 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
56 // not good since lib is async 56 // not good since lib is async
57 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 57 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
58 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 58 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
59 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 59 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
60 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 60 this, SLOT( startServiceActionClicked( QListViewItem* ) ) );
61 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 61 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ),
62 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); 62 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) );
63 connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 63 connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
64 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 64 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
65 65 // connect( localDevice, SIGNAL( available( const QString& device, bool connected ) ),
66 // this, SLOT() );
66 67
67 //Load all icons needed 68 //Load all icons needed
68 69
69 offPix = Resource::loadPixmap( "editdelete" ); 70 offPix = Resource::loadPixmap( "editdelete" );
70 onPix = Resource::loadPixmap( "installed" ); 71 onPix = Resource::loadPixmap( "installed" );
71 72
72 QPalette pal = this->palette(); 73 QPalette pal = this->palette();
73 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 74 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
74 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 75 pal.setColor( QPalette::Active, QColorGroup::Button, col );
75 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 76 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
76 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 77 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
77 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 78 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
78 this->setPalette( pal ); 79 this->setPalette( pal );
79 80
80 setCaption( tr( "Bluetooth Manager" ) ); 81 setCaption( tr( "Bluetooth Manager" ) );
81 82
82 readConfig(); 83 readConfig();
83 initGui(); 84 initGui();
84 85
85 //TESTING 86 //TESTING
86 ListView2->setRootIsDecorated(true); 87 ListView2->setRootIsDecorated(true);
87 88
88 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); 89 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" );
89 topLV2->setPixmap( 1, onPix ); 90 topLV2->setPixmap( 1, onPix );
90 topLV2->setText(4, "device" ); 91 topLV2->setText(4, "device" );
91 (void) new QListViewItem( topLV2, "Serial" ); 92 (void) new QListViewItem( topLV2, "Serial" );
92 (void) new QListViewItem( topLV2, "BlueNiC" ); 93 (void) new QListViewItem( topLV2, "BlueNiC" );
93 } 94 }
94 95
95 96
96 /** 97 /**
97 * Reads all options from the config file 98 * Reads all options from the config file
98 */ 99 */
99 void BlueBase::readConfig() { 100 void BlueBase::readConfig() {
100 101
101 Config cfg( "bluetoothmanager" ); 102 Config cfg( "bluetoothmanager" );
102 cfg.setGroup( "bluezsettings" ); 103 cfg.setGroup( "bluezsettings" );
103 104
104 105
105 deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 106 deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
106 defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 107 defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
107 useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); 108 useEncryption = cfg.readNumEntry( "useEncryption" , 1 );
108 enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); 109 enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 );
109 enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); 110 enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 );
110 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); 111 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 );
111 112
112 } 113 }
113 114
114 /** 115 /**
115 * Writes all options to the config file 116 * Writes all options to the config file
116 */ 117 */
117 void BlueBase::writeConfig() { 118 void BlueBase::writeConfig() {
118 119
119 120
120 Config cfg( "bluetoothmanager" ); 121 Config cfg( "bluetoothmanager" );
121 cfg.setGroup( "bluezsettings" ); 122 cfg.setGroup( "bluezsettings" );
122 123
123 cfg.writeEntry( "name" , deviceName ); 124 cfg.writeEntry( "name" , deviceName );
124 cfg.writeEntryCrypt( "passkey" , defaultPasskey ); 125 cfg.writeEntryCrypt( "passkey" , defaultPasskey );
125 cfg.writeEntry( "useEncryption" , useEncryption ); 126 cfg.writeEntry( "useEncryption" , useEncryption );
126 cfg.writeEntry( "enableAuthentification" , enableAuthentification ); 127 cfg.writeEntry( "enableAuthentification" , enableAuthentification );
127 cfg.writeEntry( "enablePagescan" , enablePagescan ); 128 cfg.writeEntry( "enablePagescan" , enablePagescan );
128 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); 129 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan );
129} 130}
130 131
131 132
132 /** 133 /**
133 * Read the list of allready known devices 134 * Read the list of allready known devices
134 * 135 *
135 */ 136 */
136 void BlueBase::readSavedDevices() { 137 void BlueBase::readSavedDevices() {
137 138
138 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; 139 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>;
139 140
140 QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); 141 QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/");
141 // list of .conf files 142 // list of .conf files
142 QStringList devicesFileList = deviceListSave.entryList(); 143 QStringList devicesFileList = deviceListSave.entryList();
143 144
144 // cut .conf of to get the mac and also read the name entry in it. 145 // cut .conf of to get the mac and also read the name entry in it.
145 146
146 for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { 147 for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
147 148
148 QString name; 149 QString name;
149 QString mac; 150 QString mac;
150 qDebug((*it).latin1() ); 151 qDebug((*it).latin1() );
151 Config conf((*it)); 152 Config conf((*it));
152 conf.setGroup("Info"); 153 conf.setGroup("Info");
153 name = conf.readEntry("name", "Error"); 154 name = conf.readEntry("name", "Error");
154 qDebug("MAC: " + mac); 155 qDebug("MAC: " + mac);
155 qDebug("NAME: " + name); 156 qDebug("NAME: " + name);
156 RemoteDevice currentDevice = RemoteDevice( mac , name ); 157 RemoteDevice currentDevice = RemoteDevice( mac , name );
157 loadedDevices->append( &currentDevice ); 158 loadedDevices->append( &currentDevice );
158 } 159 }
159 addSearchedDevices( *loadedDevices ); 160 addSearchedDevices( *loadedDevices );
160 } 161 }
161 162
162 /** 163 /**
163 * Write the list of allready known devices 164 * Write the list of allready known devices
164 * 165 *
165 */ 166 */
166 void BlueBase::writeSavedDevices() { 167 void BlueBase::writeSavedDevices() {
167 168
168 QListViewItemIterator it( ListView2 ); 169 QListViewItemIterator it( ListView2 );
169 170
170 for ( ; it.current(); ++it ) { 171 for ( ; it.current(); ++it ) {
171 172
172 // seperate config file for each device, to store more information in future. 173 // seperate config file for each device, to store more information in future.
173 174
174 Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(3)) + ".conf", Config::File ); 175 Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(3)) + ".conf", Config::File );
175 conf.setGroup( "Info" ); 176 conf.setGroup( "Info" );
176 conf.writeEntry( "name", it.current()->text(0) ); 177 conf.writeEntry( "name", it.current()->text(0) );
177 } 178 }
178 } 179 }
179 180
180 181
181 /** 182 /**
182 * Set up the gui 183 * Set up the gui
183 */ 184 */
184 void BlueBase::initGui() { 185 void BlueBase::initGui() {
185 186
186 StatusLabel->setText( getStatus() ); // maybe move it to getStatus() 187 StatusLabel->setText( getStatus() ); // maybe move it to getStatus()
187 188
188 cryptCheckBox->setChecked( useEncryption ); 189 cryptCheckBox->setChecked( useEncryption );
189 authCheckBox->setChecked( enableAuthentification ); 190 authCheckBox->setChecked( enableAuthentification );
190 pagescanCheckBox->setChecked( enablePagescan ); 191 pagescanCheckBox->setChecked( enablePagescan );
191 inquiryscanCheckBox->setChecked( enableInquiryscan ); 192 inquiryscanCheckBox->setChecked( enableInquiryscan );
192 deviceNameLine->setText( deviceName ); 193 deviceNameLine->setText( deviceName );
193 passkeyLine->setText( defaultPasskey ); 194 passkeyLine->setText( defaultPasskey );
194 // set info tab 195 // set info tab
195 setInfo(); 196 setInfo();
196 } 197 }
197 198
198 199
199 /** 200 /**
200 * Get the status informations and returns it 201 * Get the status informations and returns it
201 * @return QString the status informations gathered 202 * @return QString the status informations gathered
202 */ 203 */
203 QString BlueBase::getStatus(){ 204 QString BlueBase::getStatus(){
204 205
205 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 206 QString infoString = tr( "<b>Device name : </b> Ipaq" );
206 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 207 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
207 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 208 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
208 209
209 return (infoString); 210 return (infoString);
210 } 211 }
211 212
212 213
213 /** 214 /**
214 * Read the current values from the gui and invoke writeConfig() 215 * Read the current values from the gui and invoke writeConfig()
215 */ 216 */
216 void BlueBase::applyConfigChanges() { 217 void BlueBase::applyConfigChanges() {
217 218
218 deviceName = deviceNameLine->text(); 219 deviceName = deviceNameLine->text();
219 defaultPasskey = passkeyLine->text(); 220 defaultPasskey = passkeyLine->text();
220 useEncryption = cryptCheckBox->isChecked(); 221 useEncryption = cryptCheckBox->isChecked();
221 enableAuthentification = authCheckBox->isChecked(); 222 enableAuthentification = authCheckBox->isChecked();
222 enablePagescan = pagescanCheckBox->isChecked(); 223 enablePagescan = pagescanCheckBox->isChecked();
223 enableInquiryscan = inquiryscanCheckBox->isChecked(); 224 enableInquiryscan = inquiryscanCheckBox->isChecked();
224 225
225 writeConfig(); 226 writeConfig();
226 227
227 QMessageBox* box = new QMessageBox( this, "Test" ); 228 QMessageBox* box = new QMessageBox( this, "Test" );
228 box->setText( tr( "Changes applied" ) ); 229 box->setText( tr( "Changes applied" ) );
229 box->show(); 230 box->show();
230 // falls nötig hcid killhupen - die funktionalität adden 231 // falls nötig hcid killhupen - die funktionalität adden
231 } 232 }
232 233
233 234
234 /** 235 /**
235 * Add fresh found devices from scan dialog to the listing 236 * Add fresh found devices from scan dialog to the listing
236 * 237 *
237 */ 238 */
238 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { 239 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) {
239 240
240 QListViewItem * deviceItem; 241 QListViewItem * deviceItem;
241 242
242 QListIterator<RemoteDevice> it( newDevices ); 243 QListIterator<RemoteDevice> it( newDevices );
243 244
244 for( ; it.current() ; ++it ) { 245 for( ; it.current() ; ++it ) {
245 246
246 247
247 RemoteDevice *dev = it.current(); 248 RemoteDevice *dev = it.current();
248 deviceItem = new QListViewItem( ListView2 , dev->name() ); 249 deviceItem = new QListViewItem( ListView2 , dev->name() );
249 deviceItem->setExpandable ( true ); 250 deviceItem->setExpandable ( true );
250 251
251 if ( deviceActive( dev ) ) { 252 if ( deviceActive( dev ) ) {
252 deviceItem->setPixmap( 1 , onPix ); 253 deviceItem->setPixmap( 1 , onPix );
253 } else { 254 } else {
254 deviceItem->setPixmap( 1, offPix ); 255 deviceItem->setPixmap( 1, offPix );
255 } 256 }
256 257
257 deviceItem->setText( 3, dev->mac() ); 258 deviceItem->setText( 3, dev->mac() );
258 // what kind of entry is it. 259 // what kind of entry is it.
259 deviceItem->setText( 4, "device"); 260 deviceItem->setText( 4, "device");
260 261
261 // ggf auch hier? 262 // ggf auch hier?
262 addServicesToDevice( deviceItem ); 263 addServicesToDevice( deviceItem );
263 } 264 }
264 } 265 }
265 266
266 267
267 /** 268 /**
268 * Action that is toggled on entrys on click 269 * Action that is toggled on entrys on click
269 */ 270 */
270 void BlueBase::startServiceActionClicked( QListViewItem *item ) { 271 void BlueBase::startServiceActionClicked( QListViewItem *item ) {
271 272
272 273
273 } 274 }
274 275
275 /** 276 /**
276 * Action that are toggled on hold (mostly QPopups i guess) 277 * Action that are toggled on hold (mostly QPopups i guess)
277 */ 278 */
278 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { 279 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) {
279 280
280 QPopupMenu *menu = new QPopupMenu(); 281 QPopupMenu *menu = new QPopupMenu();
281 QPopupMenu *groups = new QPopupMenu(); 282 QPopupMenu *groups = new QPopupMenu();
282 int ret=0; 283 int ret=0;
283 284
284 //QSize s = menu->sizeHint ( ); 285 //QSize s = menu->sizeHint ( );
285 286
286 if ( item->text(4) == "device") { 287 if ( item->text(4) == "device") {
287 menu->insertItem( tr("rescan sevices:"), 0); 288 menu->insertItem( tr("rescan sevices:"), 0);
288 menu->insertItem( tr("to group"), groups , 1); 289 menu->insertItem( tr("to group"), groups , 1);
289 menu->insertItem( tr("delete"), 2); 290 menu->insertItem( tr("delete"), 2);
290 } else if ( item->text(4) == "service") { 291 } else if ( item->text(4) == "service") {
291 menu->insertItem( tr("Test1:"), 0); 292 menu->insertItem( tr("Test1:"), 0);
292 menu->insertItem( tr("connect"), 1); 293 menu->insertItem( tr("connect"), 1);
293 menu->insertItem( tr("delete"), 2); 294 menu->insertItem( tr("delete"), 2);
294 } 295 }
295 296
296 ret = menu->exec( point , 0); 297 ret = menu->exec( point , 0);
297 298
298// noch differenzieren 299// noch differenzieren
299 switch(ret) { 300 switch(ret) {
300 case 0: 301 case 0:
301 break; 302 break;
302 case 1: 303 case 1:
303 break; 304 break;
304 case 2: 305 case 2:
305 // delete childs too 306 // delete childs too
306 delete item; 307 delete item;
307 break; 308 break;
308 } 309 }
309 310
310 delete menu; 311 delete menu;
311 delete groups; 312 delete groups;
312 } 313 }
313 314
314 /** 315 /**
315 * Search and display avail. services for a device (on expand from device listing) 316 * Search and display avail. services for a device (on expand from device listing)
316 * 317 *
317 */ 318 */
318 void BlueBase::addServicesToDevice( QListViewItem * item ) { 319 void BlueBase::addServicesToDevice( QListViewItem * item ) {
319 320
320 qDebug("addServicesToDevice"); 321 qDebug("addServicesToDevice");
321 // row of mac adress text(3) 322 // row of mac adress text(3)
322 RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) ); 323 RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) );
323 324
324 deviceList.insert( item->text(3) , item ); 325 deviceList.insert( item->text(3) , item );
325 326
326 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 327 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
327 localDevice->searchServices( *device ); 328 localDevice->searchServices( *device );
328 329
329 // delete 330 // delete
330 } 331 }
331 332
332 333
333 /** 334 /**
334 * Overloaded. This one it the one that is connected to the foundServices signal 335 * Overloaded. This one it the one that is connected to the foundServices signal
335 * @param device the mac address of the remote device 336 * @param device the mac address of the remote device
336 * @param servicesList the list with the service the device has. 337 * @param servicesList the list with the service the device has.
337 */ 338 */
338 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 339 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
339 340
340 qDebug("fill services list"); 341 qDebug("fill services list");
341 342
342 QMap<QString,QListViewItem*>::Iterator it; 343 QMap<QString,QListViewItem*>::Iterator it;
343 344
344 QListViewItem* deviceItem; 345 QListViewItem* deviceItem;
345 346
346 // get the right devices which requested the search 347 // get the right devices which requested the search
347 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 348 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
348 if ( it.key() == device ) { 349 if ( it.key() == device ) {
349 deviceItem = it.data(); 350 deviceItem = it.data();
350 } 351 }
351 } 352 }
352 353
353 354
354 // empty entries 355 // empty entries
355 // QListViewItem * myChild = deviceItem->firstChild(); 356 // QListViewItem * myChild = deviceItem->firstChild();
356 //QList<QListViewItem*> tmpList; 357 //QList<QListViewItem*> tmpList;
357 //while( myChild ) { 358 //while( myChild ) {
358 // tmpList.append(myChild); 359 // tmpList.append(myChild);
359 // myChild = myChild->nextSibling(); 360 // myChild = myChild->nextSibling();
360 // } 361 // }
361 362
362 363
363 QValueList<OpieTooth::Services>::Iterator it2; 364 QValueList<OpieTooth::Services>::Iterator it2;
364 365
365 QListViewItem * serviceItem; 366 QListViewItem * serviceItem;
366 367
367 if (!servicesList.isEmpty() ) { 368 if (!servicesList.isEmpty() ) {
368 // add services 369 // add services
369 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 370 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
370 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); 371 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() );
371 serviceItem->setText(4, "service"); 372 serviceItem->setText(4, "service");
372 } 373 }
373 } else { 374 } else {
374 serviceItem = new QListViewItem( deviceItem , tr("no services found") ); 375 serviceItem = new QListViewItem( deviceItem , tr("no services found") );
375 serviceItem->setText(4, "service"); 376 serviceItem->setText(4, "service");
376 } 377 }
377 } 378 }
378 379
379 380
380 /** 381 /**
381 * Add the existing connections (pairs) to the connections tab. 382 * Add the existing connections (pairs) to the connections tab.
382 * 383 *
383 */ 384 */
384 void BlueBase::addConnectedDevices() { 385 void BlueBase::addConnectedDevices() {
385 386
386 387
387 //mac address 388 //mac address
388 389
389 } 390 }
390 391
391 /** 392 /**
392 * Find out if a device can currently be reached 393 * Find out if a device can currently be reached
393 */ 394 */
394 bool BlueBase::deviceActive( RemoteDevice *device ) { 395 bool BlueBase::deviceActive( RemoteDevice *device ) {
395 396
396 // search by mac 397 // search by mac
397 localDevice->isAvailable( device->mac() ); 398 localDevice->isAvailable( device->mac() );
398 399
399 return true; 400 return true;
400 } 401 }
401 402
402 403
404
405
406
403 /** 407 /**
404 * Open the "scan for devices" dialog 408 * Open the "scan for devices" dialog
405 */ 409 */
406 void BlueBase::startScan() { 410 void BlueBase::startScan() {
407 411
408 ScanDialog *scan = new ScanDialog( this, "", true); 412 ScanDialog *scan = new ScanDialog( this, "", true);
409 QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ), 413 QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ),
410 this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) ); 414 this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) );
411 415
412 scan->showMaximized(); 416 scan->showMaximized();
413 } 417 }
414 418
415 419
416 /** 420 /**
417 * Set the informations about the local device in information Tab 421 * Set the informations about the local device in information Tab
418 */ 422 */
419 void BlueBase::setInfo() { 423 void BlueBase::setInfo() {
420 StatusLabel->setText( getStatus() ); 424 StatusLabel->setText( getStatus() );
421 } 425 }
422 426
423 /** 427 /**
424 * Decontructor 428 * Decontructor
425 */ 429 */
426 BlueBase::~BlueBase() { 430 BlueBase::~BlueBase() {
427 writeSavedDevices(); 431 writeSavedDevices();
428 } 432 }
429} 433}
430 434
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index bc48bb3..dee721d 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -1,81 +1,79 @@
1 1
2#ifndef BLUEBASE_H 2#ifndef BLUEBASE_H
3#define BLUEBASE_H 3#define BLUEBASE_H
4 4
5#include <qvariant.h> 5#include <qvariant.h>
6#include <qwidget.h> 6#include <qwidget.h>
7#include <qscrollview.h> 7#include <qscrollview.h>
8#include <qsplitter.h> 8#include <qsplitter.h>
9#include <qlist.h> 9#include <qlist.h>
10#include <qpixmap.h> 10#include <qpixmap.h>
11 11
12#include "bluetoothbase.h" 12#include "bluetoothbase.h"
13 13
14 14
15#include <remotedevice.h> 15#include <remotedevice.h>
16#include <manager.h> 16#include <manager.h>
17 17
18class QVBox; 18class QVBox;
19class QHBoxLayout; 19class QHBoxLayout;
20class QGridLayout; 20class QGridLayout;
21class QFrame; 21class QFrame;
22class QLabel; 22class QLabel;
23class QPushButton; 23class QPushButton;
24class QTabWidget; 24class QTabWidget;
25class QCheckBox; 25class QCheckBox;
26 26
27 27
28namespace OpieTooth { 28namespace OpieTooth {
29 29
30
31
32 class BlueBase : public BluetoothBase { 30 class BlueBase : public BluetoothBase {
33 Q_OBJECT 31 Q_OBJECT
34 32
35 public: 33 public:
36 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 34 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
37 ~BlueBase(); 35 ~BlueBase();
38 36
39 protected: 37 protected:
40 38
41 39
42 private slots: 40 private slots:
43 void startScan(); 41 void startScan();
44 42
45 private: 43 private:
46 void readConfig(); 44 void readConfig();
47 void writeConfig(); 45 void writeConfig();
48 void readSavedDevices(); 46 void readSavedDevices();
49 void writeSavedDevices(); 47 void writeSavedDevices();
50 QString getStatus(); 48 QString getStatus();
51 void initGui(); 49 void initGui();
52 void setInfo(); 50 void setInfo();
53 Manager *localDevice; 51 Manager *localDevice;
54 QMap<QString,QListViewItem*> deviceList; 52 QMap<QString,QListViewItem*> deviceList;
55 53
56 bool deviceActive( RemoteDevice *device ); 54 bool deviceActive( RemoteDevice *device );
57 55
58 QString deviceName; 56 QString deviceName;
59 QString defaultPasskey; 57 QString defaultPasskey;
60 int useEncryption; 58 int useEncryption;
61 int enableAuthentification; 59 int enableAuthentification;
62 int enablePagescan; 60 int enablePagescan;
63 int enableInquiryscan; 61 int enableInquiryscan;
64 62
65 QPixmap offPix; 63 QPixmap offPix;
66 QPixmap onPix; 64 QPixmap onPix;
67 65
68 private slots: 66 private slots:
69 void addSearchedDevices( QList<RemoteDevice> &newDevices ); 67 void addSearchedDevices( QList<RemoteDevice> &newDevices );
70 void addServicesToDevice( QListViewItem *item ); 68 void addServicesToDevice( QListViewItem *item );
71 void addServicesToDevice( const QString& device, Services::ValueList ); 69 void addServicesToDevice( const QString& device, Services::ValueList );
72 void addConnectedDevices(); 70 void addConnectedDevices();
73 void startServiceActionClicked( QListViewItem *item ); 71 void startServiceActionClicked( QListViewItem *item );
74 void startServiceActionHold( QListViewItem *, const QPoint &, int ); 72 void startServiceActionHold( QListViewItem *, const QPoint &, int );
75 void applyConfigChanges(); 73 void applyConfigChanges();
76 74
77 }; 75 };
78 76
79} 77}
80 78
81#endif 79#endif
diff --git a/noncore/net/opietooth/manager/btlistitem.cpp b/noncore/net/opietooth/manager/btlistitem.cpp
index 4901710..19d1057 100644
--- a/noncore/net/opietooth/manager/btlistitem.cpp
+++ b/noncore/net/opietooth/manager/btlistitem.cpp
@@ -1,30 +1,33 @@
1 1
2#include "btlistitem.h" 2#include "btlistitem.h"
3 3
4namespace OpieTooth { 4namespace OpieTooth {
5 5
6 6
7 BTListItem::BTListItem( QListView * parent ) : QListViewItem( parent ) { 7 BTListItem::BTListItem( QListView * parent ) : QListViewItem( parent ) {
8 8
9 } 9 }
10 10
11 BTListItem::BTListItem( QListViewItem * parent ) : QListViewItem( parent ) { 11 BTListItem::BTListItem( QListViewItem * parent ) : QListViewItem( parent ) {
12 12
13 } 13 }
14 14
15 15
16 // name, and then mac and then servicetype 16 // name, and then mac and then servicetype
17 BTListItem::BTListItem( QListView * parent, QString name , QString mac, QString type ) 17 BTListItem::BTListItem( QListView * parent, QString name , QString mac, QString type )
18 : QListViewItem( parent, name, mac, type ){ 18 : QListViewItem( parent, name ){
19 setText(4, mac);
20 setText(5, type);
19 21
20 } 22 }
21 23
22 BTListItem::BTListItem( QListViewItem * parent , QString name, QString mac, QString type ) 24 BTListItem::BTListItem( QListViewItem * parent , QString name, QString mac, QString type )
23 : QListViewItem( parent, name, mac, type ){ 25 : QListViewItem( parent, name ){
24 26 setText(4, mac);
27 setText(5, type);
25 } 28 }
26 29
27 BTListItem::~BTListItem() { 30 BTListItem::~BTListItem() {
28 } 31 }
29 32
30} 33};
diff --git a/noncore/net/opietooth/manager/btlistitem.h b/noncore/net/opietooth/manager/btlistitem.h
index 28612b0..92b3803 100644
--- a/noncore/net/opietooth/manager/btlistitem.h
+++ b/noncore/net/opietooth/manager/btlistitem.h
@@ -1,24 +1,22 @@
1#ifndef BTLISTITEM_H 1#ifndef BTLISTITEM_H
2#define BTLISTITEM_H 2#define BTLISTITEM_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5 5
6namespace OpieTooth { 6namespace OpieTooth {
7 7
8 class BTListItem : public QListViewItem { 8 class BTListItem : public QListViewItem {
9 Q_OBJECT
10 9
11 public: 10 public:
12
13 BTListItem( QListView * parent ); 11 BTListItem( QListView * parent );
14 BTListItem( QListViewItem * parent ); 12 BTListItem( QListViewItem * parent );
15 13
16 // name, and then mac and then servicetype 14 // name, and then mac and then servicetype
17 BTListItem( QListView * , QString, QString, QString ); 15 BTListItem( QListView * , QString, QString, QString );
18 BTListItem( QListViewItem * parent , QString, QString , QString ); 16 BTListItem( QListViewItem * parent , QString, QString , QString );
19 ~BTListItem(); 17 ~BTListItem();
20 18
21 } 19 };
22} 20};
23 21
24#endif 22#endif
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 1d86684..3754869 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,12 +1,12 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on debug 2CONFIG = qt warn_on debug
3#CONFIG = qt warn_on release 3#CONFIG = qt warn_on release
4HEADERS = bluebase.h scandialog.h 4HEADERS = bluebase.h scandialog.h btlistitem.h
5SOURCES = main.cpp bluebase.cpp scandialog.cpp 5SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 7INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopietooth -lopie 9LIBS += -lqpe -lopietooth -lopie
10INTERFACES = bluetoothbase.ui devicedialog.ui 10INTERFACES = bluetoothbase.ui devicedialog.ui
11TARGET = $(OPIEDIR)/bin/bluetooth-manager 11TARGET = $(OPIEDIR)/bin/bluetooth-manager
12 12