summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/wlan/wlanimp2.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/wlan/wlanimp2.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index cdafb4d..26e3aa9 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -24,13 +24,13 @@
#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts"
#define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools"
/**
* Constructor, read in the wireless.opts file for parsing later.
*/
-WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), currentProfile("*"), interface(i) {
+WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
interfaces = new Interfaces();
interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
tabWidget->insertTab(interfaceSetup, "TCP/IP");
// Check sanity - the existance of the wireless-tools if-pre-up script
QFile file(QString(PREUP));
@@ -64,20 +64,15 @@ void WLANImp::parseOpts() {
essid->setEditText("any");
} else {
essid->setEditText(opt);
}
opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace();
- if (opt == "Auto") {
- mode->setCurrentItem(0);
- } else if (opt == "Ad-Hoc") {
- mode->setCurrentItem(2);
- } else {
- // Managed/Infrastructure mode
- mode->setCurrentItem(1);
- }
+
+ for ( int i = 0; i < mode->count(); i++)
+ if ( mode->text( i ) == opt ) mode->setCurrentItem( i );
opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace();
if (! opt.isNull()) {
specifyAp->setChecked(true);
macEdit->setText(opt);
}
@@ -200,17 +195,26 @@ void WLANImp::accept() {
}
// Try to save the interfaces settings.
writeOpts();
// Close out the dialog
- QDialog::accept();
+// FIXME: QDialog::accept();
}
void WLANImp::writeOpts() {
- bool error = false;
+ // eh can't really do anything about it other then return. :-D
+ if(!interfaces->isInterfaceSet()){
+ QMessageBox::warning(0,"Inface not set","should not happen!!!");
+ return;
+ }
+ bool error = false;
+
+ qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() );
+
+ if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!");
interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText());
interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText());
if (specifyAp->isChecked()) {
interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text());
@@ -227,19 +231,22 @@ void WLANImp::writeOpts() {
if (wepEnabled->isChecked()) {
QStringList keyList;
if (! keyLineEdit0->text().isNull()) {
keyList += keyLineEdit0->text();
keyList += "[1]";
- } else if (! keyLineEdit1->text().isNull()) {
+ } //else
+ if (! keyLineEdit1->text().isNull()) {
keyList += keyLineEdit1->text();
keyList += "[2]";
- } else if (! keyLineEdit2->text().isNull()) {
+ } //else
+ if (! keyLineEdit2->text().isNull()) {
keyList += keyLineEdit2->text();
keyList += "[3]";
- } else if (! keyLineEdit3->text().isNull()) {
+ } //else
+ if (! keyLineEdit3->text().isNull()) {
keyList += keyLineEdit3->text();
keyList += "[4]";
}
if (acceptNonEnc->isChecked()) {
keyList += "open";
} else {