summaryrefslogtreecommitdiff
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
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 (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp50
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h5
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp6
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h12
5 files changed, 55 insertions, 20 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
@@ -24,2 +24,4 @@
#include <opie2/oconfig.h>
+#include <opie/odevice.h>
+using namespace Opie;
#endif
@@ -40,2 +42,4 @@
+/* POSIX */
+#include <assert.h>
@@ -274,3 +278,9 @@ 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 */ )
{
@@ -302,10 +312,32 @@ void WellenreiterConfigWindow::performAction( const QString& type )
- /*
-
- 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 );
+ }
}
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
@@ -19,2 +19,5 @@
#include "configbase.h"
+#include "gps.h"
+
+/* QT */
#include <qmap.h>
@@ -65,3 +68,3 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase
void channelAllClicked(int);
- void performAction( const QString& );
+ void performAction( const QString&, const QString&, const QString&, bool, int, int /* , const GpsLocation& */ );
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
@@ -123,3 +123,3 @@ int main( int argc, char **argv )
{
- system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
+ ::system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
}
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
@@ -411,3 +411,3 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in
-MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
+MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
bool wep, int channel, int signal )
@@ -422,3 +422,3 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
if ( WellenreiterConfigWindow::instance() )
- WellenreiterConfigWindow::instance()->performAction( type ); // better use signal/slot combination here
+ WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
@@ -427,3 +427,3 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
-MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
+MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
bool wep, int channel, int signal )
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
@@ -70,5 +70,5 @@ class MScanListItem: public OListViewItem
MScanListItem::MScanListItem( QListView* parent,
- QString type = "unknown",
- QString essid = "unknown",
- QString macaddr = "unknown",
+ const QString& type = "unknown",
+ const QString& essid = "unknown",
+ const QString& macaddr = "unknown",
bool wep = false,
@@ -78,5 +78,5 @@ class MScanListItem: public OListViewItem
MScanListItem::MScanListItem( QListViewItem* parent,
- QString type = "unknown",
- QString essid = "unknown",
- QString macaddr = "unknown",
+ const QString& type = "unknown",
+ const QString& essid = "unknown",
+ const QString& macaddr = "unknown",
bool wep = false,