summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
authorar <ar>2004-02-07 23:00:09 (UTC)
committer ar <ar>2004-02-07 23:00:09 (UTC)
commit3f261fa6eac46b8d0d4ac8b8bb95b385435004da (patch) (unidiff)
tree3ce8d25b96a287e2df7b194513f2c3c0a27ecd0a /noncore/net/wellenreiter/gui/wellenreiter.cpp
parent83a8f6fd9db949943d58d2f2a80304d516cf45d3 (diff)
downloadopie-3f261fa6eac46b8d0d4ac8b8bb95b385435004da.zip
opie-3f261fa6eac46b8d0d4ac8b8bb95b385435004da.tar.gz
opie-3f261fa6eac46b8d0d4ac8b8bb95b385435004da.tar.bz2
correct sound calls for use with libopie2
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 43a04e3..db68e5b 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -561,155 +561,155 @@ void Wellenreiter::startClicked()
561 } 561 }
562 562
563 // open pcap and start sniffing 563 // open pcap and start sniffing
564 564
565 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? 565 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
566 { 566 {
567 dumpname = configwindow->captureFileName->text(); 567 dumpname = configwindow->captureFileName->text();
568 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 568 if ( dumpname.isEmpty() ) dumpname = "captureFile";
569 dumpname.append( '-' ); 569 dumpname.append( '-' );
570 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 570 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
571 dumpname.append( ".wellenreiter" ); 571 dumpname.append( ".wellenreiter" );
572 } 572 }
573 else // write it anyway ;) 573 else // write it anyway ;)
574 { 574 {
575 dumpname = "/var/log/dump.wellenreiter"; 575 dumpname = "/var/log/dump.wellenreiter";
576 } 576 }
577 577
578 if ( cardtype != DEVTYPE_FILE ) 578 if ( cardtype != DEVTYPE_FILE )
579 pcap->open( interface ); 579 pcap->open( interface );
580 else 580 else
581 pcap->open( QFile( interface ) ); 581 pcap->open( QFile( interface ) );
582 582
583 qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); 583 qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname );
584 pcap->openDumpFile( dumpname ); 584 pcap->openDumpFile( dumpname );
585 585
586 if ( !pcap->isOpen() ) 586 if ( !pcap->isOpen() )
587 { 587 {
588 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 588 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
589 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); 589 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
590 return; 590 return;
591 } 591 }
592 592
593 // set capturer to non-blocking mode 593 // set capturer to non-blocking mode
594 pcap->setBlocking( false ); 594 pcap->setBlocking( false );
595 595
596 // start channel hopper 596 // start channel hopper
597 if ( cardtype != DEVTYPE_FILE ) 597 if ( cardtype != DEVTYPE_FILE )
598 { 598 {
599 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); 599 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) );
600 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window 600 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window
601 } 601 }
602 602
603 if ( cardtype != DEVTYPE_FILE ) 603 if ( cardtype != DEVTYPE_FILE )
604 { 604 {
605 // connect socket notifier and start channel hopper 605 // connect socket notifier and start channel hopper
606 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 606 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
607 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 607 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
608 } 608 }
609 else 609 else
610 { 610 {
611 // start timer for reading packets 611 // start timer for reading packets
612 startTimer( 100 ); 612 startTimer( 100 );
613 } 613 }
614 614
615 logwindow->log( "(i) Started Scanning." ); 615 logwindow->log( "(i) Started Scanning." );
616 sniffing = true; 616 sniffing = true;
617 617
618 #ifdef QWS 618 #ifdef QWS
619 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) 619 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
620 { 620 {
621 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; 621 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
622 } 622 }
623 #else 623 #else
624 #warning FIXME: setScreenSaverMode is not operational on the X11 build 624 #warning FIXME: setScreenSaverMode is not operational on the X11 build
625 #endif 625 #endif
626 626
627 emit( startedSniffing() ); 627 emit( startedSniffing() );
628 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title 628 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
629 else 629 else
630 { 630 {
631 assert( parent() ); 631 assert( parent() );
632 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); 632 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
633 } 633 }
634} 634}
635 635
636 636
637void Wellenreiter::timerEvent( QTimerEvent* ) 637void Wellenreiter::timerEvent( QTimerEvent* )
638{ 638{
639 qDebug( "Wellenreiter::timerEvent()" ); 639 qDebug( "Wellenreiter::timerEvent()" );
640 OPacket* p = pcap->next(); 640 OPacket* p = pcap->next();
641 if ( !p ) // no more packets available 641 if ( !p ) // no more packets available
642 { 642 {
643 stopClicked(); 643 stopClicked();
644 } 644 }
645 else 645 else
646 { 646 {
647 receivePacket( p ); 647 receivePacket( p );
648 delete p; 648 delete p;
649 } 649 }
650} 650}
651 651
652 652
653void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) 653void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p )
654{ 654{
655 #ifdef QWS 655 #ifdef QWS
656 if ( action == "TouchSound" ) 656 if ( action == "TouchSound" )
657 ODevice::inst()->touchSound(); 657 ODevice::inst()->playTouchSound();
658 else if ( action == "AlarmSound" ) 658 else if ( action == "AlarmSound" )
659 ODevice::inst()->alarmSound(); 659 ODevice::inst()->playAlarmSound();
660 else if ( action == "KeySound" ) 660 else if ( action == "KeySound" )
661 ODevice::inst()->keySound(); 661 ODevice::inst()->playKeySound();
662 else if ( action == "LedOn" ) 662 else if ( action == "LedOn" )
663 ODevice::inst()->setLedState( Led_Mail, Led_On ); 663 ODevice::inst()->setLedState( Led_Mail, Led_On );
664 else if ( action == "LedOff" ) 664 else if ( action == "LedOff" )
665 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 665 ODevice::inst()->setLedState( Led_Mail, Led_Off );
666 else if ( action == "LogMessage" ) 666 else if ( action == "LogMessage" )
667 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 667 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
668 else if ( action == "MessageBox" ) 668 else if ( action == "MessageBox" )
669 QMessageBox::information( this, "Notification!", 669 QMessageBox::information( this, "Notification!",
670 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 670 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
671 #else 671 #else
672 #warning Actions do not work with Qt/X11 yet 672 #warning Actions do not work with Qt/X11 yet
673 #endif 673 #endif
674} 674}
675 675
676void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) 676void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
677{ 677{
678 #ifdef QWS 678 #ifdef QWS
679 if ( !iface ) 679 if ( !iface )
680 { 680 {
681 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); 681 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
682 return; 682 return;
683 } 683 }
684 684
685 if ( sniffing ) 685 if ( sniffing )
686 { 686 {
687 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); 687 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
688 return; 688 return;
689 } 689 }
690 690
691 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", 691 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s",
692 (const char*) iface->name(), 692 (const char*) iface->name(),
693 (const char*) type, 693 (const char*) type,
694 (const char*) essid, 694 (const char*) essid,
695 channel, 695 channel,
696 (const char*) macaddr ); 696 (const char*) macaddr );
697 697
698 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); 698 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
699 int count = 3; 699 int count = 3;
700 qDebug("sending %d messages",count); 700 qDebug("sending %d messages",count);
701 msg << QString("count") << QString::number(count); 701 msg << QString("count") << QString::number(count);
702 qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); 702 qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() );
703 msg << QString(iface->name()) << QString("Mode") << type; 703 msg << QString(iface->name()) << QString("Mode") << type;
704 qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); 704 qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1());
705 msg << QString(iface->name()) << QString("ESSID") << essid; 705 msg << QString(iface->name()) << QString("ESSID") << essid;
706 qDebug("msg >%s< channel >%d<", iface->name(),channel); 706 qDebug("msg >%s< channel >%d<", iface->name(),channel);
707 msg << QString(iface->name()) << QString("Channel") << channel; 707 msg << QString(iface->name()) << QString("Channel") << channel;
708// qDebug("msg >%s< mac >%s<", iface->name(),macaddr); 708// qDebug("msg >%s< mac >%s<", iface->name(),macaddr);
709// msg << QString(iface->name()) << QString("MacAddr") << macaddr; 709// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
710 #else 710 #else
711 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); 711 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
712 #endif 712 #endif
713 713
714} 714}
715 715