summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp24
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h5
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.h3
4 files changed, 45 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 2305403..5bec7ed 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -54,117 +54,139 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
54 interfaceName->insertItem( it.current()->name() ); 54 interfaceName->insertItem( it.current()->name() );
55 ++it; 55 ++it;
56 } 56 }
57 57
58 // try to guess device type 58 // try to guess device type
59 QFile m( "/proc/modules" ); 59 QFile m( "/proc/modules" );
60 if ( m.open( IO_ReadOnly ) ) 60 if ( m.open( IO_ReadOnly ) )
61 { 61 {
62 int devicetype(0); 62 int devicetype(0);
63 QString line; 63 QString line;
64 QTextStream modules( &m ); 64 QTextStream modules( &m );
65 while( !modules.atEnd() && !devicetype ) 65 while( !modules.atEnd() && !devicetype )
66 { 66 {
67 modules >> line; 67 modules >> line;
68 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; 68 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
69 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; 69 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
70 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; 70 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
71 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; 71 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
72 } 72 }
73 if ( devicetype ) 73 if ( devicetype )
74 { 74 {
75 deviceType->setCurrentItem( devicetype ); 75 deviceType->setCurrentItem( devicetype );
76 _guess = devicetype; 76 _guess = devicetype;
77 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); 77 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
78 } 78 }
79 } 79 }
80 80
81 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 81 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
82 QPushButton* okButton = new QPushButton( "ok", this ); 82 QPushButton* okButton = new QPushButton( "ok", this );
83 okButton->show(); 83 okButton->show();
84 Layout5_2->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui 84 Layout5_2->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
85 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 85 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
86 #endif 86 #endif
87 87
88 WellenreiterConfigWindow::_instance = this; 88 WellenreiterConfigWindow::_instance = this;
89 89
90 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); 90 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
91 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); 91 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
92 92
93 // make the checkbox 'channelAll' control all other channels 93 // make the checkbox 'channelAll' control all other channels
94 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); 94 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
95}; 95};
96 96
97 97
98int WellenreiterConfigWindow::driverType() const 98int WellenreiterConfigWindow::driverType() const
99{ 99{
100 QString name = deviceType->currentText(); 100 QString name = deviceType->currentText();
101 if ( _devicetype.contains( name ) ) 101 if ( _devicetype.contains( name ) )
102 { 102 {
103 return _devicetype[name]; 103 return _devicetype[name];
104 } 104 }
105 else 105 else
106 { 106 {
107 return 0; 107 return 0;
108 } 108 }
109}; 109};
110 110
111 111
112int WellenreiterConfigWindow::hoppingInterval() const 112int WellenreiterConfigWindow::hoppingInterval() const
113{ 113{
114 return hopInterval->cleanText().toInt(); 114 return hopInterval->cleanText().toInt();
115} 115}
116 116
117 117
118bool WellenreiterConfigWindow::usePrismHeader() 118bool WellenreiterConfigWindow::usePrismHeader() const
119{ 119{
120 return prismHeader->isOn(); 120 return prismHeader->isOn();
121} 121}
122 122
123 123
124bool WellenreiterConfigWindow::isChannelChecked( int channel ) const
125{
126 switch ( channel )
127 {
128 case 1: return channel1->isOn();
129 case 2: return channel2->isOn();
130 case 3: return channel3->isOn();
131 case 4: return channel4->isOn();
132 case 5: return channel5->isOn();
133 case 6: return channel6->isOn();
134 case 7: return channel7->isOn();
135 case 8: return channel8->isOn();
136 case 9: return channel9->isOn();
137 case 10: return channel10->isOn();
138 case 11: return channel11->isOn();
139 case 12: return channel12->isOn();
140 case 13: return channel13->isOn();
141 case 14: return channel14->isOn();
142 }
143}
144
145
124void WellenreiterConfigWindow::changedDeviceType(int t) 146void WellenreiterConfigWindow::changedDeviceType(int t)
125{ 147{
126 if ( t != DEVTYPE_FILE ) return; 148 if ( t != DEVTYPE_FILE ) return;
127 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); 149 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
128 if ( !name.isEmpty() && QFile::exists( name ) ) 150 if ( !name.isEmpty() && QFile::exists( name ) )
129 { 151 {
130 interfaceName->insertItem( name ); 152 interfaceName->insertItem( name );
131 interfaceName->setCurrentItem( interfaceName->count()-1 ); 153 interfaceName->setCurrentItem( interfaceName->count()-1 );
132 } 154 }
133 else 155 else
134 { 156 {
135 deviceType->setCurrentItem( _guess ); 157 deviceType->setCurrentItem( _guess );
136 } 158 }
137 159
138} 160}
139 161
140 162
141void WellenreiterConfigWindow::getCaptureFileNameClicked() 163void WellenreiterConfigWindow::getCaptureFileNameClicked()
142{ 164{
143 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 165 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
144 qDebug( "name = %s", (const char*) name ); 166 qDebug( "name = %s", (const char*) name );
145 if ( !name.isEmpty() ) 167 if ( !name.isEmpty() )
146 { 168 {
147 captureFileName->setText( name ); 169 captureFileName->setText( name );
148 } 170 }
149} 171}
150 172
151 173
152void WellenreiterConfigWindow::channelAllClicked(int state) 174void WellenreiterConfigWindow::channelAllClicked(int state)
153{ 175{
154 bool b = state; 176 bool b = state;
155 channel1->setChecked( b ); 177 channel1->setChecked( b );
156 channel2->setChecked( b ); 178 channel2->setChecked( b );
157 channel3->setChecked( b ); 179 channel3->setChecked( b );
158 channel4->setChecked( b ); 180 channel4->setChecked( b );
159 channel5->setChecked( b ); 181 channel5->setChecked( b );
160 channel6->setChecked( b ); 182 channel6->setChecked( b );
161 channel7->setChecked( b ); 183 channel7->setChecked( b );
162 channel8->setChecked( b ); 184 channel8->setChecked( b );
163 channel9->setChecked( b ); 185 channel9->setChecked( b );
164 channel10->setChecked( b ); 186 channel10->setChecked( b );
165 channel11->setChecked( b ); 187 channel11->setChecked( b );
166 channel12->setChecked( b ); 188 channel12->setChecked( b );
167 channel13->setChecked( b ); 189 channel13->setChecked( b );
168 channel14->setChecked( b ); 190 channel14->setChecked( b );
169} 191}
170 192
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index 057bed6..32dc840 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -1,61 +1,62 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITERCONFIGWINDOW_H 16#ifndef WELLENREITERCONFIGWINDOW_H
17#define WELLENREITERCONFIGWINDOW_H 17#define WELLENREITERCONFIGWINDOW_H
18 18
19#include "configbase.h" 19#include "configbase.h"
20#include <qmap.h> 20#include <qmap.h>
21#include <qcombobox.h> 21#include <qcombobox.h>
22#include <qstring.h> 22#include <qstring.h>
23 23
24const int DEVTYPE_SELECT = 0; 24const int DEVTYPE_SELECT = 0;
25const int DEVTYPE_CISCO = 1; 25const int DEVTYPE_CISCO = 1;
26const int DEVTYPE_WLAN_NG = 2; 26const int DEVTYPE_WLAN_NG = 2;
27const int DEVTYPE_HOSTAP = 3; 27const int DEVTYPE_HOSTAP = 3;
28const int DEVTYPE_ORINOCO = 4; 28const int DEVTYPE_ORINOCO = 4;
29const int DEVTYPE_MANUAL = 5; 29const int DEVTYPE_MANUAL = 5;
30const int DEVTYPE_FILE = 6; 30const int DEVTYPE_FILE = 6;
31 31
32class WellenreiterConfigWindow; 32class WellenreiterConfigWindow;
33 33
34class WellenreiterConfigWindow : public WellenreiterConfigBase 34class WellenreiterConfigWindow : public WellenreiterConfigBase
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 37
38 public: 38 public:
39 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); 39 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
40 int driverType() const; 40 int driverType() const;
41 int hoppingInterval() const;
42 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; 41 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ };
43 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; 42 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ };
44 static WellenreiterConfigWindow* instance() { return _instance; }; 43 static WellenreiterConfigWindow* instance() { return _instance; };
45 44
46 bool usePrismHeader(); 45 int hoppingInterval() const;
46 bool usePrismHeader() const;
47 bool isChannelChecked( int ) const;
47 48
48 public slots: 49 public slots:
49 void changedDeviceType(int); 50 void changedDeviceType(int);
50 void getCaptureFileNameClicked(); 51 void getCaptureFileNameClicked();
51 52
52 void channelAllClicked(int); 53 void channelAllClicked(int);
53 54
54 protected: 55 protected:
55 QMap<QString, int> _devicetype; 56 QMap<QString, int> _devicetype;
56 static WellenreiterConfigWindow* _instance; 57 static WellenreiterConfigWindow* _instance;
57 int _guess; 58 int _guess;
58 59
59}; 60};
60 61
61#endif 62#endif
diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp
index 8b86072..05ff5e7 100644
--- a/noncore/net/wellenreiter/gui/protolistview.cpp
+++ b/noncore/net/wellenreiter/gui/protolistview.cpp
@@ -29,67 +29,83 @@ ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f
29 :QScrollView( parent, name, f ) 29 :QScrollView( parent, name, f )
30{ 30{
31 actions = ( QString( "parsePackets" ) == QString( name ) ); 31 actions = ( QString( "parsePackets" ) == QString( name ) );
32 32
33 setMargins( 3, 3, 0, 0 ); 33 setMargins( 3, 3, 0, 0 );
34 viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); 34 viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) );
35 35
36 vbox = new QVBox( viewport() ); 36 vbox = new QVBox( viewport() );
37 vbox->setSpacing( 1 ); 37 vbox->setSpacing( 1 );
38 addChild( vbox ); 38 addChild( vbox );
39 39
40 QHBox* hbox = new QHBox( vbox ); 40 QHBox* hbox = new QHBox( vbox );
41 hbox->setSpacing( 40 ); 41 hbox->setSpacing( 40 );
42 new QLabel( tr( "Protocol Family" ), hbox ); 42 new QLabel( tr( "Protocol Family" ), hbox );
43 if ( actions ) new QLabel( tr( "Perform Action" ), hbox ); 43 if ( actions ) new QLabel( tr( "Perform Action" ), hbox );
44 QFrame* frame = new QFrame( vbox ); 44 QFrame* frame = new QFrame( vbox );
45 frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); 45 frame->setFrameStyle( QFrame::HLine + QFrame::Sunken );
46 46
47 //TODO: hardcoded for now...a protocol database would be nice!? 47 //TODO: hardcoded for now...a protocol database would be nice!?
48 48
49 //addProtocol( "Ethernet" ); 49 //addProtocol( "Ethernet" );
50 addProtocol( "Prism" ); 50 addProtocol( "Prism" );
51 //addProtocol( "802.11" ); 51 //addProtocol( "802.11" );
52 addProtocol( "802.11 Management" ); 52 addProtocol( "802.11 Management" );
53 addProtocol( "802.11 SSID" ); 53 addProtocol( "802.11 SSID" );
54 addProtocol( "802.11 Rates" ); 54 addProtocol( "802.11 Rates" );
55 addProtocol( "802.11 CF" ); 55 addProtocol( "802.11 CF" );
56 addProtocol( "802.11 FH" ); 56 addProtocol( "802.11 FH" );
57 addProtocol( "802.11 DS" ); 57 addProtocol( "802.11 DS" );
58 addProtocol( "802.11 Tim" ); 58 addProtocol( "802.11 Tim" );
59 addProtocol( "802.11 IBSS" ); 59 addProtocol( "802.11 IBSS" );
60 addProtocol( "802.11 Challenge" ); 60 addProtocol( "802.11 Challenge" );
61 addProtocol( "802.11 Data" ); 61 addProtocol( "802.11 Data" );
62 addProtocol( "802.11 LLC" ); 62 addProtocol( "802.11 LLC" );
63 addProtocol( "802.11 Data" ); 63 addProtocol( "802.11 Data" );
64 addProtocol( "IP" ); 64 addProtocol( "IP" );
65 addProtocol( "ARP" ); 65 addProtocol( "ARP" );
66 addProtocol( "UDP" ); 66 addProtocol( "UDP" );
67 addProtocol( "TCP" ); 67 addProtocol( "TCP" );
68} 68}
69 69
70 70
71ProtocolListView::~ProtocolListView() 71ProtocolListView::~ProtocolListView()
72{ 72{
73} 73}
74 74
75 75
76void ProtocolListView::addProtocol( const QString& name ) 76void ProtocolListView::addProtocol( const QString& name )
77{ 77{
78 QHBox* hbox = new QHBox( vbox ); 78 QHBox* hbox = new QHBox( vbox );
79 new QCheckBox( name, hbox, (const char*) name ); 79 new QCheckBox( name, hbox, (const char*) name );
80 80
81 if ( actions ) 81 if ( actions )
82 { 82 {
83 QComboBox* combo = new QComboBox( hbox, (const char*) name ); 83 QComboBox* combo = new QComboBox( hbox, (const char*) name );
84 #ifdef QWS 84 #ifdef QWS
85 combo->setFixedWidth( 75 ); 85 combo->setFixedWidth( 75 );
86 #endif 86 #endif
87 combo->insertItem( "Ignore" ); 87 combo->insertItem( "Ignore" );
88 combo->insertItem( "TouchSound" ); 88 combo->insertItem( "TouchSound" );
89 combo->insertItem( "AlarmSound" ); 89 combo->insertItem( "AlarmSound" );
90 combo->insertItem( "KeySound" ); 90 combo->insertItem( "KeySound" );
91 combo->insertItem( "LedOn" ); 91 combo->insertItem( "LedOn" );
92 combo->insertItem( "LedOff" ); 92 combo->insertItem( "LedOff" );
93 combo->insertItem( "LogMessage" );
94 combo->insertItem( "MessageBox" );
93 } 95 }
94} 96}
95 97
98
99bool ProtocolListView::isProtocolChecked( const QString& name )
100{
101 QCheckBox* box = (QCheckBox*) child( (const char*) name );
102 return ( box && box->isOn() );
103}
104
105
106QString ProtocolListView::protocolAction( const QString& name ) const
107{
108 //FIXME
109}
110
111
diff --git a/noncore/net/wellenreiter/gui/protolistview.h b/noncore/net/wellenreiter/gui/protolistview.h
index 42aec7d..723e8cd 100644
--- a/noncore/net/wellenreiter/gui/protolistview.h
+++ b/noncore/net/wellenreiter/gui/protolistview.h
@@ -1,44 +1,47 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef PROTOLISTVIEW_H 16#ifndef PROTOLISTVIEW_H
17#define PROTOLISTVIEW_H 17#define PROTOLISTVIEW_H
18 18
19#include <qscrollview.h> 19#include <qscrollview.h>
20#include <qdict.h> 20#include <qdict.h>
21//#include <qcheckbox.h> 21//#include <qcheckbox.h>
22//#include <qcombobox.h> 22//#include <qcombobox.h>
23class QCheckBox; 23class QCheckBox;
24class QComboBox; 24class QComboBox;
25 25
26class QVBox; 26class QVBox;
27 27
28class ProtocolListView : public QScrollView 28class ProtocolListView : public QScrollView
29{ 29{
30 public: 30 public:
31 ProtocolListView( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); 31 ProtocolListView( QWidget* parent = 0, const char* name = 0, WFlags f = 0 );
32 virtual ~ProtocolListView(); 32 virtual ~ProtocolListView();
33 33
34 bool isProtocolChecked( const QString& name );
35 QString protocolAction( const QString& name ) const;
36
34 protected: 37 protected:
35 virtual void addProtocol( const QString& name ); 38 virtual void addProtocol( const QString& name );
36 39
37 private: 40 private:
38 QVBox* vbox; 41 QVBox* vbox;
39 bool actions; 42 bool actions;
40}; 43};
41 44
42 45
43 46
44#endif // PROTOLISTVIEW_H 47#endif // PROTOLISTVIEW_H