summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp50
1 files changed, 41 insertions, 9 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>
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>
@@ -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
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{
@@ -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
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 {
@@ -297,20 +307,42 @@ void WellenreiterConfigWindow::performAction( const QString& type )
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