summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
authormickeyl <mickeyl>2004-01-08 10:37:42 (UTC)
committer mickeyl <mickeyl>2004-01-08 10:37:42 (UTC)
commitc1fe58cfdfdb42f75a040442c29defa15c81f626 (patch) (side-by-side diff)
tree69c3e3c441af1ef933b73984e0c1a6778f8dc672 /noncore/net/wellenreiter/gui/configwindow.cpp
parent05d47b2603adfab0e16f7395e34b7aa56ce6d8de (diff)
downloadopie-c1fe58cfdfdb42f75a040442c29defa15c81f626.zip
opie-c1fe58cfdfdb42f75a040442c29defa15c81f626.tar.gz
opie-c1fe58cfdfdb42f75a040442c29defa15c81f626.tar.bz2
Calling scripts on new {Network, Client, Station} works now. Possible substitution
values are $SSID, $MAC, $WEP, $CHAN.
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
@@ -23,4 +23,6 @@
#include <opie2/oapplication.h>
#include <opie2/oconfig.h>
+#include <opie/odevice.h>
+using namespace Opie;
#endif
@@ -39,4 +41,6 @@
#include <qtextstream.h>
+/* POSIX */
+#include <assert.h>
WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
@@ -273,5 +277,11 @@ int WellenreiterConfigWindow::gpsPort() const
-void WellenreiterConfigWindow::performAction( const QString& type )
+void WellenreiterConfigWindow::performAction( const QString& type,
+ const QString& essid,
+ const QString& mac,
+ bool wep,
+ int channel,
+ int signal
+ /* , const GpsLocation& loc */ )
{
int action;
@@ -295,5 +305,5 @@ void WellenreiterConfigWindow::performAction( const QString& type )
else
{
- qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type );
+ qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type );
return;
}
@@ -301,12 +311,34 @@ void WellenreiterConfigWindow::performAction( const QString& type )
qDebug( "going to perform action %d (script='%s')", action, (const char*) script );
- /*
-
- if ( sound == "Ignore" ) return;
- else if ( sound == "Touch" ) ODevice::inst()->touchSound();
- else if ( sound == "Key" ) ODevice::inst()->keySound();
- else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
-
- */
+ switch( action )
+ {
+ case 0: /* Ignore */ return;
+ case 1: /* Play Alarm */ ODevice::inst()->alarmSound(); return;
+ case 2: /* Play Click */ ODevice::inst()->touchSound(); return;
+ case 3: /* Blink LED */ break; //FIXME: Implement this
+ case 4: /* Run Script */
+ {
+ /**
+ *
+ * Script Substitution Information:
+ *
+ * $SSID = SSID
+ * $MAC = MAC
+ * $WEP = Wep
+ * $CHAN = Channel
+ *
+ **/
+ script = script.replace( QRegExp( "$SSID" ), essid );
+ script = script.replace( QRegExp( "$MAC" ), mac );
+ script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
+ script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
+
+ qDebug( "going to call script '%s'", (const char*) script );
+ ::system( script );
+ qDebug( "script returned." );
+ return;
+ }
+ default: assert( false );
+ }
}