summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 5d742b7..cc51405 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -70,25 +70,24 @@ namespace OpieTooth {
70 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 70 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
71 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 71 pal.setColor( QPalette::Active, QColorGroup::Button, col );
72 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 72 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
73 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 73 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
74 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 74 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
75 this->setPalette( pal ); 75 this->setPalette( pal );
76 76
77 setCaption( tr( "Bluetooth Manager" ) ); 77 setCaption( tr( "Bluetooth Manager" ) );
78 78
79 readConfig(); 79 readConfig();
80 initGui(); 80 initGui();
81 81
82
83 //TESTING 82 //TESTING
84 ListView2->setRootIsDecorated(true); 83 ListView2->setRootIsDecorated(true);
85 84
86 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); 85 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" );
87 topLV2->setPixmap( 1, onPix ); 86 topLV2->setPixmap( 1, onPix );
88 (void) new QListViewItem( topLV2, "Serial" ); 87 (void) new QListViewItem( topLV2, "Serial" );
89 (void) new QListViewItem( topLV2, "BlueNiC" ); 88 (void) new QListViewItem( topLV2, "BlueNiC" );
90 } 89 }
91 90
92 91
93 /** 92 /**
94 * Reads all options from the config file 93 * Reads all options from the config file
@@ -125,30 +124,43 @@ namespace OpieTooth {
125 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); 124 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan );
126} 125}
127 126
128 127
129 /** 128 /**
130 * Read the list of allready known devices 129 * Read the list of allready known devices
131 * 130 *
132 */ 131 */
133 void BlueBase::readSavedDevices() { 132 void BlueBase::readSavedDevices() {
134 133
135 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; 134 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>;
136 135
137 Config deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); 136 QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/");
137 // list of .conf files
138 QStringList devicesFileList = deviceListSave.entryList();
138 139
140 // cut .conf of to get the mac and also read the name entry in it.
139 141
140 // RemoteDevice *currentDevice = RemoteDevice( , ); 142 for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
141 //loadedDevices->append( currentDevice );
142 143
144 QString name;
145 QString mac;
146 qDebug((*it).latin1() );
147 Config conf((*it));
148 conf.setGroup("Info");
149 name = conf.readEntry("name", "Error");
150 qDebug("MAC: " + mac);
151 qDebug("NAME: " + name);
152 RemoteDevice currentDevice = RemoteDevice( mac , name );
153 loadedDevices->append( &currentDevice );
154 }
143 addSearchedDevices( *loadedDevices ); 155 addSearchedDevices( *loadedDevices );
144 } 156 }
145 157
146 /** 158 /**
147 * Write the list of allready known devices 159 * Write the list of allready known devices
148 * 160 *
149 */ 161 */
150 void BlueBase::writeSavedDevices() { 162 void BlueBase::writeSavedDevices() {
151 163
152 QListViewItemIterator it( ListView2 ); 164 QListViewItemIterator it( ListView2 );
153 165
154 for ( ; it.current(); ++it ) { 166 for ( ; it.current(); ++it ) {
@@ -182,46 +194,44 @@ namespace OpieTooth {
182 194
183 /** 195 /**
184 * Get the status informations and returns it 196 * Get the status informations and returns it
185 * @return QString the status informations gathered 197 * @return QString the status informations gathered
186 */ 198 */
187 QString BlueBase::getStatus(){ 199 QString BlueBase::getStatus(){
188 200
189 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 201 QString infoString = tr( "<b>Device name : </b> Ipaq" );
190 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 202 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
191 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 203 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
192 204
193 return (infoString); 205 return (infoString);
194
195 } 206 }
196 207
197 208
198 /** 209 /**
199 * Read the current values from the gui and invoke writeConfig() 210 * Read the current values from the gui and invoke writeConfig()
200 */ 211 */
201 void BlueBase::applyConfigChanges() { 212 void BlueBase::applyConfigChanges() {
202 213
203 deviceName = deviceNameLine->text(); 214 deviceName = deviceNameLine->text();
204 defaultPasskey = passkeyLine->text(); 215 defaultPasskey = passkeyLine->text();
205 useEncryption = cryptCheckBox->isChecked(); 216 useEncryption = cryptCheckBox->isChecked();
206 enableAuthentification = authCheckBox->isChecked(); 217 enableAuthentification = authCheckBox->isChecked();
207 enablePagescan = pagescanCheckBox->isChecked(); 218 enablePagescan = pagescanCheckBox->isChecked();
208 enableInquiryscan = inquiryscanCheckBox->isChecked(); 219 enableInquiryscan = inquiryscanCheckBox->isChecked();
209 220
210 writeConfig(); 221 writeConfig();
211 222
212 QMessageBox* box = new QMessageBox( this, "Test" ); 223 QMessageBox* box = new QMessageBox( this, "Test" );
213 box->setText( tr( "Changes applied" ) ); 224 box->setText( tr( "Changes applied" ) );
214 box->show(); 225 box->show();
215
216 // falls nötig hcid killhupen - die funktionalität adden 226 // falls nötig hcid killhupen - die funktionalität adden
217 } 227 }
218 228
219 229
220 /** 230 /**
221 * Add fresh found devices from scan dialog to the listing 231 * Add fresh found devices from scan dialog to the listing
222 * 232 *
223 */ 233 */
224 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { 234 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) {
225 235
226 QListViewItem * deviceItem; 236 QListViewItem * deviceItem;
227 237
@@ -252,25 +262,24 @@ namespace OpieTooth {
252 * Action that is toggled on entrys on click 262 * Action that is toggled on entrys on click
253 */ 263 */
254 void BlueBase::startServiceActionClicked( QListViewItem *item ) { 264 void BlueBase::startServiceActionClicked( QListViewItem *item ) {
255 265
256 266
257 } 267 }
258 268
259 /** 269 /**
260 * Action that are toggled on hold (mostly QPopups i guess) 270 * Action that are toggled on hold (mostly QPopups i guess)
261 */ 271 */
262 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { 272 void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) {
263 273
264
265 } 274 }
266 275
267 /** 276 /**
268 * Search and display avail. services for a device (on expand from device listing) 277 * Search and display avail. services for a device (on expand from device listing)
269 * 278 *
270 */ 279 */
271 void BlueBase::addServicesToDevice( QListViewItem * item ) { 280 void BlueBase::addServicesToDevice( QListViewItem * item ) {
272 281
273 qDebug("addServicesToDevice"); 282 qDebug("addServicesToDevice");
274 // row of mac adress 283 // row of mac adress
275 RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) ); 284 RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) );
276 285
@@ -296,26 +305,24 @@ namespace OpieTooth {
296 QMap<QString,QListViewItem*>::Iterator it; 305 QMap<QString,QListViewItem*>::Iterator it;
297 306
298 QListViewItem* deviceItem; 307 QListViewItem* deviceItem;
299 308
300 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 309 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
301 if ( it.key() == device ) { 310 if ( it.key() == device ) {
302 deviceItem = it.data(); 311 deviceItem = it.data();
303 } 312 }
304 } 313 }
305 314
306 QValueList<OpieTooth::Services>::Iterator it2; 315 QValueList<OpieTooth::Services>::Iterator it2;
307 316
308
309
310 QListViewItem * serviceItem; 317 QListViewItem * serviceItem;
311 318
312 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 319 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
313 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); 320 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() );
314 } 321 }
315 } 322 }
316 323
317 324
318 /** 325 /**
319 * Add the existing connections (pairs) to the connections tab. 326 * Add the existing connections (pairs) to the connections tab.
320 * 327 *
321 */ 328 */
@@ -323,25 +330,24 @@ namespace OpieTooth {
323 330
324 331
325 //mac address 332 //mac address
326 333
327 } 334 }
328 335
329 /** 336 /**
330 * Find out if a device can currently be reached 337 * Find out if a device can currently be reached
331 */ 338 */
332 bool BlueBase::deviceActive( RemoteDevice *device ) { 339 bool BlueBase::deviceActive( RemoteDevice *device ) {
333 340
334 // search by mac 341 // search by mac
335 //
336 localDevice->isAvailable( device->mac() ); 342 localDevice->isAvailable( device->mac() );
337 343
338 return true; 344 return true;
339 } 345 }
340 346
341 347
342 /** 348 /**
343 * Open the "scan for devices" dialog 349 * Open the "scan for devices" dialog
344 */ 350 */
345 void BlueBase::startScan() { 351 void BlueBase::startScan() {
346 352
347 ScanDialog *scan = new ScanDialog( this, "", true); 353 ScanDialog *scan = new ScanDialog( this, "", true);
@@ -356,15 +362,14 @@ namespace OpieTooth {
356 * Set the informations about the local device in information Tab 362 * Set the informations about the local device in information Tab
357 */ 363 */
358 void BlueBase::setInfo() { 364 void BlueBase::setInfo() {
359 StatusLabel->setText( getStatus() ); 365 StatusLabel->setText( getStatus() );
360 } 366 }
361 367
362 /** 368 /**
363 * Decontructor 369 * Decontructor
364 */ 370 */
365 BlueBase::~BlueBase() { 371 BlueBase::~BlueBase() {
366 writeSavedDevices(); 372 writeSavedDevices();
367 } 373 }
368
369} 374}
370 375