-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 44c721a..6a56358 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -152,78 +152,76 @@ void WLANImp::changeAndSaveSettingFile(){ | |||
152 | found = true; | 152 | found = true; |
153 | output = false; | 153 | output = false; |
154 | 154 | ||
155 | if(!line.contains("esac")) | 155 | if(!line.contains("esac")) |
156 | stream << line << "\n"; | 156 | stream << line << "\n"; |
157 | 157 | ||
158 | stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; | 158 | stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; |
159 | stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n'; | 159 | stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n'; |
160 | 160 | ||
161 | stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; | 161 | stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; |
162 | stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; | 162 | stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; |
163 | stream << "\tKEY2=" << keyLineEdit2->text() << "\n"; | 163 | stream << "\tKEY2=" << keyLineEdit2->text() << "\n"; |
164 | stream << "\tKEY3=" << keyLineEdit3->text() << "\n"; | 164 | stream << "\tKEY3=" << keyLineEdit3->text() << "\n"; |
165 | 165 | ||
166 | if(wepEnabled->isChecked()){ | 166 | if(wepEnabled->isChecked()){ |
167 | stream << "\tKEY=\""; | 167 | stream << "\tKEY=\""; |
168 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); | 168 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); |
169 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); | 169 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); |
170 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); | 170 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); |
171 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); | 171 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); |
172 | if(authOpen->isChecked()) | 172 | if(authOpen->isChecked()) |
173 | stream << " open"; | 173 | stream << " open"; |
174 | else | 174 | else |
175 | stream << " restricted"; | 175 | stream << " restricted"; |
176 | stream << "\n\""; | 176 | stream << "\"\n"; |
177 | } | 177 | } |
178 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | 178 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; |
179 | stream << "\tRATE=auto\n"; | 179 | stream << "\tRATE=auto\n"; |
180 | if(line.contains("esac")) | 180 | if(line.contains("esac")) |
181 | stream << line << "\n"; | 181 | stream << line << "\n"; |
182 | } | 182 | } |
183 | if(line.contains(";;")) | 183 | if(line.contains(";;")) |
184 | output = true; | 184 | output = true; |
185 | if(output) | 185 | if(output && (*it).length() ) |
186 | stream << (*it) << '\n'; | 186 | stream << (*it) << '\n'; |
187 | } | 187 | } |
188 | file.close(); | 188 | file.close(); |
189 | } | 189 | } |
190 | 190 | ||
191 | /** | 191 | /** |
192 | * Check to see if the current config is valid | 192 | * Check to see if the current config is valid |
193 | * Save wireless.opts, save interfaces | 193 | * Save wireless.opts, save interfaces |
194 | */ | 194 | */ |
195 | void WLANImp::accept(){ | 195 | void WLANImp::accept(){ |
196 | if(wepEnabled->isChecked()){ | 196 | if(wepEnabled->isChecked()){ |
197 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) | 197 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) |
198 | { | 198 | { |
199 | QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); | 199 | QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | // Ok settings are good here, save | 204 | // Ok settings are good here, save |
205 | changeAndSaveSettingFile(); | 205 | changeAndSaveSettingFile(); |
206 | 206 | ||
207 | // Try to save the interfaces settings. | 207 | // Try to save the interfaces settings. |
208 | if(!interfaceSetup->saveChanges()) | 208 | if(!interfaceSetup->saveChanges()) |
209 | return; | 209 | return; |
210 | 210 | ||
211 | QDialog::accept(); | ||
212 | return; | ||
213 | // Restart the device now that the settings have changed | 211 | // Restart the device now that the settings have changed |
214 | QString initpath; | 212 | QString initpath; |
215 | if( QDir("/etc/rc.d/init.d").exists() ) | 213 | if( QDir("/etc/rc.d/init.d").exists() ) |
216 | initpath = "/etc/rc.d/init.d"; | 214 | initpath = "/etc/rc.d/init.d"; |
217 | else if( QDir("/etc/init.d").exists() ) | 215 | else if( QDir("/etc/init.d").exists() ) |
218 | initpath = "/etc/init.d"; | 216 | initpath = "/etc/init.d"; |
219 | if( initpath ) | 217 | if( initpath ) |
220 | system(QString("%1/pcmcia stop").arg(initpath)); | 218 | system(QString("%1/pcmcia stop").arg(initpath)); |
221 | if( initpath ) | 219 | if( initpath ) |
222 | system(QString("%1/pcmcia start").arg(initpath)); | 220 | system(QString("%1/pcmcia start").arg(initpath)); |
223 | 221 | ||
224 | // Close out the dialog | 222 | // Close out the dialog |
225 | QDialog::accept(); | 223 | QDialog::accept(); |
226 | } | 224 | } |
227 | 225 | ||
228 | // wlanimp.cpp | 226 | // wlanimp.cpp |
229 | 227 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 44c721a..6a56358 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -152,78 +152,76 @@ void WLANImp::changeAndSaveSettingFile(){ | |||
152 | found = true; | 152 | found = true; |
153 | output = false; | 153 | output = false; |
154 | 154 | ||
155 | if(!line.contains("esac")) | 155 | if(!line.contains("esac")) |
156 | stream << line << "\n"; | 156 | stream << line << "\n"; |
157 | 157 | ||
158 | stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; | 158 | stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; |
159 | stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n'; | 159 | stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n'; |
160 | 160 | ||
161 | stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; | 161 | stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; |
162 | stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; | 162 | stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; |
163 | stream << "\tKEY2=" << keyLineEdit2->text() << "\n"; | 163 | stream << "\tKEY2=" << keyLineEdit2->text() << "\n"; |
164 | stream << "\tKEY3=" << keyLineEdit3->text() << "\n"; | 164 | stream << "\tKEY3=" << keyLineEdit3->text() << "\n"; |
165 | 165 | ||
166 | if(wepEnabled->isChecked()){ | 166 | if(wepEnabled->isChecked()){ |
167 | stream << "\tKEY=\""; | 167 | stream << "\tKEY=\""; |
168 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); | 168 | if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); |
169 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); | 169 | if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); |
170 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); | 170 | if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); |
171 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); | 171 | if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); |
172 | if(authOpen->isChecked()) | 172 | if(authOpen->isChecked()) |
173 | stream << " open"; | 173 | stream << " open"; |
174 | else | 174 | else |
175 | stream << " restricted"; | 175 | stream << " restricted"; |
176 | stream << "\n\""; | 176 | stream << "\"\n"; |
177 | } | 177 | } |
178 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | 178 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; |
179 | stream << "\tRATE=auto\n"; | 179 | stream << "\tRATE=auto\n"; |
180 | if(line.contains("esac")) | 180 | if(line.contains("esac")) |
181 | stream << line << "\n"; | 181 | stream << line << "\n"; |
182 | } | 182 | } |
183 | if(line.contains(";;")) | 183 | if(line.contains(";;")) |
184 | output = true; | 184 | output = true; |
185 | if(output) | 185 | if(output && (*it).length() ) |
186 | stream << (*it) << '\n'; | 186 | stream << (*it) << '\n'; |
187 | } | 187 | } |
188 | file.close(); | 188 | file.close(); |
189 | } | 189 | } |
190 | 190 | ||
191 | /** | 191 | /** |
192 | * Check to see if the current config is valid | 192 | * Check to see if the current config is valid |
193 | * Save wireless.opts, save interfaces | 193 | * Save wireless.opts, save interfaces |
194 | */ | 194 | */ |
195 | void WLANImp::accept(){ | 195 | void WLANImp::accept(){ |
196 | if(wepEnabled->isChecked()){ | 196 | if(wepEnabled->isChecked()){ |
197 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) | 197 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) |
198 | { | 198 | { |
199 | QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); | 199 | QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | // Ok settings are good here, save | 204 | // Ok settings are good here, save |
205 | changeAndSaveSettingFile(); | 205 | changeAndSaveSettingFile(); |
206 | 206 | ||
207 | // Try to save the interfaces settings. | 207 | // Try to save the interfaces settings. |
208 | if(!interfaceSetup->saveChanges()) | 208 | if(!interfaceSetup->saveChanges()) |
209 | return; | 209 | return; |
210 | 210 | ||
211 | QDialog::accept(); | ||
212 | return; | ||
213 | // Restart the device now that the settings have changed | 211 | // Restart the device now that the settings have changed |
214 | QString initpath; | 212 | QString initpath; |
215 | if( QDir("/etc/rc.d/init.d").exists() ) | 213 | if( QDir("/etc/rc.d/init.d").exists() ) |
216 | initpath = "/etc/rc.d/init.d"; | 214 | initpath = "/etc/rc.d/init.d"; |
217 | else if( QDir("/etc/init.d").exists() ) | 215 | else if( QDir("/etc/init.d").exists() ) |
218 | initpath = "/etc/init.d"; | 216 | initpath = "/etc/init.d"; |
219 | if( initpath ) | 217 | if( initpath ) |
220 | system(QString("%1/pcmcia stop").arg(initpath)); | 218 | system(QString("%1/pcmcia stop").arg(initpath)); |
221 | if( initpath ) | 219 | if( initpath ) |
222 | system(QString("%1/pcmcia start").arg(initpath)); | 220 | system(QString("%1/pcmcia start").arg(initpath)); |
223 | 221 | ||
224 | // Close out the dialog | 222 | // Close out the dialog |
225 | QDialog::accept(); | 223 | QDialog::accept(); |
226 | } | 224 | } |
227 | 225 | ||
228 | // wlanimp.cpp | 226 | // wlanimp.cpp |
229 | 227 | ||