summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 7f39230..9358866 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -71,51 +71,57 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
QPushButton* okButton = new QPushButton( "ok", this );
okButton->show();
WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
#endif
WellenreiterConfigWindow::_instance = this;
connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) );
connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) );
connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) );
connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
// make the checkbox 'channelAll' control all other channels
connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) );
// hide tab4 (parse) until Wellenreiter 1.2
tab->removePage( tab_4 );
};
-WellenreiterConfigWindow::~WellenreiterConfigWindow()
+void WellenreiterConfigWindow::accept()
{
save();
+ QDialog::accept();
+}
+
+
+WellenreiterConfigWindow::~WellenreiterConfigWindow()
+{
}
void WellenreiterConfigWindow::performAutodetection()
{
//TODO: insert modal splash screen here
// and sleep a second, so that it looks
// like we're actually doing something fancy... ;-)
qDebug( "WellenreiterConfigWindow::performAutodetection()" );
// try to guess device type
QFile m( "/proc/modules" );
if ( m.open( IO_ReadOnly ) )
{
int devicetype(0);
QString line;
QTextStream modules( &m );
while( !modules.atEnd() && !devicetype )
{
modules >> line;
if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
@@ -287,49 +293,49 @@ void WellenreiterConfigWindow::performAction( const QString& type,
int action;
QString script;
if ( type == "network" )
{
action = newNetworkAction->currentItem();
script = newNetworkScript->text();
}
else if ( type == "managed" || type == "adhoc" )
{
action = newClientAction->currentItem();
script = newClientScript->text();
}
else if ( type == "station" )
{
action = newStationAction->currentItem();
script = newStationScript->text();
}
else
{
qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type );
return;
}
- qDebug( "going to perform action %d (script='%s')", action, (const char*) script );
+ qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script );
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 ) );
@@ -377,53 +383,53 @@ void WellenreiterConfigWindow::load()
break;
}
}
#else
deviceType->setCurrentText( device );
#endif
}
else
{
performAutodetection();
}
prismHeader->setChecked( c->readBoolEntry( "prism", false ) );
hopChannels->setChecked( c->readBoolEntry( "hop", true ) );
hopInterval->setValue( c->readNumEntry( "interval", 250 ) );
adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) );
c->setGroup( "Capture" );
captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) );
c->setGroup( "UI" );
lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) );
openTree->setChecked( c->readBoolEntry( "openTree", true ) );
disablePM->setChecked( c->readBoolEntry( "disablePM", true ) );
- newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 0 ) );
+ newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 1 ) ); // Default: Play Alarm
newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) );
- newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 0 ) );
+ newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 2 ) ); // Default: Play Click
newClientScript->setText( c->readEntry( "newClientScript", "" ) );
- newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 0 ) );
+ newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 2 ) ); // Default: Play Click
newStationScript->setText( c->readEntry( "newStationScript", "" ) );
synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand
c->setGroup( "GPS" );
enableGPS->setChecked( c->readBoolEntry( "use", false ) );
#if QT_VERSION < 300
gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 );
gpsdHost->setCurrentItem( 0 );
#else
gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) );
#endif
gpsdPort->setValue( c->readNumEntry( "port", 2947 ) );
startGPS->setChecked( c->readBoolEntry( "start", false ) );
commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) );
#endif
}
void WellenreiterConfigWindow::save()
{
#ifdef Q_WS_X11
#warning Persistent Configuration not yet implemented for standalone X11 build
#else