summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp52
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h5
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp6
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h12
5 files changed, 56 insertions, 21 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 1341d03..7f39230 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -1,88 +1,92 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16/* LOCAL */ 16/* LOCAL */
17#include "configwindow.h" 17#include "configwindow.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19 19
20/* OPIE */ 20/* OPIE */
21#include <opie2/onetwork.h> 21#include <opie2/onetwork.h>
22#ifdef QWS 22#ifdef QWS
23#include <opie2/oapplication.h> 23#include <opie2/oapplication.h>
24#include <opie2/oconfig.h> 24#include <opie2/oconfig.h>
25#include <opie/odevice.h>
26using namespace Opie;
25#endif 27#endif
26 28
27/* QT */ 29/* QT */
28#include <qapplication.h> 30#include <qapplication.h>
29#include <qcheckbox.h> 31#include <qcheckbox.h>
30#include <qcombobox.h> 32#include <qcombobox.h>
31#include <qfile.h> 33#include <qfile.h>
32#include <qlineedit.h> 34#include <qlineedit.h>
33#include <qlayout.h> 35#include <qlayout.h>
34#include <qmap.h> 36#include <qmap.h>
35#include <qpushbutton.h> 37#include <qpushbutton.h>
36#include <qtabwidget.h> 38#include <qtabwidget.h>
37#include <qtoolbutton.h> 39#include <qtoolbutton.h>
38#include <qspinbox.h> 40#include <qspinbox.h>
39#include <qtextstream.h> 41#include <qtextstream.h>
40 42
43/* POSIX */
44#include <assert.h>
41 45
42WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 46WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
43 47
44WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 48WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
45 :WellenreiterConfigBase( parent, name, true, f ) 49 :WellenreiterConfigBase( parent, name, true, f )
46{ 50{
47 _devicetype[ "cisco" ] = DEVTYPE_CISCO; 51 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
48 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; 52 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
49 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; 53 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
50 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; 54 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
51 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; 55 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
52 _devicetype[ "<file>" ] = DEVTYPE_FILE; 56 _devicetype[ "<file>" ] = DEVTYPE_FILE;
53 57
54 // gather possible interface names from ONetwork 58 // gather possible interface names from ONetwork
55 ONetwork* net = ONetwork::instance(); 59 ONetwork* net = ONetwork::instance();
56 ONetwork::InterfaceIterator it = net->iterator(); 60 ONetwork::InterfaceIterator it = net->iterator();
57 while ( it.current() ) 61 while ( it.current() )
58 { 62 {
59 if ( it.current()->isWireless() ) 63 if ( it.current()->isWireless() )
60 interfaceName->insertItem( it.current()->name() ); 64 interfaceName->insertItem( it.current()->name() );
61 ++it; 65 ++it;
62 } 66 }
63 67
64 load(); 68 load();
65 69
66 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 70 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
67 QPushButton* okButton = new QPushButton( "ok", this ); 71 QPushButton* okButton = new QPushButton( "ok", this );
68 okButton->show(); 72 okButton->show();
69 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui 73 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
70 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 74 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
71 #endif 75 #endif
72 76
73 WellenreiterConfigWindow::_instance = this; 77 WellenreiterConfigWindow::_instance = this;
74 78
75 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); 79 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
76 connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); 80 connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) );
77 connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); 81 connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) );
78 connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); 82 connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) );
79 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); 83 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
80 84
81 // make the checkbox 'channelAll' control all other channels 85 // make the checkbox 'channelAll' control all other channels
82 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); 86 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
83 87
84 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); 88 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) );
85 89
86 // hide tab4 (parse) until Wellenreiter 1.2 90 // hide tab4 (parse) until Wellenreiter 1.2
87 tab->removePage( tab_4 ); 91 tab->removePage( tab_4 );
88}; 92};
@@ -227,132 +231,160 @@ void WellenreiterConfigWindow::getCaptureFileNameClicked()
227 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 231 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
228 qDebug( "name = %s", (const char*) name ); 232 qDebug( "name = %s", (const char*) name );
229 if ( !name.isEmpty() ) 233 if ( !name.isEmpty() )
230 { 234 {
231 captureFileName->setText( name ); 235 captureFileName->setText( name );
232 } 236 }
233} 237}
234 238
235 239
236void WellenreiterConfigWindow::channelAllClicked(int state) 240void WellenreiterConfigWindow::channelAllClicked(int state)
237{ 241{
238 bool b = state; 242 bool b = state;
239 channel1->setChecked( b ); 243 channel1->setChecked( b );
240 channel2->setChecked( b ); 244 channel2->setChecked( b );
241 channel3->setChecked( b ); 245 channel3->setChecked( b );
242 channel4->setChecked( b ); 246 channel4->setChecked( b );
243 channel5->setChecked( b ); 247 channel5->setChecked( b );
244 channel6->setChecked( b ); 248 channel6->setChecked( b );
245 channel7->setChecked( b ); 249 channel7->setChecked( b );
246 channel8->setChecked( b ); 250 channel8->setChecked( b );
247 channel9->setChecked( b ); 251 channel9->setChecked( b );
248 channel10->setChecked( b ); 252 channel10->setChecked( b );
249 channel11->setChecked( b ); 253 channel11->setChecked( b );
250 channel12->setChecked( b ); 254 channel12->setChecked( b );
251 channel13->setChecked( b ); 255 channel13->setChecked( b );
252 channel14->setChecked( b ); 256 channel14->setChecked( b );
253} 257}
254 258
255 259
256bool WellenreiterConfigWindow::useGPS() const 260bool WellenreiterConfigWindow::useGPS() const
257{ 261{
258 return enableGPS->isChecked(); 262 return enableGPS->isChecked();
259} 263}
260 264
261 265
262const QString WellenreiterConfigWindow::gpsHost() const 266const QString WellenreiterConfigWindow::gpsHost() const
263{ 267{
264 return useGPS() ? gpsdHost->currentText() : QString::null; 268 return useGPS() ? gpsdHost->currentText() : QString::null;
265} 269}
266 270
267 271
268int WellenreiterConfigWindow::gpsPort() const 272int WellenreiterConfigWindow::gpsPort() const
269{ 273{
270 bool ok; 274 bool ok;
271 return useGPS() ? gpsdPort->value() : -1; 275 return useGPS() ? gpsdPort->value() : -1;
272} 276}
273 277
274 278
275void WellenreiterConfigWindow::performAction( const QString& type ) 279void WellenreiterConfigWindow::performAction( const QString& type,
280 const QString& essid,
281 const QString& mac,
282 bool wep,
283 int channel,
284 int signal
285 /* , const GpsLocation& loc */ )
276{ 286{
277 int action; 287 int action;
278 QString script; 288 QString script;
279 289
280 if ( type == "network" ) 290 if ( type == "network" )
281 { 291 {
282 action = newNetworkAction->currentItem(); 292 action = newNetworkAction->currentItem();
283 script = newNetworkScript->text(); 293 script = newNetworkScript->text();
284 } 294 }
285 else if ( type == "managed" || type == "adhoc" ) 295 else if ( type == "managed" || type == "adhoc" )
286 { 296 {
287 action = newClientAction->currentItem(); 297 action = newClientAction->currentItem();
288 script = newClientScript->text(); 298 script = newClientScript->text();
289 } 299 }
290 else if ( type == "station" ) 300 else if ( type == "station" )
291 { 301 {
292 action = newStationAction->currentItem(); 302 action = newStationAction->currentItem();
293 script = newStationScript->text(); 303 script = newStationScript->text();
294 } 304 }
295 else 305 else
296 { 306 {
297 qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); 307 qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type );
298 return; 308 return;
299 } 309 }
300 310
301 qDebug( "going to perform action %d (script='%s')", action, (const char*) script ); 311 qDebug( "going to perform action %d (script='%s')", action, (const char*) script );
302 312
303 /* 313 switch( action )
304 314 {
305 if ( sound == "Ignore" ) return; 315 case 0: /* Ignore */ return;
306 else if ( sound == "Touch" ) ODevice::inst()->touchSound(); 316 case 1: /* Play Alarm */ ODevice::inst()->alarmSound(); return;
307 else if ( sound == "Key" ) ODevice::inst()->keySound(); 317 case 2: /* Play Click */ ODevice::inst()->touchSound(); return;
308 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); 318 case 3: /* Blink LED */ break; //FIXME: Implement this
309 319 case 4: /* Run Script */
310 */ 320 {
321 /**
322 *
323 * Script Substitution Information:
324 *
325 * $SSID = SSID
326 * $MAC = MAC
327 * $WEP = Wep
328 * $CHAN = Channel
329 *
330 **/
331 script = script.replace( QRegExp( "$SSID" ), essid );
332 script = script.replace( QRegExp( "$MAC" ), mac );
333 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
334 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
335
336 qDebug( "going to call script '%s'", (const char*) script );
337 ::system( script );
338 qDebug( "script returned." );
339 return;
340 }
341 default: assert( false );
342 }
311} 343}
312 344
313 345
314void WellenreiterConfigWindow::load() 346void WellenreiterConfigWindow::load()
315{ 347{
316#ifdef Q_WS_X11 348#ifdef Q_WS_X11
317 #warning Persistent Configuration not yet implemented for standalone X11 build 349 #warning Persistent Configuration not yet implemented for standalone X11 build
318 performAutodetection(); 350 performAutodetection();
319#else 351#else
320 qDebug( "loading configuration settings..." ); 352 qDebug( "loading configuration settings..." );
321 353
322 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 354 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
323 355
324 OConfig* c = oApp->config(); 356 OConfig* c = oApp->config();
325 357
326 c->setGroup( "Interface" ); 358 c->setGroup( "Interface" );
327 359
328 QString interface = c->readEntry( "name", "<none>" ); 360 QString interface = c->readEntry( "name", "<none>" );
329 if ( interface != "<none>" ) 361 if ( interface != "<none>" )
330 { 362 {
331#if QT_VERSION < 300 363#if QT_VERSION < 300
332 interfaceName->insertItem( interface, 0 ); 364 interfaceName->insertItem( interface, 0 );
333 interfaceName->setCurrentItem( 0 ); 365 interfaceName->setCurrentItem( 0 );
334#else 366#else
335 interfaceName->setCurrentText( interface ); 367 interfaceName->setCurrentText( interface );
336#endif 368#endif
337 369
338 QString device = c->readEntry( "type", "<select>" ); 370 QString device = c->readEntry( "type", "<select>" );
339#if QT_VERSION < 300 371#if QT_VERSION < 300
340 for ( int i = 0; i < deviceType->count(); ++i ) 372 for ( int i = 0; i < deviceType->count(); ++i )
341 { 373 {
342 if ( deviceType->text( i ) == device ) 374 if ( deviceType->text( i ) == device )
343 { 375 {
344 deviceType->setCurrentItem( i ); 376 deviceType->setCurrentItem( i );
345 break; 377 break;
346 } 378 }
347 } 379 }
348#else 380#else
349 deviceType->setCurrentText( device ); 381 deviceType->setCurrentText( device );
350#endif 382#endif
351 } 383 }
352 else 384 else
353 { 385 {
354 performAutodetection(); 386 performAutodetection();
355 } 387 }
356 388
357 prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); 389 prismHeader->setChecked( c->readBoolEntry( "prism", false ) );
358 hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); 390 hopChannels->setChecked( c->readBoolEntry( "hop", true ) );
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index b082331..5c998cb 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -1,78 +1,81 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITERCONFIGWINDOW_H 16#ifndef WELLENREITERCONFIGWINDOW_H
17#define WELLENREITERCONFIGWINDOW_H 17#define WELLENREITERCONFIGWINDOW_H
18 18
19#include "configbase.h" 19#include "configbase.h"
20#include "gps.h"
21
22/* QT */
20#include <qmap.h> 23#include <qmap.h>
21#include <qcombobox.h> 24#include <qcombobox.h>
22#include <qstring.h> 25#include <qstring.h>
23 26
24const int DEVTYPE_SELECT = 0; 27const int DEVTYPE_SELECT = 0;
25const int DEVTYPE_CISCO = 1; 28const int DEVTYPE_CISCO = 1;
26const int DEVTYPE_WLAN_NG = 2; 29const int DEVTYPE_WLAN_NG = 2;
27const int DEVTYPE_HOSTAP = 3; 30const int DEVTYPE_HOSTAP = 3;
28const int DEVTYPE_ORINOCO = 4; 31const int DEVTYPE_ORINOCO = 4;
29const int DEVTYPE_MANUAL = 5; 32const int DEVTYPE_MANUAL = 5;
30const int DEVTYPE_FILE = 6; 33const int DEVTYPE_FILE = 6;
31 34
32class WellenreiterConfigWindow; 35class WellenreiterConfigWindow;
33 36
34class WellenreiterConfigWindow : public WellenreiterConfigBase 37class WellenreiterConfigWindow : public WellenreiterConfigBase
35{ 38{
36 Q_OBJECT 39 Q_OBJECT
37 40
38 public: 41 public:
39 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); 42 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
40 ~WellenreiterConfigWindow(); 43 ~WellenreiterConfigWindow();
41 44
42 int driverType() const; 45 int driverType() const;
43 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; 46 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ };
44 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; 47 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ };
45 static WellenreiterConfigWindow* instance() { return _instance; }; 48 static WellenreiterConfigWindow* instance() { return _instance; };
46 49
47 int hoppingInterval() const; 50 int hoppingInterval() const;
48 bool usePrismHeader() const; 51 bool usePrismHeader() const;
49 bool isChannelChecked( int ) const; 52 bool isChannelChecked( int ) const;
50 53
51 bool useGPS() const; 54 bool useGPS() const;
52 const QString gpsHost() const; 55 const QString gpsHost() const;
53 int gpsPort() const; 56 int gpsPort() const;
54 57
55 void save(); 58 void save();
56 void load(); 59 void load();
57 60
58 public slots: 61 public slots:
59 void changedDeviceType(int); 62 void changedDeviceType(int);
60 void changedNetworkAction(int t); 63 void changedNetworkAction(int t);
61 void changedClientAction(int t); 64 void changedClientAction(int t);
62 void changedStationAction(int t); 65 void changedStationAction(int t);
63 void getCaptureFileNameClicked(); 66 void getCaptureFileNameClicked();
64 void performAutodetection(); 67 void performAutodetection();
65 void channelAllClicked(int); 68 void channelAllClicked(int);
66 void performAction( const QString& ); 69 void performAction( const QString&, const QString&, const QString&, bool, int, int /* , const GpsLocation& */ );
67 70
68 protected: 71 protected:
69 void synchronizeActionsAndScripts(); 72 void synchronizeActionsAndScripts();
70 73
71 protected: 74 protected:
72 QMap<QString, int> _devicetype; 75 QMap<QString, int> _devicetype;
73 static WellenreiterConfigWindow* _instance; 76 static WellenreiterConfigWindow* _instance;
74 int _guess; 77 int _guess;
75 78
76}; 79};
77 80
78#endif 81#endif
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index dd757b5..702a7cc 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -76,56 +76,56 @@ int main( int argc, char **argv )
76 QMessageBox::Yes, QMessageBox::No ); 76 QMessageBox::Yes, QMessageBox::No );
77 if ( result == QMessageBox::No ) return -1; 77 if ( result == QMessageBox::No ) return -1;
78 } 78 }
79 79
80 // dhcp check - NOT HERE! This really belongs as a static member to OProcess 80 // dhcp check - NOT HERE! This really belongs as a static member to OProcess
81 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... 81 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ...
82 82
83 QString line; 83 QString line;
84 QDir d = QDir( "/proc" ); 84 QDir d = QDir( "/proc" );
85 QStringList dirs = d.entryList( QDir::Dirs ); 85 QStringList dirs = d.entryList( QDir::Dirs );
86 QStringList::Iterator it; 86 QStringList::Iterator it;
87 for ( it = dirs.begin(); it != dirs.end(); ++it ) 87 for ( it = dirs.begin(); it != dirs.end(); ++it )
88 { 88 {
89 //qDebug( "next entry: %s", (const char*) *it ); 89 //qDebug( "next entry: %s", (const char*) *it );
90 QFile file( "/proc/"+*it+"/cmdline" ); 90 QFile file( "/proc/"+*it+"/cmdline" );
91 file.open( IO_ReadOnly ); 91 file.open( IO_ReadOnly );
92 if ( !file.isOpen() ) continue; 92 if ( !file.isOpen() ) continue;
93 QTextStream t( &file ); 93 QTextStream t( &file );
94 line = t.readLine(); 94 line = t.readLine();
95 //qDebug( "cmdline = %s", (const char*) line ); 95 //qDebug( "cmdline = %s", (const char*) line );
96 if ( line.contains( "dhcp" ) ) break; 96 if ( line.contains( "dhcp" ) ) break;
97 } 97 }
98 if ( line.contains( "dhcp" ) ) 98 if ( line.contains( "dhcp" ) )
99 { 99 {
100 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); 100 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() );
101 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" 101 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
102 "This can severly limit scanning!\nShould I kill it for you?" ), 102 "This can severly limit scanning!\nShould I kill it for you?" ),
103 QMessageBox::Yes, QMessageBox::No ); 103 QMessageBox::Yes, QMessageBox::No );
104 if ( result == QMessageBox::Yes ) 104 if ( result == QMessageBox::Yes )
105 { 105 {
106 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) 106 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
107 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); 107 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );
108 else 108 else
109 killed = true; 109 killed = true;
110 } 110 }
111 } 111 }
112 } 112 }
113 113
114 a.exec(); 114 a.exec();
115 115
116 if ( check ) 116 if ( check )
117 { 117 {
118 118
119 if ( killed ) 119 if ( killed )
120 { 120 {
121 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No ); 121 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No );
122 if ( result == QMessageBox::Yes ) 122 if ( result == QMessageBox::Yes )
123 { 123 {
124 system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) ); 124 ::system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
125 } 125 }
126 } 126 }
127 127
128 delete w; 128 delete w;
129 } 129 }
130 return 0; 130 return 0;
131} 131}
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 470646d..aea7eb6 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -364,113 +364,113 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr,
364 { 364 {
365 // we have already seen this item, it's a dupe 365 // we have already seen this item, it's a dupe
366 #ifdef DEBUG 366 #ifdef DEBUG
367 qDebug( "%s is a dupe - ignoring...", (const char*) name ); 367 qDebug( "%s is a dupe - ignoring...", (const char*) name );
368 #endif 368 #endif
369 subitem->receivedBeacon(); //FIXME: sent data bit 369 subitem->receivedBeacon(); //FIXME: sent data bit
370 return; 370 return;
371 } 371 }
372 372
373 // never seen that - add new item 373 // never seen that - add new item
374 374
375 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); 375 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
376 item->setText( col_essid, name ); 376 item->setText( col_essid, name );
377 377
378 return; 378 return;
379 } 379 }
380 } 380 }
381 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 381 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
382 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", 382 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!",
383 (const char*) macaddr.toString(), (const char*) ip ) ); 383 (const char*) macaddr.toString(), (const char*) ip ) );
384} 384}
385 385
386 386
387void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) 387void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
388{ 388{
389 if ( !item ) return; 389 if ( !item ) return;
390 390
391 MScanListItem* itm = static_cast<MScanListItem*>( item ); 391 MScanListItem* itm = static_cast<MScanListItem*>( item );
392 392
393 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", 393 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'",
394 (const char*) itm->text(0), (const char*) itm->type, col ); 394 (const char*) itm->text(0), (const char*) itm->type, col );
395 395
396 if ( itm->type == "adhoc" || itm->type == "managed" ) 396 if ( itm->type == "adhoc" || itm->type == "managed" )
397 { 397 {
398 QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); 398 QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() );
399 399
400 QPopupMenu m( this ); 400 QPopupMenu m( this );
401 m.insertItem( entry, 37773, 0 ); 401 m.insertItem( entry, 37773, 0 );
402 int result = m.exec( QCursor::pos() ); 402 int result = m.exec( QCursor::pos() );
403 if ( result == 37773 ) 403 if ( result == 37773 )
404 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); 404 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
405 } 405 }
406} 406}
407 407
408//============================================================ 408//============================================================
409// MScanListItem 409// MScanListItem
410//============================================================ 410//============================================================
411 411
412MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, 412MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
413 bool wep, int channel, int signal ) 413 bool wep, int channel, int signal )
414 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 414 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
415 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 415 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
416 _channel( channel ), _signal( signal ), _beacons( 1 ) 416 _channel( channel ), _signal( signal ), _beacons( 1 )
417{ 417{
418 #ifdef DEBUG 418 #ifdef DEBUG
419 qDebug( "creating scanlist item" ); 419 qDebug( "creating scanlist item" );
420 #endif 420 #endif
421 421
422 if ( WellenreiterConfigWindow::instance() ) 422 if ( WellenreiterConfigWindow::instance() )
423 WellenreiterConfigWindow::instance()->performAction( type ); // better use signal/slot combination here 423 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
424 424
425 decorateItem( type, essid, macaddr, wep, channel, signal ); 425 decorateItem( type, essid, macaddr, wep, channel, signal );
426} 426}
427 427
428MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, 428MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
429 bool wep, int channel, int signal ) 429 bool wep, int channel, int signal )
430 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 430 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
431{ 431{
432 #ifdef DEBUG 432 #ifdef DEBUG
433 qDebug( "creating scanlist item" ); 433 qDebug( "creating scanlist item" );
434 #endif 434 #endif
435 decorateItem( type, essid, macaddr, wep, channel, signal ); 435 decorateItem( type, essid, macaddr, wep, channel, signal );
436} 436}
437 437
438const QString& MScanListItem::essid() const 438const QString& MScanListItem::essid() const
439{ 439{
440 if ( type == "network" ) 440 if ( type == "network" )
441 return _essid; 441 return _essid;
442 else 442 else
443 return ( (MScanListItem*) parent() )->essid(); 443 return ( (MScanListItem*) parent() )->essid();
444} 444}
445 445
446OListViewItem* MScanListItem::childFactory() 446OListViewItem* MScanListItem::childFactory()
447{ 447{
448 return new MScanListItem( this ); 448 return new MScanListItem( this );
449} 449}
450 450
451void MScanListItem::serializeTo( QDataStream& s ) const 451void MScanListItem::serializeTo( QDataStream& s ) const
452{ 452{
453 #ifdef DEBUG 453 #ifdef DEBUG
454 qDebug( "serializing MScanListItem" ); 454 qDebug( "serializing MScanListItem" );
455 #endif 455 #endif
456 OListViewItem::serializeTo( s ); 456 OListViewItem::serializeTo( s );
457 457
458 s << _type; 458 s << _type;
459 s << (Q_UINT8) ( _wep ? 'y' : 'n' ); 459 s << (Q_UINT8) ( _wep ? 'y' : 'n' );
460} 460}
461 461
462void MScanListItem::serializeFrom( QDataStream& s ) 462void MScanListItem::serializeFrom( QDataStream& s )
463{ 463{
464 #ifdef DEBUG 464 #ifdef DEBUG
465 qDebug( "serializing MScanListItem" ); 465 qDebug( "serializing MScanListItem" );
466 #endif 466 #endif
467 OListViewItem::serializeFrom( s ); 467 OListViewItem::serializeFrom( s );
468 468
469 char wep; 469 char wep;
470 s >> _type; 470 s >> _type;
471 s >> (Q_UINT8) wep; 471 s >> (Q_UINT8) wep;
472 _wep = (wep == 'y'); 472 _wep = (wep == 'y');
473 473
474 QString name; 474 QString name;
475 name.sprintf( "wellenreiter/%s", (const char*) _type ); 475 name.sprintf( "wellenreiter/%s", (const char*) _type );
476 setPixmap( col_type, Resource::loadPixmap( name ) ); 476 setPixmap( col_type, Resource::loadPixmap( name ) );
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 42f35c2..e8d48c3 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -23,107 +23,107 @@
23#include <opie2/onetutils.h> 23#include <opie2/onetutils.h>
24 24
25/* QT */ 25/* QT */
26#include <qtextstream.h> 26#include <qtextstream.h>
27 27
28class QString; 28class QString;
29class MScanListItem; 29class MScanListItem;
30 30
31class MScanListView: public OListView 31class MScanListView: public OListView
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35 public: 35 public:
36 MScanListView( QWidget* parent = 0, const char* name = 0 ); 36 MScanListView( QWidget* parent = 0, const char* name = 0 );
37 virtual ~MScanListView(); 37 virtual ~MScanListView();
38 38
39 virtual OListViewItem* childFactory(); 39 virtual OListViewItem* childFactory();
40 virtual void serializeTo( QDataStream& s ) const; 40 virtual void serializeTo( QDataStream& s ) const;
41 virtual void serializeFrom( QDataStream& s ); 41 virtual void serializeFrom( QDataStream& s );
42 42
43 public slots: 43 public slots:
44 void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal, const GpsLocation& location ); 44 void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal, const GpsLocation& location );
45 void addService( const QString& name, const OMacAddress& macaddr, const QString& ip ); 45 void addService( const QString& name, const OMacAddress& macaddr, const QString& ip );
46 46
47 void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 47 void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
48 void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 48 void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
49 void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ); 49 void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo );
50 void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 50 void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
51 51
52 void identify( const OMacAddress&, const QString& ipaddr ); 52 void identify( const OMacAddress&, const QString& ipaddr );
53 53
54 void contextMenuRequested( QListViewItem* item, const QPoint&, int ); 54 void contextMenuRequested( QListViewItem* item, const QPoint&, int );
55 55
56 signals: 56 signals:
57 void rightButtonClicked(QListViewItem*,const QPoint&,int); 57 void rightButtonClicked(QListViewItem*,const QPoint&,int);
58 void joinNetwork( const QString&, const QString&, int, const QString& ); 58 void joinNetwork( const QString&, const QString&, int, const QString& );
59 59
60 protected: 60 protected:
61 void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" ); 61 void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" );
62 62
63}; 63};
64 64
65//****************************** MScanListItem **************************************************************** 65//****************************** MScanListItem ****************************************************************
66 66
67class MScanListItem: public OListViewItem 67class MScanListItem: public OListViewItem
68{ 68{
69 public: 69 public:
70 MScanListItem::MScanListItem( QListView* parent, 70 MScanListItem::MScanListItem( QListView* parent,
71 QString type = "unknown", 71 const QString& type = "unknown",
72 QString essid = "unknown", 72 const QString& essid = "unknown",
73 QString macaddr = "unknown", 73 const QString& macaddr = "unknown",
74 bool wep = false, 74 bool wep = false,
75 int channel = 0, 75 int channel = 0,
76 int signal = 0 ); 76 int signal = 0 );
77 77
78 MScanListItem::MScanListItem( QListViewItem* parent, 78 MScanListItem::MScanListItem( QListViewItem* parent,
79 QString type = "unknown", 79 const QString& type = "unknown",
80 QString essid = "unknown", 80 const QString& essid = "unknown",
81 QString macaddr = "unknown", 81 const QString& macaddr = "unknown",
82 bool wep = false, 82 bool wep = false,
83 int channel = 0, 83 int channel = 0,
84 int signal = 0 ); 84 int signal = 0 );
85 85
86 86
87 protected: 87 protected:
88 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 88 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
89 89
90 public: 90 public:
91 QString type; 91 QString type;
92 92
93 public: 93 public:
94 //const QString& type() { return _type; }; 94 //const QString& type() { return _type; };
95 const QString& essid() const; 95 const QString& essid() const;
96 const QString& macaddr() { return _macaddr; }; 96 const QString& macaddr() { return _macaddr; };
97 bool wep() { return _wep; }; 97 bool wep() { return _wep; };
98 int channel() { return _channel; }; 98 int channel() { return _channel; };
99 int signal() { return _signal; }; 99 int signal() { return _signal; };
100 int beacons() { return _beacons; }; 100 int beacons() { return _beacons; };
101 101
102 void setSignal( int signal ) { /* TODO */ }; 102 void setSignal( int signal ) { /* TODO */ };
103 void receivedBeacon(); 103 void receivedBeacon();
104 104
105 void setManufacturer( const QString& manufacturer ); 105 void setManufacturer( const QString& manufacturer );
106 void setLocation( const QString& location ); 106 void setLocation( const QString& location );
107 107
108 virtual OListViewItem* childFactory(); 108 virtual OListViewItem* childFactory();
109 virtual void serializeTo( QDataStream& s ) const; 109 virtual void serializeTo( QDataStream& s ) const;
110 virtual void serializeFrom( QDataStream& s ); 110 virtual void serializeFrom( QDataStream& s );
111 111
112 private: 112 private:
113 QString _type; 113 QString _type;
114 QString _essid; 114 QString _essid;
115 QString _macaddr; 115 QString _macaddr;
116 bool _wep; 116 bool _wep;
117 int _channel; 117 int _channel;
118 int _signal; 118 int _signal;
119 int _beacons; 119 int _beacons;
120 120
121}; 121};
122 122
123//****************************** MScanListViewFactory **************************************************************** 123//****************************** MScanListViewFactory ****************************************************************
124 124
125/* 125/*
126 126
127class MScanListViewFactory : public OListViewFactory 127class MScanListViewFactory : public OListViewFactory
128{ 128{
129public: 129public: