From 6523ee46d49203d11f34a3dbbf966a318cef7def Mon Sep 17 00:00:00 2001 From: benmeyer Date: Wed, 11 Dec 2002 22:08:02 +0000 Subject: New cleaner layout --- (limited to 'noncore/net/networksetup/wlan') diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui index 47d6db6..09593b3 100644 --- a/noncore/net/networksetup/wlan/wlan.ui +++ b/noncore/net/networksetup/wlan/wlan.ui @@ -11,8 +11,8 @@ 0 0 - 237 - 286 + 239 + 277 @@ -65,16 +65,31 @@ 6 - QButtonGroup + QCheckBox + + name + essAny + + + text + Sepecify Access Point + + + + QGroupBox name - ButtonGroup45 + GroupBox1 + + + enabled + false title - ESS ID + Settings - + margin 11 @@ -83,105 +98,65 @@ spacing 6 - - QRadioButton + + QLabel name - essNon + TextLabel1 text - Non-Spec ESSID: "ANY" - - - checked - true + ESS-ID - - QRadioButton + + QLabel name - essSpecific + TextLabel2_2 text - Specific ESSID + Network Type - + QLineEdit name essSpecificLineEdit - - enabled - false - - - - - QButtonGroup - - name - ButtonGroup46 - - - title - Network Type - - - - margin - 11 - - - spacing - 6 - - - QRadioButton + + QComboBox + + + text + Infrastructure + + + + + text + Ad-Hoc + + name - networkInfrastructure - - - text - Infrastructure - - - checked - true + networkType QLabel name - TextLabel2 - - - enabled - false + channelLabel text Channel - - QRadioButton - - name - network802 - - - text - Ad-Hoc - - QSpinBox @@ -194,7 +169,7 @@ maxValue - 11 + 15 minValue @@ -208,7 +183,7 @@ name - Spacer32 + Spacer4 orientation @@ -336,7 +311,7 @@ QButtonGroup name - ButtonGroup44 + KeyButtonGroup enabled @@ -361,6 +336,10 @@ name keyLineEdit0 + + echoMode + Password + QLineEdit @@ -368,6 +347,10 @@ name keyLineEdit1 + + echoMode + Password + QLineEdit @@ -375,6 +358,10 @@ name keyLineEdit2 + + echoMode + Password + QLineEdit @@ -382,6 +369,10 @@ name keyLineEdit3 + + echoMode + Password + QRadioButton @@ -461,49 +452,29 @@ - essSpecific - toggled(bool) - essSpecificLineEdit - setEnabled(bool) - - - network802 - clicked() - essSpecific - animateClick() - - - network802 - toggled(bool) - TextLabel2 - setEnabled(bool) - - - network802 + wepEnabled toggled(bool) - networkChannel + ButtonGroup43 setEnabled(bool) wepEnabled toggled(bool) - ButtonGroup43 + KeyButtonGroup setEnabled(bool) - wepEnabled + essAny toggled(bool) - ButtonGroup44 + GroupBox1 setEnabled(bool) tabWidget - essNon - essSpecific + essAny essSpecificLineEdit - networkInfrastructure - network802 + networkType networkChannel wepEnabled authOpen diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 6a56358..ef7329e 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp @@ -6,10 +6,12 @@ #include #include #include +#include #include #include #include #include +#include /* system() */ #include @@ -39,6 +41,13 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W } else qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); + connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); + +} + +void WLANImp::typeChanged(int mod){ + networkChannel->setEnabled(mod); + channelLabel->setEnabled(mod); } /** @@ -71,23 +80,19 @@ void WLANImp::parseSettingFile(){ if(line.contains("ESSID=")){ QString id = line.mid(line.find("ESSID=")+6, line.length()); if(id == "any"){ - essNon->setChecked(true); - essSpecific->setChecked(false); + essAny->setChecked(false); }else{ - essSpecific->setChecked(true); + essAny->setChecked(true); essSpecificLineEdit->setText(id); - essNon->setChecked(false); } } if(line.contains("MODE=")){ QString mode = line.mid(line.find("MODE=")+5, line.length()); if(mode == "Managed"){ - network802->setChecked( false ); - networkInfrastructure->setChecked( true ); + networkType->setCurrentItem(0); } else{ - network802->setChecked( true ); - networkInfrastructure->setChecked( false ); + networkType->setCurrentItem(0); } } if(line.contains("KEY0=")) @@ -154,10 +159,17 @@ void WLANImp::changeAndSaveSettingFile(){ if(!line.contains("esac")) stream << line << "\n"; - - stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; - stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n'; - + if(!essAny->isChecked() == true){ + stream << "\tESSID=any\n"; + stream << "\tMODE=Managed\n"; + stream << "\tCHANNEL=6\n"; + } + else{ + stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; + stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; + stream << "\tCHANNEL=" << networkChannel->value() << "\n"; + } + stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; stream << "\tKEY2=" << keyLineEdit2->text() << "\n"; @@ -175,7 +187,6 @@ void WLANImp::changeAndSaveSettingFile(){ stream << " restricted"; stream << "\"\n"; } - stream << "\tCHANNEL=" << networkChannel->value() << "\n"; stream << "\tRATE=auto\n"; if(line.contains("esac")) stream << line << "\n"; @@ -196,11 +207,16 @@ void WLANImp::accept(){ if(wepEnabled->isChecked()){ if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) { - QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); + QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); return; } } + if(essSpecificLineEdit->text().isEmpty()){ + QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); + return; + } + // Ok settings are good here, save changeAndSaveSettingFile(); @@ -208,6 +224,7 @@ void WLANImp::accept(){ if(!interfaceSetup->saveChanges()) return; + return; // Restart the device now that the settings have changed QString initpath; if( QDir("/etc/rc.d/init.d").exists() ) diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index df599af..310836c 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h @@ -18,6 +18,9 @@ public: protected: void accept(); +private slots: + void typeChanged(int); + private: void parseSettingFile(); void changeAndSaveSettingFile(); -- cgit v0.9.0.2