summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp52
1 files changed, 42 insertions, 10 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
@@ -22,6 +22,8 @@
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 */
@@ -38,6 +40,8 @@
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
@@ -272,7 +276,13 @@ int WellenreiterConfigWindow::gpsPort() const
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;
@@ -294,20 +304,42 @@ void WellenreiterConfigWindow::performAction( const QString& type )
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