-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 52 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 6 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 12 |
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,64 +1,68 @@ | |||
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> | ||
26 | using 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 | ||
42 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | 46 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; |
43 | 47 | ||
44 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 48 | WellenreiterConfigWindow::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(); |
@@ -251,84 +255,112 @@ void WellenreiterConfigWindow::channelAllClicked(int state) | |||
251 | channel13->setChecked( b ); | 255 | channel13->setChecked( b ); |
252 | channel14->setChecked( b ); | 256 | channel14->setChecked( b ); |
253 | } | 257 | } |
254 | 258 | ||
255 | 259 | ||
256 | bool WellenreiterConfigWindow::useGPS() const | 260 | bool WellenreiterConfigWindow::useGPS() const |
257 | { | 261 | { |
258 | return enableGPS->isChecked(); | 262 | return enableGPS->isChecked(); |
259 | } | 263 | } |
260 | 264 | ||
261 | 265 | ||
262 | const QString WellenreiterConfigWindow::gpsHost() const | 266 | const 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 | ||
268 | int WellenreiterConfigWindow::gpsPort() const | 272 | int 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 | ||
275 | void WellenreiterConfigWindow::performAction( const QString& type ) | 279 | void 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 | ||
314 | void WellenreiterConfigWindow::load() | 346 | void 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 |
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 | ||
24 | const int DEVTYPE_SELECT = 0; | 27 | const int DEVTYPE_SELECT = 0; |
25 | const int DEVTYPE_CISCO = 1; | 28 | const int DEVTYPE_CISCO = 1; |
26 | const int DEVTYPE_WLAN_NG = 2; | 29 | const int DEVTYPE_WLAN_NG = 2; |
27 | const int DEVTYPE_HOSTAP = 3; | 30 | const int DEVTYPE_HOSTAP = 3; |
28 | const int DEVTYPE_ORINOCO = 4; | 31 | const int DEVTYPE_ORINOCO = 4; |
29 | const int DEVTYPE_MANUAL = 5; | 32 | const int DEVTYPE_MANUAL = 5; |
30 | const int DEVTYPE_FILE = 6; | 33 | const int DEVTYPE_FILE = 6; |
31 | 34 | ||
32 | class WellenreiterConfigWindow; | 35 | class WellenreiterConfigWindow; |
33 | 36 | ||
34 | class WellenreiterConfigWindow : public WellenreiterConfigBase | 37 | class 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 | |||
@@ -100,32 +100,32 @@ int main( int argc, char **argv ) | |||
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 | |||
@@ -388,65 +388,65 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in | |||
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 | ||
412 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 412 | MScanListItem::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 | ||
428 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 428 | MScanListItem::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 | ||
438 | const QString& MScanListItem::essid() const | 438 | const 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 | ||
446 | OListViewItem* MScanListItem::childFactory() | 446 | OListViewItem* MScanListItem::childFactory() |
447 | { | 447 | { |
448 | return new MScanListItem( this ); | 448 | return new MScanListItem( this ); |
449 | } | 449 | } |
450 | 450 | ||
451 | void MScanListItem::serializeTo( QDataStream& s ) const | 451 | void MScanListItem::serializeTo( QDataStream& s ) const |
452 | { | 452 | { |
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 | |||
@@ -47,59 +47,59 @@ class MScanListView: public OListView | |||
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 | ||
67 | class MScanListItem: public OListViewItem | 67 | class 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 ); |