summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp39
1 files changed, 0 insertions, 39 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 8cabf0d..c4e6f02 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -61,50 +61,48 @@
61using namespace Opie::Core; 61using namespace Opie::Core;
62using namespace Opie::Net; 62using namespace Opie::Net;
63using namespace Opie::Ui; 63using namespace Opie::Ui;
64 64
65Wellenreiter* Wellenreiter::instance = 0; 65Wellenreiter* Wellenreiter::instance = 0;
66 66
67Wellenreiter::Wellenreiter( QWidget* parent ) 67Wellenreiter::Wellenreiter( QWidget* parent )
68 : WellenreiterBase( parent, 0, 0 ), 68 : WellenreiterBase( parent, 0, 0 ),
69 sniffing( false ), iface( 0 ), configwindow( 0 ) 69 sniffing( false ), iface( 0 ), configwindow( 0 )
70{ 70{
71 71
72 logwindow->log( "(i) Wellenreiter has been started." ); 72 logwindow->log( "(i) Wellenreiter has been started." );
73 73
74 // 74 //
75 // detect operating system 75 // detect operating system
76 // 76 //
77 77
78 #ifdef QWS 78 #ifdef QWS
79 QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() ); 79 QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() );
80 _system = ODevice::inst()->system(); 80 _system = ODevice::inst()->system();
81 logwindow->log( sys ); 81 logwindow->log( sys );
82 #endif 82 #endif
83 83
84 netview->setColumnWidthMode( 1, QListView::Manual ); 84 netview->setColumnWidthMode( 1, QListView::Manual );
85 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
86 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
87 pcap = new OPacketCapturer(); 85 pcap = new OPacketCapturer();
88 pcap->setAutoDelete( false ); 86 pcap->setAutoDelete( false );
89 87
90 gps = new GPS( this ); 88 gps = new GPS( this );
91 89
92 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); 90 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
93 91
94 registerSignalHandler(); 92 registerSignalHandler();
95} 93}
96 94
97 95
98Wellenreiter::~Wellenreiter() 96Wellenreiter::~Wellenreiter()
99{ 97{
100 delete pcap; 98 delete pcap;
101 //unregisterSignalHandler(); 99 //unregisterSignalHandler();
102} 100}
103 101
104 102
105void Wellenreiter::initialTimer() 103void Wellenreiter::initialTimer()
106{ 104{
107 odebug << "preloading manufacturer database..." << oendl; 105 odebug << "preloading manufacturer database..." << oendl;
108 OManufacturerDB::instance(); 106 OManufacturerDB::instance();
109} 107}
110 108
@@ -707,73 +705,36 @@ void Wellenreiter::timerEvent( QTimerEvent* )
707 705
708void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) 706void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ )
709{ 707{
710 #ifdef QWS 708 #ifdef QWS
711 if ( action == "TouchSound" ) 709 if ( action == "TouchSound" )
712 ODevice::inst()->playTouchSound(); 710 ODevice::inst()->playTouchSound();
713 else if ( action == "AlarmSound" ) 711 else if ( action == "AlarmSound" )
714 ODevice::inst()->playAlarmSound(); 712 ODevice::inst()->playAlarmSound();
715 else if ( action == "KeySound" ) 713 else if ( action == "KeySound" )
716 ODevice::inst()->playKeySound(); 714 ODevice::inst()->playKeySound();
717 else if ( action == "LedOn" ) 715 else if ( action == "LedOn" )
718 ODevice::inst()->setLedState( Led_Mail, Led_On ); 716 ODevice::inst()->setLedState( Led_Mail, Led_On );
719 else if ( action == "LedOff" ) 717 else if ( action == "LedOff" )
720 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 718 ODevice::inst()->setLedState( Led_Mail, Led_Off );
721 else if ( action == "LogMessage" ) 719 else if ( action == "LogMessage" )
722 logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); 720 logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) );
723 else if ( action == "MessageBox" ) 721 else if ( action == "MessageBox" )
724 QMessageBox::information( this, "Notification!", 722 QMessageBox::information( this, "Notification!",
725 QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); 723 QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) );
726 #else 724 #else
727 #warning Actions do not work with Qt/X11 yet 725 #warning Actions do not work with Qt/X11 yet
728 #endif 726 #endif
729} 727}
730 728
731void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
732{
733 #ifdef QWS
734 if ( !iface )
735 {
736 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
737 return;
738 }
739
740 if ( sniffing )
741 {
742 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
743 return;
744 }
745
746 odebug << "joinNetwork() with Interface " << iface->name()
747 << ": " << type << ", " << essid
748 << ", " << channel << ", " << macaddr << oendl;
749
750 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
751 int count = 3;
752 odebug << "sending " << count << " messages" << oendl;
753 msg << QString("count") << QString::number(count);
754 odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl;
755 msg << QString(iface->name()) << QString("Mode") << type;
756 odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl;
757 msg << QString(iface->name()) << QString("ESSID") << essid;
758 odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl;
759 msg << QString(iface->name()) << QString("Channel") << channel;
760// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl;
761// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
762 #else
763 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
764 #endif
765
766}
767
768void Wellenreiter::updateStatistics() 729void Wellenreiter::updateStatistics()
769{ 730{
770 // print out statistics 731 // print out statistics
771 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) 732 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
772 statwindow->updateCounter( it.key(), it.data() ); 733 statwindow->updateCounter( it.key(), it.data() );
773} 734}
774 735
775void Wellenreiter::slotTabChanged( QWidget* wid ) 736void Wellenreiter::slotTabChanged( QWidget* wid )
776{ 737{
777 if ( wid == statwindow ) 738 if ( wid == statwindow )
778 updateStatistics(); 739 updateStatistics();
779} 740}