summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-10-19 20:58:09 (UTC)
committer kergoth <kergoth>2002-10-19 20:58:09 (UTC)
commitd7449e1e0070a068c5e83366cb75b64142b71b89 (patch) (side-by-side diff)
tree0049f8b29e274c2b973ac74ce8f8a93b8bc38a77
parent8c9e2e893540c0a405637f10ac2f656df69991a7 (diff)
downloadopie-d7449e1e0070a068c5e83366cb75b64142b71b89.zip
opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.gz
opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.bz2
Cleaned up Config handling a bit.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp83
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.h10
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp3
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp83
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.h10
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp3
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
@@ -1,223 +1,224 @@
#include "wlanimp.h"
/* Config class */
#include <qpe/config.h>
/* Global namespace */
#include <qpe/global.h>
/* system() */
#include <stdlib.h>
#include <qfile.h>
#include <qdir.h>
#include <qtextstream.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qregexp.h>
-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();
}
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" ){
essNon->setChecked( true );
} else {
essSpecific->setChecked( true );
essSpecificLineEdit->setText( ssid );
}
- QString mode = config.readEntry( "Mode", "Managed" );
+ QString mode = config->readEntry( "Mode", "Managed" );
if( mode == "adhoc" ) {
network802->setChecked( true );
} else {
networkInfrastructure->setChecked( true );
}
- 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 ){
case 0:
keyRadio0->setChecked( true );
break;
case 1:
keyRadio1->setChecked( true );
break;
case 2:
keyRadio2->setChecked( true );
break;
case 3:
keyRadio3->setChecked( true );
break;
}
- 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;
}
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( );
}
/**
*/
void WLANImp::accept()
{
if ( writeConfig() )
QDialog::accept();
}
void WLANImp::done ( int r )
{
QDialog::done ( r );
close ( );
}
-bool WLANImp::writeWirelessOpts( Config &config, QString scheme )
+bool WLANImp::writeWirelessOpts( QString scheme )
{
qWarning( "WLANImp::writeWirelessOpts entered." );
QString prev = "/etc/pcmcia/wireless.opts";
QFile prevFile(prev);
if ( !prevFile.open( IO_ReadOnly ) )
return false;
QString tmp = "/etc/pcmcia/wireless.opts-qpe-new";
QFile tmpFile(tmp);
if ( !tmpFile.open( IO_WriteOnly ) )
return false;
bool retval = true;
QTextStream in( &prevFile );
QTextStream out( &tmpFile );
- config.setGroup("Properties");
+ config->setGroup("Properties");
QString line;
bool found=false;
bool done=false;
while ( !in.atEnd() ) {
QString line = in.readLine();
QString wline = line.simplifyWhiteSpace();
if ( !done ) {
if ( found ) {
// skip existing entry for this scheme, and write our own.
if ( wline == ";;" ) {
found = false;
continue;
} else {
continue;
}
} else {
if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) {
found=true;
continue; // skip this line
} else if ( wline == "esac" || wline == "*,*,*,*)" ) {
// end - add new entry
// Not all fields have a GUI, but all are supported
// in the letwork configuration files.
static const char* txtfields[] = {
0
};
- QString readmode = config.readEntry( "Mode", "Managed" );
+ QString readmode = config->readEntry( "Mode", "Managed" );
QString mode;
if( readmode == "Managed" ){
mode = readmode;
} else if( readmode == "adhoc" ){
mode = "Ad-Hoc";
}
QString key;
if( wepEnabled->isChecked() ){
- int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 );
+ int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 );
switch( defaultkey ){
case 0:
key += keyLineEdit0->text();
break;
case 1:
key += keyLineEdit1->text();
break;
case 2:
key += keyLineEdit2->text();
break;
case 3:
key += keyLineEdit3->text();
break;
}
- if( config.readEntry( "AuthType", "opensystem" ) == "opensystem")
+ if( config->readEntry( "AuthType", "opensystem" ) == "opensystem")
key += " open";
}
out << scheme << ",*,*,*)" << "\n"
- << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n"
+ << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n"
<< " MODE=" << mode << "\n"
<< " KEY=" << Global::shellQuote( key ) << "\n"
<< " RATE=" << "auto" << "\n"
;
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;
}
out << " ;;\n";
done = true;
}
}
}
out << line << "\n";
}
prevFile.close();
tmpFile.close();
QString initpath;
//system("cardctl suspend");
if( QDir("/etc/rc.d/init.d").exists() ){
initpath = "/etc/rc.d/init.d";
} else if( QDir("/etc/init.d").exists() ){
initpath = "/etc/init.d";
}
if( initpath )
system(QString("%1/pcmcia stop").arg(initpath));
if( system( "mv " + tmp + " " + prev ) )
retval = false;
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
@@ -1,27 +1,27 @@
#ifndef WLANIMP_H
#define WLANIMP_H
#include "wlan.h"
-class Config;
+#include <qpe/config.h>
class WLANImp : public WLAN {
Q_OBJECT
public:
- WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0);
+ WLANImp( QWidget* parent = 0, const char* name = 0);
protected:
void accept();
void done ( int r );
private:
void readConfig();
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;
};
#endif
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
@@ -42,50 +42,49 @@ void WLANModule::setProfile(QString newProfile){
*/
QString WLANModule::getPixmapName(Interface* ){
return "wlan";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool WLANModule::isOwner(Interface *i){
if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){
i->setHardwareName("802.11b");
return true;
}
return false;
}
/**
* Create, set tabWiget and return the WLANConfigure Module
* @param tabWidget a pointer to the tab widget that this configure has.
* @return QWidget* pointer to the tab widget in this modules configure.
*/
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;
return wlanconfig;
}
/**
* Create, set tabWiget and return the Information Module
* @param tabWidget a pointer to the tab widget that this information has.
* @return QWidget* pointer to the tab widget in this modules info.
*/
QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
WlanInfo *info = new WlanInfo(0, "wireless info");
(*tabWidget) = info->tabWidget;
struct ifreq ifr;
struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
int fd = socket( AF_INET, SOCK_DGRAM, 0 );
const char* buffer[200];
struct iwreq iwr;
memset( &iwr, 0, sizeof( iwr ) );
iwr.u.essid.pointer = (caddr_t) buffer;
iwr.u.essid.length = IW_ESSID_MAX_SIZE;
iwr.u.essid.flags = 0;
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
@@ -1,223 +1,224 @@
#include "wlanimp.h"
/* Config class */
#include <qpe/config.h>
/* Global namespace */
#include <qpe/global.h>
/* system() */
#include <stdlib.h>
#include <qfile.h>
#include <qdir.h>
#include <qtextstream.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qregexp.h>
-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();
}
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" ){
essNon->setChecked( true );
} else {
essSpecific->setChecked( true );
essSpecificLineEdit->setText( ssid );
}
- QString mode = config.readEntry( "Mode", "Managed" );
+ QString mode = config->readEntry( "Mode", "Managed" );
if( mode == "adhoc" ) {
network802->setChecked( true );
} else {
networkInfrastructure->setChecked( true );
}
- 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 ){
case 0:
keyRadio0->setChecked( true );
break;
case 1:
keyRadio1->setChecked( true );
break;
case 2:
keyRadio2->setChecked( true );
break;
case 3:
keyRadio3->setChecked( true );
break;
}
- 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;
}
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( );
}
/**
*/
void WLANImp::accept()
{
if ( writeConfig() )
QDialog::accept();
}
void WLANImp::done ( int r )
{
QDialog::done ( r );
close ( );
}
-bool WLANImp::writeWirelessOpts( Config &config, QString scheme )
+bool WLANImp::writeWirelessOpts( QString scheme )
{
qWarning( "WLANImp::writeWirelessOpts entered." );
QString prev = "/etc/pcmcia/wireless.opts";
QFile prevFile(prev);
if ( !prevFile.open( IO_ReadOnly ) )
return false;
QString tmp = "/etc/pcmcia/wireless.opts-qpe-new";
QFile tmpFile(tmp);
if ( !tmpFile.open( IO_WriteOnly ) )
return false;
bool retval = true;
QTextStream in( &prevFile );
QTextStream out( &tmpFile );
- config.setGroup("Properties");
+ config->setGroup("Properties");
QString line;
bool found=false;
bool done=false;
while ( !in.atEnd() ) {
QString line = in.readLine();
QString wline = line.simplifyWhiteSpace();
if ( !done ) {
if ( found ) {
// skip existing entry for this scheme, and write our own.
if ( wline == ";;" ) {
found = false;
continue;
} else {
continue;
}
} else {
if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) {
found=true;
continue; // skip this line
} else if ( wline == "esac" || wline == "*,*,*,*)" ) {
// end - add new entry
// Not all fields have a GUI, but all are supported
// in the letwork configuration files.
static const char* txtfields[] = {
0
};
- QString readmode = config.readEntry( "Mode", "Managed" );
+ QString readmode = config->readEntry( "Mode", "Managed" );
QString mode;
if( readmode == "Managed" ){
mode = readmode;
} else if( readmode == "adhoc" ){
mode = "Ad-Hoc";
}
QString key;
if( wepEnabled->isChecked() ){
- int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 );
+ int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 );
switch( defaultkey ){
case 0:
key += keyLineEdit0->text();
break;
case 1:
key += keyLineEdit1->text();
break;
case 2:
key += keyLineEdit2->text();
break;
case 3:
key += keyLineEdit3->text();
break;
}
- if( config.readEntry( "AuthType", "opensystem" ) == "opensystem")
+ if( config->readEntry( "AuthType", "opensystem" ) == "opensystem")
key += " open";
}
out << scheme << ",*,*,*)" << "\n"
- << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n"
+ << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n"
<< " MODE=" << mode << "\n"
<< " KEY=" << Global::shellQuote( key ) << "\n"
<< " RATE=" << "auto" << "\n"
;
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;
}
out << " ;;\n";
done = true;
}
}
}
out << line << "\n";
}
prevFile.close();
tmpFile.close();
QString initpath;
//system("cardctl suspend");
if( QDir("/etc/rc.d/init.d").exists() ){
initpath = "/etc/rc.d/init.d";
} else if( QDir("/etc/init.d").exists() ){
initpath = "/etc/init.d";
}
if( initpath )
system(QString("%1/pcmcia stop").arg(initpath));
if( system( "mv " + tmp + " " + prev ) )
retval = false;
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
@@ -1,27 +1,27 @@
#ifndef WLANIMP_H
#define WLANIMP_H
#include "wlan.h"
-class Config;
+#include <qpe/config.h>
class WLANImp : public WLAN {
Q_OBJECT
public:
- WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0);
+ WLANImp( QWidget* parent = 0, const char* name = 0);
protected:
void accept();
void done ( int r );
private:
void readConfig();
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;
};
#endif
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
@@ -42,50 +42,49 @@ void WLANModule::setProfile(QString newProfile){
*/
QString WLANModule::getPixmapName(Interface* ){
return "wlan";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool WLANModule::isOwner(Interface *i){
if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){
i->setHardwareName("802.11b");
return true;
}
return false;
}
/**
* Create, set tabWiget and return the WLANConfigure Module
* @param tabWidget a pointer to the tab widget that this configure has.
* @return QWidget* pointer to the tab widget in this modules configure.
*/
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;
return wlanconfig;
}
/**
* Create, set tabWiget and return the Information Module
* @param tabWidget a pointer to the tab widget that this information has.
* @return QWidget* pointer to the tab widget in this modules info.
*/
QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
WlanInfo *info = new WlanInfo(0, "wireless info");
(*tabWidget) = info->tabWidget;
struct ifreq ifr;
struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
int fd = socket( AF_INET, SOCK_DGRAM, 0 );
const char* buffer[200];
struct iwreq iwr;
memset( &iwr, 0, sizeof( iwr ) );
iwr.u.essid.pointer = (caddr_t) buffer;
iwr.u.essid.length = IW_ESSID_MAX_SIZE;
iwr.u.essid.flags = 0;