summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-08-24 11:53:43 (UTC)
committer mickeyl <mickeyl>2004-08-24 11:53:43 (UTC)
commitb06390cb17114692a9fd5233d77620b385252480 (patch) (unidiff)
tree91de2ed5b0eb6ed739eb6bd0126e2ad004d6a9bd
parent94611edc1942717faa15861adef25418e40ea626 (diff)
downloadopie-b06390cb17114692a9fd5233d77620b385252480.zip
opie-b06390cb17114692a9fd5233d77620b385252480.tar.gz
opie-b06390cb17114692a9fd5233d77620b385252480.tar.bz2
apply megapatch courtesy Holger 'Zecke' Freyther:
- bump version to 1.0.3-cvs - fix compile warnings - fix PacketViewer not to scroll, when watching in "real time" - fix appending text to log view - update statistics when tab is getting activated
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/graphwindow.cpp34
-rw-r--r--noncore/net/wellenreiter/gui/graphwindow.h26
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp12
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp9
-rw-r--r--noncore/net/wellenreiter/gui/packetview.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.cpp10
-rw-r--r--noncore/net/wellenreiter/gui/resource.cpp8
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp61
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp70
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h5
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp2
-rw-r--r--noncore/net/wellenreiter/opie-wellenreiter.control2
-rw-r--r--noncore/net/wellenreiter/wellenreiter.pro1
14 files changed, 154 insertions, 118 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index ae149e2..1670f93 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -1,492 +1,496 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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/* LOCAL */ 16/* LOCAL */
17#include "configwindow.h" 17#include "configwindow.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19#include "protolistview.h"
19 20
20/* OPIE */ 21/* OPIE */
21#include <opie2/onetwork.h> 22#include <opie2/onetwork.h>
22#ifdef QWS 23#ifdef QWS
23#include <opie2/oapplication.h> 24#include <opie2/oapplication.h>
24#include <opie2/oconfig.h> 25#include <opie2/oconfig.h>
25#include <opie2/odevice.h> 26#include <opie2/odevice.h>
26#include <opie2/odebug.h> 27#include <opie2/odebug.h>
27using namespace Opie::Core; 28using namespace Opie::Core;
28using namespace Opie::Net; 29using namespace Opie::Net;
29#endif 30#endif
30 31
31/* QT */ 32/* QT */
32#include <qapplication.h> 33#include <qapplication.h>
33#include <qcheckbox.h> 34#include <qcheckbox.h>
34#include <qcombobox.h> 35#include <qcombobox.h>
35#include <qfile.h> 36#include <qfile.h>
36#include <qlineedit.h> 37#include <qlineedit.h>
37#include <qlayout.h> 38#include <qlayout.h>
38#include <qmap.h> 39#include <qmap.h>
39#include <qpushbutton.h> 40#include <qpushbutton.h>
40#include <qradiobutton.h> 41#include <qradiobutton.h>
41#include <qspinbox.h> 42#include <qspinbox.h>
42#include <qtabwidget.h> 43#include <qtabwidget.h>
43#include <qtoolbutton.h> 44#include <qtoolbutton.h>
44#include <qtextstream.h> 45#include <qtextstream.h>
45 46
46/* STD */ 47/* STD */
47#include <assert.h> 48#include <assert.h>
48 49
49WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 50WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
50 51
51WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 52WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
52 :WellenreiterConfigBase( parent, name, true, f ) 53 :WellenreiterConfigBase( parent, name, true, f )
53{ 54{
54 _devicetype[ "cisco" ] = DEVTYPE_CISCO; 55 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
55 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; 56 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
56 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; 57 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
57 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; 58 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
58 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; 59 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
59 _devicetype[ "<file>" ] = DEVTYPE_FILE; 60 _devicetype[ "<file>" ] = DEVTYPE_FILE;
60 61
61 // gather possible interface names from ONetwork 62 // gather possible interface names from ONetwork
62 ONetwork* net = ONetwork::instance(); 63 ONetwork* net = ONetwork::instance();
63 ONetwork::InterfaceIterator it = net->iterator(); 64 ONetwork::InterfaceIterator it = net->iterator();
64 while ( it.current() ) 65 while ( it.current() )
65 { 66 {
66 if ( it.current()->isWireless() ) 67 if ( it.current()->isWireless() )
67 interfaceName->insertItem( it.current()->name() ); 68 interfaceName->insertItem( it.current()->name() );
68 ++it; 69 ++it;
69 } 70 }
70 71
71 load(); 72 load();
72 73
73 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 74 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
74 QPushButton* okButton = new QPushButton( "ok", this ); 75 QPushButton* okButton = new QPushButton( "ok", this );
75 okButton->show(); 76 okButton->show();
76 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui 77 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
77 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 78 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
78 #endif 79 #endif
79 80
80 WellenreiterConfigWindow::_instance = this; 81 WellenreiterConfigWindow::_instance = this;
81 82
82 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); 83 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
83 connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); 84 connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) );
84 connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); 85 connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) );
85 connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); 86 connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) );
86 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); 87 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
87 88
88 // make the checkbox 'channelAll' control all other channels 89 // make the checkbox 'channelAll' control all other channels
89 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); 90 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
90 91
91 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); 92 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) );
92 93
93 // hide tab4 (parse) until Wellenreiter 1.2 94 // hide tab4 (parse) until Wellenreiter 1.2
94 tab->removePage( tab_4 ); 95 tab->removePage( tab_4 );
95}; 96};
96 97
97 98
98void WellenreiterConfigWindow::accept() 99void WellenreiterConfigWindow::accept()
99{ 100{
100 save(); 101 save();
101 QDialog::accept(); 102 QDialog::accept();
102} 103}
103 104
104 105
105WellenreiterConfigWindow::~WellenreiterConfigWindow() 106WellenreiterConfigWindow::~WellenreiterConfigWindow()
106{ 107{
107} 108}
108 109
109 110
110void WellenreiterConfigWindow::performAutodetection() 111void WellenreiterConfigWindow::performAutodetection()
111{ 112{
112 //TODO: insert modal splash screen here 113 //TODO: insert modal splash screen here
113 // and sleep a second, so that it looks 114 // and sleep a second, so that it looks
114 // like we're actually doing something fancy... ;-) 115 // like we're actually doing something fancy... ;-)
115 116
116 odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl; 117 odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl;
117 118
118 // try to guess device type 119 // try to guess device type
119 QFile m( "/proc/modules" ); 120 QFile m( "/proc/modules" );
120 if ( m.open( IO_ReadOnly ) ) 121 if ( m.open( IO_ReadOnly ) )
121 { 122 {
122 int devicetype(0); 123 int devicetype(0);
123 QString line; 124 QString line;
124 QTextStream modules( &m ); 125 QTextStream modules( &m );
125 while( !modules.atEnd() && !devicetype ) 126 while( !modules.atEnd() && !devicetype )
126 { 127 {
127 modules >> line; 128 modules >> line;
128 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; 129 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
129 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; 130 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
130 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; 131 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
131 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; 132 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
132 } 133 }
133 if ( devicetype ) 134 if ( devicetype )
134 { 135 {
135 deviceType->setCurrentItem( devicetype ); 136 deviceType->setCurrentItem( devicetype );
136 _guess = devicetype; 137 _guess = devicetype;
137 odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl; 138 odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl;
138 } 139 }
139 } 140 }
140} 141}
141 142
142 143
143int WellenreiterConfigWindow::driverType() const 144int WellenreiterConfigWindow::driverType() const
144{ 145{
145 QString name = deviceType->currentText(); 146 QString name = deviceType->currentText();
146 if ( _devicetype.contains( name ) ) 147 if ( _devicetype.contains( name ) )
147 { 148 {
148 return _devicetype[name]; 149 return _devicetype[name];
149 } 150 }
150 else 151 else
151 { 152 {
152 return 0; 153 return 0;
153 } 154 }
154}; 155};
155 156
156 157
157int WellenreiterConfigWindow::hoppingInterval() const 158int WellenreiterConfigWindow::hoppingInterval() const
158{ 159{
159 return hopInterval->cleanText().toInt(); 160 return hopInterval->cleanText().toInt();
160} 161}
161 162
162 163
163bool WellenreiterConfigWindow::usePrismHeader() const 164bool WellenreiterConfigWindow::usePrismHeader() const
164{ 165{
165 return prismHeader->isChecked(); 166 return prismHeader->isChecked();
166} 167}
167 168
168 169
169bool WellenreiterConfigWindow::isChannelChecked( int channel ) const 170bool WellenreiterConfigWindow::isChannelChecked( int channel ) const
170{ 171{
171 switch ( channel ) 172 switch ( channel )
172 { 173 {
173 case 1: return channel1->isOn(); 174 case 1: return channel1->isOn();
174 case 2: return channel2->isOn(); 175 case 2: return channel2->isOn();
175 case 3: return channel3->isOn(); 176 case 3: return channel3->isOn();
176 case 4: return channel4->isOn(); 177 case 4: return channel4->isOn();
177 case 5: return channel5->isOn(); 178 case 5: return channel5->isOn();
178 case 6: return channel6->isOn(); 179 case 6: return channel6->isOn();
179 case 7: return channel7->isOn(); 180 case 7: return channel7->isOn();
180 case 8: return channel8->isOn(); 181 case 8: return channel8->isOn();
181 case 9: return channel9->isOn(); 182 case 9: return channel9->isOn();
182 case 10: return channel10->isOn(); 183 case 10: return channel10->isOn();
183 case 11: return channel11->isOn(); 184 case 11: return channel11->isOn();
184 case 12: return channel12->isOn(); 185 case 12: return channel12->isOn();
185 case 13: return channel13->isOn(); 186 case 13: return channel13->isOn();
186 case 14: return channel14->isOn(); 187 case 14: return channel14->isOn();
188 default: return false;
187 } 189 }
190
191
188} 192}
189 193
190 194
191void WellenreiterConfigWindow::changedDeviceType(int t) 195void WellenreiterConfigWindow::changedDeviceType(int t)
192{ 196{
193 if ( t != DEVTYPE_FILE ) return; 197 if ( t != DEVTYPE_FILE ) return;
194 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); 198 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
195 if ( !name.isEmpty() && QFile::exists( name ) ) 199 if ( !name.isEmpty() && QFile::exists( name ) )
196 { 200 {
197 interfaceName->insertItem( name ); 201 interfaceName->insertItem( name );
198 interfaceName->setCurrentItem( interfaceName->count()-1 ); 202 interfaceName->setCurrentItem( interfaceName->count()-1 );
199 } 203 }
200 else 204 else
201 { 205 {
202 deviceType->setCurrentItem( _guess ); 206 deviceType->setCurrentItem( _guess );
203 } 207 }
204 208
205} 209}
206 210
207 211
208void WellenreiterConfigWindow::synchronizeActionsAndScripts() 212void WellenreiterConfigWindow::synchronizeActionsAndScripts()
209{ 213{
210 if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide(); 214 if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide();
211 if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide(); 215 if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide();
212 if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide(); 216 if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide();
213 217
214 //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 ); 218 //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 );
215 //newClientScript->setEnabled( newClientAction->currentItem() == 4 ); 219 //newClientScript->setEnabled( newClientAction->currentItem() == 4 );
216 //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); 220 //newStationScript->setEnabled( newStationAction->currentItem() == 4 );
217} 221}
218 222
219 223
220void WellenreiterConfigWindow::changedNetworkAction(int t) 224void WellenreiterConfigWindow::changedNetworkAction(int )
221{ 225{
222 synchronizeActionsAndScripts(); 226 synchronizeActionsAndScripts();
223} 227}
224 228
225 229
226void WellenreiterConfigWindow::changedClientAction(int t) 230void WellenreiterConfigWindow::changedClientAction(int )
227{ 231{
228 synchronizeActionsAndScripts(); 232 synchronizeActionsAndScripts();
229} 233}
230 234
231 235
232void WellenreiterConfigWindow::changedStationAction(int t) 236void WellenreiterConfigWindow::changedStationAction(int )
233{ 237{
234 synchronizeActionsAndScripts(); 238 synchronizeActionsAndScripts();
235} 239}
236 240
237 241
238void WellenreiterConfigWindow::getCaptureFileNameClicked() 242void WellenreiterConfigWindow::getCaptureFileNameClicked()
239{ 243{
240 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 244 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
241 odebug << "name = " << name << "" << oendl; 245 odebug << "name = " << name << "" << oendl;
242 if ( !name.isEmpty() ) 246 if ( !name.isEmpty() )
243 { 247 {
244 captureFileName->setText( name ); 248 captureFileName->setText( name );
245 } 249 }
246} 250}
247 251
248 252
249void WellenreiterConfigWindow::channelAllClicked(int state) 253void WellenreiterConfigWindow::channelAllClicked(int state)
250{ 254{
251 bool b = state; 255 bool b = state;
252 channel1->setChecked( b ); 256 channel1->setChecked( b );
253 channel2->setChecked( b ); 257 channel2->setChecked( b );
254 channel3->setChecked( b ); 258 channel3->setChecked( b );
255 channel4->setChecked( b ); 259 channel4->setChecked( b );
256 channel5->setChecked( b ); 260 channel5->setChecked( b );
257 channel6->setChecked( b ); 261 channel6->setChecked( b );
258 channel7->setChecked( b ); 262 channel7->setChecked( b );
259 channel8->setChecked( b ); 263 channel8->setChecked( b );
260 channel9->setChecked( b ); 264 channel9->setChecked( b );
261 channel10->setChecked( b ); 265 channel10->setChecked( b );
262 channel11->setChecked( b ); 266 channel11->setChecked( b );
263 channel12->setChecked( b ); 267 channel12->setChecked( b );
264 channel13->setChecked( b ); 268 channel13->setChecked( b );
265 channel14->setChecked( b ); 269 channel14->setChecked( b );
266} 270}
267 271
268 272
269bool WellenreiterConfigWindow::useGPS() const 273bool WellenreiterConfigWindow::useGPS() const
270{ 274{
271 return enableGPS->isChecked(); 275 return enableGPS->isChecked();
272} 276}
273 277
274 278
275const QString WellenreiterConfigWindow::gpsHost() const 279const QString WellenreiterConfigWindow::gpsHost() const
276{ 280{
277 return useGPS() ? gpsdHost->currentText() : QString::null; 281 return useGPS() ? gpsdHost->currentText() : QString::null;
278} 282}
279 283
280 284
281int WellenreiterConfigWindow::gpsPort() const 285int WellenreiterConfigWindow::gpsPort() const
282{ 286{
283 bool ok;
284 return useGPS() ? gpsdPort->value() : -1; 287 return useGPS() ? gpsdPort->value() : -1;
285} 288}
286 289
287 290
288void WellenreiterConfigWindow::performAction( const QString& type, 291void WellenreiterConfigWindow::performAction( const QString& type,
289 const QString& essid, 292 const QString& essid,
290 const QString& mac, 293 const QString& mac,
291 bool wep, 294 bool wep,
292 int channel, 295 int channel,
293 int signal 296 int /* signal */
294 /* , const GpsLocation& loc */ ) 297 /* , const GpsLocation& loc */ )
295{ 298{
296 int action; 299 int action;
297 QString script; 300 QString script;
298 301
299 if ( type == "network" ) 302 if ( type == "network" )
300 { 303 {
301 action = newNetworkAction->currentItem(); 304 action = newNetworkAction->currentItem();
302 script = newNetworkScript->text(); 305 script = newNetworkScript->text();
303 } 306 }
304 else if ( type == "managed" || type == "adhoc" ) 307 else if ( type == "managed" || type == "adhoc" )
305 { 308 {
306 action = newClientAction->currentItem(); 309 action = newClientAction->currentItem();
307 script = newClientScript->text(); 310 script = newClientScript->text();
308 } 311 }
309 else if ( type == "station" ) 312 else if ( type == "station" )
310 { 313 {
311 action = newStationAction->currentItem(); 314 action = newStationAction->currentItem();
312 script = newStationScript->text(); 315 script = newStationScript->text();
313 } 316 }
314 else 317 else
315 { 318 {
316 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl; 319 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl;
317 return; 320 return;
318 } 321 }
319 322
320 odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl; 323 odebug << "for event '" << type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl;
321 324
322 switch( action ) 325 switch( action )
323 { 326 {
324 case 0: /* Ignore */ return; 327 case 0: /* Ignore */ return;
325 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; 328 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return;
326 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; 329 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return;
327 case 3: /* Blink LED */ break; //FIXME: Implement this 330 case 3: /* Blink LED */ break; //FIXME: Implement this
328 case 4: /* Run Script */ 331 case 4: /* Run Script */
329 { 332 {
330 /** 333 /**
331 * 334 *
332 * Script Substitution Information: 335 * Script Substitution Information:
333 * 336 *
334 * $SSID = SSID 337 * $SSID = SSID
335 * $MAC = MAC 338 * $MAC = MAC
336 * $WEP = Wep 339 * $WEP = Wep
337 * $CHAN = Channel 340 * $CHAN = Channel
338 * 341 *
339 **/ 342 **/
340 script = script.replace( QRegExp( "$SSID" ), essid ); 343 script = script.replace( QRegExp( "$SSID" ), essid );
341 script = script.replace( QRegExp( "$MAC" ), mac ); 344 script = script.replace( QRegExp( "$MAC" ), mac );
342 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); 345 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
343 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); 346 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
344 347
345 odebug << "going to call script '" << script << "'" << oendl; 348 odebug << "going to call script '" << script << "'" << oendl;
346 ::system( script ); 349 ::system( script );
347 odebug << "script returned." << oendl; 350 odebug << "script returned." << oendl;
348 return; 351 return;
349 } 352 }
350 default: assert( false ); 353 default: assert( false );
351 } 354 }
352} 355}
353 356
354 357
355void WellenreiterConfigWindow::load() 358void WellenreiterConfigWindow::load()
356{ 359{
357#ifdef Q_WS_X11 360#ifdef Q_WS_X11
358 #warning Persistent Configuration not yet implemented for standalone X11 build 361 #warning Persistent Configuration not yet implemented for standalone X11 build
359 performAutodetection(); 362 performAutodetection();
360#else 363#else
361 odebug << "loading configuration settings..." << oendl; 364 odebug << "loading configuration settings..." << oendl;
362 365
363 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 366 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
364 367
365 OConfig* c = oApp->config(); 368 OConfig* c = oApp->config();
366 369
367 c->setGroup( "Interface" ); 370 c->setGroup( "Interface" );
368 371
369 QString interface = c->readEntry( "name", "<none>" ); 372 QString interface = c->readEntry( "name", "<none>" );
370 if ( interface != "<none>" ) 373 if ( interface != "<none>" )
371 { 374 {
372#if QT_VERSION < 300 375#if QT_VERSION < 300
373 interfaceName->insertItem( interface, 0 ); 376 interfaceName->insertItem( interface, 0 );
374 interfaceName->setCurrentItem( 0 ); 377 interfaceName->setCurrentItem( 0 );
375#else 378#else
376 interfaceName->setCurrentText( interface ); 379 interfaceName->setCurrentText( interface );
377#endif 380#endif
378 381
379 QString device = c->readEntry( "type", "<select>" ); 382 QString device = c->readEntry( "type", "<select>" );
380#if QT_VERSION < 300 383#if QT_VERSION < 300
381 for ( int i = 0; i < deviceType->count(); ++i ) 384 for ( int i = 0; i < deviceType->count(); ++i )
382 { 385 {
383 if ( deviceType->text( i ) == device ) 386 if ( deviceType->text( i ) == device )
384 { 387 {
385 deviceType->setCurrentItem( i ); 388 deviceType->setCurrentItem( i );
386 break; 389 break;
387 } 390 }
388 } 391 }
389#else 392#else
390 deviceType->setCurrentText( device ); 393 deviceType->setCurrentText( device );
391#endif 394#endif
392 } 395 }
393 else 396 else
394 { 397 {
395 performAutodetection(); 398 performAutodetection();
396 } 399 }
397 400
398 prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); 401 prismHeader->setChecked( c->readBoolEntry( "prism", false ) );
399 hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); 402 hopChannels->setChecked( c->readBoolEntry( "hop", true ) );
400 hopInterval->setValue( c->readNumEntry( "interval", 250 ) ); 403 hopInterval->setValue( c->readNumEntry( "interval", 250 ) );
401 adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) ); 404 adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) );
402 405
403 c->setGroup( "Capture" ); 406 c->setGroup( "Capture" );
404 writeCaptureFile->setChecked( c->readBoolEntry( "writeCaptureFile", true ) ); 407 writeCaptureFile->setChecked( c->readBoolEntry( "writeCaptureFile", true ) );
405 captureFileName->setEnabled( writeCaptureFile->isChecked() ); 408 captureFileName->setEnabled( writeCaptureFile->isChecked() );
406 getCaptureFileName->setEnabled( writeCaptureFile->isChecked() ); 409 getCaptureFileName->setEnabled( writeCaptureFile->isChecked() );
410 parsePackets->setEnabled( writeCaptureFile->isChecked() );
407 captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); 411 captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) );
408 hexViewBufferUnlimited->setChecked( c->readBoolEntry( "hexViewBufferUnlimited", true ) ); 412 hexViewBufferUnlimited->setChecked( c->readBoolEntry( "hexViewBufferUnlimited", true ) );
409 hexViewBufferLimited->setChecked( !c->readBoolEntry( "hexViewBufferUnlimited", true ) ); 413 hexViewBufferLimited->setChecked( !c->readBoolEntry( "hexViewBufferUnlimited", true ) );
410 hexViewBufferSize->setValue( c->readNumEntry( "hexViewBufferSize", 2000 ) ); 414 hexViewBufferSize->setValue( c->readNumEntry( "hexViewBufferSize", 2000 ) );
411 415
412 c->setGroup( "UI" ); 416 c->setGroup( "UI" );
413 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); 417 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) );
414 openTree->setChecked( c->readBoolEntry( "openTree", true ) ); 418 openTree->setChecked( c->readBoolEntry( "openTree", true ) );
415 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); 419 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) );
416 newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 1 ) ); // Default: Play Alarm 420 newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 1 ) ); // Default: Play Alarm
417 newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) ); 421 newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) );
418 newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 2 ) ); // Default: Play Click 422 newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 2 ) ); // Default: Play Click
419 newClientScript->setText( c->readEntry( "newClientScript", "" ) ); 423 newClientScript->setText( c->readEntry( "newClientScript", "" ) );
420 newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 2 ) ); // Default: Play Click 424 newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 2 ) ); // Default: Play Click
421 newStationScript->setText( c->readEntry( "newStationScript", "" ) ); 425 newStationScript->setText( c->readEntry( "newStationScript", "" ) );
422 synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand 426 synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand
423 427
424 c->setGroup( "GPS" ); 428 c->setGroup( "GPS" );
425 enableGPS->setChecked( c->readBoolEntry( "use", false ) ); 429 enableGPS->setChecked( c->readBoolEntry( "use", false ) );
426#if QT_VERSION < 300 430#if QT_VERSION < 300
427 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 ); 431 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 );
428 gpsdHost->setCurrentItem( 0 ); 432 gpsdHost->setCurrentItem( 0 );
429#else 433#else
430 gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) ); 434 gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) );
431#endif 435#endif
432 gpsdPort->setValue( c->readNumEntry( "port", 2947 ) ); 436 gpsdPort->setValue( c->readNumEntry( "port", 2947 ) );
433 startGPS->setChecked( c->readBoolEntry( "start", false ) ); 437 startGPS->setChecked( c->readBoolEntry( "start", false ) );
434 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); 438 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) );
435 439
436#endif 440#endif
437} 441}
438 442
439 443
440void WellenreiterConfigWindow::save() 444void WellenreiterConfigWindow::save()
441{ 445{
442#ifdef Q_WS_X11 446#ifdef Q_WS_X11
443 #warning Persistent Configuration not yet implemented for standalone X11 build 447 #warning Persistent Configuration not yet implemented for standalone X11 build
444#else 448#else
445 odebug << "saving configuration settings..." << oendl; 449 odebug << "saving configuration settings..." << oendl;
446 450
447 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 451 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
448 452
449 OConfig* c = oApp->config(); 453 OConfig* c = oApp->config();
450 454
451 c->setGroup( "Interface" ); 455 c->setGroup( "Interface" );
452 c->writeEntry( "name", interfaceName->currentText() ); 456 c->writeEntry( "name", interfaceName->currentText() );
453 c->writeEntry( "type", deviceType->currentText() ); 457 c->writeEntry( "type", deviceType->currentText() );
454 c->writeEntry( "prism", prismHeader->isChecked() ); 458 c->writeEntry( "prism", prismHeader->isChecked() );
455 c->writeEntry( "hop", hopChannels->isChecked() ); 459 c->writeEntry( "hop", hopChannels->isChecked() );
456 c->writeEntry( "interval", hopInterval->value() ); 460 c->writeEntry( "interval", hopInterval->value() );
457 c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); 461 c->writeEntry( "adaptive", adaptiveHopping->isChecked() );
458 462
459 c->setGroup( "Capture" ); 463 c->setGroup( "Capture" );
460 c->writeEntry( "writeCaptureFile", writeCaptureFile->isChecked() ); 464 c->writeEntry( "writeCaptureFile", writeCaptureFile->isChecked() );
461 c->writeEntry( "filename", captureFileName->text() ); 465 c->writeEntry( "filename", captureFileName->text() );
462 c->writeEntry( "hexViewBufferUnlimited", hexViewBufferUnlimited->isChecked() ); 466 c->writeEntry( "hexViewBufferUnlimited", hexViewBufferUnlimited->isChecked() );
463 c->writeEntry( "hexViewBufferSize", hexViewBufferSize->value() ); 467 c->writeEntry( "hexViewBufferSize", hexViewBufferSize->value() );
464 468
465 c->setGroup( "UI" ); 469 c->setGroup( "UI" );
466 c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); 470 c->writeEntry( "lookupVendor", lookupVendor->isChecked() );
467 c->writeEntry( "openTree", openTree->isChecked() ); 471 c->writeEntry( "openTree", openTree->isChecked() );
468 c->writeEntry( "disablePM", disablePM->isChecked() ); 472 c->writeEntry( "disablePM", disablePM->isChecked() );
469 c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() ); 473 c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() );
470 c->writeEntry( "newNetworkScript", newNetworkScript->text() ); 474 c->writeEntry( "newNetworkScript", newNetworkScript->text() );
471 c->writeEntry( "newClientAction", newClientAction->currentItem() ); 475 c->writeEntry( "newClientAction", newClientAction->currentItem() );
472 c->writeEntry( "newClientScript", newClientScript->text() ); 476 c->writeEntry( "newClientScript", newClientScript->text() );
473 c->writeEntry( "newStationAction", newStationAction->currentItem() ); 477 c->writeEntry( "newStationAction", newStationAction->currentItem() );
474 c->writeEntry( "newStationScript", newStationScript->text() ); 478 c->writeEntry( "newStationScript", newStationScript->text() );
475 479
476 c->setGroup( "GPS" ); 480 c->setGroup( "GPS" );
477 c->writeEntry( "use", enableGPS->isChecked() ); 481 c->writeEntry( "use", enableGPS->isChecked() );
478 c->writeEntry( "host", gpsdHost->currentText() ); 482 c->writeEntry( "host", gpsdHost->currentText() );
479 c->writeEntry( "port", gpsdPort->value() ); 483 c->writeEntry( "port", gpsdPort->value() );
480 c->writeEntry( "start", startGPS->isChecked() ); 484 c->writeEntry( "start", startGPS->isChecked() );
481 c->writeEntry( "command", commandGPS->text() ); 485 c->writeEntry( "command", commandGPS->text() );
482 486
483 c->write(); 487 c->write();
484 488
485#endif 489#endif
486} 490}
487 491
488 492
489int WellenreiterConfigWindow::hexViewBuffer() const 493int WellenreiterConfigWindow::hexViewBuffer() const
490{ 494{
491 return hexViewBufferUnlimited->isChecked() ? -1 : hexViewBufferSize->value(); 495 return hexViewBufferUnlimited->isChecked() ? -1 : hexViewBufferSize->value();
492} 496}
diff --git a/noncore/net/wellenreiter/gui/graphwindow.cpp b/noncore/net/wellenreiter/gui/graphwindow.cpp
index b4174d3..d53421c 100644
--- a/noncore/net/wellenreiter/gui/graphwindow.cpp
+++ b/noncore/net/wellenreiter/gui/graphwindow.cpp
@@ -1,187 +1,211 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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#include "graphwindow.h" 16#include "graphwindow.h"
17 17
18#include <qpainter.h> 18#include <qpainter.h>
19#include <qpixmap.h> 19#include <qpixmap.h>
20#include <qtimer.h> 20#include <qtimer.h>
21 21
22/* XPM */
23static char * background[] = {
24"16 16 6 1",
25 " c None",
26 ".c #52676E",
27 "+c #3F545B",
28 "@c #394E56",
29 "#c #2F454C",
30 "$c #364B52",
31".+++++++++++++++",
32"@###############",
33"+$$$$$$$$$$$$$$$",
34"@###############",
35"+$$$$$$$$$$$$$$$",
36"@###############",
37"+$$$$$$$$$$$$$$$",
38"@###############",
39"+$$$$$$$$$$$$$$$",
40"@###############",
41"+$$$$$$$$$$$$$$$",
42"@###############",
43"+$$$$$$$$$$$$$$$",
44"@###############",
45"+$$$$$$$$$$$$$$$",
46"@###############"};
47
48
22MFrequencySpectrum::MFrequencySpectrum( int channels, QWidget* parent, const char* name, WFlags f) 49MFrequencySpectrum::MFrequencySpectrum( int channels, QWidget* parent, const char* name, WFlags f)
23 :QWidget( parent, name,f ), _channels( channels ) 50 :QWidget( parent, name,f ), _channels( channels )
24{ 51{
25 _values = new int[_channels]; 52 _values = new int[_channels];
26 _dirty = new bool[_channels]; 53 _dirty = new bool[_channels];
27 for ( int i = 0; i < channels; ++i ) 54 for ( int i = 0; i < channels; ++i )
28 { _values[i] = 0; 55 { _values[i] = 0;
29 _dirty[i] = true; 56 _dirty[i] = true;
30 } 57 }
31 58
32 // we draw everything on our own 59 // we draw everything on our own
33 setBackgroundMode( QWidget::NoBackground ); 60 setBackgroundMode( QWidget::NoBackground );
34} 61}
35 62
36 63
37void MFrequencySpectrum::drawTopLine( QPainter* p, int x, int y, int width, const QColor& c ) 64void MFrequencySpectrum::drawTopLine( QPainter* p, int x, int y, int width, const QColor& c )
38{ 65{
39 p->setPen( c.light() ); 66 p->setPen( c.light() );
40 p->drawLine( x, y, x+width-1, y ); 67 p->drawLine( x, y, x+width-1, y );
41} 68}
42 69
43 70
44void MFrequencySpectrum::drawBottomLine( QPainter* p, int x, int y, int width, const QColor& c ) 71void MFrequencySpectrum::drawBottomLine( QPainter* p, int x, int y, int width, const QColor& c )
45{ 72{
46 p->setPen( c.dark() ); 73 p->setPen( c.dark() );
47 p->drawLine( x, y, x+width-1, y ); 74 p->drawLine( x, y, x+width-1, y );
48} 75}
49 76
50 77
51void MFrequencySpectrum::drawLine( QPainter* p, int x, int y, int width, const QColor& c ) 78void MFrequencySpectrum::drawLine( QPainter* p, int x, int y, int width, const QColor& c )
52{ 79{
53 p->setPen( c.light() ); 80 p->setPen( c.light() );
54 p->drawPoint( x++, y ); 81 p->drawPoint( x++, y );
55 p->setPen( c ); 82 p->setPen( c );
56 p->drawLine( x, y, x+width-2, y ); 83 p->drawLine( x, y, x+width-2, y );
57 p->setPen( c.dark() ); 84 p->setPen( c.dark() );
58 p->drawPoint( x+width-1, y ); 85 p->drawPoint( x+width-1, y );
59} 86}
60 87
61 88
62void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int height, int maxheight ) 89void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int height, int maxheight )
63{ 90{
64 int h1 = 133; int h2 = 0; 91 int h1 = 133; int h2 = 0;
65 int s1 = 200; int s2 = 255; 92 int s1 = 200; int s2 = 255;
66 int v1 = 140; int v2 = 255; 93 int v1 = 140; int v2 = 255;
67 94
68 /*int h1 = 196; int h2 = 194; 95 /*int h1 = 196; int h2 = 194;
69 int s1 = 85; int s2 = 15; 96 int s1 = 85; int s2 = 15;
70 int v1 = 95; int v2 = 237;*/ 97 int v1 = 95; int v2 = 237;*/
71 98
72 QColor c( 120, 60, 200 ); 99 QColor c( 120, 60, 200 );
73 for ( int i = 0; i < height; ++i ) 100 for ( int i = 0; i < height; ++i )
74 { 101 {
75 int h = (h2-h1)*i/maxheight + h1; 102 int h = (h2-h1)*i/maxheight + h1;
76 int s = (s2-s1)*i/maxheight + s1; 103 int s = (s2-s1)*i/maxheight + s1;
77 int v = (v2-v1)*i/maxheight + v1; 104 int v = (v2-v1)*i/maxheight + v1;
78 if ( i == 0 ) 105 if ( i == 0 )
79 drawBottomLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) ); 106 drawBottomLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) );
80 else if ( i == height-1 ) 107 else if ( i == height-1 )
81 drawTopLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) ); 108 drawTopLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) );
82 else 109 else
83 drawLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) ); 110 drawLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) );
84 } 111 }
85} 112}
86 113
87 114
88void MFrequencySpectrum::paintEvent( QPaintEvent* e ) 115void MFrequencySpectrum::paintEvent( QPaintEvent* )
89{ 116{
90 QPixmap pm( size() ); 117 QPixmap pm( size() );
91 QPainter p; 118 QPainter p;
92 p.begin( &pm ); 119 p.begin( &pm );
93 p.drawTiledPixmap( 0, 0, size().width(), size().height(), QPixmap( (const char**) &background ) ); 120 p.drawTiledPixmap( 0, 0, size().width(), size().height(), QPixmap( (const char**) &background ) );
94 121
95 int xmargin = 5; 122 int xmargin = 5;
96 int ymargin = 2; 123 int ymargin = 2;
97 int y = size().height() - 2 * ymargin; 124 int y = size().height() - 2 * ymargin;
98 int x = 0; 125 int x = 0;
99 int width = ( size().width() - 2 * xmargin ) / _channels; 126 int width = ( size().width() - 2 * xmargin ) / _channels;
100 127
101 for ( int i = 0; i < _channels; ++i ) 128 for ( int i = 0; i < _channels; ++i )
102 { 129 {
103 if ( _dirty[i] ) 130 if ( _dirty[i] )
104 { 131 {
105 drawBar( &p, xmargin + x, y - ymargin, width-3, _values[i]*y/100, y ); 132 drawBar( &p, xmargin + x, y - ymargin, width-3, _values[i]*y/100, y );
106 _dirty[i] = false; 133 _dirty[i] = false;
107 } 134 }
108 x+= width; 135 x+= width;
109 } 136 }
110 137
111 p.end(); 138 p.end();
112 bitBlt( this, 0, 0, &pm ); 139 bitBlt( this, 0, 0, &pm );
113} 140}
114 141
115 142
116void MFrequencySpectrum::mousePressEvent( QMouseEvent* e ) 143void MFrequencySpectrum::mousePressEvent( QMouseEvent* e )
117{ 144{
118 int xmargin = 5; 145 int xmargin = 5;
119 int ymargin = 2; 146 int ymargin = 2;
120 int y = size().height() - 2 * ymargin; 147 int y = size().height() - 2 * ymargin;
121 int x = 0;
122 int width = ( size().width() - 2 * xmargin ) / _channels; 148 int width = ( size().width() - 2 * xmargin ) / _channels;
123 149
124 QPoint pos = e->pos(); 150 QPoint pos = e->pos();
125 int channel = ( pos.x()-xmargin ) / width; 151 int channel = ( pos.x()-xmargin ) / width;
126 int height = 100 - ( pos.y()-ymargin )*100/y; 152 int height = 100 - ( pos.y()-ymargin )*100/y;
127 if ( channel < 15 ) _values[channel] = height; 153 if ( channel < 15 ) _values[channel] = height;
128 154
129} 155}
130 156
131 157
132Legende::Legende( int channels, QWidget* parent, const char* name, WFlags f ) 158Legende::Legende( int channels, QWidget* parent, const char* name, WFlags f )
133 :QFrame( parent, name, f ), _channels( channels ) 159 :QFrame( parent, name, f ), _channels( channels )
134{ 160{
135 setLineWidth( 2 ); 161 setLineWidth( 2 );
136 setFrameStyle( Panel + Sunken ); 162 setFrameStyle( Panel + Sunken );
137 setFixedHeight( 16 ); 163 setFixedHeight( 16 );
138 164
139} 165}
140 166
141 167
142void Legende::drawContents( QPainter* p ) 168void Legende::drawContents( QPainter* p )
143{ 169{
144 int xmargin = 5; 170 int xmargin = 5;
145 int ymargin = 2;
146 int x = 0;
147 int width = ( contentsRect().width() - 2 * xmargin ) / _channels; 171 int width = ( contentsRect().width() - 2 * xmargin ) / _channels;
148 172
149 for ( int i = 0; i < _channels; ++i ) 173 for ( int i = 0; i < _channels; ++i )
150 p->drawText( xmargin + (width*i), 12, QString().sprintf( "%02d", i+1 ) ); 174 p->drawText( xmargin + (width*i), 12, QString().sprintf( "%02d", i+1 ) );
151} 175}
152 176
153 177
154MGraphWindow::MGraphWindow( QWidget* parent, const char* name, WFlags f ) 178MGraphWindow::MGraphWindow( QWidget* parent, const char* name, WFlags f )
155 :QVBox( parent, name, f ) 179 :QVBox( parent, name, f )
156{ 180{
157 spectrum = new MFrequencySpectrum( 14, this ); 181 spectrum = new MFrequencySpectrum( 14, this );
158 legende = new Legende( 14, this ); 182 legende = new Legende( 14, this );
159 startTimer( 50 ); 183 startTimer( 50 );
160}; 184};
161 185
162 186
163void MGraphWindow::testGraph() 187void MGraphWindow::testGraph()
164{ 188{
165 static int i = 0; 189 static int i = 0;
166 spectrum->setValue( i++, 100 ); 190 spectrum->setValue( i++, 100 );
167 if ( i == 14 ) i = 0; 191 if ( i == 14 ) i = 0;
168 QTimer::singleShot( 2000, this, SLOT( testGraph() ) ); 192 QTimer::singleShot( 2000, this, SLOT( testGraph() ) );
169 193
170} 194}
171 195
172 196
173void MGraphWindow::timerEvent( QTimerEvent* e ) 197void MGraphWindow::timerEvent( QTimerEvent* )
174{ 198{
175 for ( int i = 0; i < 14; i++ ) 199 for ( int i = 0; i < 14; i++ )
176 { 200 {
177 spectrum->decrease( i, 1 ); 201 spectrum->decrease( i, 1 );
178 } 202 }
179 spectrum->repaint(); 203 spectrum->repaint();
180} 204}
181 205
182 206
183void MGraphWindow::traffic( int channel, int signal ) 207void MGraphWindow::traffic( int channel, int signal )
184{ 208{
185 spectrum->setValue( channel-1, signal ); 209 spectrum->setValue( channel-1, signal );
186} 210}
187 211
diff --git a/noncore/net/wellenreiter/gui/graphwindow.h b/noncore/net/wellenreiter/gui/graphwindow.h
index fafcab1..392d85b 100644
--- a/noncore/net/wellenreiter/gui/graphwindow.h
+++ b/noncore/net/wellenreiter/gui/graphwindow.h
@@ -1,121 +1,95 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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 GRAPHWINDOW_H 16#ifndef GRAPHWINDOW_H
17#define GRAPHWINDOW_H 17#define GRAPHWINDOW_H
18 18
19#include <qwidget.h> 19#include <qwidget.h>
20#include <qvbox.h> 20#include <qvbox.h>
21 21
22class MFrequencySpectrum : public QWidget 22class MFrequencySpectrum : public QWidget
23{ 23{
24 public: 24 public:
25 MFrequencySpectrum( int channels, QWidget* parent = 0, const char* name = "MFrequencySpectrum", WFlags f = 0 ); 25 MFrequencySpectrum( int channels, QWidget* parent = 0, const char* name = "MFrequencySpectrum", WFlags f = 0 );
26 int value( int channel ) const { return _values[channel]; }; 26 int value( int channel ) const { return _values[channel]; };
27 void setValue( int channel, int value ) 27 void setValue( int channel, int value )
28 { 28 {
29 if ( value > _values[channel] ) 29 if ( value > _values[channel] )
30 { 30 {
31 _values[channel] = value; 31 _values[channel] = value;
32 _dirty[channel] = true; 32 _dirty[channel] = true;
33 } 33 }
34 }; 34 };
35 void decrease( int channel, int amount ) 35 void decrease( int channel, int amount )
36 { 36 {
37 if ( _values[channel] >= amount ) 37 if ( _values[channel] >= amount )
38 { 38 {
39 _values[channel] -= amount; 39 _values[channel] -= amount;
40 _dirty[channel] = true; 40 _dirty[channel] = true;
41 } 41 }
42 }; 42 };
43 43
44 protected: 44 protected:
45 virtual void paintEvent( QPaintEvent* ); 45 virtual void paintEvent( QPaintEvent* );
46 virtual void mousePressEvent( QMouseEvent* ); 46 virtual void mousePressEvent( QMouseEvent* );
47 47
48 void drawLine( QPainter* p, int x, int y, int width, const QColor& c ); 48 void drawLine( QPainter* p, int x, int y, int width, const QColor& c );
49 void drawTopLine( QPainter* p, int x, int y, int width, const QColor& c ); 49 void drawTopLine( QPainter* p, int x, int y, int width, const QColor& c );
50 void drawBottomLine( QPainter* p, int x, int y, int width, const QColor& c ); 50 void drawBottomLine( QPainter* p, int x, int y, int width, const QColor& c );
51 void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int height, int maxheight ); 51 void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int height, int maxheight );
52 52
53 private: 53 private:
54 int _channels; 54 int _channels;
55 int* _values; 55 int* _values;
56 bool* _dirty; 56 bool* _dirty;
57}; 57};
58 58
59 59
60class Legende : public QFrame 60class Legende : public QFrame
61{ 61{
62 public: 62 public:
63 Legende( int channels, QWidget* parent = 0, const char* name = "Legende", WFlags f = 0 ); 63 Legende( int channels, QWidget* parent = 0, const char* name = "Legende", WFlags f = 0 );
64 64
65 protected: 65 protected:
66 virtual void drawContents( QPainter* ); 66 virtual void drawContents( QPainter* );
67 67
68 private: 68 private:
69 int _channels; 69 int _channels;
70}; 70};
71 71
72 72
73class MGraphWindow : public QVBox 73class MGraphWindow : public QVBox
74{ 74{
75 Q_OBJECT 75 Q_OBJECT
76 76
77 public: 77 public:
78 MGraphWindow( QWidget* parent = 0, const char* name = "MGraphWindow", WFlags f = 0 ); 78 MGraphWindow( QWidget* parent = 0, const char* name = "MGraphWindow", WFlags f = 0 );
79 void traffic( int channel, int signal ); 79 void traffic( int channel, int signal );
80 80
81 protected: 81 protected:
82 virtual void timerEvent( QTimerEvent* e ); 82 virtual void timerEvent( QTimerEvent* e );
83 83
84 protected slots: 84 protected slots:
85 virtual void testGraph(); 85 virtual void testGraph();
86 86
87 protected: 87 protected:
88 MFrequencySpectrum* spectrum; 88 MFrequencySpectrum* spectrum;
89 Legende* legende; 89 Legende* legende;
90 90
91}; 91};
92 92
93/* XPM */
94static char * background[] = {
95"16 16 6 1",
96 " c None",
97 ".c #52676E",
98 "+c #3F545B",
99 "@c #394E56",
100 "#c #2F454C",
101 "$c #364B52",
102".+++++++++++++++",
103"@###############",
104"+$$$$$$$$$$$$$$$",
105"@###############",
106"+$$$$$$$$$$$$$$$",
107"@###############",
108"+$$$$$$$$$$$$$$$",
109"@###############",
110"+$$$$$$$$$$$$$$$",
111"@###############",
112"+$$$$$$$$$$$$$$$",
113"@###############",
114"+$$$$$$$$$$$$$$$",
115"@###############",
116"+$$$$$$$$$$$$$$$",
117"@###############"};
118
119 93
120#endif 94#endif
121 95
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp
index 714a9a9..a83f700 100644
--- a/noncore/net/wellenreiter/gui/logwindow.cpp
+++ b/noncore/net/wellenreiter/gui/logwindow.cpp
@@ -1,60 +1,58 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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#include "logwindow.h" 16#include "logwindow.h"
17 17
18/* OPIE */ 18/* OPIE */
19#include <opie2/odebug.h> 19#include <opie2/odebug.h>
20using namespace Opie::Core; 20using namespace Opie::Core;
21 21
22/* QT */ 22/* QT */
23#include <qmultilineedit.h> 23#include <qmultilineedit.h>
24#include <qdatetime.h> 24#include <qdatetime.h>
25 25
26MLogWindow* MLogWindow::_instance; 26MLogWindow* MLogWindow::_instance;
27 27
28MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) 28MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f )
29 :QVBox( parent, name, f ) 29 :QVBox( parent, name, f )
30{ 30{
31 ledit = new QMultiLineEdit( this ); 31 ledit = new QMultiLineEdit( this );
32 ledit->setReadOnly( true ); 32 ledit->setReadOnly( true );
33 ledit->setUndoEnabled( false );
34
33 35
34 MLogWindow::_instance = this; 36 MLogWindow::_instance = this;
35} 37}
36 38
37 39
38void MLogWindow::log( QString text ) 40void MLogWindow::log( QString text )
39{ 41{
40 QTime time = QTime::currentTime(); 42 QTime time = QTime::currentTime();
41 QString line; 43 QString line = QString( "[%1] %2\n" ).arg(time.toString() ).arg( text );
42 line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); 44 ledit->insertLine( line );
43 int col; 45 odebug << line << oendl;
44 int row;
45 ledit->getCursorPosition( &col, &row );
46 ledit->insertAt( line, col, row );
47 odebug << line << oendl;
48} 46}
49 47
50 48
51void MLogWindow::clear() 49void MLogWindow::clear()
52{ 50{
53 ledit->clear(); 51 ledit->clear();
54} 52}
55 53
56 54
57const QString MLogWindow::getLog() const 55const QString MLogWindow::getLog() const
58{ 56{
59 return ledit->text(); 57 return ledit->text();
60} 58}
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index ef7ffcf..3e18531 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -1,251 +1,252 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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#include "configwindow.h" 16#include "configwindow.h"
17#include "gps.h" 17#include "gps.h"
18#include "logwindow.h" 18#include "logwindow.h"
19#include "packetview.h" 19#include "packetview.h"
20#include "mainwindow.h" 20#include "mainwindow.h"
21#include "wellenreiter.h" 21#include "wellenreiter.h"
22#include "scanlist.h" 22#include "scanlist.h"
23 23
24/* OPIE */ 24/* OPIE */
25#ifdef QWS 25#ifdef QWS
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <opie2/odebug.h> 27#include <opie2/odebug.h>
28#include <opie2/ofiledialog.h> 28#include <opie2/ofiledialog.h>
29#else 29#else
30#include "resource.h" 30#include "resource.h"
31#include <qapplication.h> 31#include <qapplication.h>
32#include <qfiledialog.h> 32#include <qfiledialog.h>
33#endif 33#endif
34using namespace Opie::Core;
35using namespace Opie::Net;
36using namespace Opie::Ui;
37 34
38/* QT */ 35/* QT */
39#include <qcombobox.h> 36#include <qcombobox.h>
40#include <qdatastream.h> 37#include <qdatastream.h>
41#include <qfile.h> 38#include <qfile.h>
42#include <qfileinfo.h> 39#include <qfileinfo.h>
43#include <qlabel.h> 40#include <qlabel.h>
44#include <qlayout.h> 41#include <qlayout.h>
45#include <qlineedit.h> 42#include <qlineedit.h>
46#include <qiconset.h> 43#include <qiconset.h>
47#include <qmenubar.h> 44#include <qmenubar.h>
48#include <qmessagebox.h> 45#include <qmessagebox.h>
49#include <qpopupmenu.h> 46#include <qpopupmenu.h>
50#include <qpushbutton.h> 47#include <qpushbutton.h>
51#include <qstatusbar.h> 48#include <qstatusbar.h>
52#include <qspinbox.h> 49#include <qspinbox.h>
53#include <qtextstream.h> 50#include <qtextstream.h>
54#include <qtoolbutton.h> 51#include <qtoolbutton.h>
55#include <qwhatsthis.h> 52#include <qwhatsthis.h>
56 53
57/* STD */ 54/* STD */
58#include <unistd.h> 55#include <unistd.h>
59 56
57using namespace Opie::Core;
58using namespace Opie::Net;
59using namespace Opie::Ui;
60
60WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) 61WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
61 :QMainWindow( parent, name, f ) 62 :QMainWindow( parent, name, f )
62{ 63{
63 cw = new WellenreiterConfigWindow( this ); 64 cw = new WellenreiterConfigWindow( this );
64 mw = new Wellenreiter( this ); 65 mw = new Wellenreiter( this );
65 mw->setConfigWindow( cw ); 66 mw->setConfigWindow( cw );
66 setCentralWidget( mw ); 67 setCentralWidget( mw );
67 68
68 // setup application icon 69 // setup application icon
69 70
70 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); 71 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
71 #ifndef QWS 72 #ifndef QWS
72 setIconText( "Wellenreiter/X11" ); 73 setIconText( "Wellenreiter/X11" );
73 #endif 74 #endif
74 75
75 // setup tool buttons 76 // setup tool buttons
76 77
77 startButton = new QToolButton( 0 ); 78 startButton = new QToolButton( 0 );
78 QWhatsThis::add( startButton, tr( "Click here to start scanning." ) ); 79 QWhatsThis::add( startButton, tr( "Click here to start scanning." ) );
79 #ifdef QWS 80 #ifdef QWS
80 startButton->setAutoRaise( true ); 81 startButton->setAutoRaise( true );
81 #endif 82 #endif
82 startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); 83 startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) );
83 startButton->setEnabled( false ); 84 startButton->setEnabled( false );
84 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); 85 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) );
85 86
86 stopButton = new QToolButton( 0 ); 87 stopButton = new QToolButton( 0 );
87 QWhatsThis::add( stopButton, tr( "Click here to stop scanning." ) ); 88 QWhatsThis::add( stopButton, tr( "Click here to stop scanning." ) );
88 #ifdef QWS 89 #ifdef QWS
89 stopButton->setAutoRaise( true ); 90 stopButton->setAutoRaise( true );
90 #endif 91 #endif
91 stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); 92 stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) );
92 stopButton->setEnabled( false ); 93 stopButton->setEnabled( false );
93 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); 94 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) );
94 95
95 QToolButton* d = new QToolButton( 0 ); 96 QToolButton* d = new QToolButton( 0 );
96 QWhatsThis::add( d, tr( "Click here to open the configure dialog." ) ), 97 QWhatsThis::add( d, tr( "Click here to open the configure dialog." ) ),
97 #ifdef QWS 98 #ifdef QWS
98 d->setAutoRaise( true ); 99 d->setAutoRaise( true );
99 #endif 100 #endif
100 d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); 101 d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) );
101 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 102 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
102 103
103 uploadButton = new QToolButton( 0 ); 104 uploadButton = new QToolButton( 0 );
104 QWhatsThis::add( uploadButton, tr( "Click here to upload a capture session." ) ); 105 QWhatsThis::add( uploadButton, tr( "Click here to upload a capture session." ) );
105 #ifdef QWS 106 #ifdef QWS
106 uploadButton->setAutoRaise( true ); 107 uploadButton->setAutoRaise( true );
107 #endif 108 #endif
108 uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); 109 uploadButton->setIconSet( Resource::loadIconSet( "up" ) );
109 uploadButton->setEnabled( false ); 110 uploadButton->setEnabled( false );
110 //uploadButton->setEnabled( true ); // DEBUGGING 111 //uploadButton->setEnabled( true ); // DEBUGGING
111 connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); 112 connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) );
112 113
113 // setup menu bar 114 // setup menu bar
114 115
115 int id; 116 int id;
116 117
117 QMenuBar* mb = menuBar(); 118 QMenuBar* mb = menuBar();
118 119
119 QPopupMenu* fileSave = new QPopupMenu( mb ); 120 QPopupMenu* fileSave = new QPopupMenu( mb );
120 fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); 121 fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) );
121 fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); 122 fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) );
122 fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); 123 fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) );
123 124
124 QPopupMenu* fileLoad = new QPopupMenu( mb ); 125 QPopupMenu* fileLoad = new QPopupMenu( mb );
125 fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); 126 fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) );
126 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); 127 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) );
127 128
128 QPopupMenu* file = new QPopupMenu( mb ); 129 QPopupMenu* file = new QPopupMenu( mb );
129 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); 130 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) );
130 id = file->insertItem( tr( "&Load" ), fileLoad ); 131 id = file->insertItem( tr( "&Load" ), fileLoad );
131 file->insertItem( tr( "&Save" ), fileSave ); 132 file->insertItem( tr( "&Save" ), fileSave );
132 file->insertSeparator(); 133 file->insertSeparator();
133 uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); 134 uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) );
134 file->insertSeparator(); 135 file->insertSeparator();
135 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); 136 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) );
136 137
137 QPopupMenu* sniffer = new QPopupMenu( mb ); 138 QPopupMenu* sniffer = new QPopupMenu( mb );
138 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); 139 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) );
139 sniffer->insertSeparator(); 140 sniffer->insertSeparator();
140 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); 141 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) );
141 sniffer->setItemEnabled( startID, false ); 142 sniffer->setItemEnabled( startID, false );
142 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); 143 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) );
143 sniffer->setItemEnabled( stopID, false ); 144 sniffer->setItemEnabled( stopID, false );
144 145
145 QPopupMenu* view = new QPopupMenu( mb ); 146 QPopupMenu* view = new QPopupMenu( mb );
146 view->insertItem( tr( "&Expand All" ), this, SLOT( viewExpandAll() ) ); 147 view->insertItem( tr( "&Expand All" ), this, SLOT( viewExpandAll() ) );
147 view->insertItem( tr( "&Collapse All" ), this, SLOT( viewCollapseAll() ) ); 148 view->insertItem( tr( "&Collapse All" ), this, SLOT( viewCollapseAll() ) );
148 149
149 QPopupMenu* demo = new QPopupMenu( mb ); 150 QPopupMenu* demo = new QPopupMenu( mb );
150 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); 151 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) );
151 //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); 152 //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) );
152 153
153 id = mb->insertItem( tr( "&File" ), file ); 154 id = mb->insertItem( tr( "&File" ), file );
154 155
155 id = mb->insertItem( tr( "&View" ), view ); 156 id = mb->insertItem( tr( "&View" ), view );
156 //mb->setItemEnabled( id, false ); 157 //mb->setItemEnabled( id, false );
157 158
158 id = mb->insertItem( tr( "&Sniffer" ), sniffer ); 159 id = mb->insertItem( tr( "&Sniffer" ), sniffer );
159 160
160 id = mb->insertItem( tr( "&Demo" ), demo ); 161 id = mb->insertItem( tr( "&Demo" ), demo );
161 mb->setItemEnabled( id, true ); 162 mb->setItemEnabled( id, true );
162 mb->setItemEnabled( uploadID, false ); 163 mb->setItemEnabled( uploadID, false );
163 164
164 #ifdef QWS 165 #ifdef QWS
165 mb->insertItem( startButton ); 166 mb->insertItem( startButton );
166 mb->insertItem( stopButton ); 167 mb->insertItem( stopButton );
167 mb->insertItem( uploadButton ); 168 mb->insertItem( uploadButton );
168 mb->insertItem( d ); 169 mb->insertItem( d );
169 #else // Qt3 changed the insertion order. It's now totally random :( 170 #else // Qt3 changed the insertion order. It's now totally random :(
170 mb->insertItem( d ); 171 mb->insertItem( d );
171 mb->insertItem( uploadButton ); 172 mb->insertItem( uploadButton );
172 mb->insertItem( stopButton ); 173 mb->insertItem( stopButton );
173 mb->insertItem( startButton ); 174 mb->insertItem( startButton );
174 #endif 175 #endif
175 176
176 updateToolButtonState(); 177 updateToolButtonState();
177 178
178 // setup status bar (for now only on X11) 179 // setup status bar (for now only on X11)
179 180
180 #ifndef QWS 181 #ifndef QWS
181 statusBar()->message( tr( "Ready." ) ); 182 statusBar()->message( tr( "Ready." ) );
182 #endif 183 #endif
183 184
184 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); 185 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) );
185 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); 186 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) );
186}; 187};
187 188
188 189
189 190
190void WellenreiterMainWindow::showConfigure() 191void WellenreiterMainWindow::showConfigure()
191{ 192{
192 odebug << "show configure..." << oendl; 193 odebug << "show configure..." << oendl;
193 cw->setCaption( tr( "Configure" ) ); 194 cw->setCaption( tr( "Configure" ) );
194 int result = QPEApplication::execDialog( cw ); 195 int result = QPEApplication::execDialog( cw );
195 196
196 if ( result ) updateToolButtonState(); 197 if ( result ) updateToolButtonState();
197} 198}
198 199
199 200
200void WellenreiterMainWindow::updateToolButtonState() 201void WellenreiterMainWindow::updateToolButtonState()
201{ 202{
202 const QString& interface = cw->interfaceName->currentText(); 203 const QString& interface = cw->interfaceName->currentText();
203 const int cardtype = cw->driverType(); 204 const int cardtype = cw->driverType();
204 205
205 if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) 206 if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
206 { 207 {
207 startButton->setEnabled( true ); 208 startButton->setEnabled( true );
208 menuBar()->setItemEnabled( startID, true ); 209 menuBar()->setItemEnabled( startID, true );
209 } 210 }
210 else 211 else
211 { 212 {
212 startButton->setEnabled( false ); 213 startButton->setEnabled( false );
213 menuBar()->setItemEnabled( startID, false ); 214 menuBar()->setItemEnabled( startID, false );
214 } 215 }
215} 216}
216 217
217 218
218void WellenreiterMainWindow::changedSniffingState() 219void WellenreiterMainWindow::changedSniffingState()
219{ 220{
220 startButton->setEnabled( !mw->sniffing ); 221 startButton->setEnabled( !mw->sniffing );
221 menuBar()->setItemEnabled( startID, !mw->sniffing ); 222 menuBar()->setItemEnabled( startID, !mw->sniffing );
222 stopButton->setEnabled( mw->sniffing ); 223 stopButton->setEnabled( mw->sniffing );
223 menuBar()->setItemEnabled( stopID, mw->sniffing ); 224 menuBar()->setItemEnabled( stopID, mw->sniffing );
224 225
225 if ( !mw->sniffing && QFile::exists( mw->dumpname ) ) 226 if ( !mw->sniffing && QFile::exists( mw->dumpname ) )
226 { 227 {
227 menuBar()->setItemEnabled( uploadID, true ); 228 menuBar()->setItemEnabled( uploadID, true );
228 uploadButton->setEnabled( true ); 229 uploadButton->setEnabled( true );
229 } 230 }
230} 231}
231 232
232 233
233WellenreiterMainWindow::~WellenreiterMainWindow() 234WellenreiterMainWindow::~WellenreiterMainWindow()
234{ 235{
235 odebug << "Wellenreiter: bye." << oendl; 236 odebug << "Wellenreiter: bye." << oendl;
236}; 237};
237 238
238 239
239void WellenreiterMainWindow::demoAddStations() 240void WellenreiterMainWindow::demoAddStations()
240{ 241{
241 //mw = 0; // test SIGSEGV handling 242 //mw = 0; // test SIGSEGV handling
242 243
243 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); 244 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) );
244 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); 245 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
245 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); 246 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
246 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); 247 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
247 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); 248 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
248} 249}
249 250
250 251
251void WellenreiterMainWindow::demoReadFromGps() 252void WellenreiterMainWindow::demoReadFromGps()
@@ -279,304 +280,304 @@ QString WellenreiterMainWindow::getFileName( bool save )
279 str = QFileDialog::getSaveFileName(); 280 str = QFileDialog::getSaveFileName();
280 #endif 281 #endif
281 if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) 282 if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ )
282 return ""; 283 return "";
283 } 284 }
284 else 285 else
285 { 286 {
286 #ifdef QWS 287 #ifdef QWS
287 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); 288 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map );
288 #else 289 #else
289 str = QFileDialog::getOpenFileName(); 290 str = QFileDialog::getOpenFileName();
290 #endif 291 #endif
291 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) 292 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() )
292 return ""; 293 return "";
293 } 294 }
294 return str; 295 return str;
295} 296}
296 297
297 298
298void WellenreiterMainWindow::fileSaveLog() 299void WellenreiterMainWindow::fileSaveLog()
299{ 300{
300 QString fname = getFileName( true ); 301 QString fname = getFileName( true );
301 if ( !fname.isEmpty() ) 302 if ( !fname.isEmpty() )
302 { 303 {
303 QFile f( fname ); 304 QFile f( fname );
304 if ( f.open(IO_WriteOnly) ) 305 if ( f.open(IO_WriteOnly) )
305 { 306 {
306 QTextStream t( &f ); 307 QTextStream t( &f );
307 t << mw->logWindow()->getLog(); 308 t << mw->logWindow()->getLog();
308 f.close(); 309 f.close();
309 odebug << "Saved log to file '" << fname << "'" << oendl; 310 odebug << "Saved log to file '" << fname << "'" << oendl;
310 } 311 }
311 else 312 else
312 { 313 {
313 odebug << "Problem saving log to file '" << fname << "'" << oendl; 314 odebug << "Problem saving log to file '" << fname << "'" << oendl;
314 } 315 }
315 } 316 }
316} 317}
317 318
318void WellenreiterMainWindow::fileSaveSession() 319void WellenreiterMainWindow::fileSaveSession()
319{ 320{
320 QString fname = getFileName( true ); 321 QString fname = getFileName( true );
321 if ( !fname.isEmpty() ) 322 if ( !fname.isEmpty() )
322 { 323 {
323 324
324 QFile f( fname ); 325 QFile f( fname );
325 if ( f.open(IO_WriteOnly) ) 326 if ( f.open(IO_WriteOnly) )
326 { 327 {
327 QDataStream t( &f ); 328 QDataStream t( &f );
328 t << *mw->netView(); 329 t << *mw->netView();
329 f.close(); 330 f.close();
330 odebug << "Saved session to file '" << fname << "'" << oendl; 331 odebug << "Saved session to file '" << fname << "'" << oendl;
331 } 332 }
332 else 333 else
333 { 334 {
334 odebug << "Problem saving session to file '" << fname << "'" << oendl; 335 odebug << "Problem saving session to file '" << fname << "'" << oendl;
335 } 336 }
336 } 337 }
337} 338}
338 339
339void WellenreiterMainWindow::fileSaveHex() 340void WellenreiterMainWindow::fileSaveHex()
340{ 341{
341 #warning DOES NOT WORK AT THE MOMENT 342 #warning DOES NOT WORK AT THE MOMENT
342 /* 343 /*
343 QString fname = getFileName( true ); 344 QString fname = getFileName( true );
344 if ( !fname.isEmpty() ) 345 if ( !fname.isEmpty() )
345 { 346 {
346 QFile f( fname ); 347 QFile f( fname );
347 if ( f.open(IO_WriteOnly) ) 348 if ( f.open(IO_WriteOnly) )
348 { 349 {
349 QTextStream t( &f ); 350 QTextStream t( &f );
350 t << mw->hexWindow()->getLog(); 351 t << mw->hexWindow()->getLog();
351 f.close(); 352 f.close();
352 odebug << "Saved hex log to file '" << fname << "'" << oendl; 353 odebug << "Saved hex log to file '" << fname << "'" << oendl;
353 } 354 }
354 else 355 else
355 { 356 {
356 odebug << "Problem saving hex log to file '" << fname << "'" << oendl; 357 odebug << "Problem saving hex log to file '" << fname << "'" << oendl;
357 } 358 }
358 } 359 }
359 */ 360 */
360} 361}
361 362
362void WellenreiterMainWindow::fileLoadSession() 363void WellenreiterMainWindow::fileLoadSession()
363{ 364{
364 QString fname = getFileName( false ); 365 QString fname = getFileName( false );
365 if ( !fname.isEmpty() ) 366 if ( !fname.isEmpty() )
366 { 367 {
367 QFile f( fname ); 368 QFile f( fname );
368 if ( f.open(IO_ReadOnly) ) 369 if ( f.open(IO_ReadOnly) )
369 { 370 {
370 QDataStream t( &f ); 371 QDataStream t( &f );
371 t >> *mw->netView(); 372 t >> *mw->netView();
372 f.close(); 373 f.close();
373 odebug << "Loaded session from file '" << fname << "'" << oendl; 374 odebug << "Loaded session from file '" << fname << "'" << oendl;
374 } 375 }
375 else 376 else
376 { 377 {
377 odebug << "Problem loading session from file '" << fname << "'" << oendl; 378 odebug << "Problem loading session from file '" << fname << "'" << oendl;
378 } 379 }
379 } 380 }
380} 381}
381 382
382 383
383void WellenreiterMainWindow::fileNew() 384void WellenreiterMainWindow::fileNew()
384{ 385{
385 mw->netView()->clear(); 386 mw->netView()->clear();
386 mw->logWindow()->clear(); 387 mw->logWindow()->clear();
387 mw->hexWindow()->clear(); 388 mw->hexWindow()->clear();
388} 389}
389 390
390 391
391void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) 392void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
392{ 393{
393 if ( mw->isDaemonRunning() ) 394 if ( mw->isDaemonRunning() )
394 { 395 {
395 QMessageBox::warning( this, "Wellenreiter/Opie", 396 QMessageBox::warning( this, "Wellenreiter/Opie",
396 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); 397 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) );
397 e->ignore(); 398 e->ignore();
398 } 399 }
399 else 400 else
400 { 401 {
401 QMainWindow::closeEvent( e ); 402 QMainWindow::closeEvent( e );
402 } 403 }
403} 404}
404 405
405static const char* CAP_hostname = "www.vanille.de"; 406static const char* CAP_hostname = "www.vanille.de";
406 407
407#include <netdb.h> 408#include <netdb.h>
408#include <unistd.h> 409#include <unistd.h>
409#include <sys/types.h> 410#include <sys/types.h>
410#include <sys/socket.h> 411#include <sys/socket.h>
411 412
412void WellenreiterMainWindow::uploadSession() 413void WellenreiterMainWindow::uploadSession()
413{ 414{
414 QLineEdit* from; 415 QLineEdit* from;
415 QLineEdit* location; 416 QLineEdit* location;
416 QLineEdit* comments; 417 QLineEdit* comments;
417 QPushButton* accept; 418 QPushButton* accept;
418 QPushButton* reject; 419 QPushButton* reject;
419 420
420 QDialog* d = new QDialog( 0, "session upload", true ); 421 QDialog* d = new QDialog( 0, "session upload", true );
421 d->setCaption( tr( "Upload Session" ) ); 422 d->setCaption( tr( "Upload Session" ) );
422 QGridLayout* g = new QGridLayout( d, 4, 2, 3 ); 423 QGridLayout* g = new QGridLayout( d, 4, 2, 3 );
423 g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 ); 424 g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 );
424 g->addWidget( from = new QLineEdit( d ), 0, 1 ); 425 g->addWidget( from = new QLineEdit( d ), 0, 1 );
425 g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 ); 426 g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 );
426 g->addWidget( location = new QLineEdit( d ), 1, 1 ); 427 g->addWidget( location = new QLineEdit( d ), 1, 1 );
427 g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 ); 428 g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 );
428 g->addWidget( comments = new QLineEdit( d ), 2, 1 ); 429 g->addWidget( comments = new QLineEdit( d ), 2, 1 );
429 g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 ); 430 g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 );
430 g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); 431 g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 );
431 accept->setDefault( true ); 432 accept->setDefault( true );
432 accept->setAutoDefault( true ); 433 accept->setAutoDefault( true );
433 from->setText( "WL II User" ); 434 from->setText( "WL II User" );
434 location->setText( "WL II Location" ); 435 location->setText( "WL II Location" );
435 comments->setText( "No Comments." ); 436 comments->setText( "No Comments." );
436 connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); 437 connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) );
437 connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); 438 connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) );
438 int result = d->exec(); 439 int result = d->exec();
439 440
440 if ( !result ) 441 if ( !result )
441 { 442 {
442 odebug << "Session upload cancelled :(" << oendl; 443 odebug << "Session upload cancelled :(" << oendl;
443 return; 444 return;
444 } 445 }
445 446
446 odebug << "Starting upload..." << oendl; 447 odebug << "Starting upload..." << oendl;
447 448
448 struct sockaddr_in raddr; 449 struct sockaddr_in raddr;
449 struct hostent *rhost_info; 450 struct hostent *rhost_info;
450 int sock = -1; 451 int sock = -1;
451 bool ok = false; 452 bool ok = false;
452 453
453 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); 454 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname );
454 if ( rhost_info ) 455 if ( rhost_info )
455 { 456 {
456 457
457 458
458 if ( !QFile::exists( mw->captureFileName() ) ) 459 if ( !QFile::exists( mw->captureFileName() ) )
459 { 460 {
460 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) ); 461 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) );
461 return; 462 return;
462 } 463 }
463 464
464 QFile f( mw->captureFileName() ); 465 QFile f( mw->captureFileName() );
465 if ( !f.open( IO_ReadOnly ) ) 466 if ( !f.open( IO_ReadOnly ) )
466 { 467 {
467 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) ); 468 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) );
468 return; 469 return;
469 } 470 }
470 471
471 int content_length = f.size(); 472// int content_length = f.size();
472 473
473 ::memset( &raddr, 0, sizeof (struct sockaddr_in) ); 474 ::memset( &raddr, 0, sizeof (struct sockaddr_in) );
474 ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); 475 ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length );
475 raddr.sin_family = rhost_info-> h_addrtype; 476 raddr.sin_family = rhost_info-> h_addrtype;
476 raddr.sin_port = htons ( 80 ); 477 raddr.sin_port = htons ( 80 );
477 478
478 sock = ::socket( AF_INET, SOCK_STREAM, 0 ); 479 sock = ::socket( AF_INET, SOCK_STREAM, 0 );
479 480
480 if ( sock >= 0 ) 481 if ( sock >= 0 )
481 { 482 {
482 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) 483 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 )
483 { 484 {
484 QString header; 485 QString header;
485 QString content; 486 QString content;
486 QString preambel; 487 QString preambel;
487 488
488 header = "" 489 header = ""
489 "POST /projects/capturedump.spy HTTP/1.1\r\n" 490 "POST /projects/capturedump.spy HTTP/1.1\r\n"
490 "Host: www.vanille.de\r\n" 491 "Host: www.vanille.de\r\n"
491 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031010 Galeon/1.3.10\r\n" 492 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031010 Galeon/1.3.10\r\n"
492 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1\r\n" 493 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1\r\n"
493 "Accept-Language: en\r\n" 494 "Accept-Language: en\r\n"
494 "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n" 495 "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n"
495 "Accept-Charset: us-ascii,utf-8;q=0.7,*;q=0.7\r\n" 496 "Accept-Charset: us-ascii,utf-8;q=0.7,*;q=0.7\r\n"
496 "Keep-Alive: 300\r\n" 497 "Keep-Alive: 300\r\n"
497 "Connection: keep-alive\r\n" 498 "Connection: keep-alive\r\n"
498 "Referer: http://www.vanille.de/projects/capturedump.spy\r\n" 499 "Referer: http://www.vanille.de/projects/capturedump.spy\r\n"
499 "Content-Type: multipart/form-data; boundary=---------------------------97267758015830030481215568065\r\n" 500 "Content-Type: multipart/form-data; boundary=---------------------------97267758015830030481215568065\r\n"
500 "Content-Length: %1\r\n" 501 "Content-Length: %1\r\n"
501 "\r\n"; 502 "\r\n";
502 503
503 content = "" 504 content = ""
504 "-----------------------------97267758015830030481215568065\r\n" 505 "-----------------------------97267758015830030481215568065\r\n"
505 "Content-Disposition: form-data; name=\"Name\"\r\n" 506 "Content-Disposition: form-data; name=\"Name\"\r\n"
506 "\r\n" 507 "\r\n"
507 "%1\r\n" 508 "%1\r\n"
508 "-----------------------------97267758015830030481215568065\r\n" 509 "-----------------------------97267758015830030481215568065\r\n"
509 "Content-Disposition: form-data; name=\"Location\"\r\n" 510 "Content-Disposition: form-data; name=\"Location\"\r\n"
510 "\r\n" 511 "\r\n"
511 "%2\r\n" 512 "%2\r\n"
512 "-----------------------------97267758015830030481215568065\r\n" 513 "-----------------------------97267758015830030481215568065\r\n"
513 "Content-Disposition: form-data; name=\"Comments\"\r\n" 514 "Content-Disposition: form-data; name=\"Comments\"\r\n"
514 "\r\n" 515 "\r\n"
515 "%3\r\n" 516 "%3\r\n"
516 "-----------------------------97267758015830030481215568065\r\n" 517 "-----------------------------97267758015830030481215568065\r\n"
517 "Content-Disposition: form-data; name=\"upfile\"; filename=\"%4\"\r\n" 518 "Content-Disposition: form-data; name=\"upfile\"; filename=\"%4\"\r\n"
518 "Content-Type: application/octet-stream\r\n" 519 "Content-Type: application/octet-stream\r\n"
519 "\r\n"; 520 "\r\n";
520 521
521 preambel = "" 522 preambel = ""
522 "\r\n-----------------------------97267758015830030481215568065--\r\n"; 523 "\r\n-----------------------------97267758015830030481215568065--\r\n";
523 524
524 content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() ); 525 content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() );
525 content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() ); 526 content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() );
526 content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() ); 527 content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() );
527 content = content.arg( mw->captureFileName() ); 528 content = content.arg( mw->captureFileName() );
528 529
529 header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) ); 530 header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) );
530 531
531 // write header 532 // write header
532 533
533 const char* ascii = header.latin1(); 534 const char* ascii = header.latin1();
534 uint ascii_len = ::strlen( ascii ); 535 uint ascii_len = ::strlen( ascii );
535 ::write ( sock, ascii, ascii_len ); 536 ::write ( sock, ascii, ascii_len );
536 537
537 // write fixed content 538 // write fixed content
538 539
539 ascii = content.latin1(); 540 ascii = content.latin1();
540 ascii_len = ::strlen( ascii ); 541 ascii_len = ::strlen( ascii );
541 ::write ( sock, ascii, ascii_len ); 542 ::write ( sock, ascii, ascii_len );
542 543
543 // write variable content 544 // write variable content
544 545
545 char ch; 546 char ch;
546 while ( !f.atEnd() ) 547 while ( !f.atEnd() )
547 { 548 {
548 f.readBlock( &ch, 1 ); 549 f.readBlock( &ch, 1 );
549 ::write ( sock, &ch, 1 ); 550 ::write ( sock, &ch, 1 );
550 } 551 }
551 552
552 // write preambel 553 // write preambel
553 554
554 ascii = preambel.latin1(); 555 ascii = preambel.latin1();
555 ascii_len = ::strlen( ascii ); 556 ascii_len = ::strlen( ascii );
556 ::write ( sock, ascii, ascii_len ); 557 ::write ( sock, ascii, ascii_len );
557 558
558 // done! 559 // done!
559 560
560 ok = true; 561 ok = true;
561 } 562 }
562 } 563 }
563 ::close ( sock ); 564 ::close ( sock );
564 } 565 }
565 if ( ok ) 566 if ( ok )
566 QMessageBox::information( 0, tr( "Success" ), 567 QMessageBox::information( 0, tr( "Success" ),
567 QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) ); 568 QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) );
568 else 569 else
569 QMessageBox::warning( 0, tr( "Error" ), 570 QMessageBox::warning( 0, tr( "Error" ),
570 QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) ); 571 QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) );
571} 572}
572 573
573 574
574void WellenreiterMainWindow::viewExpandAll() 575void WellenreiterMainWindow::viewExpandAll()
575{ 576{
576 mw->netView()->expand(); 577 mw->netView()->expand();
577} 578}
578 579
579void WellenreiterMainWindow::viewCollapseAll() 580void WellenreiterMainWindow::viewCollapseAll()
580{ 581{
581 mw->netView()->collapse(); 582 mw->netView()->collapse();
582} 583}
diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp
index 69438fa..d71111f 100644
--- a/noncore/net/wellenreiter/gui/packetview.cpp
+++ b/noncore/net/wellenreiter/gui/packetview.cpp
@@ -1,153 +1,165 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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#include "packetview.h" 16#include "packetview.h"
17 17
18/* OPIE */ 18/* OPIE */
19#include <opie2/opcap.h> 19#include <opie2/opcap.h>
20#include <opie2/odebug.h> 20#include <opie2/odebug.h>
21#include <opie2/olistview.h> 21#include <opie2/olistview.h>
22#include <opie2/oapplication.h> 22#include <opie2/oapplication.h>
23 23
24/* QT */ 24/* QT */
25#include <qfont.h> 25#include <qfont.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlist.h> 28#include <qlist.h>
29#include <qlistview.h> 29#include <qlistview.h>
30#include <qobjectlist.h> 30#include <qobjectlist.h>
31#include <qspinbox.h> 31#include <qspinbox.h>
32#include <qtextview.h> 32#include <qtextview.h>
33 33
34using namespace Opie::Net; 34using namespace Opie::Net;
35using namespace Opie::Core; 35using namespace Opie::Core;
36using namespace Opie::Ui; 36using namespace Opie::Ui;
37 37
38PacketView::PacketView( QWidget * parent, const char * name, WFlags f ) 38PacketView::PacketView( QWidget * parent, const char * name, WFlags f )
39 :QFrame( parent, name, f ) 39 :QFrame( parent, name, f )
40{ 40{
41 _number = new QSpinBox( this ); 41 _number = new QSpinBox( this );
42 _number->setPrefix( "Pkt# " ); 42 _number->setPrefix( "Pkt# " );
43 _label = new QLabel( this ); 43 _label = new QLabel( this );
44 _list = new OListView( this ); 44 _list = new OListView( this );
45 _list->addColumn( "#" ); 45 _list->addColumn( "#" );
46 _list->addColumn( "Packet Type" ); 46 _list->addColumn( "Packet Type" );
47 _list->setColumnAlignment( 0, Qt::AlignCenter ); 47 _list->setColumnAlignment( 0, Qt::AlignCenter );
48 _list->setColumnAlignment( 1, Qt::AlignLeft ); 48 _list->setColumnAlignment( 1, Qt::AlignLeft );
49 _list->setAllColumnsShowFocus( true ); 49 _list->setAllColumnsShowFocus( true );
50 _list->setFont( QFont( "Fixed", 8 ) ); 50 _list->setFont( QFont( "Fixed", 8 ) );
51 51
52 _hex = new QTextView( this ); 52 _hex = new QTextView( this );
53 _hex->setMargin( 0 ); 53 _hex->setMargin( 0 );
54 _hex->setFont( QFont( "Fixed", 8 ) ); 54 _hex->setFont( QFont( "Fixed", 8 ) );
55 55
56 QVBoxLayout* vb = new QVBoxLayout( this, 2, 2 ); 56 QVBoxLayout* vb = new QVBoxLayout( this, 2, 2 );
57 QHBoxLayout* hb = new QHBoxLayout( vb, 2 ); 57 QHBoxLayout* hb = new QHBoxLayout( vb, 2 );
58 hb->addWidget( _label, 5 ); 58 hb->addWidget( _label, 5 );
59 hb->addWidget( _number, 2 ); 59 hb->addWidget( _number, 2 );
60 vb->addWidget( _list, 3 ); 60 vb->addWidget( _list, 3 );
61 vb->addWidget( _hex, 4 ); // allow a bit (4/3) more space 61 vb->addWidget( _hex, 4 ); // allow a bit (4/3) more space
62 62
63 _packets.setAutoDelete( true ); 63 _packets.setAutoDelete( true );
64 64
65 connect( _number, SIGNAL( valueChanged( int ) ), this, SLOT( showPacket( int ) ) ); 65 connect( _number, SIGNAL( valueChanged( int ) ), this, SLOT( showPacket( int ) ) );
66 connect( parent, SIGNAL( currentChanged( QWidget *) ), this, SLOT( activated( QWidget* ) ) ); 66 connect( parent, SIGNAL( currentChanged( QWidget *) ), this, SLOT( activated( QWidget* ) ) );
67 67
68 clear(); 68 clear();
69 69
70} 70}
71 71
72void PacketView::add( const OPacket* p, int size ) 72void PacketView::add( const OPacket* p, int size )
73{ 73{
74 /*
75 * don't scroll away when somebody views packages
76 * while scanning
77 */
78 int value = _number->value();
79 bool last = (value == static_cast<int>( _packets.count() ) );
80
74 odebug << "PacketView::add() size = " << size << oendl; 81 odebug << "PacketView::add() size = " << size << oendl;
75 if ( size == -1 ) // unlimited buffer 82 if ( size == -1 ) // unlimited buffer
76 { 83 {
77 _packets.append( p ); 84 _packets.append( p );
78 } 85 }
79 else 86 else
80 { // limited buffer, limit = size 87 { // limited buffer, limit = size
81 while ( _packets.count() >= size ) 88 while ( _packets.count() >= static_cast<uint>( size ) )
82 { 89 {
83 _packets.removeFirst(); 90 _packets.removeFirst();
91 --value;
84 } 92 }
93
94 /* check if we lost our packet */
95 last = ( value < 1 );
85 _packets.append( p ); 96 _packets.append( p );
86 } 97 }
87 98
88 _number->setMinValue( 1 ); 99 _number->setMinValue( 1 );
89 _number->setMaxValue( _packets.count() ); 100 _number->setMaxValue( _packets.count() );
90 _number->setValue( _packets.count() ); 101 _number->setValue( last ? _packets.count() : value );
91} 102}
92 103
93void PacketView::showPacket( int number ) 104void PacketView::showPacket( int number )
94{ 105{
95 _list->clear(); 106 _list->clear();
96 _hex->setText(""); 107 _hex->setText("");
97 const OPacket* p = _packets.at( number-1 ); 108 const OPacket* p = _packets.at( number-1 );
98 109
99 if ( p ) 110 if ( p )
100 { 111 {
101 _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 ); 112 _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 );
102 _doHexPacket( p ); 113 _doHexPacket( p );
103 QDateTime dt; dt.setTime_t( p->timeval().tv_sec ); 114 QDateTime dt; dt.setTime_t( p->timeval().tv_sec );
104 _label->setText( dt.toString() + QString().sprintf( " Len=%d", p->len() ) ); 115 _label->setText( dt.toString() + QString().sprintf( " Len=%d", p->len() ) );
105 } 116 }
106 else 117 else
107 { 118 {
108 odebug << "D'oh! No packet!" << oendl; 119 odebug << "D'oh! No packet!" << oendl;
109 } 120 }
110} 121}
111 122
112void PacketView::activated( QWidget* w ) 123void PacketView::activated( QWidget* w )
113{ 124{
114 if ( ( this == w ) && _packets.count() ) 125 if ( ( this == w ) && _packets.count() )
115 { 126 {
116 _number->setValue( 1 ); 127 _number->setValue( 1 );
117 } 128 }
118} 129}
119 130
120void PacketView::_doSubPackets( QObjectList* l, int counter ) 131void PacketView::_doSubPackets( QObjectList* l, int counter )
121{ 132{
122 if (!l) return; 133 if (!l) return;
123 QObject* o = l->first(); 134 QObject* o = l->first();
124 while ( o ) 135 while ( o )
125 { 136 {
126 new OListViewItem( _list, QString::number( counter++ ), o->name() ); 137 new OListViewItem( _list, QString::number( counter++ ), o->name() );
127 _doSubPackets( const_cast<QObjectList*>( o->children() ), counter ); 138 _doSubPackets( const_cast<QObjectList*>( o->children() ), counter );
128 o = l->next(); 139 o = l->next();
129 } 140 }
130} 141}
131 142
132void PacketView::_doHexPacket( const OPacket* p ) 143void PacketView::_doHexPacket( const OPacket* p )
133{ 144{
134 if ( oApp->desktop()->width() > 320 ) 145 if ( oApp->desktop()->width() > 320 )
135 _hex->setText( p->dump( 16 ) ); 146 _hex->setText( p->dump( 16 ) );
136 else 147 else
137 _hex->setText( p->dump( 8 ) ); 148 _hex->setText( p->dump( 8 ) );
138} 149}
139 150
140const QString PacketView::getLog() const 151const QString PacketView::getLog() const
141{ 152{
153 return QString::null;
142} 154}
143 155
144void PacketView::clear() 156void PacketView::clear()
145{ 157{
146 _packets.clear(); 158 _packets.clear();
147 _number->setMinValue( 0 ); 159 _number->setMinValue( 0 );
148 _number->setMaxValue( 0 ); 160 _number->setMaxValue( 0 );
149 _label->setText( "---" ); 161 _label->setText( "---" );
150 _list->clear(); 162 _list->clear();
151 _hex->setText( " <center><i>-- no Packet available --</i></center> " ); 163 _hex->setText( " <center><i>-- no Packet available --</i></center> " );
152} 164}
153 165
diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp
index 635e174..1e3d195 100644
--- a/noncore/net/wellenreiter/gui/protolistview.cpp
+++ b/noncore/net/wellenreiter/gui/protolistview.cpp
@@ -1,120 +1,120 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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/* LOCAL */ 16/* LOCAL */
17#include "protolistview.h" 17#include "protolistview.h"
18 18
19#include <qcheckbox.h> 19#include <qcheckbox.h>
20#include <qcombobox.h> 20#include <qcombobox.h>
21#include <qvbox.h> 21#include <qvbox.h>
22#include <qlabel.h> 22#include <qlabel.h>
23 23
24ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) 24ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f )
25 :QScrollView( parent, name, f ) 25 :QScrollView( parent, name, f )
26{ 26{
27 parse = ( QString( "parsePackets" ) == QString( name ) ); 27 parse = ( QString( "parsePackets" ) == QString( name ) );
28 28
29 setMargins( 3, 3, 0, 0 ); 29 setMargins( 3, 3, 0, 0 );
30 viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); 30 viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) );
31 31
32 vbox = new QVBox( viewport() ); 32 vbox = new QVBox( viewport() );
33 vbox->setSpacing( 1 ); 33 vbox->setSpacing( 1 );
34 addChild( vbox ); 34 addChild( vbox );
35 35
36 QHBox* hbox = new QHBox( vbox ); 36 QHBox* hbox = new QHBox( vbox );
37 hbox->setSpacing( 40 ); 37 hbox->setSpacing( 40 );
38 new QLabel( tr( "Protocol Family" ), hbox ); 38 new QLabel( tr( "Protocol Family" ), hbox );
39 new QLabel( tr( "Perform Action" ), hbox ); 39 new QLabel( tr( "Perform Action" ), hbox );
40 QFrame* frame = new QFrame( vbox ); 40 QFrame* frame = new QFrame( vbox );
41 frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); 41 frame->setFrameStyle( QFrame::HLine + QFrame::Sunken );
42 42
43 //TODO: hardcoded for now...a protocol database would be nice!? 43 //TODO: hardcoded for now...a protocol database would be nice!?
44 44
45 //addProtocol( "Ethernet" ); 45 //addProtocol( "Ethernet" );
46 addProtocol( "Prism" ); 46 addProtocol( "Prism" );
47 //addProtocol( "802.11" ); 47 //addProtocol( "802.11" );
48 addProtocol( "802.11 Management" ); 48 addProtocol( "802.11 Management" );
49 addProtocol( "802.11 SSID" ); 49 addProtocol( "802.11 SSID" );
50 addProtocol( "802.11 Rates" ); 50 addProtocol( "802.11 Rates" );
51 addProtocol( "802.11 CF" ); 51 addProtocol( "802.11 CF" );
52 addProtocol( "802.11 FH" ); 52 addProtocol( "802.11 FH" );
53 addProtocol( "802.11 DS" ); 53 addProtocol( "802.11 DS" );
54 addProtocol( "802.11 Tim" ); 54 addProtocol( "802.11 Tim" );
55 addProtocol( "802.11 IBSS" ); 55 addProtocol( "802.11 IBSS" );
56 addProtocol( "802.11 Challenge" ); 56 addProtocol( "802.11 Challenge" );
57 addProtocol( "802.11 Data" ); 57 addProtocol( "802.11 Data" );
58 addProtocol( "802.11 LLC" ); 58 addProtocol( "802.11 LLC" );
59 addProtocol( "802.11 Data" ); 59 addProtocol( "802.11 Data" );
60 addProtocol( "IP" ); 60 addProtocol( "IP" );
61 addProtocol( "ARP" ); 61 addProtocol( "ARP" );
62 addProtocol( "UDP" ); 62 addProtocol( "UDP" );
63 addProtocol( "TCP" ); 63 addProtocol( "TCP" );
64} 64}
65 65
66 66
67ProtocolListView::~ProtocolListView() 67ProtocolListView::~ProtocolListView()
68{ 68{
69} 69}
70 70
71 71
72void ProtocolListView::addProtocol( const QString& name ) 72void ProtocolListView::addProtocol( const QString& name )
73{ 73{
74 QHBox* hbox = new QHBox( vbox ); 74 QHBox* hbox = new QHBox( vbox );
75 new QCheckBox( name, hbox, (const char*) name ); 75 new QCheckBox( name, hbox, name.local8Bit() );
76 76
77 if ( parse ) 77 if ( parse )
78 { 78 {
79 QComboBox* combo = new QComboBox( hbox, (const char*) name ); 79 QComboBox* combo = new QComboBox( hbox, name.local8Bit() );
80 #ifdef QWS 80 #ifdef QWS
81 combo->setFixedWidth( 75 ); 81 combo->setFixedWidth( 75 );
82 #endif 82 #endif
83 combo->insertItem( "Pass" ); 83 combo->insertItem( "Pass" );
84 combo->insertItem( "Discard!" ); 84 combo->insertItem( "Discard!" );
85 combo->insertItem( "TouchSound" ); 85 combo->insertItem( "TouchSound" );
86 combo->insertItem( "AlarmSound" ); 86 combo->insertItem( "AlarmSound" );
87 combo->insertItem( "KeySound" ); 87 combo->insertItem( "KeySound" );
88 combo->insertItem( "LedOn" ); 88 combo->insertItem( "LedOn" );
89 combo->insertItem( "LedOff" ); 89 combo->insertItem( "LedOff" );
90 combo->insertItem( "LogMessage" ); 90 combo->insertItem( "LogMessage" );
91 combo->insertItem( "MessageBox" ); 91 combo->insertItem( "MessageBox" );
92 } 92 }
93 else 93 else
94 { 94 {
95 QComboBox* combo = new QComboBox( hbox, (const char*) name ); 95 QComboBox* combo = new QComboBox( hbox, name.local8Bit() );
96 #ifdef QWS 96 #ifdef QWS
97 combo->setFixedWidth( 75 ); 97 combo->setFixedWidth( 75 );
98 #endif 98 #endif
99 combo->insertItem( "Pass" ); 99 combo->insertItem( "Pass" );
100 combo->insertItem( "Discard!" ); 100 combo->insertItem( "Discard!" );
101 } 101 }
102} 102}
103 103
104 104
105bool ProtocolListView::isProtocolChecked( const QString& name ) 105bool ProtocolListView::isProtocolChecked( const QString& name )
106{ 106{
107 QCheckBox* box = (QCheckBox*) child( (const char*) name ); 107 QCheckBox* box = (QCheckBox*) child( name.local8Bit() );
108 return ( box && box->isOn() ); 108 return ( box && box->isOn() );
109} 109}
110 110
111 111
112QString ProtocolListView::protocolAction( const QString& name ) 112QString ProtocolListView::protocolAction( const QString& name )
113{ 113{
114 QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); 114 QComboBox* combo = (QComboBox*) child( name.local8Bit(), "QComboBox" );
115 if ( combo ) 115 if ( combo )
116 return combo->currentText(); 116 return combo->currentText();
117 else 117 else
118 return "<unknown>"; 118 return "<unknown>";
119} 119}
120 120
diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp
index cb17f51..13096f2 100644
--- a/noncore/net/wellenreiter/gui/resource.cpp
+++ b/noncore/net/wellenreiter/gui/resource.cpp
@@ -1,49 +1,49 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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#include "resource.h" 16#include "resource.h"
17 17
18#define PIXMAPPATH "/usr/local/share" 18#define PIXMAPPATH "/usr/local/share"
19 19
20#include <qiconset.h> 20#include <qiconset.h>
21 21
22namespace Resource 22namespace Resource
23{ 23{
24 24
25QPixmap loadPixmap( const QString& pix ) 25QPixmap loadPixmap( const QString& pix )
26{ 26{
27 QString filename; 27 QString filename;
28 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); 28 filename.sprintf( "%s/%s.png", PIXMAPPATH, pix.local8Bit() );
29 QPixmap pixmap( filename ); 29 QPixmap pixmap( filename );
30 if ( pixmap.isNull() ) 30 if ( pixmap.isNull() )
31 { 31 {
32 odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; 32 odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl;
33 } 33 }
34 return pixmap; 34 return pixmap;
35}; 35};
36 36
37QIconSet loadIconSet( const QString& pix ) 37QIconSet loadIconSet( const QString& pix )
38{ 38{
39 QString filename; 39 QString filename;
40 filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); 40 filename.sprintf( "%s/%s.png", PIXMAPPATH, pix.local8Bit() );
41 QPixmap pixmap( filename ); 41 QPixmap pixmap( filename );
42 if ( pixmap.isNull() ) 42 if ( pixmap.isNull() )
43 { 43 {
44 odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; 44 odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl;
45 } 45 }
46 return QIconSet( pixmap ); 46 return QIconSet( pixmap );
47}; 47};
48 48
49}; 49};
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 9e907d8..fa1d724 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -1,566 +1,569 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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#include "scanlist.h" 16#include "scanlist.h"
17#include "configwindow.h" 17#include "configwindow.h"
18#include "logwindow.h" 18#include "logwindow.h"
19 19
20/* OPIE */ 20/* OPIE */
21#ifdef QWS 21#ifdef QWS
22#include <opie2/odebug.h> 22#include <opie2/odebug.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#else 25#else
26#include "resource.h" 26#include "resource.h"
27#endif 27#endif
28using namespace Opie::Core; 28
29using namespace Opie::Ui;
30using namespace Opie::Net;
31 29
32/* QT */ 30/* QT */
33#include <qcursor.h> 31#include <qcursor.h>
34#include <qdatetime.h> 32#include <qdatetime.h>
35#include <qpopupmenu.h> 33#include <qpopupmenu.h>
36#include <qcheckbox.h> 34#include <qcheckbox.h>
37 35
38/* STD */ 36/* STD */
39#include <assert.h> 37#include <assert.h>
40 38
39using namespace Opie::Core;
40using namespace Opie::Ui;
41using namespace Opie::Net;
42
41const int col_type = 0; 43const int col_type = 0;
42const int col_essid = 0; 44const int col_essid = 0;
43const int col_sig = 1; 45const int col_sig = 1;
44const int col_ap = 2; 46const int col_ap = 2;
45const int col_channel = 3; 47const int col_channel = 3;
46const int col_wep = 4; 48const int col_wep = 4;
47const int col_traffic = 5; 49const int col_traffic = 5;
48const int col_ip = 6; 50const int col_ip = 6;
49const int col_manuf = 7; 51const int col_manuf = 7;
50const int col_firstseen = 8; 52const int col_firstseen = 8;
51const int col_lastseen = 9; 53const int col_lastseen = 9;
52const int col_location = 10; 54const int col_location = 10;
53 55
56#define DEBUG
57
54MScanListView::MScanListView( QWidget* parent, const char* name ) 58MScanListView::MScanListView( QWidget* parent, const char* name )
55 :OListView( parent, name ) 59 :OListView( parent, name )
56{ 60{
57 setFrameShape( QListView::StyledPanel ); 61 setFrameShape( QListView::StyledPanel );
58 setFrameShadow( QListView::Sunken ); 62 setFrameShadow( QListView::Sunken );
59 63
60 addColumn( tr( "Net/Station" ) ); 64 addColumn( tr( "Net/Station" ) );
61 setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); 65 setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
62 addColumn( tr( "#" ) ); 66 addColumn( tr( "#" ) );
63 setColumnAlignment( col_sig, AlignCenter ); 67 setColumnAlignment( col_sig, AlignCenter );
64 addColumn( tr( "MAC" ) ); 68 addColumn( tr( "MAC" ) );
65 setColumnAlignment( col_ap, AlignCenter ); 69 setColumnAlignment( col_ap, AlignCenter );
66 addColumn( tr( "Chn" ) ); 70 addColumn( tr( "Chn" ) );
67 setColumnAlignment( col_channel, AlignCenter ); 71 setColumnAlignment( col_channel, AlignCenter );
68 addColumn( tr( "W" ) ); 72 addColumn( tr( "W" ) );
69 setColumnAlignment( col_wep, AlignCenter ); 73 setColumnAlignment( col_wep, AlignCenter );
70 addColumn( tr( "T" ) ); 74 addColumn( tr( "T" ) );
71 setColumnAlignment( col_traffic, AlignCenter ); 75 setColumnAlignment( col_traffic, AlignCenter );
72 addColumn( tr( "IP" ) ); 76 addColumn( tr( "IP" ) );
73 setColumnAlignment( col_ip, AlignCenter ); 77 setColumnAlignment( col_ip, AlignCenter );
74 addColumn( tr( "Manufacturer" ) ); 78 addColumn( tr( "Manufacturer" ) );
75 setColumnAlignment( col_manuf, AlignCenter ); 79 setColumnAlignment( col_manuf, AlignCenter );
76 addColumn( tr( "First Seen" ) ); 80 addColumn( tr( "First Seen" ) );
77 setColumnAlignment( col_firstseen, AlignCenter ); 81 setColumnAlignment( col_firstseen, AlignCenter );
78 addColumn( tr( "Last Seen" ) ); 82 addColumn( tr( "Last Seen" ) );
79 setColumnAlignment( col_lastseen, AlignCenter ); 83 setColumnAlignment( col_lastseen, AlignCenter );
80 addColumn( tr( "Location" ) ); 84 addColumn( tr( "Location" ) );
81 setColumnAlignment( col_location, AlignCenter ); 85 setColumnAlignment( col_location, AlignCenter );
82 setRootIsDecorated( true ); 86 setRootIsDecorated( true );
83 setAllColumnsShowFocus( true ); 87 setAllColumnsShowFocus( true );
84 88
85 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 89 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
86 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); 90 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
87 91
88 #ifdef QWS 92 #ifdef QWS
89 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 93 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
90 #endif 94 #endif
91 95
92}; 96};
93 97
94 98
95MScanListView::~MScanListView() 99MScanListView::~MScanListView()
96{ 100{
97}; 101};
98 102
99 103
100OListViewItem* MScanListView::childFactory() 104OListViewItem* MScanListView::childFactory()
101{ 105{
102 return new MScanListItem( this ); 106 return new MScanListItem( this );
103} 107}
104 108
105 109
106void MScanListView::serializeTo( QDataStream& s) const 110void MScanListView::serializeTo( QDataStream& s) const
107{ 111{
108 odebug << "serializing MScanListView" << oendl; 112 odebug << "serializing MScanListView" << oendl;
109 OListView::serializeTo( s ); 113 OListView::serializeTo( s );
110} 114}
111 115
112 116
113void MScanListView::serializeFrom( QDataStream& s) 117void MScanListView::serializeFrom( QDataStream& s)
114{ 118{
115 odebug << "serializing MScanListView" << oendl; 119 odebug << "serializing MScanListView" << oendl;
116 OListView::serializeFrom( s ); 120 OListView::serializeFrom( s );
117} 121}
118 122
119 123
120void MScanListView::addNewItem( const QString& type, 124void MScanListView::addNewItem( const QString& type,
121 const QString& essid, 125 const QString& essid,
122 const OMacAddress& mac, 126 const OMacAddress& mac,
123 bool wep, 127 bool wep,
124 int channel, 128 int channel,
125 int signal, 129 int signal,
126 const GpsLocation& loc, 130 const GpsLocation& loc,
127 bool probe ) 131 bool probe )
128{ 132{
129 QString macaddr = mac.toString(true); 133 QString macaddr = mac.toString(true);
130 134
131 #ifdef DEBUG 135 #ifdef DEBUG
132 odebug << "MScanList::addNewItem( " << type << " / " 136 odebug << "MScanList::addNewItem( " << type << " / "
133 << essid << " / " << macaddr 137 << essid << " / " << macaddr
134 << " [" << channel << "]" << oendl; 138 << " [" << channel << "]" << oendl;
135 #endif 139 #endif
136 140
137 // search, if we already have seen this net 141 // search, if we already have seen this net
138 142
139 QString s; 143 QString s;
140 MScanListItem* network; 144 MScanListItem* network;
141 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 145 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
142 146
143 while ( item && ( item->text( col_essid ) != essid ) ) 147 while ( item && ( item->text( col_essid ) != essid ) )
144 { 148 {
145 #ifdef DEBUG 149 #ifdef DEBUG
146 odebug << "itemtext: " << item->text( col_essid ) << "" << oendl; 150 odebug << "itemtext: " << item->text( col_essid ) << "" << oendl;
147 #endif 151 #endif
148 item = static_cast<MScanListItem*> ( item->nextSibling() ); 152 item = static_cast<MScanListItem*> ( item->nextSibling() );
149 } 153 }
150 if ( item ) 154 if ( item )
151 { 155 {
152 // we have already seen this net, check all childs if MAC exists 156 // we have already seen this net, check all childs if MAC exists
153 157
154 network = item; 158 network = item;
155 159
156 item = static_cast<MScanListItem*> ( item->firstChild() ); 160 item = static_cast<MScanListItem*> ( item->firstChild() );
157 assert( item ); // this shouldn't fail 161 assert( item ); // this shouldn't fail
158 162
159 while ( item && ( item->text( col_ap ) != macaddr ) ) 163 while ( item && ( item->text( col_ap ) != macaddr ) )
160 { 164 {
161 #ifdef DEBUG 165 #ifdef DEBUG
162 odebug << "subitemtext: " << item->text( col_ap ) << "" << oendl; 166 odebug << "subitemtext: " << item->text( col_ap ) << "" << oendl;
163 #endif 167 #endif
164 item = static_cast<MScanListItem*> ( item->nextSibling() ); 168 item = static_cast<MScanListItem*> ( item->nextSibling() );
165 } 169 }
166 170
167 if ( item ) 171 if ( item )
168 { 172 {
169 // we have already seen this item, it's a dupe 173 // we have already seen this item, it's a dupe
170 #ifdef DEBUG 174 #ifdef DEBUG
171 odebug << "" << macaddr << " is a dupe - ignoring..." << oendl; 175 odebug << "" << macaddr << " is a dupe - ignoring..." << oendl;
172 #endif 176 #endif
173 item->receivedBeacon(); 177 item->receivedBeacon();
174 return; 178 return;
175 } 179 }
176 } 180 }
177 else 181 else
178 { 182 {
179 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); 183 s = QString( "(i) New network: ESSID '%1'" ).arg( essid );
180 MLogWindow::logwindow()->log( s ); 184 MLogWindow::logwindow()->log( s );
181 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); 185 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe );
182 } 186 }
183 187
184 188
185 // insert new station as child from network 189 // insert new station as child from network
186 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 190 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
187 191
188 #ifdef DEBUG 192 #ifdef DEBUG
189 odebug << "inserting new station " << macaddr << "" << oendl; 193 odebug << "inserting new station " << macaddr << "" << oendl;
190 #endif 194 #endif
191 195
192 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 196 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
193 station->setManufacturer( mac.manufacturer() ); 197 station->setManufacturer( mac.manufacturer() );
194 station->setLocation( loc.dmsPosition() ); 198 station->setLocation( loc.dmsPosition() );
195 199
196 if ( type == "managed" ) 200 if ( type == "managed" )
197 { 201 {
198 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); 202 s = QString( "(i) New Access Point in '%1' [%2]" ).arg( essid ).arg( channel );
199 } 203 }
200 else 204 else
201 { 205 {
202 s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); 206 s = QString( "(i) New AdHoc station in '%1' [%2]" ).arg( essid ).arg( channel );
203 } 207 }
204 MLogWindow::logwindow()->log( s ); 208 MLogWindow::logwindow()->log( s );
205} 209}
206 210
207 211
208void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) 212void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
209{ 213{
210 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); 214 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
211 215
212 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) 216 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
213 { 217 {
214 #ifdef DEBUG 218 #ifdef DEBUG
215 odebug << "subitemtext: " << subitem->text( col_ap ) << "" << oendl; 219 odebug << "subitemtext: " << subitem->text( col_ap ) << "" << oendl;
216 #endif 220 #endif
217 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 221 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
218 } 222 }
219 223
220 if ( subitem ) 224 if ( subitem )
221 { 225 {
222 // we have already seen this item, it's a dupe 226 // we have already seen this item, it's a dupe
223 #ifdef DEBUG 227 #ifdef DEBUG
224 odebug << "" << addr.toString(true) << " is a dupe - ignoring..." << oendl; 228 odebug << "" << addr.toString(true) << " is a dupe - ignoring..." << oendl;
225 #endif 229 #endif
226 subitem->receivedBeacon(); //FIXME: sent data bit 230 subitem->receivedBeacon(); //FIXME: sent data bit
227 return; 231 return;
228 } 232 }
229 233
230 // Hey, it seems to be a new item :-D 234 // Hey, it seems to be a new item :-D
231 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); 235 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 );
232 station->setManufacturer( addr.manufacturer() ); 236 station->setManufacturer( addr.manufacturer() );
233 237
234 QString s; 238 QString s;
235 if ( type == "station" ) 239 if ( type == "station" )
236 { 240 {
237 s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 241 s = QString( "(i) New Station in '%1' [xx]" ).arg( network->text( col_essid ) );
238 } 242 }
239 else 243 else
240 { 244 {
241 s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 245 s = QString( "(i) New Wireless Station in '%1' [xx]" ).arg( network->text( col_essid ) );
242 } 246 }
243 MLogWindow::logwindow()->log( s ); 247 MLogWindow::logwindow()->log( s );
244} 248}
245 249
246 250
247void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) 251void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo )
248{ 252{
249 odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; 253 odebug << "WDSTraffic: " << viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl;
250 QString s; 254 QString s;
251 MScanListItem* network; 255// MScanListItem* network;
252 256
253 QListViewItemIterator it( this ); 257 QListViewItemIterator it( this );
254 while ( it.current() && 258 while ( it.current() &&
255 it.current()->text( col_ap ) != viaFrom.toString(true) && 259 it.current()->text( col_ap ) != viaFrom.toString(true) &&
256 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; 260 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it;
257 261
258 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 262 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
259 263
260 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations 264 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
261 { 265 {
262 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); 266 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
263 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); 267 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to );
264 } 268 }
265 else 269 else
266 { 270 {
267 odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl; 271 odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl;
268 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); 272 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" );
269 } 273 }
270} 274}
271 275
272 276
273void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 277void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via )
274{ 278{
275 QString s; 279 QString s;
276 MScanListItem* network; 280// MScanListItem* network;
277 281
278 QListViewItemIterator it( this ); 282 QListViewItemIterator it( this );
279 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; 283 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
280 284
281 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 285 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
282 286
283 if ( item ) // AP has shown up yet, so just add our new "from" - station 287 if ( item ) // AP has shown up yet, so just add our new "from" - station
284 { 288 {
285 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); 289 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" );
286 } 290 }
287 else 291 else
288 { 292 {
289 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; 293 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
290 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); 294 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" );
291 295
292 } 296 }
293} 297}
294 298
295 299
296void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 300void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via )
297{ 301{
298 QString s; 302 QString s;
299 MScanListItem* network; 303// MScanListItem* network;
300 304
301 QListViewItemIterator it( this ); 305 QListViewItemIterator it( this );
302 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; 306 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
303 307
304 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 308 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
305 309
306 if ( item ) // AP has shown up yet, so just add our new "from" - station 310 if ( item ) // AP has shown up yet, so just add our new "from" - station
307 { 311 {
308 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); 312 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" );
309 } 313 }
310 else 314 else
311 { 315 {
312 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; 316 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
313 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); 317 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" );
314 } 318 }
315} 319}
316 320
317 321
318void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 322void MScanListView::IBSStraffic( const OMacAddress& /*from*/, const OMacAddress& /*to*/, const OMacAddress& /*via*/ )
319{ 323{
320 owarn << "D'oh! Not yet implemented..." << oendl; 324 owarn << "D'oh! Not yet implemented..." << oendl;
321 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); 325 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
322} 326}
323 327
324 328
325void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) 329void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
326{ 330{
327 odebug << "identify " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; 331 odebug << "identify " << macaddr.toString() << " = " << ip << "" << oendl;
328 332
329 QListViewItemIterator it( this ); 333 QListViewItemIterator it( this );
330 for ( ; it.current(); ++it ) 334 for ( ; it.current(); ++it )
331 { 335 {
332 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 336 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
333 { 337 {
334 it.current()->setText( col_ip, ip ); 338 it.current()->setText( col_ip, ip );
335 return; 339 return;
336 } 340 }
337 } 341 }
338 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; 342 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
339 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", 343 MLogWindow::logwindow()->log( QString( "WARNING: Unhandled identification %1 = %2!" )
340 (const char*) macaddr.toString(), (const char*) ip ) ); 344 .arg( macaddr.toString() ).arg( ip ) );
341} 345}
342 346
343 347
344void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) 348void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip )
345{ 349{
346 odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; 350 odebug << "addService '" << name << "', Server = " << macaddr.toString() << " = " << ip << "" << oendl;
347 351
348 //TODO: Refactor that out, we need it all over the place. 352 //TODO: Refactor that out, we need it all over the place.
349 // Best to do it in a more comfortable abstraction in OListView 353 // Best to do it in a more comfortable abstraction in OListView
350 // (Hmm, didn't I already start something in this direction?) 354 // (Hmm, didn't I already start something in this direction?)
351 355
352 QListViewItemIterator it( this ); 356 QListViewItemIterator it( this );
353 for ( ; it.current(); ++it ) 357 for ( ; it.current(); ++it )
354 { 358 {
355 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 359 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
356 { 360 {
357 361
358 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); 362 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
359 363
360 while ( subitem && ( subitem->text( col_essid ) != name ) ) 364 while ( subitem && ( subitem->text( col_essid ) != name ) )
361 { 365 {
362 #ifdef DEBUG 366 #ifdef DEBUG
363 odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl; 367 odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl;
364 #endif 368 #endif
365 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 369 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
366 } 370 }
367 371
368 if ( subitem ) 372 if ( subitem )
369 { 373 {
370 // we have already seen this item, it's a dupe 374 // we have already seen this item, it's a dupe
371 #ifdef DEBUG 375 #ifdef DEBUG
372 odebug << "" << name << " is a dupe - ignoring..." << oendl; 376 odebug << "" << name << " is a dupe - ignoring..." << oendl;
373 #endif 377 #endif
374 subitem->receivedBeacon(); //FIXME: sent data bit 378 subitem->receivedBeacon(); //FIXME: sent data bit
375 return; 379 return;
376 } 380 }
377 381
378 // never seen that - add new item 382 // never seen that - add new item
379 383
380 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); 384 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
381 item->setText( col_essid, name ); 385 item->setText( col_essid, name );
382 386
383 return; 387 return;
384 } 388 }
385 } 389 }
386 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; 390 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
387 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", 391 MLogWindow::logwindow()->log( QString("WARNING: Unhandled service addition %s = %s!")
388 (const char*) macaddr.toString(), (const char*) ip ) ); 392 .arg( macaddr.toString() ).arg( ip ) );
389} 393}
390 394
391 395
392void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) 396void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
393{ 397{
394 if ( !item ) return; 398 if ( !item ) return;
395 399
396 MScanListItem* itm = static_cast<MScanListItem*>( item ); 400 MScanListItem* itm = static_cast<MScanListItem*>( item );
397 401
398 odebug << "contextMenuRequested on item '" << (const char*) itm->text(0) << "' (" 402 odebug << "contextMenuRequested on item '" << itm->text(0) << "' ("
399 << (const char*) itm->type << ") in column: '" << col << "'" << oendl; 403 << itm->type << ") in column: '" << col << "'" << oendl;
400 404
401 if ( itm->type == "adhoc" || itm->type == "managed" ) 405 if ( itm->type == "adhoc" || itm->type == "managed" )
402 { 406 {
403 QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); 407 QString entry = QString( "&Join %1 Net '%2'..." ).arg( itm->type ).arg( itm->essid() );
404 408
405 QPopupMenu m( this ); 409 QPopupMenu m( this );
406 m.insertItem( entry, 37773, 0 ); 410 m.insertItem( entry, 37773, 0 );
407 int result = m.exec( QCursor::pos() ); 411 int result = m.exec( QCursor::pos() );
408 if ( result == 37773 ) 412 if ( result == 37773 )
409 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); 413 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
410 } 414 }
411} 415}
412 416
413//============================================================ 417//============================================================
414// MScanListItem 418// MScanListItem
415//============================================================ 419//============================================================
416 420
417MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, 421MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
418 bool wep, int channel, int signal, bool probed ) 422 bool wep, int channel, int signal, bool probed )
419 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 423 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
420 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 424 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
421 _channel( channel ), _signal( signal ), _beacons( 1 ) 425 _channel( channel ), _signal( signal ), _beacons( 1 )
422{ 426{
423 #ifdef DEBUG 427 #ifdef DEBUG
424 odebug << "creating scanlist item" << oendl; 428 odebug << "creating scanlist item" << oendl;
425 #endif 429 #endif
426 430
427 if ( WellenreiterConfigWindow::instance() ) 431 if ( WellenreiterConfigWindow::instance() )
428 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 432 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
429 433
430 decorateItem( type, essid, macaddr, wep, channel, signal, probed ); 434 decorateItem( type, essid, macaddr, wep, channel, signal, probed );
431} 435}
432 436
433MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, 437MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
434 bool wep, int channel, int signal ) 438 bool wep, int channel, int signal )
435 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 439 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
436{ 440{
437 #ifdef DEBUG 441 #ifdef DEBUG
438 odebug << "creating scanlist item" << oendl; 442 odebug << "creating scanlist item" << oendl;
439 #endif 443 #endif
440 if ( WellenreiterConfigWindow::instance() ) 444 if ( WellenreiterConfigWindow::instance() )
441 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 445 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
442 446
443 decorateItem( type, essid, macaddr, wep, channel, signal, false ); 447 decorateItem( type, essid, macaddr, wep, channel, signal, false );
444} 448}
445 449
446const QString& MScanListItem::essid() const 450const QString& MScanListItem::essid() const
447{ 451{
448 if ( type == "network" ) 452 if ( type == "network" )
449 return _essid; 453 return _essid;
450 else 454 else
451 return ( (MScanListItem*) parent() )->essid(); 455 return ( (MScanListItem*) parent() )->essid();
452} 456}
453 457
454OListViewItem* MScanListItem::childFactory() 458OListViewItem* MScanListItem::childFactory()
455{ 459{
456 return new MScanListItem( this ); 460 return new MScanListItem( this );
457} 461}
458 462
459void MScanListItem::serializeTo( QDataStream& s ) const 463void MScanListItem::serializeTo( QDataStream& s ) const
460{ 464{
461 #ifdef DEBUG 465 #ifdef DEBUG
462 odebug << "serializing MScanListItem" << oendl; 466 odebug << "serializing MScanListItem" << oendl;
463 #endif 467 #endif
464 OListViewItem::serializeTo( s ); 468 OListViewItem::serializeTo( s );
465 469
466 s << _type; 470 s << _type;
467 s << (Q_UINT8) ( _wep ? 'y' : 'n' ); 471 s << (Q_UINT8) ( _wep ? 'y' : 'n' );
468} 472}
469 473
470void MScanListItem::serializeFrom( QDataStream& s ) 474void MScanListItem::serializeFrom( QDataStream& s )
471{ 475{
472 #ifdef DEBUG 476 #ifdef DEBUG
473 odebug << "serializing MScanListItem" << oendl; 477 odebug << "serializing MScanListItem" << oendl;
474 #endif 478 #endif
475 OListViewItem::serializeFrom( s ); 479 OListViewItem::serializeFrom( s );
476 480
477 Q_UINT8 wep; 481 Q_UINT8 wep;
478 s >> _type; 482 s >> _type;
479 s >> wep; 483 s >> wep;
480 _wep = (wep == 'y'); 484 _wep = (wep == 'y');
481 485
482 QString name; 486 QString name = QString( "wellenreiter/"+ _type );
483 name.sprintf( "wellenreiter/%s", (const char*) _type );
484 setPixmap( col_type, Resource::loadPixmap( name ) ); 487 setPixmap( col_type, Resource::loadPixmap( name ) );
485 if ( _wep ) 488 if ( _wep )
486 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 489 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
487 listView()->triggerUpdate(); 490 listView()->triggerUpdate();
488} 491}
489 492
490void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) 493void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed )
491{ 494{
492 #ifdef DEBUG 495 #ifdef DEBUG
493 odebug << "decorating scanlist item " << (const char*) type << " / " 496 odebug << "decorating scanlist item " << type << " / "
494 << (const char*) essid << " / " << (const char*) macaddr 497 << essid << " / " << macaddr
495 << "[" << channel << "]" << oendl; 498 << "[" << channel << "]" << oendl;
496 #endif 499 #endif
497 500
498 // set icon for managed or adhoc mode 501 // set icon for managed or adhoc mode
499 QString name; 502 QString name;
500 name.sprintf( "wellenreiter/%s", (const char*) type ); 503 name.sprintf( "wellenreiter/"+ type );
501 setPixmap( col_type, Resource::loadPixmap( name ) ); 504 setPixmap( col_type, Resource::loadPixmap( name ) );
502 505
503 // special case for probed networks FIXME: This is ugly at present 506 // special case for probed networks FIXME: This is ugly at present
504 if ( type == "network" && probed ) 507 if ( type == "network" && probed )
505 { 508 {
506 setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); 509 setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) );
507 } 510 }
508 511
509 // set icon for wep (wireless encryption protocol) 512 // set icon for wep (wireless encryption protocol)
510 if ( wep ) 513 if ( wep )
511 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 514 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
512 515
513 // set channel and signal text 516 // set channel and signal text
514 517
515 if ( signal != -1 ) 518 if ( signal != -1 )
516 setText( col_sig, QString::number( signal ) ); 519 setText( col_sig, QString::number( signal ) );
517 if ( channel != -1 ) 520 if ( channel != -1 )
518 setText( col_channel, QString::number( channel ) ); 521 setText( col_channel, QString::number( channel ) );
519 522
520 setText( col_firstseen, QTime::currentTime().toString() ); 523 setText( col_firstseen, QTime::currentTime().toString() );
521 //setText( col_lastseen, QTime::currentTime().toString() ); 524 //setText( col_lastseen, QTime::currentTime().toString() );
522 525
523 listView()->triggerUpdate(); 526 listView()->triggerUpdate();
524 527
525 this->type = type; 528 this->type = type;
526 _type = type; 529 _type = type;
527 _essid = essid; 530 _essid = essid;
528 _macaddr = macaddr; 531 _macaddr = macaddr;
529 _channel = channel; 532 _channel = channel;
530 _beacons = 1; 533 _beacons = 1;
531 _signal = 0; 534 _signal = 0;
532 535
533 if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) 536 if ( WellenreiterConfigWindow::instance()->openTree->isChecked() )
534 { 537 {
535 listView()->ensureItemVisible( this ); 538 listView()->ensureItemVisible( this );
536 } 539 }
537 540
538} 541}
539 542
540 543
541void MScanListItem::setManufacturer( const QString& manufacturer ) 544void MScanListItem::setManufacturer( const QString& manufacturer )
542{ 545{
543 setText( col_manuf, manufacturer ); 546 setText( col_manuf, manufacturer );
544} 547}
545 548
546 549
547void MScanListItem::setLocation( const QString& location ) 550void MScanListItem::setLocation( const QString& location )
548{ 551{
549 setText( col_location, location ); 552 setText( col_location, location );
550} 553}
551 554
552 555
553void MScanListItem::receivedBeacon() 556void MScanListItem::receivedBeacon()
554{ 557{
555 _beacons++; 558 _beacons++;
556 #ifdef DEBUG 559 #ifdef DEBUG
557 odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl; 560 odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl;
558 #endif 561 #endif
559 setText( col_sig, QString::number( _beacons ) ); 562 setText( col_sig, QString::number( _beacons ) );
560 setText( col_lastseen, QTime::currentTime().toString() ); 563 setText( col_lastseen, QTime::currentTime().toString() );
561 564
562 MScanListItem* p = (MScanListItem*) parent(); 565 MScanListItem* p = (MScanListItem*) parent();
563 if ( p ) p->receivedBeacon(); 566 if ( p ) p->receivedBeacon();
564 567
565} 568}
566 569
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index e801ce7..df8e9c3 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,766 +1,778 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file may be distributed and/or modified under the terms of the 4** This file may be distributed and/or modified under the terms of the
5** GNU General Public License version 2 as published by the Free Software 5** GNU General Public License version 2 as published by the Free Software
6** Foundation and appearing in the file LICENSE.GPL included in the 6** Foundation and appearing in the file LICENSE.GPL included in the
7** packaging of this file. 7** packaging of this file.
8** 8**
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11** 11**
12***********************************************************************/ 12***********************************************************************/
13 13
14#include "gps.h" 14#include "gps.h"
15#include "wellenreiter.h" 15#include "wellenreiter.h"
16#include "scanlist.h" 16#include "scanlist.h"
17#include "logwindow.h" 17#include "logwindow.h"
18#include "packetview.h" 18#include "packetview.h"
19#include "configwindow.h" 19#include "configwindow.h"
20#include "statwindow.h" 20#include "statwindow.h"
21#include "graphwindow.h" 21#include "graphwindow.h"
22#include "protolistview.h" 22#include "protolistview.h"
23 23
24/* OPIE */ 24/* OPIE */
25#ifdef QWS 25#ifdef QWS
26#include <opie2/oapplication.h> 26#include <opie2/oapplication.h>
27#include <opie2/odebug.h> 27#include <opie2/odebug.h>
28#include <opie2/odevice.h> 28#include <opie2/odevice.h>
29#else 29#else
30#include <qapplication.h> 30#include <qapplication.h>
31#endif 31#endif
32#include <opie2/omanufacturerdb.h> 32#include <opie2/omanufacturerdb.h>
33#include <opie2/onetwork.h> 33#include <opie2/onetwork.h>
34#include <opie2/opcap.h> 34#include <opie2/opcap.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36using namespace Opie::Core;
37using namespace Opie::Net;
38using namespace Opie::Ui;
39 36
40/* QT */ 37/* QT */
41#include <qcheckbox.h> 38#include <qcheckbox.h>
42#include <qcombobox.h> 39#include <qcombobox.h>
43#include <qdatetime.h> 40#include <qdatetime.h>
44#include <qpushbutton.h> 41#include <qpushbutton.h>
45#include <qlineedit.h> 42#include <qlineedit.h>
46#include <qmessagebox.h> 43#include <qmessagebox.h>
47#include <qobjectlist.h> 44#include <qobjectlist.h>
48#include <qregexp.h> 45#include <qregexp.h>
49#include <qspinbox.h> 46#include <qspinbox.h>
50#include <qtimer.h> 47#include <qtimer.h>
51#include <qtoolbutton.h> 48#include <qtoolbutton.h>
52#include <qmainwindow.h> 49#include <qmainwindow.h>
53 50
54/* STD */ 51/* STD */
55#include <assert.h> 52#include <assert.h>
56#include <errno.h> 53#include <errno.h>
57#include <unistd.h> 54#include <unistd.h>
58#include <string.h> 55#include <string.h>
59#include <sys/types.h> 56#include <sys/types.h>
60#include <stdlib.h> 57#include <stdlib.h>
61#include <signal.h> 58#include <signal.h>
62 59
60
61using namespace Opie::Core;
62using namespace Opie::Net;
63using namespace Opie::Ui;
64
63Wellenreiter* Wellenreiter::instance = 0; 65Wellenreiter* Wellenreiter::instance = 0;
64 66
65Wellenreiter::Wellenreiter( QWidget* parent ) 67Wellenreiter::Wellenreiter( QWidget* parent )
66 : WellenreiterBase( parent, 0, 0 ), 68 : WellenreiterBase( parent, 0, 0 ),
67 sniffing( false ), iface( 0 ), configwindow( 0 ) 69 sniffing( false ), iface( 0 ), configwindow( 0 )
68{ 70{
69 71
70 logwindow->log( "(i) Wellenreiter has been started." ); 72 logwindow->log( "(i) Wellenreiter has been started." );
71 73
72 // 74 //
73 // detect operating system 75 // detect operating system
74 // 76 //
75 77
76 #ifdef QWS 78 #ifdef QWS
77 QString sys; 79 QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() );
78 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
79 _system = ODevice::inst()->system(); 80 _system = ODevice::inst()->system();
80 logwindow->log( sys ); 81 logwindow->log( sys );
81 #endif 82 #endif
82 83
83 netview->setColumnWidthMode( 1, QListView::Manual ); 84 netview->setColumnWidthMode( 1, QListView::Manual );
84 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), 85 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
85 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); 86 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
86 pcap = new OPacketCapturer(); 87 pcap = new OPacketCapturer();
87 pcap->setAutoDelete( false ); 88 pcap->setAutoDelete( false );
88 89
89 gps = new GPS( this ); 90 gps = new GPS( this );
90 91
91 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); 92 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
92 93
93 registerSignalHandler(); 94 registerSignalHandler();
94} 95}
95 96
96 97
97Wellenreiter::~Wellenreiter() 98Wellenreiter::~Wellenreiter()
98{ 99{
99 delete pcap; 100 delete pcap;
100 //unregisterSignalHandler(); 101 //unregisterSignalHandler();
101} 102}
102 103
103 104
104void Wellenreiter::initialTimer() 105void Wellenreiter::initialTimer()
105{ 106{
106 odebug << "preloading manufacturer database..." << oendl; 107 odebug << "preloading manufacturer database..." << oendl;
107 OManufacturerDB::instance(); 108 OManufacturerDB::instance();
108} 109}
109 110
110 111
111void Wellenreiter::signalHandler( int sig ) 112void Wellenreiter::signalHandler( int sig )
112{ 113{
114 Q_UNUSED( sig )
113 oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; 115 oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl;
114 if ( Wellenreiter::instance->sniffing ) 116 if ( Wellenreiter::instance->sniffing )
115 { 117 {
116 Wellenreiter::instance->pcap->closeDumpFile(); 118 Wellenreiter::instance->pcap->closeDumpFile();
117 Wellenreiter::instance->pcap->close(); 119 Wellenreiter::instance->pcap->close();
118 Wellenreiter::instance->stopClicked(); 120 Wellenreiter::instance->stopClicked();
119 } 121 }
120 oerr << "Phew. Seemed to work." << oendl; 122 oerr << "Phew. Seemed to work." << oendl;
121 ::exit( -1 ); 123 ::exit( -1 );
122} 124}
123 125
124 126
125void Wellenreiter::registerSignalHandler() 127void Wellenreiter::registerSignalHandler()
126{ 128{
127 Wellenreiter::instance = this; 129 Wellenreiter::instance = this;
128 struct sigaction action; 130 struct sigaction action;
129 131
130 action.sa_handler = Wellenreiter::signalHandler; 132 action.sa_handler = Wellenreiter::signalHandler;
131 if (sigemptyset(&action.sa_mask)) 133 if (sigemptyset(&action.sa_mask))
132 oerr << "sigemptyset() failure:" << strerror( errno ) << oendl; 134 oerr << "sigemptyset() failure:" << strerror( errno ) << oendl;
133 if (sigaction(SIGSEGV, &action, NULL)) 135 if (sigaction(SIGSEGV, &action, NULL))
134 oerr << "can't set up a signal handler for SIGSEGV:" << strerror( errno ) << oendl; 136 oerr << "can't set up a signal handler for SIGSEGV:" << strerror( errno ) << oendl;
135 if (sigaction(SIGBUS, &action, NULL)) 137 if (sigaction(SIGBUS, &action, NULL))
136 oerr << "can't set up a signal handler for SIGBUS:" << strerror( errno ) << oendl; 138 oerr << "can't set up a signal handler for SIGBUS:" << strerror( errno ) << oendl;
137 odebug << "signal handlers setup." << oendl; 139 odebug << "signal handlers setup." << oendl;
138} 140}
139 141
140 142
141void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 143void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
142{ 144{
143 configwindow = cw; 145 configwindow = cw;
144} 146}
145 147
146 148
147void Wellenreiter::channelHopped(int c) 149void Wellenreiter::channelHopped(int c)
148{ 150{
149 QString title = "Wellenreiter II -scan- ["; 151 QString title = "Wellenreiter II -scan- [";
150 QString left; 152 QString left;
151 if ( c > 1 ) left.fill( '.', c-1 ); 153 if ( c > 1 ) left.fill( '.', c-1 );
152 title.append( left ); 154 title.append( left );
153 title.append( '|' ); 155 title.append( '|' );
154 if ( c < iface->channels() ) 156 if ( c < iface->channels() )
155 { 157 {
156 QString right; 158 QString right;
157 right.fill( '.', iface->channels()-c ); 159 right.fill( '.', iface->channels()-c );
158 title.append( right ); 160 title.append( right );
159 } 161 }
160 title.append( "]" ); 162 title.append( "]" );
161 //title.append( QString().sprintf( " %02d", c ) ); 163 //title.append( QString().sprintf( " %02d", c ) );
162 assert( parent() ); 164 assert( parent() );
163 ( (QMainWindow*) parent() )->setCaption( title ); 165 ( (QMainWindow*) parent() )->setCaption( title );
164} 166}
165 167
166 168
167void Wellenreiter::handleNotification( OPacket* p ) 169void Wellenreiter::handleNotification( OPacket* p )
168{ 170{
169 QObjectList* l = p->queryList(); 171 QObjectList* l = p->queryList();
170 QObjectListIt it( *l ); 172 QObjectListIt it( *l );
171 QObject* o; 173 QObject* o;
172 174
173 while ( (o = it.current()) != 0 ) 175 while ( (o = it.current()) != 0 )
174 { 176 {
175 QString name = it.current()->name(); 177 QString name = it.current()->name();
176 if ( configwindow->parsePackets->isProtocolChecked( name ) ) 178 if ( configwindow->parsePackets->isProtocolChecked( name ) )
177 { 179 {
178 QString action = configwindow->parsePackets->protocolAction( name ); 180 QString action = configwindow->parsePackets->protocolAction( name );
179 odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; 181 odebug << "parsePacket-action for '" << name << "' seems to be '" << action << "'" << oendl;
180 doAction( action, name, p ); 182 doAction( action, name, p );
181 } 183 }
182 else 184 else
183 { 185 {
184 odebug << "protocol '" << name << "' not checked in parsePackets." << oendl; 186 odebug << "protocol '" << name << "' not checked in parsePackets." << oendl;
185 } 187 }
186 ++it; 188 ++it;
187 } 189 }
188} 190}
189 191
190 192
191void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) 193void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
192{ 194{
193 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); 195 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage );
194 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); 196 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage );
195 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); 197 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage );
196 else owarn << "Wellenreiter::handleManagementFrame(): '" << manage->managementType() << "' - please handle me!" << oendl; 198 else owarn << "Wellenreiter::handleManagementFrame(): '" << manage->managementType() << "' - please handle me!" << oendl;
197} 199}
198 200
199 201
200void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) 202void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* /* request */ )
201{ 203{
202 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 204 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
203 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); 205 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
204 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 206// OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
205 int channel = ds ? ds->channel() : -1; 207// int channel = ds ? ds->channel() : -1;
206 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 208 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
207 209
208 GpsLocation loc( -111, -111 ); 210 GpsLocation loc( -111, -111 );
209 if ( configwindow->enableGPS->isChecked() ) 211 if ( configwindow->enableGPS->isChecked() )
210 { 212 {
211 // TODO: add check if GPS is working!? 213 // TODO: add check if GPS is working!?
212 odebug << "Wellenreiter::gathering GPS data..." << oendl; 214 odebug << "Wellenreiter::gathering GPS data..." << oendl;
213 loc = gps->position(); 215 loc = gps->position();
214 odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; 216 odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl;
215 } 217 }
216 218
217 if ( essid.length() ) 219 if ( essid.length() )
218 netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); 220 netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ );
219 odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; 221 odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl;
220} 222}
221 223
222 224
223void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) 225void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ )
224{ 226{
225} 227}
226 228
227 229
228void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) 230void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
229{ 231{
230 QString type; 232 QString type;
231 if ( beacon->canIBSS() ) 233 if ( beacon->canIBSS() )
232 { 234 {
233 type = "adhoc"; 235 type = "adhoc";
234 } 236 }
235 else if ( beacon->canESS() ) 237 else if ( beacon->canESS() )
236 { 238 {
237 type = "managed"; 239 type = "managed";
238 } 240 }
239 else 241 else
240 { 242 {
241 owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; 243 owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl;
242 return; 244 return;
243 } 245 }
244 246
245 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 247 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
246 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); 248 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
247 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 249 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
248 int channel = ds ? ds->channel() : -1; 250 int channel = ds ? ds->channel() : -1;
249 251
250 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 252 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
251 253
252 GpsLocation loc( -111, -111 ); 254 GpsLocation loc( -111, -111 );
253 if ( configwindow->enableGPS->isChecked() ) 255 if ( configwindow->enableGPS->isChecked() )
254 { 256 {
255 // TODO: add check if GPS is working!? 257 // TODO: add check if GPS is working!?
256 odebug << "Wellenreiter::gathering GPS data..." << oendl; 258 odebug << "Wellenreiter::gathering GPS data..." << oendl;
257 loc = gps->position(); 259 loc = gps->position();
258 odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; 260 odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl;
259 } 261 }
260 262
261 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); 263 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
262 264
263 // update graph window 265 // update graph window
264 if ( ds ) 266 if ( ds )
265 { 267 {
266 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); 268 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
267 if ( prism ) 269 if ( prism )
268 graphwindow->traffic( ds->channel(), prism->signalStrength() ); 270 graphwindow->traffic( ds->channel(), prism->signalStrength() );
269 else 271 else
270 graphwindow->traffic( ds->channel(), 95 ); 272 graphwindow->traffic( ds->channel(), 95 );
271 } 273 }
272} 274}
273 275
274 276
275void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) 277void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control )
276{ 278{
277 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 279 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
278 280
279 if ( control->controlType() == "Acknowledge" ) 281 if ( control->controlType() == "Acknowledge" )
280 { 282 {
281 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); 283 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) );
282 } 284 }
283 else 285 else
284 { 286 {
285 odebug << "Wellenreiter::handleControlFrame - please handle " << control->controlType() << " in a future version! :D" << oendl; 287 odebug << "Wellenreiter::handleControlFrame - please handle " << control->controlType() << " in a future version! :D" << oendl;
286 } 288 }
287} 289}
288 290
289 291
290void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) 292void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* /* data */ , OMacAddress& from, OMacAddress& to )
291{ 293{
292 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 294 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
293 if ( wlan->fromDS() && !wlan->toDS() ) 295 if ( wlan->fromDS() && !wlan->toDS() )
294 { 296 {
295 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 297 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
296 from = wlan->macAddress3(); 298 from = wlan->macAddress3();
297 to = wlan->macAddress2(); 299 to = wlan->macAddress2();
298 } 300 }
299 else if ( !wlan->fromDS() && wlan->toDS() ) 301 else if ( !wlan->fromDS() && wlan->toDS() )
300 { 302 {
301 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); 303 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
302 from = wlan->macAddress2(); 304 from = wlan->macAddress2();
303 to = wlan->macAddress3(); 305 to = wlan->macAddress3();
304 } 306 }
305 else if ( wlan->fromDS() && wlan->toDS() ) 307 else if ( wlan->fromDS() && wlan->toDS() )
306 { 308 {
307 netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 309 netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
308 from = wlan->macAddress4(); 310 from = wlan->macAddress4();
309 to = wlan->macAddress3(); 311 to = wlan->macAddress3();
310 } 312 }
311 else 313 else
312 { 314 {
313 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); 315 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
314 from = wlan->macAddress2(); 316 from = wlan->macAddress2();
315 to = wlan->macAddress1(); 317 to = wlan->macAddress1();
316 } 318 }
317} 319}
318 320
319 321
320void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) 322void Wellenreiter::handleEthernetData( OPacket* /* p */, OEthernetPacket* data, OMacAddress& from, OMacAddress& to )
321{ 323{
322 from = data->sourceAddress(); 324 from = data->sourceAddress();
323 to = data->destinationAddress(); 325 to = data->destinationAddress();
324 326
325 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); 327 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) );
326} 328}
327 329
328 330
329void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) 331void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& /* source */, OMacAddress& /* dest */ )
330{ 332{
331 OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); 333 OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
332 if ( arp ) 334 if ( arp )
333 { 335 {
334 odebug << "Received ARP traffic (type '" << arp->type() << "'): " << oendl; 336 odebug << "Received ARP traffic (type '" << arp->type() << "'): " << oendl;
335 if ( arp->type() == "REQUEST" ) 337 if ( arp->type() == "REQUEST" )
336 { 338 {
337 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 339 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
338 } 340 }
339 else if ( arp->type() == "REPLY" ) 341 else if ( arp->type() == "REPLY" )
340 { 342 {
341 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 343 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
342 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); 344 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
343 } 345 }
344 } 346 }
345} 347}
346 348
347 349
348void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) 350void Wellenreiter::handleIPData( OPacket* p, OIPPacket* /* ip */, OMacAddress& source, OMacAddress& /* dest */ )
349{ 351{
350 //TODO: Implement more IP based protocols 352 //TODO: Implement more IP based protocols
351 353
352 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); 354 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" );
353 if ( dhcp ) 355 if ( dhcp )
354 { 356 {
355 odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl; 357 odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl;
356 if ( dhcp->type() == "OFFER" ) 358 if ( dhcp->type() == "OFFER" )
357 { 359 {
358 odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; 360 odebug << "DHCP: '" << source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl;
359 netView()->identify( source, dhcp->serverAddress().toString() ); 361 netView()->identify( source, dhcp->serverAddress().toString() );
360 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); 362 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() );
361 } 363 }
362 else if ( dhcp->type() == "ACK" ) 364 else if ( dhcp->type() == "ACK" )
363 { 365 {
364 odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; 366 odebug << "DHCP: '" << dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl;
365 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); 367 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() );
366 } 368 }
367 } 369 }
368} 370}
369 371
370 372
371QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) 373QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
372{ 374{
373 if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) 375 if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
374 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) 376 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
375 return 0; 377 return 0;
376 378
377 return p->child( protocol ); 379 return p->child( protocol );
378} 380}
379 381
380 382
381bool Wellenreiter::checkDumpPacket( OPacket* p ) 383bool Wellenreiter::checkDumpPacket( OPacket* p )
382{ 384{
383 // 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
384 // 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
385 if ( !configwindow->writeCaptureFile->isChecked() ) 387 if ( !configwindow->writeCaptureFile->isChecked() )
386 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
387 389
388 QObjectList* l = p->queryList(); 390 QObjectList* l = p->queryList();
389 QObjectListIt it( *l ); 391 QObjectListIt it( *l );
390 QObject* o; 392 QObject* o;
391 393
392 while ( (o = it.current()) != 0 ) 394 while ( (o = it.current()) != 0 )
393 { 395 {
394 QString name = it.current()->name(); 396 QString name = it.current()->name();
395 if ( configwindow->capturePackets->isProtocolChecked( name ) ) 397 if ( configwindow->capturePackets->isProtocolChecked( name ) )
396 { 398 {
397 QString action = configwindow->capturePackets->protocolAction( name ); 399 QString action = configwindow->capturePackets->protocolAction( name );
398 odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; 400 odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl;
399 if ( action == "Discard" ) 401 if ( action == "Discard" )
400 { 402 {
401 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); 403 logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) );
402 return false; 404 return false;
403 } 405 }
404 } 406 }
405 else 407 else
406 { 408 {
407 odebug << "protocol '" << name << "' not checked in capturePackets." << oendl; 409 odebug << "protocol '" << name << "' not checked in capturePackets." << oendl;
408 } 410 }
409 ++it; 411 ++it;
410 } 412 }
411 return true; 413 return true;
412} 414}
413 415
414 416
415void Wellenreiter::receivePacket( OPacket* p ) 417void Wellenreiter::receivePacket( OPacket* p )
416{ 418{
417 hexWindow()->add( p, configwindow->hexViewBuffer() ); 419 hexWindow()->add( p, configwindow->hexViewBuffer() );
418 420
419 if ( checkDumpPacket( p ) ) 421 if ( checkDumpPacket( p ) )
420 { 422 {
421 pcap->dump( p ); 423 pcap->dump( p );
422 } 424 }
423 425
424 // check for a management frame 426 // check for a management frame
425 OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); 427 OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
426 if ( manage ) 428 if ( manage )
427 { 429 {
428 handleManagementFrame( p, manage ); 430 handleManagementFrame( p, manage );
429 return; 431 return;
430 } 432 }
431 433
432 // check for a control frame 434 // check for a control frame
433 OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) ); 435 OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) );
434 if ( control ) 436 if ( control )
435 { 437 {
436 handleControlFrame( p, control ); 438 handleControlFrame( p, control );
437 return; 439 return;
438 } 440 }
439 441
440 OMacAddress source; 442 OMacAddress source;
441 OMacAddress dest; 443 OMacAddress dest;
442 444
443 //TODO: WEP check here 445 //TODO: WEP check here
444 446
445 // check for a wireless data frame 447 // check for a wireless data frame
446 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); 448 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) );
447 if ( wlan ) 449 if ( wlan )
448 { 450 {
449 handleWlanData( p, wlan, source, dest ); 451 handleWlanData( p, wlan, source, dest );
450 } 452 }
451 453
452 // check for a wired data frame 454 // check for a wired data frame
453 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); 455 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) );
454 if ( eth ) 456 if ( eth )
455 { 457 {
456 handleEthernetData( p, eth, source, dest ); 458 handleEthernetData( p, eth, source, dest );
457 } 459 }
458 460
459 // 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:
460 // 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.
461 OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); 463 OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) );
462 if ( arp ) 464 if ( arp )
463 { 465 {
464 handleARPData( p, arp, source, dest ); 466 handleARPData( p, arp, source, dest );
465 } 467 }
466 468
467 // check for a ip frame 469 // check for a ip frame
468 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); 470 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) );
469 if ( ip ) 471 if ( ip )
470 { 472 {
471 handleIPData( p, ip, source, dest ); 473 handleIPData( p, ip, source, dest );
472 } 474 }
473 475
474 //handleNotification( p ); 476 //handleNotification( p );
475 477
476} 478}
477 479
478 480
479void Wellenreiter::stopClicked() 481void Wellenreiter::stopClicked()
480{ 482{
481 if ( iface ) 483 if ( iface )
482 { 484 {
483 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*) ) );
484 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 486 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
485 iface->setChannelHopping(); // stop hopping channels 487 iface->setChannelHopping(); // stop hopping channels
486 } 488 }
487 else 489 else
488 killTimers(); 490 killTimers();
489 491
490 pcap->close(); 492 pcap->close();
491 sniffing = false; 493 sniffing = false;
492 494
493 if ( iface ) 495 if ( iface )
494 { 496 {
495 // switch off monitor mode 497 // switch off monitor mode
496 iface->setMode( "managed" ); 498 iface->setMode( "managed" );
497 // switch off promisc flag 499 // switch off promisc flag
498 iface->setPromiscuousMode( false ); 500 iface->setPromiscuousMode( false );
499 501
500 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess 502 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
501 } 503 }
502 504
503 logwindow->log( "(i) Stopped Scanning." ); 505 logwindow->log( "(i) Stopped Scanning." );
504 assert( parent() ); 506 assert( parent() );
505 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); 507 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" );
506 508
507 // message the user 509 // message the user
508 QMessageBox::information( this, "Wellenreiter II", 510 QMessageBox::information( this, "Wellenreiter II",
509 tr( "Your wireless card\nshould now be usable again." ) ); 511 tr( "Your wireless card\nshould now be usable again." ) );
510 512
511 sniffing = false; 513 sniffing = false;
512 emit( stoppedSniffing() ); 514 emit( stoppedSniffing() );
513 515
514 #ifdef QWS 516 #ifdef QWS
515 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) 517 if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
516 { 518 {
517 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 519 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
518 } 520 }
519 #else 521 #else
520 #warning FIXME: setScreenSaverMode is not operational on the X11 build 522 #warning FIXME: setScreenSaverMode is not operational on the X11 build
521 #endif 523 #endif
522 524
523 // print out statistics 525 updateStatistics();
524 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
525 statwindow->updateCounter( it.key(), it.data() );
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>are not matching!<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().sprintf( "Got packet with protocol '%s'", (const char*) 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().sprintf( "Got packet with protocol '%s'", (const char*) 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 " << (const char*) iface->name() 745 odebug << "joinNetwork() with Interface " << iface->name()
746 << ": " << (const char*) type << ", " << (const char*) essid 746 << ": " << type << ", " << essid
747 << ", " << channel << ", " << (const char*) 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
767void Wellenreiter::updateStatistics()
768{
769 // print out statistics
770 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
771 statwindow->updateCounter( it.key(), it.data() );
772}
773
774void Wellenreiter::slotTabChanged( QWidget* wid )
775{
776 if ( wid == statwindow )
777 updateStatistics();
778}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index f582a5f..5ac389e 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -1,112 +1,117 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file may be distributed and/or modified under the terms of the 4** This file may be distributed and/or modified under the terms of the
5** GNU General Public License version 2 as published by the Free Software 5** GNU General Public License version 2 as published by the Free Software
6** Foundation and appearing in the file LICENSE.GPL included in the 6** Foundation and appearing in the file LICENSE.GPL included in the
7** packaging of this file. 7** packaging of this file.
8** 8**
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11** 11**
12**********************************************************************/ 12**********************************************************************/
13 13
14#ifndef WELLENREITER_H 14#ifndef WELLENREITER_H
15#define WELLENREITER_H 15#define WELLENREITER_H
16 16
17#include "wellenreiterbase.h" 17#include "wellenreiterbase.h"
18 18
19#ifdef QWS 19#ifdef QWS
20#include <opie2/odevice.h> 20#include <opie2/odevice.h>
21#endif 21#endif
22 22
23#include <signal.h> 23#include <signal.h>
24 24
25class QTimerEvent; 25class QTimerEvent;
26class QPixmap; 26class QPixmap;
27namespace Opie {namespace Net {class OPacket;}} 27namespace Opie {namespace Net {class OPacket;}}
28namespace Opie {namespace Net {class OWaveLanManagementPacket;}} 28namespace Opie {namespace Net {class OWaveLanManagementPacket;}}
29namespace Opie {namespace Net {class OWaveLanControlPacket;}} 29namespace Opie {namespace Net {class OWaveLanControlPacket;}}
30namespace Opie {namespace Net {class OWaveLanDataPacket;}} 30namespace Opie {namespace Net {class OWaveLanDataPacket;}}
31namespace Opie {namespace Net {class OEthernetPacket;}} 31namespace Opie {namespace Net {class OEthernetPacket;}}
32namespace Opie {namespace Net {class OARPPacket;}} 32namespace Opie {namespace Net {class OARPPacket;}}
33namespace Opie {namespace Net {class OMacAddress;}} 33namespace Opie {namespace Net {class OMacAddress;}}
34namespace Opie {namespace Net {class OIPPacket;}} 34namespace Opie {namespace Net {class OIPPacket;}}
35namespace Opie {namespace Net {class OPacket;}} 35namespace Opie {namespace Net {class OPacket;}}
36namespace Opie {namespace Net {class OWirelessNetworkInterface;}} 36namespace Opie {namespace Net {class OWirelessNetworkInterface;}}
37namespace Opie {namespace Net {class OPacketCapturer;}} 37namespace Opie {namespace Net {class OPacketCapturer;}}
38class PacketView; 38class PacketView;
39class WellenreiterConfigWindow; 39class WellenreiterConfigWindow;
40class MLogWindow; 40class MLogWindow;
41class GPS; 41class GPS;
42 42
43class Wellenreiter : public WellenreiterBase { 43class Wellenreiter : public WellenreiterBase {
44 Q_OBJECT 44 Q_OBJECT
45 45
46 public: 46 public:
47 Wellenreiter( QWidget* parent = 0 ); 47 Wellenreiter( QWidget* parent = 0 );
48 ~Wellenreiter(); 48 ~Wellenreiter();
49 49
50 void setConfigWindow( WellenreiterConfigWindow* cw ); 50 void setConfigWindow( WellenreiterConfigWindow* cw );
51 MScanListView* netView() const { return netview; }; 51 MScanListView* netView() const { return netview; };
52 MLogWindow* logWindow() const { return logwindow; }; 52 MLogWindow* logWindow() const { return logwindow; };
53 PacketView* hexWindow() const { return hexwindow; }; 53 PacketView* hexWindow() const { return hexwindow; };
54 bool isDaemonRunning() const { return sniffing; }; 54 bool isDaemonRunning() const { return sniffing; };
55 QString captureFileName() const { return dumpname; }; 55 QString captureFileName() const { return dumpname; };
56 56
57 public: 57 public:
58 QString dumpname; 58 QString dumpname;
59 bool sniffing; 59 bool sniffing;
60 static Wellenreiter* instance; 60 static Wellenreiter* instance;
61 static void signalHandler( int sig ); 61 static void signalHandler( int sig );
62 62
63 protected: 63 protected:
64 virtual void timerEvent( QTimerEvent* ); 64 virtual void timerEvent( QTimerEvent* );
65 65
66 public slots: 66 public slots:
67 void initialTimer(); 67 void initialTimer();
68 68
69 void channelHopped(int); 69 void channelHopped(int);
70 void receivePacket(Opie::Net::OPacket*); 70 void receivePacket(Opie::Net::OPacket*);
71 void startClicked(); 71 void startClicked();
72 void stopClicked(); 72 void stopClicked();
73 73
74 void joinNetwork(const QString&,const QString&,int,const QString&); 74 void joinNetwork(const QString&,const QString&,int,const QString&);
75 75
76 signals: 76 signals:
77 void startedSniffing(); 77 void startedSniffing();
78 void stoppedSniffing(); 78 void stoppedSniffing();
79 79
80 private: 80 private:
81 void handleManagementFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 81 void handleManagementFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
82 void handleManagementFrameBeacon( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 82 void handleManagementFrameBeacon( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
83 void handleManagementFrameProbeRequest( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 83 void handleManagementFrameProbeRequest( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
84 void handleManagementFrameProbeResponse( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 84 void handleManagementFrameProbeResponse( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
85 void handleControlFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanControlPacket* control ); 85 void handleControlFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanControlPacket* control );
86 void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 86 void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
87 void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 87 void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
88 void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 88 void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
89 void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 89 void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
90 void handleNotification( Opie::Net::OPacket* p ); 90 void handleNotification( Opie::Net::OPacket* p );
91 void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p ); 91 void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p );
92 QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol ); 92 QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol );
93 bool checkDumpPacket( Opie::Net::OPacket* p ); 93 bool checkDumpPacket( Opie::Net::OPacket* p );
94 void registerSignalHandler(); 94 void registerSignalHandler();
95 95
96 private slots:
97 void slotTabChanged( QWidget* );
98
96 private: 99 private:
100 void updateStatistics();
101
97 #ifdef QWS 102 #ifdef QWS
98 Opie::Core::OSystem _system; // Opie Operating System identifier 103 Opie::Core::OSystem _system; // Opie Operating System identifier
99 #endif 104 #endif
100 105
101 Opie::Net::OWirelessNetworkInterface* iface; 106 Opie::Net::OWirelessNetworkInterface* iface;
102 Opie::Net::OPacketCapturer* pcap; 107 Opie::Net::OPacketCapturer* pcap;
103 WellenreiterConfigWindow* configwindow; 108 WellenreiterConfigWindow* configwindow;
104 GPS* gps; 109 GPS* gps;
105 110
106 //void readConfig(); 111 //void readConfig();
107 //void writeConfig(); 112 //void writeConfig();
108}; 113};
109 114
110 115
111 116
112#endif 117#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index a29d520..0ca0bd7 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -1,190 +1,192 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Wellenreiter II. 4** This file is part of Wellenreiter II.
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#include "wellenreiterbase.h" 16#include "wellenreiterbase.h"
17 17
18#include <qlabel.h> 18#include <qlabel.h>
19#include <qlayout.h> 19#include <qlayout.h>
20 20
21#include "logwindow.h" 21#include "logwindow.h"
22#include "packetview.h" 22#include "packetview.h"
23#include "scanlist.h" 23#include "scanlist.h"
24#include "statwindow.h" 24#include "statwindow.h"
25#include "graphwindow.h" 25#include "graphwindow.h"
26 26
27#ifdef QWS 27#ifdef QWS
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29#include <opie2/otabwidget.h> 29#include <opie2/otabwidget.h>
30using namespace Opie; 30using namespace Opie;
31#else 31#else
32#include "resource.h" 32#include "resource.h"
33#include <qtabwidget.h> 33#include <qtabwidget.h>
34#endif 34#endif
35 35
36#define WELLENREITER_VERSION "V1.0.3 (unofficial)" 36#define WELLENREITER_VERSION "V1.0.3 (unofficial)"
37 37
38/* 38/*
39 * Constructs a WellenreiterBase which is a child of 'parent', with the 39 * Constructs a WellenreiterBase which is a child of 'parent', with the
40 * name 'name' and widget flags set to 'f' 40 * name 'name' and widget flags set to 'f'
41 */ 41 */
42using namespace Opie::Ui; 42using namespace Opie::Ui;
43using namespace Opie::Ui; 43using namespace Opie::Ui;
44using namespace Opie::Ui; 44using namespace Opie::Ui;
45WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) 45WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
46 : QWidget( parent, name, fl ) 46 : QWidget( parent, name, fl )
47{ 47{
48 //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); 48 //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) );
49 //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); 49 //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) );
50 //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); 50 //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) );
51 //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); 51 //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) );
52 52
53 if ( !name ) 53 if ( !name )
54 setName( "WellenreiterBase" ); 54 setName( "WellenreiterBase" );
55 resize( 191, 294 ); 55 resize( 191, 294 );
56#ifdef QWS 56#ifdef QWS
57 setCaption( tr( "Wellenreiter/Opie" ) ); 57 setCaption( tr( "Wellenreiter/Opie" ) );
58#else 58#else
59 setCaption( tr( "Wellenreiter/X11" ) ); 59 setCaption( tr( "Wellenreiter/X11" ) );
60#endif 60#endif
61 WellenreiterBaseLayout = new QVBoxLayout( this ); 61 WellenreiterBaseLayout = new QVBoxLayout( this );
62 WellenreiterBaseLayout->setSpacing( 2 ); 62 WellenreiterBaseLayout->setSpacing( 2 );
63 WellenreiterBaseLayout->setMargin( 0 ); 63 WellenreiterBaseLayout->setMargin( 0 );
64#ifdef QWS 64#ifdef QWS
65 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); 65 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
66#else 66#else
67 TabWidget = new QTabWidget( this, "TabWidget" ); 67 TabWidget = new QTabWidget( this, "TabWidget" );
68#endif 68#endif
69 ap = new QWidget( TabWidget, "ap" ); 69 ap = new QWidget( TabWidget, "ap" );
70 apLayout = new QVBoxLayout( ap ); 70 apLayout = new QVBoxLayout( ap );
71 apLayout->setSpacing( 2 ); 71 apLayout->setSpacing( 2 );
72 apLayout->setMargin( 2 ); 72 apLayout->setMargin( 2 );
73 73
74 //--------- NETVIEW TAB -------------- 74 //--------- NETVIEW TAB --------------
75 75
76 netview = new MScanListView( ap ); 76 netview = new MScanListView( ap );
77 apLayout->addWidget( netview ); 77 apLayout->addWidget( netview );
78 78
79 //--------- GRAPH TAB -------------- 79 //--------- GRAPH TAB --------------
80 80
81 graphwindow = new MGraphWindow( TabWidget, "Graph" ); 81 graphwindow = new MGraphWindow( TabWidget, "Graph" );
82 82
83 //--------- LOG TAB -------------- 83 //--------- LOG TAB --------------
84 84
85 logwindow = new MLogWindow( TabWidget, "Log" ); 85 logwindow = new MLogWindow( TabWidget, "Log" );
86 86
87 //--------- HEX TAB -------------- 87 //--------- HEX TAB --------------
88 88
89 hexwindow = new PacketView( TabWidget, "Hex" ); 89 hexwindow = new PacketView( TabWidget, "Hex" );
90 90
91 //--------- STAT TAB -------------- 91 //--------- STAT TAB --------------
92 92
93 statwindow = new MStatWindow( TabWidget, "Stat" ); 93 statwindow = new MStatWindow( TabWidget, "Stat" );
94 94
95 //--------- ABOUT TAB -------------- 95 //--------- ABOUT TAB --------------
96 96
97 about = new QWidget( TabWidget, "about" ); 97 about = new QWidget( TabWidget, "about" );
98 aboutLayout = new QGridLayout( about ); 98 aboutLayout = new QGridLayout( about );
99 aboutLayout->setSpacing( 6 ); 99 aboutLayout->setSpacing( 6 );
100 aboutLayout->setMargin( 11 ); 100 aboutLayout->setMargin( 11 );
101 101
102 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); 102 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
103 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); 103 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
104 PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); 104 PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
105 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); 105 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
106 PixmapLabel1_3_2->setLineWidth( 2 ); 106 PixmapLabel1_3_2->setLineWidth( 2 );
107 PixmapLabel1_3_2->setMargin( 0 ); 107 PixmapLabel1_3_2->setMargin( 0 );
108 PixmapLabel1_3_2->setMidLineWidth( 0 ); 108 PixmapLabel1_3_2->setMidLineWidth( 0 );
109 109
110 QPixmap logo = Resource::loadPixmap( "wellenreiter/logo" ); 110 QPixmap logo = Resource::loadPixmap( "wellenreiter/logo" );
111 QPainter draw( &logo ); 111 QPainter draw( &logo );
112 draw.setPen( Qt::black ); 112 draw.setPen( Qt::black );
113 draw.setFont( QFont( "Fixed", 8 ) ); 113 draw.setFont( QFont( "Fixed", 8 ) );
114 draw.drawText( 30, 10, WELLENREITER_VERSION ); 114 draw.drawText( 30, 10, WELLENREITER_VERSION );
115 115
116 PixmapLabel1_3_2->setPixmap( logo ); 116 PixmapLabel1_3_2->setPixmap( logo );
117 PixmapLabel1_3_2->setScaledContents( TRUE ); 117 PixmapLabel1_3_2->setScaledContents( TRUE );
118 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); 118 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
119 119
120 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); 120 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
121 121
122 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); 122 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
123 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 123 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
124 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 124 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
125 TextLabel1_4_2_font.setPointSize( 10 ); 125 TextLabel1_4_2_font.setPointSize( 10 );
126 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 126 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
127 TextLabel1_4_2->setText( 127 TextLabel1_4_2->setText(
128"<p align=center>" 128"<p align=center>"
129"<hr>" 129"<hr>"
130"<b>(C) Michael 'Mickey' Lauer</b><br>" 130"<b>(C) Michael 'Mickey' Lauer</b><br>"
131"<hr>" 131"<hr>"
132"mickey@Vanille.de<br>" 132"mickey@Vanille.de<br>"
133"www.Vanille.de/projects/wellenreiter.html<br>" 133"www.Vanille.de/projects/wellenreiter.html<br>"
134"www.wellenreiter.net" 134"www.wellenreiter.net"
135"</p>" ); 135"</p>" );
136 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); 136 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
137 137
138 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); 138 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
139 139
140#ifdef QWS 140#ifdef QWS
141 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); 141 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) );
142 TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); 142 TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) );
143 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); 143 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
144 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); 144 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
145 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); 145 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) );
146 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); 146 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
147#else 147#else
148 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); 148 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
149 TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); 149 TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) );
150 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); 150 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
151 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); 151 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
152 TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); 152 TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) );
153 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); 153 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
154#endif 154#endif
155 WellenreiterBaseLayout->addWidget( TabWidget ); 155 WellenreiterBaseLayout->addWidget( TabWidget );
156 156
157#ifdef QWS 157#ifdef QWS
158 TabWidget->setCurrentTab( tr( "Nets" ) ); 158 TabWidget->setCurrentTab( tr( "Nets" ) );
159#endif 159#endif
160 160
161 connect(TabWidget, SIGNAL(currentChanged(QWidget*)),
162 this, SLOT(slotTabChanged(QWidget*)));
161} 163}
162 164
163/* 165/*
164 * Destroys the object and frees any allocated resources 166 * Destroys the object and frees any allocated resources
165 */ 167 */
166WellenreiterBase::~WellenreiterBase() 168WellenreiterBase::~WellenreiterBase()
167{ 169{
168 // no need to delete child widgets, Qt does it all for us 170 // no need to delete child widgets, Qt does it all for us
169} 171}
170 172
171/* 173/*
172 * Main event handler. Reimplemented to handle application 174 * Main event handler. Reimplemented to handle application
173 * font changes 175 * font changes
174 */ 176 */
175bool WellenreiterBase::event( QEvent* ev ) 177bool WellenreiterBase::event( QEvent* ev )
176{ 178{
177 bool ret = QWidget::event( ev ); 179 bool ret = QWidget::event( ev );
178 if ( ev->type() == QEvent::ApplicationFontChange ) { 180 if ( ev->type() == QEvent::ApplicationFontChange ) {
179 //QFont Log_2_font( Log_2->font() ); 181 //QFont Log_2_font( Log_2->font() );
180 //Log_2_font.setFamily( "adobe-courier" ); 182 //Log_2_font.setFamily( "adobe-courier" );
181 //Log_2_font.setPointSize( 8 ); 183 //Log_2_font.setPointSize( 8 );
182 //Log_2->setFont( Log_2_font ); 184 //Log_2->setFont( Log_2_font );
183 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 185 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
184 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 186 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
185 TextLabel1_4_2_font.setPointSize( 10 ); 187 TextLabel1_4_2_font.setPointSize( 10 );
186 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 188 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
187 } 189 }
188 return ret; 190 return ret;
189} 191}
190 192
diff --git a/noncore/net/wellenreiter/opie-wellenreiter.control b/noncore/net/wellenreiter/opie-wellenreiter.control
index cbc287a..e7bc25d 100644
--- a/noncore/net/wellenreiter/opie-wellenreiter.control
+++ b/noncore/net/wellenreiter/opie-wellenreiter.control
@@ -1,10 +1,10 @@
1Package: opie-wellenreiter 1Package: opie-wellenreiter
2Files: bin/wellenreiter pics/wellenreiter apps/Applications/wellenreiter.desktop 2Files: bin/wellenreiter pics/wellenreiter apps/Applications/wellenreiter.desktop
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> 5Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 1.0.3 7Version: 1.0.3-cvs
8Depends: libqpe1, libpcap0 (>=0.7.2), libopiecore2, libopienet2, libopieui2 8Depends: libqpe1, libpcap0 (>=0.7.2), libopiecore2, libopienet2, libopieui2
9Description: A WaveLAN Network Monitor 9Description: A WaveLAN Network Monitor
10 A WaveLAN Network Monitor/Sniffer for the Opie Environment. 10 A WaveLAN Network Monitor/Sniffer for the Opie Environment.
diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro
index eb60c4a..53b762a 100644
--- a/noncore/net/wellenreiter/wellenreiter.pro
+++ b/noncore/net/wellenreiter/wellenreiter.pro
@@ -1,14 +1,15 @@
1TEMPLATE = subdirs 1TEMPLATE = subdirs
2VERSION = 1.0.3-cvs
2 3
3!contains( platform, x11 ) { 4!contains( platform, x11 ) {
4 message( Configuring Wellenreiter for build on Opie ) 5 message( Configuring Wellenreiter for build on Opie )
5 SUBDIRS = gui 6 SUBDIRS = gui
6 include ( $(OPIEDIR)/include.pro ) 7 include ( $(OPIEDIR)/include.pro )
7} 8}
8 9
9contains( platform, x11 ) { 10contains( platform, x11 ) {
10 message( Configuring Wellenreiter for build on Qt/X11 ) 11 message( Configuring Wellenreiter for build on Qt/X11 )
11 SUBDIRS = lib gui 12 SUBDIRS = lib gui
12 system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics ) 13 system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics )
13} 14}
14 15