summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-04-21 10:21:18 (UTC)
committer mickeyl <mickeyl>2005-04-21 10:21:18 (UTC)
commit945c98bd21a59f18a3ac0cdf330153163861731a (patch) (unidiff)
treee868fa29ae20923a8567d3e5c2af429e1e8cf937
parenta5044439757037640435a5800584d408a58c1bba (diff)
downloadopie-945c98bd21a59f18a3ac0cdf330153163861731a.zip
opie-945c98bd21a59f18a3ac0cdf330153163861731a.tar.gz
opie-945c98bd21a59f18a3ac0cdf330153163861731a.tar.bz2
disable "Rescan Neighbourhood" while scanning
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/wlan.pro2
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp6
2 files changed, 5 insertions, 3 deletions
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro
index e975dde..eb9dd4f 100644
--- a/noncore/settings/networksettings/wlan/wlan.pro
+++ b/noncore/settings/networksettings/wlan/wlan.pro
@@ -1,32 +1,32 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on 2CONFIG += qt plugin warn_on
3DESTDIR = $(OPIEDIR)/plugins/networksettings 3DESTDIR = $(OPIEDIR)/plugins/networksettings
4 HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h 4 HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h
5 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp 5 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 6 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
7 DEPENDPATH+= $(OPIEDIR)/include 7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe -L../interfaces/ -linterfaces -lopiecore2 -lopienet2 8LIBS += -lqpe -L../interfaces/ -linterfaces -lopiecore2 -lopienet2
9 INTERFACES= wlan.ui info.ui 9 INTERFACES= wlan.ui info.ui
10 TARGET = wlan 10 TARGET = wlan
11 VERSION = 1.0.0 11 VERSION = 1.0.1
12 12
13#CONFIG += wirelessopts 13#CONFIG += wirelessopts
14 14
15wirelessopts { 15wirelessopts {
16 HEADERS+= wlanimp.h 16 HEADERS+= wlanimp.h
17 SOURCES+= wlanimp.cpp 17 SOURCES+= wlanimp.cpp
18} 18}
19 19
20! wirelessopts { 20! wirelessopts {
21 HEADERS+= wlanimp2.h 21 HEADERS+= wlanimp2.h
22 SOURCES += wlanimp2.cpp 22 SOURCES += wlanimp2.cpp
23} 23}
24 24
25include( $(OPIEDIR)/include.pro ) 25include( $(OPIEDIR)/include.pro )
26 26
27!isEmpty( LIBPCAP_INC_DIR ) { 27!isEmpty( LIBPCAP_INC_DIR ) {
28 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH 28 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH
29} 29}
30!isEmpty( LIBPCAP_LIB_DIR ) { 30!isEmpty( LIBPCAP_LIB_DIR ) {
31 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS 31 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS
32} 32}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index 5cb78cf..11dfe74 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -181,312 +181,314 @@ void WLANImp::parseKeyStr(QString keystr) {
181 keyLineEdit2->setText(key); 181 keyLineEdit2->setText(key);
182 break; 182 break;
183 case 4: 183 case 4:
184 keyLineEdit3->setText(key); 184 keyLineEdit3->setText(key);
185 break; 185 break;
186 } 186 }
187 key = QString::null; 187 key = QString::null;
188 } 188 }
189 } 189 }
190 if (enc == 1) { 190 if (enc == 1) {
191 wepEnabled->setChecked(true); 191 wepEnabled->setChecked(true);
192 } else { 192 } else {
193 wepEnabled->setChecked(false); 193 wepEnabled->setChecked(false);
194 } 194 }
195} 195}
196 196
197/** 197/**
198 * Check to see if the current config is valid 198 * Check to see if the current config is valid
199 * Save interfaces 199 * Save interfaces
200 */ 200 */
201void WLANImp::accept() { 201void WLANImp::accept() {
202 if (wepEnabled->isChecked()) { 202 if (wepEnabled->isChecked()) {
203 if ((keyRadio0->isChecked() && keyLineEdit0->text().isEmpty()) || 203 if ((keyRadio0->isChecked() && keyLineEdit0->text().isEmpty()) ||
204 (keyRadio1->isChecked() && keyLineEdit1->text().isEmpty()) || 204 (keyRadio1->isChecked() && keyLineEdit1->text().isEmpty()) ||
205 (keyRadio2->isChecked() && keyLineEdit2->text().isEmpty()) || 205 (keyRadio2->isChecked() && keyLineEdit2->text().isEmpty()) ||
206 (keyRadio3->isChecked() && keyLineEdit3->text().isEmpty())) { 206 (keyRadio3->isChecked() && keyLineEdit3->text().isEmpty())) {
207 QMessageBox::information(this, "Error", "Please enter a WEP key.", QMessageBox::Ok); 207 QMessageBox::information(this, "Error", "Please enter a WEP key.", QMessageBox::Ok);
208 return; 208 return;
209 } 209 }
210 } 210 }
211 211
212 if (essid->currentText().isEmpty()) { 212 if (essid->currentText().isEmpty()) {
213 QMessageBox::information(this, "Error", "Please select/enter an ESSID.", QMessageBox::Ok); 213 QMessageBox::information(this, "Error", "Please select/enter an ESSID.", QMessageBox::Ok);
214 return; 214 return;
215 } 215 }
216 216
217 if (specifyAp->isChecked() && macEdit->text().isEmpty()) { 217 if (specifyAp->isChecked() && macEdit->text().isEmpty()) {
218 QMessageBox::information(this, "Error", "Please enter the MAC address of the Access Point.", QMessageBox::Ok); 218 QMessageBox::information(this, "Error", "Please enter the MAC address of the Access Point.", QMessageBox::Ok);
219 return; 219 return;
220 } 220 }
221 221
222 // Try to save the interfaces settings. 222 // Try to save the interfaces settings.
223 writeOpts(); 223 writeOpts();
224 224
225 // Close out the dialog 225 // Close out the dialog
226// FIXME: QDialog::accept(); 226// FIXME: QDialog::accept();
227} 227}
228 228
229void WLANImp::writeOpts() { 229void WLANImp::writeOpts() {
230 // eh can't really do anything about it other then return. :-D 230 // eh can't really do anything about it other then return. :-D
231 if(!interfaces->isInterfaceSet()){ 231 if(!interfaces->isInterfaceSet()){
232 QMessageBox::warning(0,"Inface not set","should not happen!!!"); 232 QMessageBox::warning(0,"Inface not set","should not happen!!!");
233 return; 233 return;
234 } 234 }
235 bool error = false; 235 bool error = false;
236 236
237 odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl; 237 odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl;
238 238
239 if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); 239 if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!");
240 240
241 interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); 241 interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText());
242 interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); 242 interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText());
243 243
244 if (specifyAp->isChecked()) { 244 if (specifyAp->isChecked()) {
245 interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); 245 interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text());
246 } else { 246 } else {
247 interfaces->removeInterfaceOption(QString("wireless_ap")); 247 interfaces->removeInterfaceOption(QString("wireless_ap"));
248 } 248 }
249 249
250 if (specifyChan->isChecked()) { 250 if (specifyChan->isChecked()) {
251 interfaces->setInterfaceOption(QString("wireless_channel"), networkChannel->text()); 251 interfaces->setInterfaceOption(QString("wireless_channel"), networkChannel->text());
252 } else { 252 } else {
253 interfaces->removeInterfaceOption(QString("wireless_channel")); 253 interfaces->removeInterfaceOption(QString("wireless_channel"));
254 } 254 }
255 255
256 if (wepEnabled->isChecked()) { 256 if (wepEnabled->isChecked()) {
257 QStringList keyList; 257 QStringList keyList;
258 258
259 if (! keyLineEdit0->text().isNull()) { 259 if (! keyLineEdit0->text().isNull()) {
260 keyList += keyLineEdit0->text(); 260 keyList += keyLineEdit0->text();
261 keyList += "[1]"; 261 keyList += "[1]";
262 } //else 262 } //else
263 if (! keyLineEdit1->text().isNull()) { 263 if (! keyLineEdit1->text().isNull()) {
264 keyList += keyLineEdit1->text(); 264 keyList += keyLineEdit1->text();
265 keyList += "[2]"; 265 keyList += "[2]";
266 } //else 266 } //else
267 if (! keyLineEdit2->text().isNull()) { 267 if (! keyLineEdit2->text().isNull()) {
268 keyList += keyLineEdit2->text(); 268 keyList += keyLineEdit2->text();
269 keyList += "[3]"; 269 keyList += "[3]";
270 } //else 270 } //else
271 if (! keyLineEdit3->text().isNull()) { 271 if (! keyLineEdit3->text().isNull()) {
272 keyList += keyLineEdit3->text(); 272 keyList += keyLineEdit3->text();
273 keyList += "[4]"; 273 keyList += "[4]";
274 } 274 }
275 if (acceptNonEnc->isChecked()) { 275 if (acceptNonEnc->isChecked()) {
276 keyList += "open"; 276 keyList += "open";
277 } else { 277 } else {
278 keyList += "restricted"; 278 keyList += "restricted";
279 } 279 }
280 280
281 keyList += "key"; 281 keyList += "key";
282 if (keyRadio0->isChecked()) { 282 if (keyRadio0->isChecked()) {
283 keyList += "[1]"; 283 keyList += "[1]";
284 } else if (keyRadio1->isChecked()) { 284 } else if (keyRadio1->isChecked()) {
285 keyList += "[2]"; 285 keyList += "[2]";
286 } else if (keyRadio2->isChecked()) { 286 } else if (keyRadio2->isChecked()) {
287 keyList += "[3]"; 287 keyList += "[3]";
288 } else if (keyRadio3->isChecked()) { 288 } else if (keyRadio3->isChecked()) {
289 keyList += "[4]"; 289 keyList += "[4]";
290 } 290 }
291 interfaces->setInterfaceOption(QString("wireless_key"), keyList.join(QString(" "))); 291 interfaces->setInterfaceOption(QString("wireless_key"), keyList.join(QString(" ")));
292 } else { 292 } else {
293 interfaces->removeInterfaceOption(QString("wireless_key")); 293 interfaces->removeInterfaceOption(QString("wireless_key"));
294 } 294 }
295 interfaces->removeInterfaceOption(QString("wireless_enc")); 295 interfaces->removeInterfaceOption(QString("wireless_enc"));
296 296
297 if(!interfaceSetup->saveChanges()) 297 if(!interfaceSetup->saveChanges())
298 return; 298 return;
299 299
300 QDialog::accept(); 300 QDialog::accept();
301} 301}
302 302
303/* 303/*
304 * Scan for possible wireless networks around... 304 * Scan for possible wireless networks around...
305 * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> 305 * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org>
306 */ 306 */
307 307
308void WLANImp::rescanNeighbourhood() 308void WLANImp::rescanNeighbourhood()
309{ 309{
310 QString name = interface->getInterfaceName(); 310 QString name = interface->getInterfaceName();
311 odebug << "rescanNeighbourhood via '" << name << "'" << oendl; 311 odebug << "rescanNeighbourhood via '" << name << "'" << oendl;
312 312
313 OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); 313 OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) );
314 assert( wiface ); 314 assert( wiface );
315 315
316 // try to guess device type 316 // try to guess device type
317 QString devicetype; 317 QString devicetype;
318 QFile m( "/proc/modules" ); 318 QFile m( "/proc/modules" );
319 if ( m.open( IO_ReadOnly ) ) 319 if ( m.open( IO_ReadOnly ) )
320 { 320 {
321 QString line; 321 QString line;
322 QTextStream modules( &m ); 322 QTextStream modules( &m );
323 while( !modules.atEnd() && !devicetype ) 323 while( !modules.atEnd() && !devicetype )
324 { 324 {
325 modules >> line; 325 modules >> line;
326 if ( line.contains( "cisco" ) ) devicetype = "cisco"; 326 if ( line.contains( "cisco" ) ) devicetype = "cisco";
327 else if ( line.contains( "hostap" ) ) devicetype = "hostap"; 327 else if ( line.contains( "hostap" ) ) devicetype = "hostap";
328 else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ 328 else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */
329 else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; 329 else if ( line.contains( "orinoco" ) ) devicetype = "orinoco";
330 } 330 }
331 } 331 }
332 if ( devicetype.isEmpty() ) 332 if ( devicetype.isEmpty() )
333 { 333 {
334 owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl; 334 owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl;
335 return; 335 return;
336 } 336 }
337 else 337 else
338 { 338 {
339 odebug << "rescanNeighbourhood(): device type seems to be '" << devicetype << "'" << oendl; 339 odebug << "rescanNeighbourhood(): device type seems to be '" << devicetype << "'" << oendl;
340 } 340 }
341 341
342 // configure interface to receive 802.11 management frames 342 // configure interface to receive 802.11 management frames
343 343
344 wiface->setUp( true ); 344 wiface->setUp( true );
345 wiface->setPromiscuousMode( true ); 345 wiface->setPromiscuousMode( true );
346 346
347 if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); 347 if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) );
348 else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); 348 else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) );
349 else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); 349 else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) );
350 else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); 350 else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) );
351 else 351 else
352 { 352 {
353 odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl; 353 odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl;
354 return; 354 return;
355 } 355 }
356 356
357 wiface->setMode( "monitor" ); 357 wiface->setMode( "monitor" );
358 if ( wiface->mode() != "monitor" ) 358 if ( wiface->mode() != "monitor" )
359 { 359 {
360 owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl; 360 owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl;
361 return; 361 return;
362 } 362 }
363 363
364 // open a packet capturer 364 // open a packet capturer
365 OPacketCapturer* cap = new OPacketCapturer(); 365 OPacketCapturer* cap = new OPacketCapturer();
366 cap->open( name ); 366 cap->open( name );
367 if ( !cap->isOpen() ) 367 if ( !cap->isOpen() )
368 { 368 {
369 owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl; 369 owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl;
370 return; 370 return;
371 } 371 }
372 372
373 // display splash screen 373 // disable button and display splash screen
374 rescanButton->setEnabled( false );
374 QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); 375 QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize );
375 splash->setLineWidth( 2 ); 376 splash->setLineWidth( 2 );
376 splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); 377 splash->setFrameStyle( QFrame::Panel | QFrame::Raised );
377 QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); 378 QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 );
378 QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); 379 QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash );
379 QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); 380 QProgressBar* pb = new QProgressBar( wiface->channels(), splash );
380 vbox->addWidget( lab ); 381 vbox->addWidget( lab );
381 vbox->addWidget( pb ); 382 vbox->addWidget( pb );
382 pb->setCenterIndicator( true ); 383 pb->setCenterIndicator( true );
383 pb->setFixedHeight( pb->sizeHint().height() ); 384 pb->setFixedHeight( pb->sizeHint().height() );
384 QWidget* widgetDesktop = qApp->desktop(); 385 QWidget* widgetDesktop = qApp->desktop();
385 int dw = widgetDesktop->width(); 386 int dw = widgetDesktop->width();
386 int dh = widgetDesktop->height(); 387 int dh = widgetDesktop->height();
387 int pw = vbox->sizeHint().width(); 388 int pw = vbox->sizeHint().width();
388 int ph = vbox->sizeHint().height(); 389 int ph = vbox->sizeHint().height();
389 splash->setGeometry((dw-pw)/2,(dh-ph)/2,pw,ph); 390 splash->setGeometry((dw-pw)/2,(dh-ph)/2,pw,ph);
390 splash->show(); 391 splash->show();
391 splash->raise(); 392 splash->raise();
392 qApp->processEvents(); 393 qApp->processEvents();
393 394
394 // set capturer to non-blocking mode 395 // set capturer to non-blocking mode
395 cap->setBlocking( false ); 396 cap->setBlocking( false );
396 397
397 for ( int i = 1; i <= wiface->channels(); ++i ) 398 for ( int i = 1; i <= wiface->channels(); ++i )
398 { 399 {
399 wiface->setChannel( i ); 400 wiface->setChannel( i );
400 pb->setProgress( i ); 401 pb->setProgress( i );
401 qApp->processEvents(); 402 qApp->processEvents();
402 odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl; 403 odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl;
403 OPacket* p = cap->next( 1000 ); 404 OPacket* p = cap->next( 1000 );
404 if ( !p ) 405 if ( !p )
405 { 406 {
406 odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl; 407 odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl;
407 } 408 }
408 else 409 else
409 { 410 {
410 odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl; 411 odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl;
411 handlePacket( p ); 412 handlePacket( p );
412 } 413 }
413 } 414 }
414 415
415 cap->close(); 416 cap->close();
416 wiface->setMode( "managed" ); // TODO: use previous mode 417 wiface->setMode( "managed" ); // TODO: use previous mode
417 wiface->setPromiscuousMode( false ); 418 wiface->setPromiscuousMode( false );
418 419
420 // hide splash screen and reenable button
419 splash->hide(); 421 splash->hide();
420 delete splash; 422 delete splash;
421 423 rescanButton->setEnabled( true );
422} 424}
423 425
424void WLANImp::handlePacket( OPacket* p ) 426void WLANImp::handlePacket( OPacket* p )
425{ 427{
426 428
427 // check if we received a beacon frame 429 // check if we received a beacon frame
428 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 430 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
429 if ( beacon && beacon->managementType() == "Beacon" ) 431 if ( beacon && beacon->managementType() == "Beacon" )
430 { 432 {
431 433
432 QString type; 434 QString type;
433 if ( beacon->canIBSS() ) 435 if ( beacon->canIBSS() )
434 { 436 {
435 type = "adhoc"; 437 type = "adhoc";
436 } 438 }
437 else if ( beacon->canESS() ) 439 else if ( beacon->canESS() )
438 { 440 {
439 type = "managed"; 441 type = "managed";
440 } 442 }
441 else 443 else
442 { 444 {
443 owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl; 445 owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl;
444 return; 446 return;
445 } 447 }
446 448
447 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 449 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
448 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 450 QString essid = ssid ? ssid->ID() : QString("<unknown>");
449 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 451 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
450 int channel = ds ? ds->channel() : -1; 452 int channel = ds ? ds->channel() : -1;
451 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 453 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
452 displayFoundNetwork( type, channel, essid, header->macAddress2() ); 454 displayFoundNetwork( type, channel, essid, header->macAddress2() );
453 } 455 }
454} 456}
455 457
456 458
457void WLANImp::displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac ) 459void WLANImp::displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac )
458{ 460{
459 461
460 odebug << "found network: <" << (const char*) mode << ">, chn " << channel 462 odebug << "found network: <" << (const char*) mode << ">, chn " << channel
461 << ", ssid '" << (const char*) ssid << "', mac '" << (const char*) mac.toString() << "'" << oendl; 463 << ", ssid '" << (const char*) ssid << "', mac '" << (const char*) mac.toString() << "'" << oendl;
462 464
463 QListViewItemIterator it( netView ); 465 QListViewItemIterator it( netView );
464 while ( it.current() && it.current()->text( col_ssid ) != ssid ) ++it; 466 while ( it.current() && it.current()->text( col_ssid ) != ssid ) ++it;
465 if ( !it.current() ) // ssid didn't show up yet 467 if ( !it.current() ) // ssid didn't show up yet
466 { 468 {
467 QListViewItem* item = new QListViewItem( netView, mode.left( 1 ).upper(), ssid, QString::number( channel ), mac.toString() ); 469 QListViewItem* item = new QListViewItem( netView, mode.left( 1 ).upper(), ssid, QString::number( channel ), mac.toString() );
468 QString name; 470 QString name;
469 name.sprintf( "networksettings/%s", (const char*) mode ); 471 name.sprintf( "networksettings/%s", (const char*) mode );
470 item->setPixmap( col_mode, Resource::loadPixmap( name ) ); 472 item->setPixmap( col_mode, Resource::loadPixmap( name ) );
471 qApp->processEvents(); 473 qApp->processEvents();
472 } 474 }
473 475
474} 476}
475 477
476 478
477void WLANImp::selectNetwork( QListViewItem* item ) 479void WLANImp::selectNetwork( QListViewItem* item )
478{ 480{
479 bool ok; 481 bool ok;
480 if ( item ) 482 if ( item )
481 { 483 {
482 specifyAp->setChecked(true); 484 specifyAp->setChecked(true);
483 macEdit->setText( item->text( col_mac ) ); 485 macEdit->setText( item->text( col_mac ) );
484 specifyChan->setChecked( item->text( col_mode ) == "A" ); 486 specifyChan->setChecked( item->text( col_mode ) == "A" );
485 networkChannel->setValue( item->text( col_chn ).toInt( &ok ) ); 487 networkChannel->setValue( item->text( col_chn ).toInt( &ok ) );
486 essid->setEditText( item->text( col_ssid ) ); 488 essid->setEditText( item->text( col_ssid ) );
487 if ( item->text( col_mode ) == "A" ) 489 if ( item->text( col_mode ) == "A" )
488 mode->setCurrentItem( 3 ); 490 mode->setCurrentItem( 3 );
489 else 491 else
490 mode->setCurrentItem( 2 ); 492 mode->setCurrentItem( 2 );
491 } 493 }
492} 494}