summaryrefslogtreecommitdiff
authorandyq <andyq>2002-11-10 15:34:59 (UTC)
committer andyq <andyq>2002-11-10 15:34:59 (UTC)
commit6d3fd69b7f14971d837e4fd13084bb978592a752 (patch) (unidiff)
tree9c11d7be738bc147215af59654c9ab1f51ddcf10
parent804e08f4642353af836bab921d8f732709051de0 (diff)
downloadopie-6d3fd69b7f14971d837e4fd13084bb978592a752.zip
opie-6d3fd69b7f14971d837e4fd13084bb978592a752.tar.gz
opie-6d3fd69b7f14971d837e4fd13084bb978592a752.tar.bz2
Added braces round key checking if statement to fix bug that WEP settings
were never saved if WEP was enabled
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp7
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp7
2 files changed, 10 insertions, 4 deletions
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp
index d4b4af9..e64a633 100644
--- a/noncore/net/networksetup/wlan/wlanimp.cpp
+++ b/noncore/net/networksetup/wlan/wlanimp.cpp
@@ -155,78 +155,81 @@ void WLANImp::changeAndSaveSettingFile(){
155 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { 155 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) {
156 QString line = (*it).simplifyWhiteSpace(); 156 QString line = (*it).simplifyWhiteSpace();
157 if(line.contains("case")) 157 if(line.contains("case"))
158 foundCase = true; 158 foundCase = true;
159 // See if we found our scheme to write or the sceme couldn't be found 159 // See if we found our scheme to write or the sceme couldn't be found
160 if((foundCase && line.contains("esac") && !found) || 160 if((foundCase && line.contains("esac") && !found) ||
161 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ 161 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){
162 // write out scheme 162 // write out scheme
163 found = true; 163 found = true;
164 output = false; 164 output = false;
165 165
166 if(!line.contains("esac")) 166 if(!line.contains("esac"))
167 stream << line << "\n"; 167 stream << line << "\n";
168 168
169 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; 169 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n';
170 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n'; 170 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n';
171 if(!wepEnabled->isChecked()) 171 if(!wepEnabled->isChecked())
172 stream << "#"; 172 stream << "#";
173 stream << "\tKEY="; 173 stream << "\tKEY=";
174 stream << keyLineEdit0->text() << " [1]"; 174 stream << keyLineEdit0->text() << " [1]";
175 stream << keyLineEdit1->text() << " [2]"; 175 stream << keyLineEdit1->text() << " [2]";
176 stream << keyLineEdit2->text() << " [3]"; 176 stream << keyLineEdit2->text() << " [3]";
177 stream << keyLineEdit3->text() << " [4]"; 177 stream << keyLineEdit3->text() << " [4]";
178 stream << " key ["; 178 stream << " key [";
179 if(keyRadio0->isChecked()) stream << "1]"; 179 if(keyRadio0->isChecked()) stream << "1]";
180 if(keyRadio1->isChecked()) stream << "2]"; 180 if(keyRadio1->isChecked()) stream << "2]";
181 if(keyRadio2->isChecked()) stream << "3]"; 181 if(keyRadio2->isChecked()) stream << "3]";
182 if(keyRadio3->isChecked()) stream << "4]"; 182 if(keyRadio3->isChecked()) stream << "4]";
183 if(authOpen->isChecked()) stream << " open"; 183 if(authOpen->isChecked()) stream << " open";
184 stream << "\n"; 184 stream << "\n";
185 stream << "\tCHANNEL=" << networkChannel->value() << "\n"; 185 stream << "\tCHANNEL=" << networkChannel->value() << "\n";
186 stream << "\tRATE=auto\n"; 186 stream << "\tRATE=auto\n";
187 if(line.contains("esac")) 187 if(line.contains("esac"))
188 stream << line << "\n"; 188 stream << line << "\n";
189 } 189 }
190 if(line.contains(";;")) 190 if(line.contains(";;"))
191 output = true; 191 output = true;
192 if(output) 192 if(output)
193 stream << (*it) << '\n'; 193 stream << (*it) << '\n';
194 } 194 }
195 file.close(); 195 file.close();
196} 196}
197 197
198/** 198/**
199 * Check to see if the current config is valid 199 * Check to see if the current config is valid
200 * Save wireless.opts, save interfaces 200 * Save wireless.opts, save interfaces
201 */ 201 */
202void WLANImp::accept(){ 202void WLANImp::accept(){
203 printf( "Accept pressed\n" );
203 if(wepEnabled->isChecked()){ 204 if(wepEnabled->isChecked()){
204 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) 205 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() )
205 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); 206 {
206 return; 207 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok);
208 return;
209 }
207 } 210 }
208 211
209 // Ok settings are good here, save 212 // Ok settings are good here, save
210 changeAndSaveSettingFile(); 213 changeAndSaveSettingFile();
211 214
212 // Try to save the interfaces settings. 215 // Try to save the interfaces settings.
213 if(!interfaceSetup->saveChanges()) 216 if(!interfaceSetup->saveChanges())
214 return; 217 return;
215 218
216 // Restart the device now that the settings have changed 219 // Restart the device now that the settings have changed
217 QString initpath; 220 QString initpath;
218 if( QDir("/etc/rc.d/init.d").exists() ) 221 if( QDir("/etc/rc.d/init.d").exists() )
219 initpath = "/etc/rc.d/init.d"; 222 initpath = "/etc/rc.d/init.d";
220 else if( QDir("/etc/init.d").exists() ) 223 else if( QDir("/etc/init.d").exists() )
221 initpath = "/etc/init.d"; 224 initpath = "/etc/init.d";
222 if( initpath ) 225 if( initpath )
223 system(QString("%1/pcmcia stop").arg(initpath)); 226 system(QString("%1/pcmcia stop").arg(initpath));
224 if( initpath ) 227 if( initpath )
225 system(QString("%1/pcmcia start").arg(initpath)); 228 system(QString("%1/pcmcia start").arg(initpath));
226 229
227 // Close out the dialog 230 // Close out the dialog
228 QDialog::accept(); 231 QDialog::accept();
229} 232}
230 233
231// wlanimp.cpp 234// wlanimp.cpp
232 235
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
index d4b4af9..e64a633 100644
--- a/noncore/settings/networksettings/wlan/wlanimp.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -155,78 +155,81 @@ void WLANImp::changeAndSaveSettingFile(){
155 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { 155 for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) {
156 QString line = (*it).simplifyWhiteSpace(); 156 QString line = (*it).simplifyWhiteSpace();
157 if(line.contains("case")) 157 if(line.contains("case"))
158 foundCase = true; 158 foundCase = true;
159 // See if we found our scheme to write or the sceme couldn't be found 159 // See if we found our scheme to write or the sceme couldn't be found
160 if((foundCase && line.contains("esac") && !found) || 160 if((foundCase && line.contains("esac") && !found) ||
161 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ 161 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){
162 // write out scheme 162 // write out scheme
163 found = true; 163 found = true;
164 output = false; 164 output = false;
165 165
166 if(!line.contains("esac")) 166 if(!line.contains("esac"))
167 stream << line << "\n"; 167 stream << line << "\n";
168 168
169 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; 169 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n';
170 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n'; 170 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n';
171 if(!wepEnabled->isChecked()) 171 if(!wepEnabled->isChecked())
172 stream << "#"; 172 stream << "#";
173 stream << "\tKEY="; 173 stream << "\tKEY=";
174 stream << keyLineEdit0->text() << " [1]"; 174 stream << keyLineEdit0->text() << " [1]";
175 stream << keyLineEdit1->text() << " [2]"; 175 stream << keyLineEdit1->text() << " [2]";
176 stream << keyLineEdit2->text() << " [3]"; 176 stream << keyLineEdit2->text() << " [3]";
177 stream << keyLineEdit3->text() << " [4]"; 177 stream << keyLineEdit3->text() << " [4]";
178 stream << " key ["; 178 stream << " key [";
179 if(keyRadio0->isChecked()) stream << "1]"; 179 if(keyRadio0->isChecked()) stream << "1]";
180 if(keyRadio1->isChecked()) stream << "2]"; 180 if(keyRadio1->isChecked()) stream << "2]";
181 if(keyRadio2->isChecked()) stream << "3]"; 181 if(keyRadio2->isChecked()) stream << "3]";
182 if(keyRadio3->isChecked()) stream << "4]"; 182 if(keyRadio3->isChecked()) stream << "4]";
183 if(authOpen->isChecked()) stream << " open"; 183 if(authOpen->isChecked()) stream << " open";
184 stream << "\n"; 184 stream << "\n";
185 stream << "\tCHANNEL=" << networkChannel->value() << "\n"; 185 stream << "\tCHANNEL=" << networkChannel->value() << "\n";
186 stream << "\tRATE=auto\n"; 186 stream << "\tRATE=auto\n";
187 if(line.contains("esac")) 187 if(line.contains("esac"))
188 stream << line << "\n"; 188 stream << line << "\n";
189 } 189 }
190 if(line.contains(";;")) 190 if(line.contains(";;"))
191 output = true; 191 output = true;
192 if(output) 192 if(output)
193 stream << (*it) << '\n'; 193 stream << (*it) << '\n';
194 } 194 }
195 file.close(); 195 file.close();
196} 196}
197 197
198/** 198/**
199 * Check to see if the current config is valid 199 * Check to see if the current config is valid
200 * Save wireless.opts, save interfaces 200 * Save wireless.opts, save interfaces
201 */ 201 */
202void WLANImp::accept(){ 202void WLANImp::accept(){
203 printf( "Accept pressed\n" );
203 if(wepEnabled->isChecked()){ 204 if(wepEnabled->isChecked()){
204 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) 205 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() )
205 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); 206 {
206 return; 207 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok);
208 return;
209 }
207 } 210 }
208 211
209 // Ok settings are good here, save 212 // Ok settings are good here, save
210 changeAndSaveSettingFile(); 213 changeAndSaveSettingFile();
211 214
212 // Try to save the interfaces settings. 215 // Try to save the interfaces settings.
213 if(!interfaceSetup->saveChanges()) 216 if(!interfaceSetup->saveChanges())
214 return; 217 return;
215 218
216 // Restart the device now that the settings have changed 219 // Restart the device now that the settings have changed
217 QString initpath; 220 QString initpath;
218 if( QDir("/etc/rc.d/init.d").exists() ) 221 if( QDir("/etc/rc.d/init.d").exists() )
219 initpath = "/etc/rc.d/init.d"; 222 initpath = "/etc/rc.d/init.d";
220 else if( QDir("/etc/init.d").exists() ) 223 else if( QDir("/etc/init.d").exists() )
221 initpath = "/etc/init.d"; 224 initpath = "/etc/init.d";
222 if( initpath ) 225 if( initpath )
223 system(QString("%1/pcmcia stop").arg(initpath)); 226 system(QString("%1/pcmcia stop").arg(initpath));
224 if( initpath ) 227 if( initpath )
225 system(QString("%1/pcmcia start").arg(initpath)); 228 system(QString("%1/pcmcia start").arg(initpath));
226 229
227 // Close out the dialog 230 // Close out the dialog
228 QDialog::accept(); 231 QDialog::accept();
229} 232}
230 233
231// wlanimp.cpp 234// wlanimp.cpp
232 235