summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-10-29 10:51:08 (UTC)
committer mickeyl <mickeyl>2004-10-29 10:51:08 (UTC)
commit1cde6419bcf60ec1ba23750106b2ec01474416fb (patch) (unidiff)
tree80eab25b6ef88621aab36c4bbb1789e4b9d48502
parent35262b3fbc09b32d4c5b20004f755e0c5651dc1b (diff)
downloadopie-1cde6419bcf60ec1ba23750106b2ec01474416fb.zip
opie-1cde6419bcf60ec1ba23750106b2ec01474416fb.tar.gz
opie-1cde6419bcf60ec1ba23750106b2ec01474416fb.tar.bz2
improve english
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index df8e9c3..9fe463a 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -382,385 +382,385 @@ QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
382 382
383bool Wellenreiter::checkDumpPacket( OPacket* p ) 383bool Wellenreiter::checkDumpPacket( OPacket* p )
384{ 384{
385 // go through all child packets and see if one is inside the child hierarchy for p 385 // go through all child packets and see if one is inside the child hierarchy for p
386 // if so, do what the user requested (protocolAction), e.g. pass or discard 386 // if so, do what the user requested (protocolAction), e.g. pass or discard
387 if ( !configwindow->writeCaptureFile->isChecked() ) 387 if ( !configwindow->writeCaptureFile->isChecked() )
388 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter 388 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
389 389
390 QObjectList* l = p->queryList(); 390 QObjectList* l = p->queryList();
391 QObjectListIt it( *l ); 391 QObjectListIt it( *l );
392 QObject* o; 392 QObject* o;
393 393
394 while ( (o = it.current()) != 0 ) 394 while ( (o = it.current()) != 0 )
395 { 395 {
396 QString name = it.current()->name(); 396 QString name = it.current()->name();
397 if ( configwindow->capturePackets->isProtocolChecked( name ) ) 397 if ( configwindow->capturePackets->isProtocolChecked( name ) )
398 { 398 {
399 QString action = configwindow->capturePackets->protocolAction( name ); 399 QString action = configwindow->capturePackets->protocolAction( name );
400 odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl; 400 odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl;
401 if ( action == "Discard" ) 401 if ( action == "Discard" )
402 { 402 {
403 logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) ); 403 logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) );
404 return false; 404 return false;
405 } 405 }
406 } 406 }
407 else 407 else
408 { 408 {
409 odebug << "protocol '" << name << "' not checked in capturePackets." << oendl; 409 odebug << "protocol '" << name << "' not checked in capturePackets." << oendl;
410 } 410 }
411 ++it; 411 ++it;
412 } 412 }
413 return true; 413 return true;
414} 414}
415 415
416 416
417void Wellenreiter::receivePacket( OPacket* p ) 417void Wellenreiter::receivePacket( OPacket* p )
418{ 418{
419 hexWindow()->add( p, configwindow->hexViewBuffer() ); 419 hexWindow()->add( p, configwindow->hexViewBuffer() );
420 420
421 if ( checkDumpPacket( p ) ) 421 if ( checkDumpPacket( p ) )
422 { 422 {
423 pcap->dump( p ); 423 pcap->dump( p );
424 } 424 }
425 425
426 // check for a management frame 426 // check for a management frame
427 OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); 427 OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
428 if ( manage ) 428 if ( manage )
429 { 429 {
430 handleManagementFrame( p, manage ); 430 handleManagementFrame( p, manage );
431 return; 431 return;
432 } 432 }
433 433
434 // check for a control frame 434 // check for a control frame
435 OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) ); 435 OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) );
436 if ( control ) 436 if ( control )
437 { 437 {
438 handleControlFrame( p, control ); 438 handleControlFrame( p, control );
439 return; 439 return;
440 } 440 }
441 441
442 OMacAddress source; 442 OMacAddress source;
443 OMacAddress dest; 443 OMacAddress dest;
444 444
445 //TODO: WEP check here 445 //TODO: WEP check here
446 446
447 // check for a wireless data frame 447 // check for a wireless data frame
448 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); 448 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) );
449 if ( wlan ) 449 if ( wlan )
450 { 450 {
451 handleWlanData( p, wlan, source, dest ); 451 handleWlanData( p, wlan, source, dest );
452 } 452 }
453 453
454 // check for a wired data frame 454 // check for a wired data frame
455 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); 455 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) );
456 if ( eth ) 456 if ( eth )
457 { 457 {
458 handleEthernetData( p, eth, source, dest ); 458 handleEthernetData( p, eth, source, dest );
459 } 459 }
460 460
461 // check for an arp frame since arp frames come in two flavours: 461 // check for an arp frame since arp frames come in two flavours:
462 // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. 462 // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't.
463 OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); 463 OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) );
464 if ( arp ) 464 if ( arp )
465 { 465 {
466 handleARPData( p, arp, source, dest ); 466 handleARPData( p, arp, source, dest );
467 } 467 }
468 468
469 // check for a ip frame 469 // check for a ip frame
470 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); 470 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) );
471 if ( ip ) 471 if ( ip )
472 { 472 {
473 handleIPData( p, ip, source, dest ); 473 handleIPData( p, ip, source, dest );
474 } 474 }
475 475
476 //handleNotification( p ); 476 //handleNotification( p );
477 477
478} 478}
479 479
480 480
481void Wellenreiter::stopClicked() 481void Wellenreiter::stopClicked()
482{ 482{
483 if ( iface ) 483 if ( iface )
484 { 484 {
485 disconnect( SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); 485 disconnect( SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) );
486 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 486 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
487 iface->setChannelHopping(); // stop hopping channels 487 iface->setChannelHopping(); // stop hopping channels
488 } 488 }
489 else 489 else
490 killTimers(); 490 killTimers();
491 491
492 pcap->close(); 492 pcap->close();
493 sniffing = false; 493 sniffing = false;
494 494
495 if ( iface ) 495 if ( iface )
496 { 496 {
497 // switch off monitor mode 497 // switch off monitor mode
498 iface->setMode( "managed" ); 498 iface->setMode( "managed" );
499 // switch off promisc flag 499 // switch off promisc flag
500 iface->setPromiscuousMode( false ); 500 iface->setPromiscuousMode( false );
501 501
502 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess 502 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
503 } 503 }
504 504
505 logwindow->log( "(i) Stopped Scanning." ); 505 logwindow->log( "(i) Stopped Scanning." );
506 assert( parent() ); 506 assert( parent() );
507 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); 507 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" );
508 508
509 // message the user 509 // message the user
510 QMessageBox::information( this, "Wellenreiter II", 510 QMessageBox::information( this, "Wellenreiter II",
511 tr( "Your wireless card\nshould now be usable again." ) ); 511 tr( "Your wireless card\nshould now be usable again." ) );
512 512
513 sniffing = false; 513 sniffing = false;
514 emit( stoppedSniffing() ); 514 emit( stoppedSniffing() );
515 515
516 #ifdef QWS 516 #ifdef QWS
517 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) 517 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
518 { 518 {
519 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 519 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
520 } 520 }
521 #else 521 #else
522 #warning FIXME: setScreenSaverMode is not operational on the X11 build 522 #warning FIXME: setScreenSaverMode is not operational on the X11 build
523 #endif 523 #endif
524 524
525 updateStatistics(); 525 updateStatistics();
526} 526}
527 527
528 528
529void Wellenreiter::startClicked() 529void Wellenreiter::startClicked()
530{ 530{
531 // get configuration from config window 531 // get configuration from config window
532 532
533 const QString& interface = configwindow->interfaceName->currentText(); 533 const QString& interface = configwindow->interfaceName->currentText();
534 const int cardtype = configwindow->driverType(); 534 const int cardtype = configwindow->driverType();
535// const int interval = configwindow->hoppingInterval(); 535// const int interval = configwindow->hoppingInterval();
536 536
537 if ( ( interface == "" ) || ( cardtype == 0 ) ) 537 if ( ( interface == "" ) || ( cardtype == 0 ) )
538 { 538 {
539 QMessageBox::information( this, "Wellenreiter II", 539 QMessageBox::information( this, "Wellenreiter II",
540 tr( "No device configured.\nPlease reconfigure!" ) ); 540 tr( "No device configured.\nPlease reconfigure!" ) );
541 return; 541 return;
542 } 542 }
543 543
544 // configure device 544 // configure device
545 ONetwork* net = ONetwork::instance(); 545 ONetwork* net = ONetwork::instance();
546 546
547 // TODO: check if interface is wireless and support sniffing for non-wireless interfaces 547 // TODO: check if interface is wireless and support sniffing for non-wireless interfaces
548 548
549 if ( cardtype != DEVTYPE_FILE ) 549 if ( cardtype != DEVTYPE_FILE )
550 { 550 {
551 551
552 if ( !net->isPresent( interface ) ) 552 if ( !net->isPresent( interface ) )
553 { 553 {
554 QMessageBox::information( this, "Wellenreiter II", 554 QMessageBox::information( this, "Wellenreiter II",
555 tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); 555 tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) );
556 return; 556 return;
557 } 557 }
558 558
559 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! 559 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless!
560 assert( iface ); 560 assert( iface );
561 561
562 // bring device UP 562 // bring device UP
563 iface->setUp( true ); 563 iface->setUp( true );
564 if ( !iface->isUp() ) 564 if ( !iface->isUp() )
565 { 565 {
566 QMessageBox::warning( this, "Wellenreiter II", 566 QMessageBox::warning( this, "Wellenreiter II",
567 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); 567 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) );
568 return; 568 return;
569 } 569 }
570 570
571 // check if wireless extension version matches 571 // check if wireless extension version matches
572 if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() ) 572 if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() )
573 { 573 {
574 QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>are not matching!<p>" 574 QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>do not match!<p>"
575 " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" ) 575 " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" )
576 .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) ) 576 .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) )
577 .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) ); 577 .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) );
578 return; 578 return;
579 } 579 }
580 } 580 }
581 // set monitor mode 581 // set monitor mode
582 bool usePrism = configwindow->usePrismHeader(); 582 bool usePrism = configwindow->usePrismHeader();
583 583
584 switch ( cardtype ) 584 switch ( cardtype )
585 { 585 {
586 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; 586 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
587 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; 587 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
588 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; 588 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break;
589 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; 589 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break;
590 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; 590 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break;
591 case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << interface << "'" << oendl; break; 591 case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << interface << "'" << oendl; break;
592 default: assert( 0 ); // shouldn't reach this 592 default: assert( 0 ); // shouldn't reach this
593 } 593 }
594 594
595 // switch device into monitor mode 595 // switch device into monitor mode
596 if ( cardtype < DEVTYPE_FILE ) 596 if ( cardtype < DEVTYPE_FILE )
597 { 597 {
598 if ( cardtype != DEVTYPE_MANUAL ) 598 if ( cardtype != DEVTYPE_MANUAL )
599 iface->setMode( "monitor" ); 599 iface->setMode( "monitor" );
600 if ( iface->mode() != "monitor" ) 600 if ( iface->mode() != "monitor" )
601 { 601 {
602 if ( QMessageBox::warning( this, "Wellenreiter II", 602 if ( QMessageBox::warning( this, "Wellenreiter II",
603 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + 603 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) +
604 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 604 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
605 return; 605 return;
606 } 606 }
607 } 607 }
608 608
609 // open GPS device 609 // open GPS device
610 if ( configwindow->enableGPS->isChecked() ) 610 if ( configwindow->enableGPS->isChecked() )
611 { 611 {
612 odebug << "Wellenreiter:GPS enabled @ " << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; 612 odebug << "Wellenreiter:GPS enabled @ " << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl;
613 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 613 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
614 } 614 }
615 615
616 // open pcap and start sniffing 616 // open pcap and start sniffing
617 617
618 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? 618 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
619 { 619 {
620 dumpname = configwindow->captureFileName->text(); 620 dumpname = configwindow->captureFileName->text();
621 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 621 if ( dumpname.isEmpty() ) dumpname = "captureFile";
622 dumpname.append( '-' ); 622 dumpname.append( '-' );
623 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 623 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
624 dumpname.append( ".wellenreiter" ); 624 dumpname.append( ".wellenreiter" );
625 } 625 }
626 626
627 if ( cardtype != DEVTYPE_FILE ) 627 if ( cardtype != DEVTYPE_FILE )
628 pcap->open( interface ); 628 pcap->open( interface );
629 else 629 else
630 pcap->openCaptureFile( interface ); 630 pcap->openCaptureFile( interface );
631 631
632 if ( configwindow->writeCaptureFile->isChecked() ) 632 if ( configwindow->writeCaptureFile->isChecked() )
633 { 633 {
634 odebug << "Wellenreiter:: dumping to " << dumpname << oendl; 634 odebug << "Wellenreiter:: dumping to " << dumpname << oendl;
635 pcap->openDumpFile( dumpname ); 635 pcap->openDumpFile( dumpname );
636 } 636 }
637 637
638 if ( !pcap->isOpen() ) 638 if ( !pcap->isOpen() )
639 { 639 {
640 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 640 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
641 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); 641 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
642 return; 642 return;
643 } 643 }
644 644
645 // set capturer to non-blocking mode 645 // set capturer to non-blocking mode
646 pcap->setBlocking( false ); 646 pcap->setBlocking( false );
647 647
648 // start channel hopper 648 // start channel hopper
649 if ( cardtype != DEVTYPE_FILE ) 649 if ( cardtype != DEVTYPE_FILE )
650 { 650 {
651 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); 651 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) );
652 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window 652 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window
653 } 653 }
654 654
655 if ( cardtype != DEVTYPE_FILE ) 655 if ( cardtype != DEVTYPE_FILE )
656 { 656 {
657 // connect socket notifier and start channel hopper 657 // connect socket notifier and start channel hopper
658 connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); 658 connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) );
659 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 659 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
660 } 660 }
661 else 661 else
662 { 662 {
663 // start timer for reading packets 663 // start timer for reading packets
664 startTimer( 100 ); 664 startTimer( 100 );
665 } 665 }
666 666
667 logwindow->log( "(i) Started Scanning." ); 667 logwindow->log( "(i) Started Scanning." );
668 sniffing = true; 668 sniffing = true;
669 669
670 #ifdef QWS 670 #ifdef QWS
671 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) 671 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
672 { 672 {
673 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; 673 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
674 } 674 }
675 #else 675 #else
676 #warning FIXME: setScreenSaverMode is not operational on the X11 build 676 #warning FIXME: setScreenSaverMode is not operational on the X11 build
677 #endif 677 #endif
678 678
679 emit( startedSniffing() ); 679 emit( startedSniffing() );
680 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title 680 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
681 else 681 else
682 { 682 {
683 assert( parent() ); 683 assert( parent() );
684 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); 684 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
685 } 685 }
686} 686}
687 687
688 688
689void Wellenreiter::timerEvent( QTimerEvent* ) 689void Wellenreiter::timerEvent( QTimerEvent* )
690{ 690{
691 odebug << "Wellenreiter::timerEvent()" << oendl; 691 odebug << "Wellenreiter::timerEvent()" << oendl;
692 OPacket* p = pcap->next(); 692 OPacket* p = pcap->next();
693 if ( !p ) // no more packets available 693 if ( !p ) // no more packets available
694 { 694 {
695 stopClicked(); 695 stopClicked();
696 } 696 }
697 else 697 else
698 { 698 {
699 receivePacket( p ); 699 receivePacket( p );
700 // We no longer delete packets here. Ownership of the packets is 700 // We no longer delete packets here. Ownership of the packets is
701 // transferred to the PacketView. 701 // transferred to the PacketView.
702 //delete p; 702 //delete p;
703 } 703 }
704} 704}
705 705
706 706
707void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) 707void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ )
708{ 708{
709 #ifdef QWS 709 #ifdef QWS
710 if ( action == "TouchSound" ) 710 if ( action == "TouchSound" )
711 ODevice::inst()->playTouchSound(); 711 ODevice::inst()->playTouchSound();
712 else if ( action == "AlarmSound" ) 712 else if ( action == "AlarmSound" )
713 ODevice::inst()->playAlarmSound(); 713 ODevice::inst()->playAlarmSound();
714 else if ( action == "KeySound" ) 714 else if ( action == "KeySound" )
715 ODevice::inst()->playKeySound(); 715 ODevice::inst()->playKeySound();
716 else if ( action == "LedOn" ) 716 else if ( action == "LedOn" )
717 ODevice::inst()->setLedState( Led_Mail, Led_On ); 717 ODevice::inst()->setLedState( Led_Mail, Led_On );
718 else if ( action == "LedOff" ) 718 else if ( action == "LedOff" )
719 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 719 ODevice::inst()->setLedState( Led_Mail, Led_Off );
720 else if ( action == "LogMessage" ) 720 else if ( action == "LogMessage" )
721 logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); 721 logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) );
722 else if ( action == "MessageBox" ) 722 else if ( action == "MessageBox" )
723 QMessageBox::information( this, "Notification!", 723 QMessageBox::information( this, "Notification!",
724 QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); 724 QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) );
725 #else 725 #else
726 #warning Actions do not work with Qt/X11 yet 726 #warning Actions do not work with Qt/X11 yet
727 #endif 727 #endif
728} 728}
729 729
730void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) 730void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
731{ 731{
732 #ifdef QWS 732 #ifdef QWS
733 if ( !iface ) 733 if ( !iface )
734 { 734 {
735 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); 735 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
736 return; 736 return;
737 } 737 }
738 738
739 if ( sniffing ) 739 if ( sniffing )
740 { 740 {
741 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); 741 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
742 return; 742 return;
743 } 743 }
744 744
745 odebug << "joinNetwork() with Interface " << iface->name() 745 odebug << "joinNetwork() with Interface " << iface->name()
746 << ": " << type << ", " << essid 746 << ": " << type << ", " << essid
747 << ", " << channel << ", " << macaddr << oendl; 747 << ", " << channel << ", " << macaddr << oendl;
748 748
749 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); 749 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
750 int count = 3; 750 int count = 3;
751 odebug << "sending " << count << " messages" << oendl; 751 odebug << "sending " << count << " messages" << oendl;
752 msg << QString("count") << QString::number(count); 752 msg << QString("count") << QString::number(count);
753 odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; 753 odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl;
754 msg << QString(iface->name()) << QString("Mode") << type; 754 msg << QString(iface->name()) << QString("Mode") << type;
755 odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; 755 odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl;
756 msg << QString(iface->name()) << QString("ESSID") << essid; 756 msg << QString(iface->name()) << QString("ESSID") << essid;
757 odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; 757 odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl;
758 msg << QString(iface->name()) << QString("Channel") << channel; 758 msg << QString(iface->name()) << QString("Channel") << channel;
759// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; 759// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl;
760// msg << QString(iface->name()) << QString("MacAddr") << macaddr; 760// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
761 #else 761 #else
762 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); 762 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
763 #endif 763 #endif
764 764
765} 765}
766 766