author | mickeyl <mickeyl> | 2004-01-09 20:01:42 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-09 20:01:42 (UTC) |
commit | 88af644c534f19e391ebbe8ea0babf3ccf459eb1 (patch) (side-by-side diff) | |
tree | f49e88a6dfc58d3f196e6918bb402a14ee9f0ad0 | |
parent | 56bb9961db1158250bbfe971f4556b56c0bd6581 (diff) | |
download | opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.zip opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.tar.gz opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.tar.bz2 |
save configuration settings in accept(), not in the ~
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 3 |
3 files changed, 16 insertions, 6 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 @@ -79,35 +79,41 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char 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); @@ -295,33 +301,33 @@ void WellenreiterConfigWindow::performAction( const QString& type, 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 @@ -385,37 +391,37 @@ void WellenreiterConfigWindow::load() { 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 diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index 5c998cb..d31d1e8 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h @@ -55,27 +55,28 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase const QString gpsHost() const; int gpsPort() const; void save(); void load(); public slots: void changedDeviceType(int); void changedNetworkAction(int t); void changedClientAction(int t); void changedStationAction(int t); void getCaptureFileNameClicked(); void performAutodetection(); void channelAllClicked(int); void performAction( const QString&, const QString&, const QString&, bool, int, int /* , const GpsLocation& */ ); - protected: + protected slots: void synchronizeActionsAndScripts(); + virtual void accept(); protected: QMap<QString, int> _devicetype; static WellenreiterConfigWindow* _instance; int _guess; }; #endif diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index fd88b63..10ead53 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -419,32 +419,35 @@ MScanListItem::MScanListItem( QListView* parent, const QString& type, const QStr qDebug( "creating scanlist item" ); #endif if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here decorateItem( type, essid, macaddr, wep, channel, signal, probed ); } MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, bool wep, int channel, int signal ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { #ifdef DEBUG qDebug( "creating scanlist item" ); #endif + if ( WellenreiterConfigWindow::instance() ) + WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here + decorateItem( type, essid, macaddr, wep, channel, signal, false ); } const QString& MScanListItem::essid() const { if ( type == "network" ) return _essid; else return ( (MScanListItem*) parent() )->essid(); } OListViewItem* MScanListItem::childFactory() { return new MScanListItem( this ); } |