-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 | |||
@@ -19,12 +19,14 @@ | |||
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> |
@@ -35,12 +37,14 @@ | |||
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 | { |
@@ -269,13 +273,19 @@ 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 | { |
@@ -291,26 +301,48 @@ void WellenreiterConfigWindow::performAction( const QString& type ) | |||
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 |
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 | |||
@@ -14,12 +14,15 @@ | |||
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; |
@@ -60,13 +63,13 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase | |||
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; |
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 | |||
@@ -118,13 +118,13 @@ int main( int argc, char **argv ) | |||
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; |
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 | |||
@@ -406,29 +406,29 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in | |||
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 |
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 | |||
@@ -65,23 +65,23 @@ class MScanListView: public OListView | |||
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: |