author | kergoth <kergoth> | 2002-10-19 20:58:09 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-10-19 20:58:09 (UTC) |
commit | d7449e1e0070a068c5e83366cb75b64142b71b89 (patch) (side-by-side diff) | |
tree | 0049f8b29e274c2b973ac74ce8f8a93b8bc38a77 | |
parent | 8c9e2e893540c0a405637f10ac2f656df69991a7 (diff) | |
download | opie-d7449e1e0070a068c5e83366cb75b64142b71b89.zip opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.gz opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.bz2 |
Cleaned up Config handling a bit.
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 83 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 10 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 83 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.h | 10 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 3 |
6 files changed, 96 insertions, 96 deletions
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 517604f..3b0e0b7 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp @@ -18,3 +18,4 @@ -WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){ +WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name){ + config = new Config("wireless"); readConfig(); @@ -25,4 +26,4 @@ void WLANImp::readConfig() qWarning( "WLANImp::readConfig() called." ); - config.setGroup( "Properties" ); - QString ssid = config.readEntry( "SSID", "any" ); + config->setGroup( "Properties" ); + QString ssid = config->readEntry( "SSID", "any" ); if( ssid == "any" || ssid == "ANY" ){ @@ -33,3 +34,3 @@ void WLANImp::readConfig() } - QString mode = config.readEntry( "Mode", "Managed" ); + QString mode = config->readEntry( "Mode", "Managed" ); if( mode == "adhoc" ) { @@ -39,8 +40,8 @@ void WLANImp::readConfig() } - networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) ); -// config.readEntry( "RATE", "auto" ); - config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); - config.readEntry( "AuthType", "opensystem" ); - config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); - int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); + networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); +// config->readEntry( "RATE", "auto" ); + config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); + config->readEntry( "AuthType", "opensystem" ); + config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); + int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); switch( defaultkey ){ @@ -59,6 +60,6 @@ void WLANImp::readConfig() } - keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" )); - keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" )); - keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" )); - keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" )); + keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); + keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); + keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); + keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); return; @@ -69,32 +70,32 @@ bool WLANImp::writeConfig() qWarning( "WLANImp::writeConfig() called." ); - config.setGroup( "Properties" ); + config->setGroup( "Properties" ); if( essNon->isChecked() ) { - config.writeEntry( "SSID", "any" ); + config->writeEntry( "SSID", "any" ); } else { - config.writeEntry( "SSID", essSpecificLineEdit->text() ); + config->writeEntry( "SSID", essSpecificLineEdit->text() ); } if( networkInfrastructure->isChecked() ){ - config.writeEntry( "Mode", "Managed" ); + config->writeEntry( "Mode", "Managed" ); } else if( network802->isChecked() ){ - config.writeEntry( "Mode", "adhoc" ); + config->writeEntry( "Mode", "adhoc" ); } - config.writeEntry( "CHANNEL", networkChannel->value() ); -// config.readEntry( "RATE", "auto" ); - wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" ); - authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" ); - key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" ); + config->writeEntry( "CHANNEL", networkChannel->value() ); +// config->readEntry( "RATE", "auto" ); + wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); + authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); + key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); if( keyRadio0->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 0 ); + config->writeEntry( "dot11WEPDefaultKeyID", 0 ); } else if( keyRadio1->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 1 ); + config->writeEntry( "dot11WEPDefaultKeyID", 1 ); } else if( keyRadio2->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 2 ); + config->writeEntry( "dot11WEPDefaultKeyID", 2 ); } else if( keyRadio3->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 3 ); + config->writeEntry( "dot11WEPDefaultKeyID", 3 ); } - config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); - config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); - config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); - config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); - return writeWirelessOpts( config ); + config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); + config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); + config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); + config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); + return writeWirelessOpts( ); } @@ -115,3 +116,3 @@ void WLANImp::done ( int r ) -bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) +bool WLANImp::writeWirelessOpts( QString scheme ) { @@ -133,3 +134,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) - config.setGroup("Properties"); + config->setGroup("Properties"); @@ -161,3 +162,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) }; - QString readmode = config.readEntry( "Mode", "Managed" ); + QString readmode = config->readEntry( "Mode", "Managed" ); QString mode; @@ -170,3 +171,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) if( wepEnabled->isChecked() ){ - int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); + int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); switch( defaultkey ){ @@ -185,3 +186,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) } - if( config.readEntry( "AuthType", "opensystem" ) == "opensystem") + if( config->readEntry( "AuthType", "opensystem" ) == "opensystem") key += " open"; @@ -189,3 +190,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) out << scheme << ",*,*,*)" << "\n" - << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n" + << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n" << " MODE=" << mode << "\n" @@ -195,6 +196,6 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) if( mode != "Managed" ) - out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n"; + out << " CHANNEL=" << config->readNumEntry( "CHANNEL", 1 ) << "\n"; const char** f = txtfields; while (*f) { - out << " " << *f << "=" << config.readEntry(*f,"") << "\n"; + out << " " << *f << "=" << config->readEntry(*f,"") << "\n"; ++f; diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index 8e355ce..79e931d 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h @@ -5,3 +5,3 @@ -class Config; +#include <qpe/config.h> @@ -11,3 +11,3 @@ class WLANImp : public WLAN { public: - WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0); + WLANImp( QWidget* parent = 0, const char* name = 0); @@ -20,5 +20,5 @@ private: bool writeConfig(); - bool writeWirelessOpts( Config &cfg, QString scheme = "*" ); - bool writeWlanngOpts( Config &cfg, QString scheme = "*" ); - Config& config; + bool writeWirelessOpts( QString scheme = "*" ); + bool writeWlanngOpts( QString scheme = "*" ); + Config* config; }; diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index f12e608..cbb520d 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp @@ -65,4 +65,3 @@ bool WLANModule::isOwner(Interface *i){ QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ - Config *cfg = new Config("wireless config"); - WLANImp *wlanconfig = new WLANImp(*cfg); + WLANImp *wlanconfig = new WLANImp( ); (*tabWidget) = wlanconfig->tabWidget; diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 517604f..3b0e0b7 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp @@ -18,3 +18,4 @@ -WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){ +WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name){ + config = new Config("wireless"); readConfig(); @@ -25,4 +26,4 @@ void WLANImp::readConfig() qWarning( "WLANImp::readConfig() called." ); - config.setGroup( "Properties" ); - QString ssid = config.readEntry( "SSID", "any" ); + config->setGroup( "Properties" ); + QString ssid = config->readEntry( "SSID", "any" ); if( ssid == "any" || ssid == "ANY" ){ @@ -33,3 +34,3 @@ void WLANImp::readConfig() } - QString mode = config.readEntry( "Mode", "Managed" ); + QString mode = config->readEntry( "Mode", "Managed" ); if( mode == "adhoc" ) { @@ -39,8 +40,8 @@ void WLANImp::readConfig() } - networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) ); -// config.readEntry( "RATE", "auto" ); - config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); - config.readEntry( "AuthType", "opensystem" ); - config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); - int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); + networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); +// config->readEntry( "RATE", "auto" ); + config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); + config->readEntry( "AuthType", "opensystem" ); + config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); + int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); switch( defaultkey ){ @@ -59,6 +60,6 @@ void WLANImp::readConfig() } - keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" )); - keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" )); - keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" )); - keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" )); + keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); + keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); + keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); + keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); return; @@ -69,32 +70,32 @@ bool WLANImp::writeConfig() qWarning( "WLANImp::writeConfig() called." ); - config.setGroup( "Properties" ); + config->setGroup( "Properties" ); if( essNon->isChecked() ) { - config.writeEntry( "SSID", "any" ); + config->writeEntry( "SSID", "any" ); } else { - config.writeEntry( "SSID", essSpecificLineEdit->text() ); + config->writeEntry( "SSID", essSpecificLineEdit->text() ); } if( networkInfrastructure->isChecked() ){ - config.writeEntry( "Mode", "Managed" ); + config->writeEntry( "Mode", "Managed" ); } else if( network802->isChecked() ){ - config.writeEntry( "Mode", "adhoc" ); + config->writeEntry( "Mode", "adhoc" ); } - config.writeEntry( "CHANNEL", networkChannel->value() ); -// config.readEntry( "RATE", "auto" ); - wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" ); - authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" ); - key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" ); + config->writeEntry( "CHANNEL", networkChannel->value() ); +// config->readEntry( "RATE", "auto" ); + wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); + authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); + key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); if( keyRadio0->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 0 ); + config->writeEntry( "dot11WEPDefaultKeyID", 0 ); } else if( keyRadio1->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 1 ); + config->writeEntry( "dot11WEPDefaultKeyID", 1 ); } else if( keyRadio2->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 2 ); + config->writeEntry( "dot11WEPDefaultKeyID", 2 ); } else if( keyRadio3->isChecked() ){ - config.writeEntry( "dot11WEPDefaultKeyID", 3 ); + config->writeEntry( "dot11WEPDefaultKeyID", 3 ); } - config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); - config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); - config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); - config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); - return writeWirelessOpts( config ); + config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); + config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); + config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); + config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); + return writeWirelessOpts( ); } @@ -115,3 +116,3 @@ void WLANImp::done ( int r ) -bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) +bool WLANImp::writeWirelessOpts( QString scheme ) { @@ -133,3 +134,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) - config.setGroup("Properties"); + config->setGroup("Properties"); @@ -161,3 +162,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) }; - QString readmode = config.readEntry( "Mode", "Managed" ); + QString readmode = config->readEntry( "Mode", "Managed" ); QString mode; @@ -170,3 +171,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) if( wepEnabled->isChecked() ){ - int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); + int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); switch( defaultkey ){ @@ -185,3 +186,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) } - if( config.readEntry( "AuthType", "opensystem" ) == "opensystem") + if( config->readEntry( "AuthType", "opensystem" ) == "opensystem") key += " open"; @@ -189,3 +190,3 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) out << scheme << ",*,*,*)" << "\n" - << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n" + << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n" << " MODE=" << mode << "\n" @@ -195,6 +196,6 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) if( mode != "Managed" ) - out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n"; + out << " CHANNEL=" << config->readNumEntry( "CHANNEL", 1 ) << "\n"; const char** f = txtfields; while (*f) { - out << " " << *f << "=" << config.readEntry(*f,"") << "\n"; + out << " " << *f << "=" << config->readEntry(*f,"") << "\n"; ++f; diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h index 8e355ce..79e931d 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.h +++ b/noncore/settings/networksettings/wlan/wlanimp.h @@ -5,3 +5,3 @@ -class Config; +#include <qpe/config.h> @@ -11,3 +11,3 @@ class WLANImp : public WLAN { public: - WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0); + WLANImp( QWidget* parent = 0, const char* name = 0); @@ -20,5 +20,5 @@ private: bool writeConfig(); - bool writeWirelessOpts( Config &cfg, QString scheme = "*" ); - bool writeWlanngOpts( Config &cfg, QString scheme = "*" ); - Config& config; + bool writeWirelessOpts( QString scheme = "*" ); + bool writeWlanngOpts( QString scheme = "*" ); + Config* config; }; diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index f12e608..cbb520d 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp @@ -65,4 +65,3 @@ bool WLANModule::isOwner(Interface *i){ QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ - Config *cfg = new Config("wireless config"); - WLANImp *wlanconfig = new WLANImp(*cfg); + WLANImp *wlanconfig = new WLANImp( ); (*tabWidget) = wlanconfig->tabWidget; |