Diffstat (limited to 'noncore/settings/networksettings/wlan/wlanimp2.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp2.cpp | 35 |
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 @@ -22,17 +22,17 @@ #endif #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)); if (file.exists()) { qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); @@ -62,24 +62,19 @@ void WLANImp::parseOpts() { opt = interfaces->getInterfaceOption("wireless_essid", error); if(opt == "any" || opt == "off" || opt.isNull()){ 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); } opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); @@ -198,21 +193,30 @@ void WLANImp::accept() { QMessageBox::information(this, "Error", "Please enter the MAC address of the Access Point.", QMessageBox::Ok); return; } // 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()); } else { interfaces->removeInterfaceOption(QString("wireless_ap")); @@ -225,23 +229,26 @@ 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 { keyList += "restricted"; } |