summaryrefslogtreecommitdiff
path: root/noncore
authorbenmeyer <benmeyer>2002-11-22 16:22:08 (UTC)
committer benmeyer <benmeyer>2002-11-22 16:22:08 (UTC)
commit85af9693eaa9d7ed1651883ba078d1622bd88639 (patch) (unidiff)
tree8e3ba452d927883995f137d4e6ea6f8eda6d69fc /noncore
parent3b5b10771415ef0a4cf7e4e02805e64238171f52 (diff)
downloadopie-85af9693eaa9d7ed1651883ba078d1622bd88639.zip
opie-85af9693eaa9d7ed1651883ba078d1622bd88639.tar.gz
opie-85af9693eaa9d7ed1651883ba078d1622bd88639.tar.bz2
Fixed WEP bugs
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/wlan.pro2
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp74
-rw-r--r--noncore/settings/networksettings/wlan/wlan.pro2
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp74
4 files changed, 68 insertions, 84 deletions
diff --git a/noncore/net/networksetup/wlan/wlan.pro b/noncore/net/networksetup/wlan/wlan.pro
index 23fc39a..396dd4a 100644
--- a/noncore/net/networksetup/wlan/wlan.pro
+++ b/noncore/net/networksetup/wlan/wlan.pro
@@ -1,12 +1,12 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug 3 #CONFIG += qt warn_on debug
4DESTDIR = $(OPIEDIR)/plugins/networksetup 4#DESTDIR = $(OPIEDIR)/plugins/networksetup
5 HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h 5 HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h
6 SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp 6 SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
8 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe -L../interfaces/ -linterfaces 9LIBS += -lqpe -L../interfaces/ -linterfaces
10 INTERFACES= wlan.ui info.ui 10 INTERFACES= wlan.ui info.ui
11 TARGET = wlanplugin 11 TARGET = wlanplugin
12 VERSION = 1.0.0 12 VERSION = 1.0.0
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp
index 87a9716..488911b 100644
--- a/noncore/net/networksetup/wlan/wlanimp.cpp
+++ b/noncore/net/networksetup/wlan/wlanimp.cpp
@@ -81,61 +81,50 @@ void WLANImp::parseSettingFile(){
81 } 81 }
82 if(line.contains("MODE=")){ 82 if(line.contains("MODE=")){
83 QString mode = line.mid(line.find("MODE=")+5, line.length()); 83 QString mode = line.mid(line.find("MODE=")+5, line.length());
84 if(mode == "Managed"){ 84 if(mode == "Managed"){
85 network802->setChecked( false ); 85 network802->setChecked( false );
86 networkInfrastructure->setChecked( true ); 86 networkInfrastructure->setChecked( true );
87 } 87 }
88 else{ 88 else{
89 network802->setChecked( true ); 89 network802->setChecked( true );
90 networkInfrastructure->setChecked( false ); 90 networkInfrastructure->setChecked( false );
91 } 91 }
92 } 92 }
93 if(line.contains("KEY0="))
94 keyLineEdit0->setText(line.mid(5, line.length()));
95 if(line.contains("KEY1="))
96 keyLineEdit1->setText(line.mid(5, line.length()));
97 if(line.contains("KEY2="))
98 keyLineEdit2->setText(line.mid(5, line.length()));
99 if(line.contains("KEY3="))
100 keyLineEdit3->setText(line.mid(5, line.length()));
101
93 if(line.contains("KEY=")){ 102 if(line.contains("KEY=")){
94 line.at(0) != '#' ? wepEnabled->setChecked(true) : wepEnabled->setChecked(false); 103 wepEnabled->setChecked(true);
95 int s = line.find("KEY="); 104 QString key;
96 line = line.mid(s+4, line.length()); 105 if(line.right(5) == (" open")){
97 // Find first Key 106 key = line.mid(4, line.length()-5);
98 s = line.find("[1]");
99 if(s != -1){
100 keyLineEdit0->setText(line.mid(0, s));
101 line = line.mid(s+3, line.length());
102 }
103 s = line.find("[2]");
104 if(s != -1){
105 keyLineEdit1->setText(line.mid(0, s));
106 line = line.mid(s+3, line.length());
107 }
108 s = line.find("[3]");
109 if(s != -1){
110 keyLineEdit2->setText(line.mid(0, s));
111 line = line.mid(s+3, line.length());
112 }
113 s = line.find("[4]");
114 if(s != -1){
115 keyLineEdit3->setText(line.mid(0, s));
116 line = line.mid(s+3, line.length());
117 }
118 if(line.contains("key [1]")) keyRadio0->setChecked(true);
119 if(line.contains("key [2]")) keyRadio1->setChecked(true);
120 if(line.contains("key [3]")) keyRadio2->setChecked(true);
121 if(line.contains("key [4]")) keyRadio3->setChecked(true);
122 if(line.contains("open")){
123 authOpen->setChecked(true); 107 authOpen->setChecked(true);
124 authShared->setChecked(false); 108 authShared->setChecked(false);
125 } 109 }
126 else{ 110 else{
127 authOpen->setChecked(false); 111 authOpen->setChecked(false);
128 authShared->setChecked(true); 112 authShared->setChecked(true);
113 key = line.mid(4, line.length());
129 } 114 }
115 if(key == keyLineEdit0->text()) keyRadio0->setChecked(true);
116 if(key == keyLineEdit1->text()) keyRadio1->setChecked(true);
117 if(key == keyLineEdit2->text()) keyRadio2->setChecked(true);
118 if(key == keyLineEdit3->text()) keyRadio3->setChecked(true);
130 } 119 }
131 if(line.contains("CHANNEL=")){ 120 if(line.contains("CHANNEL=")){
132 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); 121 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt());
133 } 122 }
134 } 123 }
135 } 124 }
136} 125}
137 126
138/** 127/**
139 * Saves settings to the wireless.opts file using the current profile 128 * Saves settings to the wireless.opts file using the current profile
140 */ 129 */
141void WLANImp::changeAndSaveSettingFile(){ 130void WLANImp::changeAndSaveSettingFile(){
@@ -158,39 +147,40 @@ void WLANImp::changeAndSaveSettingFile(){
158 foundCase = true; 147 foundCase = true;
159 // See if we found our scheme to write or the sceme couldn't be found 148 // See if we found our scheme to write or the sceme couldn't be found
160 if((foundCase && line.contains("esac") && !found) || 149 if((foundCase && line.contains("esac") && !found) ||
161 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ 150 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){
162 // write out scheme 151 // write out scheme
163 found = true; 152 found = true;
164 output = false; 153 output = false;
165 154
166 if(!line.contains("esac")) 155 if(!line.contains("esac"))
167 stream << line << "\n"; 156 stream << line << "\n";
168 157
169 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; 158 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n';
170 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n'; 159 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n';
171 if(!wepEnabled->isChecked()) 160
172 stream << "#"; 161 stream << "\tKEY0=" << keyLineEdit0->text() << "\n";
162 stream << "\tKEY1=" << keyLineEdit1->text() << "\n";
163 stream << "\tKEY2=" << keyLineEdit2->text() << "\n";
164 stream << "\tKEY3=" << keyLineEdit3->text() << "\n";
165
166 if(wepEnabled->isChecked()){
173 stream << "\tKEY="; 167 stream << "\tKEY=";
174 stream << keyLineEdit0->text() << " [1]"; 168 if(keyRadio0->isChecked()) stream << keyLineEdit0->text();
175 stream << keyLineEdit1->text() << " [2]"; 169 if(keyRadio1->isChecked()) stream << keyLineEdit1->text();
176 stream << keyLineEdit2->text() << " [3]"; 170 if(keyRadio2->isChecked()) stream << keyLineEdit2->text();
177 stream << keyLineEdit3->text() << " [4]"; 171 if(keyRadio3->isChecked()) stream << keyLineEdit3->text();
178 stream << " key [";
179 if(keyRadio0->isChecked()) stream << "1]";
180 if(keyRadio1->isChecked()) stream << "2]";
181 if(keyRadio2->isChecked()) stream << "3]";
182 if(keyRadio3->isChecked()) stream << "4]";
183 if(authOpen->isChecked()) stream << " open"; 172 if(authOpen->isChecked()) stream << " open";
184 stream << "\n"; 173 stream << "\n";
174 }
185 stream << "\tCHANNEL=" << networkChannel->value() << "\n"; 175 stream << "\tCHANNEL=" << networkChannel->value() << "\n";
186 stream << "\tRATE=auto\n"; 176 stream << "\tRATE=auto\n";
187 if(line.contains("esac")) 177 if(line.contains("esac"))
188 stream << line << "\n"; 178 stream << line << "\n";
189 } 179 }
190 if(line.contains(";;")) 180 if(line.contains(";;"))
191 output = true; 181 output = true;
192 if(output) 182 if(output)
193 stream << (*it) << '\n'; 183 stream << (*it) << '\n';
194 } 184 }
195 file.close(); 185 file.close();
196} 186}
@@ -206,24 +196,26 @@ void WLANImp::accept(){
206 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); 196 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok);
207 return; 197 return;
208 } 198 }
209 } 199 }
210 200
211 // Ok settings are good here, save 201 // Ok settings are good here, save
212 changeAndSaveSettingFile(); 202 changeAndSaveSettingFile();
213 203
214 // Try to save the interfaces settings. 204 // Try to save the interfaces settings.
215 if(!interfaceSetup->saveChanges()) 205 if(!interfaceSetup->saveChanges())
216 return; 206 return;
217 207
208 QDialog::accept();
209 return;
218 // Restart the device now that the settings have changed 210 // Restart the device now that the settings have changed
219 QString initpath; 211 QString initpath;
220 if( QDir("/etc/rc.d/init.d").exists() ) 212 if( QDir("/etc/rc.d/init.d").exists() )
221 initpath = "/etc/rc.d/init.d"; 213 initpath = "/etc/rc.d/init.d";
222 else if( QDir("/etc/init.d").exists() ) 214 else if( QDir("/etc/init.d").exists() )
223 initpath = "/etc/init.d"; 215 initpath = "/etc/init.d";
224 if( initpath ) 216 if( initpath )
225 system(QString("%1/pcmcia stop").arg(initpath)); 217 system(QString("%1/pcmcia stop").arg(initpath));
226 if( initpath ) 218 if( initpath )
227 system(QString("%1/pcmcia start").arg(initpath)); 219 system(QString("%1/pcmcia start").arg(initpath));
228 220
229 // Close out the dialog 221 // Close out the dialog
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro
index 23fc39a..396dd4a 100644
--- a/noncore/settings/networksettings/wlan/wlan.pro
+++ b/noncore/settings/networksettings/wlan/wlan.pro
@@ -1,12 +1,12 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug 3 #CONFIG += qt warn_on debug
4DESTDIR = $(OPIEDIR)/plugins/networksetup 4#DESTDIR = $(OPIEDIR)/plugins/networksetup
5 HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h 5 HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h
6 SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp 6 SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
8 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe -L../interfaces/ -linterfaces 9LIBS += -lqpe -L../interfaces/ -linterfaces
10 INTERFACES= wlan.ui info.ui 10 INTERFACES= wlan.ui info.ui
11 TARGET = wlanplugin 11 TARGET = wlanplugin
12 VERSION = 1.0.0 12 VERSION = 1.0.0
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
index 87a9716..488911b 100644
--- a/noncore/settings/networksettings/wlan/wlanimp.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -81,61 +81,50 @@ void WLANImp::parseSettingFile(){
81 } 81 }
82 if(line.contains("MODE=")){ 82 if(line.contains("MODE=")){
83 QString mode = line.mid(line.find("MODE=")+5, line.length()); 83 QString mode = line.mid(line.find("MODE=")+5, line.length());
84 if(mode == "Managed"){ 84 if(mode == "Managed"){
85 network802->setChecked( false ); 85 network802->setChecked( false );
86 networkInfrastructure->setChecked( true ); 86 networkInfrastructure->setChecked( true );
87 } 87 }
88 else{ 88 else{
89 network802->setChecked( true ); 89 network802->setChecked( true );
90 networkInfrastructure->setChecked( false ); 90 networkInfrastructure->setChecked( false );
91 } 91 }
92 } 92 }
93 if(line.contains("KEY0="))
94 keyLineEdit0->setText(line.mid(5, line.length()));
95 if(line.contains("KEY1="))
96 keyLineEdit1->setText(line.mid(5, line.length()));
97 if(line.contains("KEY2="))
98 keyLineEdit2->setText(line.mid(5, line.length()));
99 if(line.contains("KEY3="))
100 keyLineEdit3->setText(line.mid(5, line.length()));
101
93 if(line.contains("KEY=")){ 102 if(line.contains("KEY=")){
94 line.at(0) != '#' ? wepEnabled->setChecked(true) : wepEnabled->setChecked(false); 103 wepEnabled->setChecked(true);
95 int s = line.find("KEY="); 104 QString key;
96 line = line.mid(s+4, line.length()); 105 if(line.right(5) == (" open")){
97 // Find first Key 106 key = line.mid(4, line.length()-5);
98 s = line.find("[1]");
99 if(s != -1){
100 keyLineEdit0->setText(line.mid(0, s));
101 line = line.mid(s+3, line.length());
102 }
103 s = line.find("[2]");
104 if(s != -1){
105 keyLineEdit1->setText(line.mid(0, s));
106 line = line.mid(s+3, line.length());
107 }
108 s = line.find("[3]");
109 if(s != -1){
110 keyLineEdit2->setText(line.mid(0, s));
111 line = line.mid(s+3, line.length());
112 }
113 s = line.find("[4]");
114 if(s != -1){
115 keyLineEdit3->setText(line.mid(0, s));
116 line = line.mid(s+3, line.length());
117 }
118 if(line.contains("key [1]")) keyRadio0->setChecked(true);
119 if(line.contains("key [2]")) keyRadio1->setChecked(true);
120 if(line.contains("key [3]")) keyRadio2->setChecked(true);
121 if(line.contains("key [4]")) keyRadio3->setChecked(true);
122 if(line.contains("open")){
123 authOpen->setChecked(true); 107 authOpen->setChecked(true);
124 authShared->setChecked(false); 108 authShared->setChecked(false);
125 } 109 }
126 else{ 110 else{
127 authOpen->setChecked(false); 111 authOpen->setChecked(false);
128 authShared->setChecked(true); 112 authShared->setChecked(true);
113 key = line.mid(4, line.length());
129 } 114 }
115 if(key == keyLineEdit0->text()) keyRadio0->setChecked(true);
116 if(key == keyLineEdit1->text()) keyRadio1->setChecked(true);
117 if(key == keyLineEdit2->text()) keyRadio2->setChecked(true);
118 if(key == keyLineEdit3->text()) keyRadio3->setChecked(true);
130 } 119 }
131 if(line.contains("CHANNEL=")){ 120 if(line.contains("CHANNEL=")){
132 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); 121 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt());
133 } 122 }
134 } 123 }
135 } 124 }
136} 125}
137 126
138/** 127/**
139 * Saves settings to the wireless.opts file using the current profile 128 * Saves settings to the wireless.opts file using the current profile
140 */ 129 */
141void WLANImp::changeAndSaveSettingFile(){ 130void WLANImp::changeAndSaveSettingFile(){
@@ -158,39 +147,40 @@ void WLANImp::changeAndSaveSettingFile(){
158 foundCase = true; 147 foundCase = true;
159 // See if we found our scheme to write or the sceme couldn't be found 148 // See if we found our scheme to write or the sceme couldn't be found
160 if((foundCase && line.contains("esac") && !found) || 149 if((foundCase && line.contains("esac") && !found) ||
161 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ 150 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){
162 // write out scheme 151 // write out scheme
163 found = true; 152 found = true;
164 output = false; 153 output = false;
165 154
166 if(!line.contains("esac")) 155 if(!line.contains("esac"))
167 stream << line << "\n"; 156 stream << line << "\n";
168 157
169 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; 158 stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n';
170 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n'; 159 stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "ad-hoc") << '\n';
171 if(!wepEnabled->isChecked()) 160
172 stream << "#"; 161 stream << "\tKEY0=" << keyLineEdit0->text() << "\n";
162 stream << "\tKEY1=" << keyLineEdit1->text() << "\n";
163 stream << "\tKEY2=" << keyLineEdit2->text() << "\n";
164 stream << "\tKEY3=" << keyLineEdit3->text() << "\n";
165
166 if(wepEnabled->isChecked()){
173 stream << "\tKEY="; 167 stream << "\tKEY=";
174 stream << keyLineEdit0->text() << " [1]"; 168 if(keyRadio0->isChecked()) stream << keyLineEdit0->text();
175 stream << keyLineEdit1->text() << " [2]"; 169 if(keyRadio1->isChecked()) stream << keyLineEdit1->text();
176 stream << keyLineEdit2->text() << " [3]"; 170 if(keyRadio2->isChecked()) stream << keyLineEdit2->text();
177 stream << keyLineEdit3->text() << " [4]"; 171 if(keyRadio3->isChecked()) stream << keyLineEdit3->text();
178 stream << " key [";
179 if(keyRadio0->isChecked()) stream << "1]";
180 if(keyRadio1->isChecked()) stream << "2]";
181 if(keyRadio2->isChecked()) stream << "3]";
182 if(keyRadio3->isChecked()) stream << "4]";
183 if(authOpen->isChecked()) stream << " open"; 172 if(authOpen->isChecked()) stream << " open";
184 stream << "\n"; 173 stream << "\n";
174 }
185 stream << "\tCHANNEL=" << networkChannel->value() << "\n"; 175 stream << "\tCHANNEL=" << networkChannel->value() << "\n";
186 stream << "\tRATE=auto\n"; 176 stream << "\tRATE=auto\n";
187 if(line.contains("esac")) 177 if(line.contains("esac"))
188 stream << line << "\n"; 178 stream << line << "\n";
189 } 179 }
190 if(line.contains(";;")) 180 if(line.contains(";;"))
191 output = true; 181 output = true;
192 if(output) 182 if(output)
193 stream << (*it) << '\n'; 183 stream << (*it) << '\n';
194 } 184 }
195 file.close(); 185 file.close();
196} 186}
@@ -206,24 +196,26 @@ void WLANImp::accept(){
206 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); 196 QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok);
207 return; 197 return;
208 } 198 }
209 } 199 }
210 200
211 // Ok settings are good here, save 201 // Ok settings are good here, save
212 changeAndSaveSettingFile(); 202 changeAndSaveSettingFile();
213 203
214 // Try to save the interfaces settings. 204 // Try to save the interfaces settings.
215 if(!interfaceSetup->saveChanges()) 205 if(!interfaceSetup->saveChanges())
216 return; 206 return;
217 207
208 QDialog::accept();
209 return;
218 // Restart the device now that the settings have changed 210 // Restart the device now that the settings have changed
219 QString initpath; 211 QString initpath;
220 if( QDir("/etc/rc.d/init.d").exists() ) 212 if( QDir("/etc/rc.d/init.d").exists() )
221 initpath = "/etc/rc.d/init.d"; 213 initpath = "/etc/rc.d/init.d";
222 else if( QDir("/etc/init.d").exists() ) 214 else if( QDir("/etc/init.d").exists() )
223 initpath = "/etc/init.d"; 215 initpath = "/etc/init.d";
224 if( initpath ) 216 if( initpath )
225 system(QString("%1/pcmcia stop").arg(initpath)); 217 system(QString("%1/pcmcia stop").arg(initpath));
226 if( initpath ) 218 if( initpath )
227 system(QString("%1/pcmcia start").arg(initpath)); 219 system(QString("%1/pcmcia start").arg(initpath));
228 220
229 // Close out the dialog 221 // Close out the dialog