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 | |||
@@ -24,13 +24,13 @@ | |||
24 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" | 24 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
25 | #define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools" | 25 | #define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools" |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Constructor, read in the wireless.opts file for parsing later. | 28 | * Constructor, read in the wireless.opts file for parsing later. |
29 | */ | 29 | */ |
30 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), currentProfile("*"), interface(i) { | 30 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { |
31 | interfaces = new Interfaces(); | 31 | interfaces = new Interfaces(); |
32 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); | 32 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); |
33 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 33 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
34 | 34 | ||
35 | // Check sanity - the existance of the wireless-tools if-pre-up script | 35 | // Check sanity - the existance of the wireless-tools if-pre-up script |
36 | QFile file(QString(PREUP)); | 36 | QFile file(QString(PREUP)); |
@@ -64,20 +64,15 @@ void WLANImp::parseOpts() { | |||
64 | essid->setEditText("any"); | 64 | essid->setEditText("any"); |
65 | } else { | 65 | } else { |
66 | essid->setEditText(opt); | 66 | essid->setEditText(opt); |
67 | } | 67 | } |
68 | 68 | ||
69 | opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); | 69 | opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); |
70 | if (opt == "Auto") { | 70 | |
71 | mode->setCurrentItem(0); | 71 | for ( int i = 0; i < mode->count(); i++) |
72 | } else if (opt == "Ad-Hoc") { | 72 | if ( mode->text( i ) == opt ) mode->setCurrentItem( i ); |
73 | mode->setCurrentItem(2); | ||
74 | } else { | ||
75 | // Managed/Infrastructure mode | ||
76 | mode->setCurrentItem(1); | ||
77 | } | ||
78 | 73 | ||
79 | opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); | 74 | opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); |
80 | if (! opt.isNull()) { | 75 | if (! opt.isNull()) { |
81 | specifyAp->setChecked(true); | 76 | specifyAp->setChecked(true); |
82 | macEdit->setText(opt); | 77 | macEdit->setText(opt); |
83 | } | 78 | } |
@@ -200,17 +195,26 @@ void WLANImp::accept() { | |||
200 | } | 195 | } |
201 | 196 | ||
202 | // Try to save the interfaces settings. | 197 | // Try to save the interfaces settings. |
203 | writeOpts(); | 198 | writeOpts(); |
204 | 199 | ||
205 | // Close out the dialog | 200 | // Close out the dialog |
206 | QDialog::accept(); | 201 | // FIXME: QDialog::accept(); |
207 | } | 202 | } |
208 | 203 | ||
209 | void WLANImp::writeOpts() { | 204 | void WLANImp::writeOpts() { |
210 | bool error = false; | 205 | // eh can't really do anything about it other then return. :-D |
206 | if(!interfaces->isInterfaceSet()){ | ||
207 | QMessageBox::warning(0,"Inface not set","should not happen!!!"); | ||
208 | return; | ||
209 | } | ||
210 | bool error = false; | ||
211 | |||
212 | qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() ); | ||
213 | |||
214 | if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); | ||
211 | 215 | ||
212 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); | 216 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); |
213 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); | 217 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); |
214 | 218 | ||
215 | if (specifyAp->isChecked()) { | 219 | if (specifyAp->isChecked()) { |
216 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); | 220 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); |
@@ -227,19 +231,22 @@ void WLANImp::writeOpts() { | |||
227 | if (wepEnabled->isChecked()) { | 231 | if (wepEnabled->isChecked()) { |
228 | QStringList keyList; | 232 | QStringList keyList; |
229 | 233 | ||
230 | if (! keyLineEdit0->text().isNull()) { | 234 | if (! keyLineEdit0->text().isNull()) { |
231 | keyList += keyLineEdit0->text(); | 235 | keyList += keyLineEdit0->text(); |
232 | keyList += "[1]"; | 236 | keyList += "[1]"; |
233 | } else if (! keyLineEdit1->text().isNull()) { | 237 | } //else |
238 | if (! keyLineEdit1->text().isNull()) { | ||
234 | keyList += keyLineEdit1->text(); | 239 | keyList += keyLineEdit1->text(); |
235 | keyList += "[2]"; | 240 | keyList += "[2]"; |
236 | } else if (! keyLineEdit2->text().isNull()) { | 241 | } //else |
242 | if (! keyLineEdit2->text().isNull()) { | ||
237 | keyList += keyLineEdit2->text(); | 243 | keyList += keyLineEdit2->text(); |
238 | keyList += "[3]"; | 244 | keyList += "[3]"; |
239 | } else if (! keyLineEdit3->text().isNull()) { | 245 | } //else |
246 | if (! keyLineEdit3->text().isNull()) { | ||
240 | keyList += keyLineEdit3->text(); | 247 | keyList += keyLineEdit3->text(); |
241 | keyList += "[4]"; | 248 | keyList += "[4]"; |
242 | } | 249 | } |
243 | if (acceptNonEnc->isChecked()) { | 250 | if (acceptNonEnc->isChecked()) { |
244 | keyList += "open"; | 251 | keyList += "open"; |
245 | } else { | 252 | } else { |