-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index e8d9de7..c8d77a7 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -509,37 +509,38 @@ void Wellenreiter::startClicked() | |||
509 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 509 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
510 | { | 510 | { |
511 | QMessageBox::information( this, "Wellenreiter II", | 511 | QMessageBox::information( this, "Wellenreiter II", |
512 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 512 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
513 | return; | 513 | return; |
514 | } | 514 | } |
515 | 515 | ||
516 | // configure device | 516 | // configure device |
517 | ONetwork* net = ONetwork::instance(); | 517 | ONetwork* net = ONetwork::instance(); |
518 | 518 | ||
519 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | 519 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces |
520 | 520 | ||
521 | if ( !net->isPresent( interface ) ) | ||
522 | { | ||
523 | QMessageBox::information( this, "Wellenreiter II", | ||
524 | tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); | ||
525 | return; | ||
526 | } | ||
527 | |||
528 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | ||
529 | assert( iface ); | ||
530 | |||
531 | // bring device UP | ||
532 | if ( cardtype != DEVTYPE_FILE ) | 521 | if ( cardtype != DEVTYPE_FILE ) |
533 | { | 522 | { |
523 | |||
524 | if ( !net->isPresent( interface ) ) | ||
525 | { | ||
526 | QMessageBox::information( this, "Wellenreiter II", | ||
527 | tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); | ||
528 | return; | ||
529 | } | ||
530 | |||
531 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | ||
532 | assert( iface ); | ||
533 | |||
534 | // bring device UP | ||
534 | iface->setUp( true ); | 535 | iface->setUp( true ); |
535 | if ( !iface->isUp() ) | 536 | if ( !iface->isUp() ) |
536 | { | 537 | { |
537 | QMessageBox::warning( this, "Wellenreiter II", | 538 | QMessageBox::warning( this, "Wellenreiter II", |
538 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 539 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
539 | return; | 540 | return; |
540 | } | 541 | } |
541 | } | 542 | } |
542 | // set monitor mode | 543 | // set monitor mode |
543 | bool usePrism = configwindow->usePrismHeader(); | 544 | bool usePrism = configwindow->usePrismHeader(); |
544 | 545 | ||
545 | switch ( cardtype ) | 546 | switch ( cardtype ) |
@@ -635,25 +636,25 @@ void Wellenreiter::startClicked() | |||
635 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; | 636 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; |
636 | } | 637 | } |
637 | #else | 638 | #else |
638 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 639 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
639 | #endif | 640 | #endif |
640 | 641 | ||
641 | emit( startedSniffing() ); | 642 | emit( startedSniffing() ); |
642 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 643 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
643 | else | 644 | else |
644 | { | 645 | { |
645 | assert( parent() ); | 646 | assert( parent() ); |
646 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 647 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
647 | } | 648 | } |
648 | } | 649 | } |
649 | 650 | ||
650 | 651 | ||
651 | void Wellenreiter::timerEvent( QTimerEvent* ) | 652 | void Wellenreiter::timerEvent( QTimerEvent* ) |
652 | { | 653 | { |
653 | qDebug( "Wellenreiter::timerEvent()" ); | 654 | qDebug( "Wellenreiter::timerEvent()" ); |
654 | OPacket* p = pcap->next(); | 655 | OPacket* p = pcap->next(); |
655 | if ( !p ) // no more packets available | 656 | if ( !p ) // no more packets available |
656 | { | 657 | { |
657 | stopClicked(); | 658 | stopClicked(); |
658 | } | 659 | } |
659 | else | 660 | else |