author | harlekin <harlekin> | 2003-03-25 00:13:33 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-25 00:13:33 (UTC) |
commit | a70a56b2ec4a806e00a26c8768b9f3df7033e987 (patch) (unidiff) | |
tree | c0b811851694f4253c4cf323369f8034792ecf71 | |
parent | c80099645138ab1ab8ad542cbfce401bcc6d095c (diff) | |
download | opie-a70a56b2ec4a806e00a26c8768b9f3df7033e987.zip opie-a70a56b2ec4a806e00a26c8768b9f3df7033e987.tar.gz opie-a70a56b2ec4a806e00a26c8768b9f3df7033e987.tar.bz2 |
give me other popups then obex again .-|
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/panpopup.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 04fa117..935c11a 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -144,385 +144,385 @@ void BlueBase::writeConfig() { | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * Modify the hcid.conf file to our needs | 147 | * Modify the hcid.conf file to our needs |
148 | */ | 148 | */ |
149 | void BlueBase::writeToHciConfig() { | 149 | void BlueBase::writeToHciConfig() { |
150 | qWarning("writeToHciConfig"); | 150 | qWarning("writeToHciConfig"); |
151 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 151 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
152 | hciconf.load(); | 152 | hciconf.load(); |
153 | hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | 153 | hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); |
154 | hciconf.setName( m_deviceName ); | 154 | hciconf.setName( m_deviceName ); |
155 | hciconf.setEncrypt( m_useEncryption ); | 155 | hciconf.setEncrypt( m_useEncryption ); |
156 | hciconf.setAuth( m_enableAuthentification ); | 156 | hciconf.setAuth( m_enableAuthentification ); |
157 | hciconf.setPscan( m_enablePagescan ); | 157 | hciconf.setPscan( m_enablePagescan ); |
158 | hciconf.setIscan( m_enableInquiryscan ); | 158 | hciconf.setIscan( m_enableInquiryscan ); |
159 | hciconf.save(); | 159 | hciconf.save(); |
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Read the list of allready known devices | 164 | * Read the list of allready known devices |
165 | */ | 165 | */ |
166 | void BlueBase::readSavedDevices() { | 166 | void BlueBase::readSavedDevices() { |
167 | 167 | ||
168 | QValueList<RemoteDevice> loadedDevices; | 168 | QValueList<RemoteDevice> loadedDevices; |
169 | DeviceHandler handler; | 169 | DeviceHandler handler; |
170 | loadedDevices = handler.load(); | 170 | loadedDevices = handler.load(); |
171 | 171 | ||
172 | addSearchedDevices( loadedDevices ); | 172 | addSearchedDevices( loadedDevices ); |
173 | } | 173 | } |
174 | 174 | ||
175 | 175 | ||
176 | /** | 176 | /** |
177 | * Write the list of allready known devices | 177 | * Write the list of allready known devices |
178 | */ | 178 | */ |
179 | void BlueBase::writeSavedDevices() { | 179 | void BlueBase::writeSavedDevices() { |
180 | QListViewItemIterator it( ListView2 ); | 180 | QListViewItemIterator it( ListView2 ); |
181 | BTListItem* item; | 181 | BTListItem* item; |
182 | BTDeviceItem* device; | 182 | BTDeviceItem* device; |
183 | RemoteDevice::ValueList list; | 183 | RemoteDevice::ValueList list; |
184 | for ( ; it.current(); ++it ) { | 184 | for ( ; it.current(); ++it ) { |
185 | item = (BTListItem*)it.current(); | 185 | item = (BTListItem*)it.current(); |
186 | if(item->typeId() != BTListItem::Device ) | 186 | if(item->typeId() != BTListItem::Device ) |
187 | continue; | 187 | continue; |
188 | device = (BTDeviceItem*)item; | 188 | device = (BTDeviceItem*)item; |
189 | 189 | ||
190 | list.append( device->remoteDevice() ); | 190 | list.append( device->remoteDevice() ); |
191 | } | 191 | } |
192 | /* | 192 | /* |
193 | * if not empty save the List through DeviceHandler | 193 | * if not empty save the List through DeviceHandler |
194 | */ | 194 | */ |
195 | if ( list.isEmpty() ) | 195 | if ( list.isEmpty() ) |
196 | return; | 196 | return; |
197 | DeviceHandler handler; | 197 | DeviceHandler handler; |
198 | handler.save( list ); | 198 | handler.save( list ); |
199 | } | 199 | } |
200 | 200 | ||
201 | 201 | ||
202 | /** | 202 | /** |
203 | * Set up the gui | 203 | * Set up the gui |
204 | */ | 204 | */ |
205 | void BlueBase::initGui() { | 205 | void BlueBase::initGui() { |
206 | StatusLabel->setText( status() ); // maybe move it to getStatus() | 206 | StatusLabel->setText( status() ); // maybe move it to getStatus() |
207 | cryptCheckBox->setChecked( m_useEncryption ); | 207 | cryptCheckBox->setChecked( m_useEncryption ); |
208 | authCheckBox->setChecked( m_enableAuthentification ); | 208 | authCheckBox->setChecked( m_enableAuthentification ); |
209 | pagescanCheckBox->setChecked( m_enablePagescan ); | 209 | pagescanCheckBox->setChecked( m_enablePagescan ); |
210 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); | 210 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); |
211 | deviceNameLine->setText( m_deviceName ); | 211 | deviceNameLine->setText( m_deviceName ); |
212 | passkeyLine->setText( m_defaultPasskey ); | 212 | passkeyLine->setText( m_defaultPasskey ); |
213 | // set info tab | 213 | // set info tab |
214 | setInfo(); | 214 | setInfo(); |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | /** | 218 | /** |
219 | * Get the status informations and returns it | 219 | * Get the status informations and returns it |
220 | * @return QString the status informations gathered | 220 | * @return QString the status informations gathered |
221 | */ | 221 | */ |
222 | QString BlueBase::status()const{ | 222 | QString BlueBase::status()const{ |
223 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); | 223 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); |
224 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); | 224 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); |
225 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); | 225 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); |
226 | 226 | ||
227 | return (infoString); | 227 | return (infoString); |
228 | } | 228 | } |
229 | 229 | ||
230 | 230 | ||
231 | /** | 231 | /** |
232 | * Read the current values from the gui and invoke writeConfig() | 232 | * Read the current values from the gui and invoke writeConfig() |
233 | */ | 233 | */ |
234 | void BlueBase::applyConfigChanges() { | 234 | void BlueBase::applyConfigChanges() { |
235 | m_deviceName = deviceNameLine->text(); | 235 | m_deviceName = deviceNameLine->text(); |
236 | m_defaultPasskey = passkeyLine->text(); | 236 | m_defaultPasskey = passkeyLine->text(); |
237 | m_useEncryption = cryptCheckBox->isChecked(); | 237 | m_useEncryption = cryptCheckBox->isChecked(); |
238 | m_enableAuthentification = authCheckBox->isChecked(); | 238 | m_enableAuthentification = authCheckBox->isChecked(); |
239 | m_enablePagescan = pagescanCheckBox->isChecked(); | 239 | m_enablePagescan = pagescanCheckBox->isChecked(); |
240 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); | 240 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); |
241 | 241 | ||
242 | writeConfig(); | 242 | writeConfig(); |
243 | 243 | ||
244 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); | 244 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); |
245 | } | 245 | } |
246 | 246 | ||
247 | /** | 247 | /** |
248 | * Add fresh found devices from scan dialog to the listing | 248 | * Add fresh found devices from scan dialog to the listing |
249 | * | 249 | * |
250 | */ | 250 | */ |
251 | void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { | 251 | void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { |
252 | BTDeviceItem * deviceItem; | 252 | BTDeviceItem * deviceItem; |
253 | QValueList<RemoteDevice>::ConstIterator it; | 253 | QValueList<RemoteDevice>::ConstIterator it; |
254 | 254 | ||
255 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { | 255 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { |
256 | 256 | ||
257 | if (find( (*it) )) // is already inserted | 257 | if (find( (*it) )) // is already inserted |
258 | continue; | 258 | continue; |
259 | 259 | ||
260 | deviceItem = new BTDeviceItem( ListView2 , (*it) ); | 260 | deviceItem = new BTDeviceItem( ListView2 , (*it) ); |
261 | deviceItem->setPixmap( 1, m_findPix ); | 261 | deviceItem->setPixmap( 1, m_findPix ); |
262 | deviceItem->setExpandable ( true ); | 262 | deviceItem->setExpandable ( true ); |
263 | 263 | ||
264 | // look if device is avail. atm, async | 264 | // look if device is avail. atm, async |
265 | deviceActive( (*it) ); | 265 | deviceActive( (*it) ); |
266 | 266 | ||
267 | // ggf auch hier? | 267 | // ggf auch hier? |
268 | addServicesToDevice( deviceItem ); | 268 | addServicesToDevice( deviceItem ); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | /** | 273 | /** |
274 | * Action that is toggled on entrys on click | 274 | * Action that is toggled on entrys on click |
275 | */ | 275 | */ |
276 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { | 276 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | /** | 280 | /** |
281 | * Action that are toggled on hold (mostly QPopups i guess) | 281 | * Action that are toggled on hold (mostly QPopups i guess) |
282 | */ | 282 | */ |
283 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { | 283 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { |
284 | if (!item ) | 284 | if (!item ) |
285 | return; | 285 | return; |
286 | 286 | ||
287 | QPopupMenu *menu = new QPopupMenu(); | 287 | QPopupMenu *menu = new QPopupMenu(); |
288 | int ret=0; | 288 | int ret=0; |
289 | 289 | ||
290 | if ( ((BTListItem*)item)->type() == "device") { | 290 | if ( ((BTListItem*)item)->type() == "device") { |
291 | 291 | ||
292 | QPopupMenu *groups = new QPopupMenu(); | 292 | QPopupMenu *groups = new QPopupMenu(); |
293 | 293 | ||
294 | menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); | 294 | menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); |
295 | menu->insertSeparator(1); | 295 | menu->insertSeparator(1); |
296 | menu->insertItem( tr("rescan sevices"), 2); | 296 | menu->insertItem( tr("rescan sevices"), 2); |
297 | menu->insertItem( tr("to group"), groups , 3); | 297 | menu->insertItem( tr("to group"), groups , 3); |
298 | menu->insertItem( tr("delete"), 4); | 298 | menu->insertItem( tr("delete"), 4); |
299 | 299 | ||
300 | ret = menu->exec( point , 0); | 300 | ret = menu->exec( point , 0); |
301 | 301 | ||
302 | switch(ret) { | 302 | switch(ret) { |
303 | case -1: | 303 | case -1: |
304 | break; | 304 | break; |
305 | case 2: | 305 | case 2: |
306 | addServicesToDevice( (BTDeviceItem*)item ); | 306 | addServicesToDevice( (BTDeviceItem*)item ); |
307 | break; | 307 | break; |
308 | 308 | ||
309 | case 4: | 309 | case 4: |
310 | // deletes childs too | 310 | // deletes childs too |
311 | delete item; | 311 | delete item; |
312 | break; | 312 | break; |
313 | } | 313 | } |
314 | delete groups; | 314 | delete groups; |
315 | 315 | ||
316 | } | 316 | } |
317 | 317 | ||
318 | /* | 318 | /* |
319 | * We got service sensitive PopupMenus in our factory | 319 | * We got service sensitive PopupMenus in our factory |
320 | * We will create one through the factory and will insert | 320 | * We will create one through the factory and will insert |
321 | * our Separator + ShowInfo into the menu or create a new | 321 | * our Separator + ShowInfo into the menu or create a new |
322 | * one if the factory returns 0 | 322 | * one if the factory returns 0 |
323 | * PopupMenu deletion is kind of weird. | 323 | * PopupMenu deletion is kind of weird. |
324 | * If escaped( -1 ) or any of our items were chosen we'll | 324 | * If escaped( -1 ) or any of our items were chosen we'll |
325 | * delete the PopupMenu otherwise it's the responsibility of | 325 | * delete the PopupMenu otherwise it's the responsibility of |
326 | * the PopupMenu to delete itself | 326 | * the PopupMenu to delete itself |
327 | * | 327 | * |
328 | */ | 328 | */ |
329 | else if ( ((BTListItem*)item)->type() == "service") { | 329 | else if ( ((BTListItem*)item)->type() == "service") { |
330 | BTServiceItem* service = (BTServiceItem*)item; | 330 | BTServiceItem* service = (BTServiceItem*)item; |
331 | QMap<int, QString> list = service->services().classIdList(); | 331 | QMap<int, QString> list = service->services().classIdList(); |
332 | QMap<int, QString>::Iterator it = list.begin(); | 332 | QMap<int, QString>::Iterator it = list.begin(); |
333 | QPopupMenu *popup =0l; | 333 | QPopupMenu *popup =0l; |
334 | if ( it != list.end() ) { | 334 | if ( it != list.end() ) { |
335 | qWarning("Searching id %d %s", it.key(), it.data().latin1() ); | 335 | qWarning("Searching id %d %s", it.key(), it.data().latin1() ); |
336 | popup = m_popHelper.find( 4358, | 336 | popup = m_popHelper.find( it.key(), |
337 | service->services(), | 337 | service->services(), |
338 | (BTDeviceItem*)service->parent() ); | 338 | (BTDeviceItem*)service->parent() ); |
339 | }else { | 339 | }else { |
340 | qWarning("Empty"); | 340 | qWarning("Empty"); |
341 | } | 341 | } |
342 | 342 | ||
343 | if ( popup == 0l ) { | 343 | if ( popup == 0l ) { |
344 | qWarning("factory returned 0l"); | 344 | qWarning("factory returned 0l"); |
345 | popup = new QPopupMenu(); | 345 | popup = new QPopupMenu(); |
346 | } | 346 | } |
347 | int test1 = popup->insertItem( tr("Test1:"), 2); | 347 | int test1 = popup->insertItem( tr("Test1:"), 2); |
348 | 348 | ||
349 | ret = popup->exec( point ); | 349 | ret = popup->exec( point ); |
350 | qWarning("returned from exec() "); | 350 | qWarning("returned from exec() "); |
351 | if ( ret == -1 ) { | 351 | if ( ret == -1 ) { |
352 | ; | 352 | ; |
353 | } else if ( ret == test1 ) { | 353 | } else if ( ret == test1 ) { |
354 | ; | 354 | ; |
355 | } | 355 | } |
356 | delete popup; | 356 | delete popup; |
357 | } | 357 | } |
358 | delete menu; | 358 | delete menu; |
359 | } | 359 | } |
360 | 360 | ||
361 | 361 | ||
362 | /** | 362 | /** |
363 | * Search and display avail. services for a device (on expand from device listing) | 363 | * Search and display avail. services for a device (on expand from device listing) |
364 | * @param item the service item returned | 364 | * @param item the service item returned |
365 | */ | 365 | */ |
366 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) { | 366 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) { |
367 | qDebug("addServicesToDevice"); | 367 | qDebug("addServicesToDevice"); |
368 | // row of mac adress text(3) | 368 | // row of mac adress text(3) |
369 | RemoteDevice device = item->remoteDevice(); | 369 | RemoteDevice device = item->remoteDevice(); |
370 | m_deviceList.insert( item->mac() , item ); | 370 | m_deviceList.insert( item->mac() , item ); |
371 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | 371 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back |
372 | m_localDevice->searchServices( device ); | 372 | m_localDevice->searchServices( device ); |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
376 | /** | 376 | /** |
377 | * Overloaded. This one it the one that is | 377 | * Overloaded. This one it the one that is |
378 | ted to the foundServices signal | 378 | ted to the foundServices signal |
379 | * @param device the mac address of the remote device | 379 | * @param device the mac address of the remote device |
380 | * @param servicesList the list with the service the device has. | 380 | * @param servicesList the list with the service the device has. |
381 | */ | 381 | */ |
382 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { | 382 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { |
383 | qDebug("fill services list"); | 383 | qDebug("fill services list"); |
384 | 384 | ||
385 | QMap<QString,BTDeviceItem*>::Iterator it; | 385 | QMap<QString,BTDeviceItem*>::Iterator it; |
386 | BTDeviceItem* deviceItem = 0; | 386 | BTDeviceItem* deviceItem = 0; |
387 | 387 | ||
388 | // get the right devices which requested the search | 388 | // get the right devices which requested the search |
389 | it = m_deviceList.find( device ); | 389 | it = m_deviceList.find( device ); |
390 | if( it == m_deviceList.end() ) | 390 | if( it == m_deviceList.end() ) |
391 | return; | 391 | return; |
392 | deviceItem = it.data(); | 392 | deviceItem = it.data(); |
393 | 393 | ||
394 | // remove previous entries | 394 | // remove previous entries |
395 | QList<QListViewItem> tempList; | 395 | QList<QListViewItem> tempList; |
396 | tempList.setAutoDelete( true ); | 396 | tempList.setAutoDelete( true ); |
397 | QListViewItem * child = deviceItem->firstChild(); | 397 | QListViewItem * child = deviceItem->firstChild(); |
398 | while( child ) { | 398 | while( child ) { |
399 | tempList.append( child ); | 399 | tempList.append( child ); |
400 | child = child->nextSibling(); | 400 | child = child->nextSibling(); |
401 | } | 401 | } |
402 | tempList.clear(); | 402 | tempList.clear(); |
403 | 403 | ||
404 | QValueList<OpieTooth::Services>::Iterator it2; | 404 | QValueList<OpieTooth::Services>::Iterator it2; |
405 | BTServiceItem* serviceItem; | 405 | BTServiceItem* serviceItem; |
406 | 406 | ||
407 | 407 | ||
408 | if (!servicesList.isEmpty() ) { | 408 | if (!servicesList.isEmpty() ) { |
409 | // add services | 409 | // add services |
410 | QMap<int, QString> list; | 410 | QMap<int, QString> list; |
411 | QMap<int, QString>::Iterator classIt; | 411 | QMap<int, QString>::Iterator classIt; |
412 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | 412 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { |
413 | serviceItem = new BTServiceItem( deviceItem, (*it2) ); | 413 | serviceItem = new BTServiceItem( deviceItem, (*it2) ); |
414 | list = (*it2).classIdList(); | 414 | list = (*it2).classIdList(); |
415 | classIt = list.begin(); | 415 | classIt = list.begin(); |
416 | int classId=0; | 416 | int classId=0; |
417 | if ( classIt != list.end() ) { | 417 | if ( classIt != list.end() ) { |
418 | classId = classIt.key(); | 418 | classId = classIt.key(); |
419 | } | 419 | } |
420 | 420 | ||
421 | serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); | 421 | serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); |
422 | } | 422 | } |
423 | } else { | 423 | } else { |
424 | Services s1; | 424 | Services s1; |
425 | s1.setServiceName( tr("no services found") ); | 425 | s1.setServiceName( tr("no services found") ); |
426 | serviceItem = new BTServiceItem( deviceItem, s1 ); | 426 | serviceItem = new BTServiceItem( deviceItem, s1 ); |
427 | } | 427 | } |
428 | // now remove them from the list | 428 | // now remove them from the list |
429 | m_deviceList.remove( it ); | 429 | m_deviceList.remove( it ); |
430 | } | 430 | } |
431 | 431 | ||
432 | 432 | ||
433 | 433 | ||
434 | 434 | ||
435 | 435 | ||
436 | void BlueBase::addSignalStrength() { | 436 | void BlueBase::addSignalStrength() { |
437 | 437 | ||
438 | QListViewItemIterator it( ListView4 ); | 438 | QListViewItemIterator it( ListView4 ); |
439 | for ( ; it.current(); ++it ) { | 439 | for ( ; it.current(); ++it ) { |
440 | m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); | 440 | m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); |
441 | } | 441 | } |
442 | 442 | ||
443 | QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); | 443 | QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); |
444 | } | 444 | } |
445 | 445 | ||
446 | void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { | 446 | void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { |
447 | 447 | ||
448 | QListViewItemIterator it( ListView4 ); | 448 | QListViewItemIterator it( ListView4 ); |
449 | for ( ; it.current(); ++it ) { | 449 | for ( ; it.current(); ++it ) { |
450 | if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { | 450 | if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { |
451 | ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); | 451 | ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | /** | 456 | /** |
457 | * Add the existing connections (pairs) to the connections tab. | 457 | * Add the existing connections (pairs) to the connections tab. |
458 | * This one triggers the search | 458 | * This one triggers the search |
459 | */ | 459 | */ |
460 | void BlueBase::addConnectedDevices() { | 460 | void BlueBase::addConnectedDevices() { |
461 | m_localDevice->searchConnections(); | 461 | m_localDevice->searchConnections(); |
462 | } | 462 | } |
463 | 463 | ||
464 | /** | 464 | /** |
465 | * This adds the found connections to the connection tab. | 465 | * This adds the found connections to the connection tab. |
466 | * @param connectionList the ValueList with all current connections | 466 | * @param connectionList the ValueList with all current connections |
467 | */ | 467 | */ |
468 | void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { | 468 | void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { |
469 | 469 | ||
470 | QValueList<OpieTooth::ConnectionState>::Iterator it; | 470 | QValueList<OpieTooth::ConnectionState>::Iterator it; |
471 | BTConnectionItem * connectionItem; | 471 | BTConnectionItem * connectionItem; |
472 | 472 | ||
473 | if ( !connectionList.isEmpty() ) { | 473 | if ( !connectionList.isEmpty() ) { |
474 | 474 | ||
475 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { | 475 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { |
476 | 476 | ||
477 | QListViewItemIterator it2( ListView4 ); | 477 | QListViewItemIterator it2( ListView4 ); |
478 | bool found = false; | 478 | bool found = false; |
479 | for ( ; it2.current(); ++it2 ) { | 479 | for ( ; it2.current(); ++it2 ) { |
480 | if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) { | 480 | if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) { |
481 | found = true; | 481 | found = true; |
482 | } | 482 | } |
483 | } | 483 | } |
484 | 484 | ||
485 | if ( found == false ) { | 485 | if ( found == false ) { |
486 | connectionItem = new BTConnectionItem( ListView4, (*it) ); | 486 | connectionItem = new BTConnectionItem( ListView4, (*it) ); |
487 | 487 | ||
488 | if( m_deviceList.find((*it).mac()).data() ) { | 488 | if( m_deviceList.find((*it).mac()).data() ) { |
489 | connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); | 489 | connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); |
490 | } | 490 | } |
491 | } | 491 | } |
492 | 492 | ||
493 | } | 493 | } |
494 | 494 | ||
495 | QListViewItemIterator it2( ListView4 ); | 495 | QListViewItemIterator it2( ListView4 ); |
496 | for ( ; it2.current(); ++it2 ) { | 496 | for ( ; it2.current(); ++it2 ) { |
497 | bool found = false; | 497 | bool found = false; |
498 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { | 498 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { |
499 | if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) { | 499 | if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) { |
500 | found = true; | 500 | found = true; |
501 | } | 501 | } |
502 | } | 502 | } |
503 | 503 | ||
504 | if ( !found ) { | 504 | if ( !found ) { |
505 | delete it2.current(); | 505 | delete it2.current(); |
506 | } | 506 | } |
507 | 507 | ||
508 | } | 508 | } |
509 | 509 | ||
510 | 510 | ||
511 | } else { | 511 | } else { |
512 | ListView4->clear(); | 512 | ListView4->clear(); |
513 | ConnectionState con; | 513 | ConnectionState con; |
514 | con.setMac( tr("No connections found") ); | 514 | con.setMac( tr("No connections found") ); |
515 | connectionItem = new BTConnectionItem( ListView4 , con ); | 515 | connectionItem = new BTConnectionItem( ListView4 , con ); |
516 | } | 516 | } |
517 | 517 | ||
518 | // recall connection search after some time | 518 | // recall connection search after some time |
519 | QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); | 519 | QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); |
520 | } | 520 | } |
521 | 521 | ||
522 | 522 | ||
523 | /** | 523 | /** |
524 | * Find out if a device can currently be reached | 524 | * Find out if a device can currently be reached |
525 | * @param device | 525 | * @param device |
526 | */ | 526 | */ |
527 | void BlueBase::deviceActive( const RemoteDevice &device ) { | 527 | void BlueBase::deviceActive( const RemoteDevice &device ) { |
528 | // search by mac, async, gets a signal back | 528 | // search by mac, async, gets a signal back |
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp index 61e632b..7a0ee55 100644 --- a/noncore/net/opietooth/manager/panpopup.cpp +++ b/noncore/net/opietooth/manager/panpopup.cpp | |||
@@ -1,62 +1,63 @@ | |||
1 | #include <qpe/qcopenvelope_qws.h> | 1 | #include <qpe/qcopenvelope_qws.h> |
2 | 2 | ||
3 | #include <qtimer.h> | 3 | #include <qtimer.h> |
4 | 4 | ||
5 | #include "panpopup.h" | 5 | #include "panpopup.h" |
6 | 6 | ||
7 | using namespace OpieTooth; | 7 | using namespace OpieTooth; |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * c'tor init the QAction | 10 | * c'tor init the QAction |
11 | */ | 11 | */ |
12 | PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | 12 | PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { |
13 | 13 | ||
14 | qWarning("PanPopup c'tor"); | 14 | qWarning("PanPopup c'tor"); |
15 | 15 | ||
16 | m_item = item; | 16 | m_item = item; |
17 | QAction *a, *b, *c; | 17 | QAction *a, *b, *c; |
18 | 18 | ||
19 | m_panconnection = 0l; | 19 | m_panconnection = 0l; |
20 | /* connect action */ | 20 | /* connect action */ |
21 | 21 | ||
22 | 22 | ||
23 | a = new QAction(); // so it's get deleted | 23 | a = new QAction(); // so it's get deleted |
24 | a->setText( tr("connect") ); | 24 | a->setText( tr("connect") ); |
25 | a->addTo( this ); | 25 | a->addTo( this ); |
26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); | 26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); |
27 | 27 | ||
28 | 28 | ||
29 | b = new QAction(); | 29 | b = new QAction(); |
30 | b->setText( tr( "connect+conf" ) ); | 30 | b->setText( tr( "connect+conf" ) ); |
31 | b->addTo( this ); | 31 | b->addTo( this ); |
32 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); | 32 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); |
33 | 33 | ||
34 | c = new QAction(); | 34 | c = new QAction(); |
35 | c->setText( tr( "disconnect" ) ); | 35 | c->setText( tr( "disconnect" ) ); |
36 | c->addTo( this ); | 36 | c->addTo( this ); |
37 | connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); | 37 | connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); |
38 | 38 | ||
39 | }; | 39 | }; |
40 | 40 | ||
41 | PanPopup::~PanPopup() { | 41 | PanPopup::~PanPopup() { |
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | void PanPopup::slotConnect() { | 45 | void PanPopup::slotConnect() { |
46 | |||
46 | m_panconnection = new StartPanConnection( m_item->mac() ); | 47 | m_panconnection = new StartPanConnection( m_item->mac() ); |
47 | m_panconnection->start(); | 48 | m_panconnection->start(); |
48 | } | 49 | } |
49 | 50 | ||
50 | void PanPopup::slotDisconnect() { | 51 | void PanPopup::slotDisconnect() { |
51 | m_panconnection->stop(); | 52 | m_panconnection->stop(); |
52 | } | 53 | } |
53 | 54 | ||
54 | 55 | ||
55 | void PanPopup::slotConnectAndConfig() { | 56 | void PanPopup::slotConnectAndConfig() { |
56 | slotConnect(); | 57 | slotConnect(); |
57 | 58 | ||
58 | // more intelligence here later like passing the device ( bnepX ) | 59 | // more intelligence here later like passing the device ( bnepX ) |
59 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 60 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
60 | e << QString( "networksetup" ); | 61 | e << QString( "networksetup" ); |
61 | 62 | ||
62 | } | 63 | } |