-rw-r--r-- | noncore/net/networksetup/wlan/wlan.ui | 199 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 415 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 13 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlan.ui | 199 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 415 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.h | 13 |
6 files changed, 556 insertions, 698 deletions
diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui index 9f33559..1b29a3e 100644 --- a/noncore/net/networksetup/wlan/wlan.ui +++ b/noncore/net/networksetup/wlan/wlan.ui | |||
@@ -1,62 +1,62 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WLAN</class> | 2 | <class>WLAN</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WLAN</cstring> | 7 | <cstring>WLAN</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>250</width> | 14 | <width>238</width> |
15 | <height>286</height> | 15 | <height>286</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Wireless LAN Setting</string> | 20 | <string>Wireless LAN Setting</string> |
21 | </property> | 21 | </property> |
22 | <property stdset="1"> | 22 | <property stdset="1"> |
23 | <name>sizeGripEnabled</name> | 23 | <name>sizeGripEnabled</name> |
24 | <bool>true</bool> | 24 | <bool>true</bool> |
25 | </property> | 25 | </property> |
26 | <property> | 26 | <property> |
27 | <name>layoutMargin</name> | 27 | <name>layoutMargin</name> |
28 | </property> | 28 | </property> |
29 | <vbox> | 29 | <vbox> |
30 | <property stdset="1"> | 30 | <property stdset="1"> |
31 | <name>margin</name> | 31 | <name>margin</name> |
32 | <number>0</number> | 32 | <number>0</number> |
33 | </property> | 33 | </property> |
34 | <property stdset="1"> | 34 | <property stdset="1"> |
35 | <name>spacing</name> | 35 | <name>spacing</name> |
36 | <number>6</number> | 36 | <number>6</number> |
37 | </property> | 37 | </property> |
38 | <widget> | 38 | <widget> |
39 | <class>QTabWidget</class> | 39 | <class>QTabWidget</class> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
41 | <name>name</name> | 41 | <name>name</name> |
42 | <cstring>tabWidget</cstring> | 42 | <cstring>tabWidget</cstring> |
43 | </property> | 43 | </property> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>enabled</name> | 45 | <name>enabled</name> |
46 | <bool>true</bool> | 46 | <bool>true</bool> |
47 | </property> | 47 | </property> |
48 | <widget> | 48 | <widget> |
49 | <class>QWidget</class> | 49 | <class>QWidget</class> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>name</name> | 51 | <name>name</name> |
52 | <cstring>ConfigPage</cstring> | 52 | <cstring>ConfigPage</cstring> |
53 | </property> | 53 | </property> |
54 | <attribute> | 54 | <attribute> |
55 | <name>title</name> | 55 | <name>title</name> |
56 | <string>WLAN General</string> | 56 | <string>WLAN General</string> |
57 | </attribute> | 57 | </attribute> |
58 | <vbox> | 58 | <vbox> |
59 | <property stdset="1"> | 59 | <property stdset="1"> |
60 | <name>margin</name> | 60 | <name>margin</name> |
61 | <number>11</number> | 61 | <number>11</number> |
62 | </property> | 62 | </property> |
@@ -134,184 +134,250 @@ | |||
134 | </property> | 134 | </property> |
135 | <grid> | 135 | <grid> |
136 | <property stdset="1"> | 136 | <property stdset="1"> |
137 | <name>margin</name> | 137 | <name>margin</name> |
138 | <number>11</number> | 138 | <number>11</number> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>spacing</name> | 141 | <name>spacing</name> |
142 | <number>6</number> | 142 | <number>6</number> |
143 | </property> | 143 | </property> |
144 | <widget row="0" column="0" rowspan="1" colspan="3" > | 144 | <widget row="0" column="0" rowspan="1" colspan="3" > |
145 | <class>QRadioButton</class> | 145 | <class>QRadioButton</class> |
146 | <property stdset="1"> | 146 | <property stdset="1"> |
147 | <name>name</name> | 147 | <name>name</name> |
148 | <cstring>networkInfrastructure</cstring> | 148 | <cstring>networkInfrastructure</cstring> |
149 | </property> | 149 | </property> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>text</name> | 151 | <name>text</name> |
152 | <string>Infrastructure</string> | 152 | <string>Infrastructure</string> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>checked</name> | 155 | <name>checked</name> |
156 | <bool>true</bool> | 156 | <bool>true</bool> |
157 | </property> | 157 | </property> |
158 | </widget> | 158 | </widget> |
159 | <widget row="2" column="0" > | 159 | <widget row="2" column="0" > |
160 | <class>QLabel</class> | 160 | <class>QLabel</class> |
161 | <property stdset="1"> | 161 | <property stdset="1"> |
162 | <name>name</name> | 162 | <name>name</name> |
163 | <cstring>TextLabel2</cstring> | 163 | <cstring>TextLabel2</cstring> |
164 | </property> | 164 | </property> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>enabled</name> | 166 | <name>enabled</name> |
167 | <bool>false</bool> | 167 | <bool>false</bool> |
168 | </property> | 168 | </property> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>text</name> | 170 | <name>text</name> |
171 | <string>Channel</string> | 171 | <string>Channel</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | <widget row="1" column="0" rowspan="1" colspan="2" > | 174 | <widget row="1" column="0" rowspan="1" colspan="2" > |
175 | <class>QRadioButton</class> | 175 | <class>QRadioButton</class> |
176 | <property stdset="1"> | 176 | <property stdset="1"> |
177 | <name>name</name> | 177 | <name>name</name> |
178 | <cstring>network802</cstring> | 178 | <cstring>network802</cstring> |
179 | </property> | 179 | </property> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>text</name> | 181 | <name>text</name> |
182 | <string>802.11 Ad-Hoc</string> | 182 | <string>Ad-Hoc</string> |
183 | </property> | 183 | </property> |
184 | </widget> | 184 | </widget> |
185 | <widget row="2" column="1" > | 185 | <widget row="2" column="1" > |
186 | <class>QSpinBox</class> | 186 | <class>QSpinBox</class> |
187 | <property stdset="1"> | 187 | <property stdset="1"> |
188 | <name>name</name> | 188 | <name>name</name> |
189 | <cstring>networkChannel</cstring> | 189 | <cstring>networkChannel</cstring> |
190 | </property> | 190 | </property> |
191 | <property stdset="1"> | 191 | <property stdset="1"> |
192 | <name>enabled</name> | 192 | <name>enabled</name> |
193 | <bool>false</bool> | 193 | <bool>false</bool> |
194 | </property> | 194 | </property> |
195 | <property stdset="1"> | 195 | <property stdset="1"> |
196 | <name>maxValue</name> | 196 | <name>maxValue</name> |
197 | <number>11</number> | 197 | <number>11</number> |
198 | </property> | 198 | </property> |
199 | <property stdset="1"> | 199 | <property stdset="1"> |
200 | <name>minValue</name> | 200 | <name>minValue</name> |
201 | <number>1</number> | 201 | <number>1</number> |
202 | </property> | 202 | </property> |
203 | <property stdset="1"> | ||
204 | <name>value</name> | ||
205 | <number>6</number> | ||
206 | </property> | ||
203 | </widget> | 207 | </widget> |
204 | <spacer row="2" column="2" > | 208 | <spacer row="2" column="2" > |
205 | <property> | 209 | <property> |
206 | <name>name</name> | 210 | <name>name</name> |
207 | <cstring>Spacer32</cstring> | 211 | <cstring>Spacer32</cstring> |
208 | </property> | 212 | </property> |
209 | <property stdset="1"> | 213 | <property stdset="1"> |
210 | <name>orientation</name> | 214 | <name>orientation</name> |
211 | <enum>Horizontal</enum> | 215 | <enum>Horizontal</enum> |
212 | </property> | 216 | </property> |
213 | <property stdset="1"> | 217 | <property stdset="1"> |
214 | <name>sizeType</name> | 218 | <name>sizeType</name> |
215 | <enum>Expanding</enum> | 219 | <enum>Expanding</enum> |
216 | </property> | 220 | </property> |
217 | <property> | 221 | <property> |
218 | <name>sizeHint</name> | 222 | <name>sizeHint</name> |
219 | <size> | 223 | <size> |
220 | <width>20</width> | 224 | <width>20</width> |
221 | <height>20</height> | 225 | <height>20</height> |
222 | </size> | 226 | </size> |
223 | </property> | 227 | </property> |
224 | </spacer> | 228 | </spacer> |
225 | </grid> | 229 | </grid> |
226 | </widget> | 230 | </widget> |
227 | <spacer> | 231 | <spacer> |
228 | <property> | 232 | <property> |
229 | <name>name</name> | 233 | <name>name</name> |
230 | <cstring>Spacer31</cstring> | 234 | <cstring>Spacer31</cstring> |
231 | </property> | 235 | </property> |
232 | <property stdset="1"> | 236 | <property stdset="1"> |
233 | <name>orientation</name> | 237 | <name>orientation</name> |
234 | <enum>Vertical</enum> | 238 | <enum>Vertical</enum> |
235 | </property> | 239 | </property> |
236 | <property stdset="1"> | 240 | <property stdset="1"> |
237 | <name>sizeType</name> | 241 | <name>sizeType</name> |
238 | <enum>Expanding</enum> | 242 | <enum>Expanding</enum> |
239 | </property> | 243 | </property> |
240 | <property> | 244 | <property> |
241 | <name>sizeHint</name> | 245 | <name>sizeHint</name> |
242 | <size> | 246 | <size> |
243 | <width>20</width> | 247 | <width>20</width> |
244 | <height>20</height> | 248 | <height>20</height> |
245 | </size> | 249 | </size> |
246 | </property> | 250 | </property> |
247 | </spacer> | 251 | </spacer> |
248 | </vbox> | 252 | </vbox> |
249 | </widget> | 253 | </widget> |
250 | <widget> | 254 | <widget> |
251 | <class>QWidget</class> | 255 | <class>QWidget</class> |
252 | <property stdset="1"> | 256 | <property stdset="1"> |
253 | <name>name</name> | 257 | <name>name</name> |
254 | <cstring>WepPage</cstring> | 258 | <cstring>WepPage</cstring> |
255 | </property> | 259 | </property> |
256 | <attribute> | 260 | <attribute> |
257 | <name>title</name> | 261 | <name>title</name> |
258 | <string>Wep</string> | 262 | <string>Wep</string> |
259 | </attribute> | 263 | </attribute> |
260 | <grid> | 264 | <vbox> |
261 | <property stdset="1"> | 265 | <property stdset="1"> |
262 | <name>margin</name> | 266 | <name>margin</name> |
263 | <number>11</number> | 267 | <number>11</number> |
264 | </property> | 268 | </property> |
265 | <property stdset="1"> | 269 | <property stdset="1"> |
266 | <name>spacing</name> | 270 | <name>spacing</name> |
267 | <number>6</number> | 271 | <number>6</number> |
268 | </property> | 272 | </property> |
269 | <widget row="2" column="0" rowspan="1" colspan="2" > | 273 | <widget> |
274 | <class>QCheckBox</class> | ||
275 | <property stdset="1"> | ||
276 | <name>name</name> | ||
277 | <cstring>wepEnabled</cstring> | ||
278 | </property> | ||
279 | <property stdset="1"> | ||
280 | <name>text</name> | ||
281 | <string>Enable Wep</string> | ||
282 | </property> | ||
283 | </widget> | ||
284 | <widget> | ||
285 | <class>QButtonGroup</class> | ||
286 | <property stdset="1"> | ||
287 | <name>name</name> | ||
288 | <cstring>ButtonGroup43</cstring> | ||
289 | </property> | ||
290 | <property stdset="1"> | ||
291 | <name>enabled</name> | ||
292 | <bool>false</bool> | ||
293 | </property> | ||
294 | <property stdset="1"> | ||
295 | <name>title</name> | ||
296 | <string>Authentication Type</string> | ||
297 | </property> | ||
298 | <hbox> | ||
299 | <property stdset="1"> | ||
300 | <name>margin</name> | ||
301 | <number>11</number> | ||
302 | </property> | ||
303 | <property stdset="1"> | ||
304 | <name>spacing</name> | ||
305 | <number>6</number> | ||
306 | </property> | ||
307 | <widget> | ||
308 | <class>QRadioButton</class> | ||
309 | <property stdset="1"> | ||
310 | <name>name</name> | ||
311 | <cstring>authOpen</cstring> | ||
312 | </property> | ||
313 | <property stdset="1"> | ||
314 | <name>text</name> | ||
315 | <string>Open System</string> | ||
316 | </property> | ||
317 | <property stdset="1"> | ||
318 | <name>checked</name> | ||
319 | <bool>true</bool> | ||
320 | </property> | ||
321 | </widget> | ||
322 | <widget> | ||
323 | <class>QRadioButton</class> | ||
324 | <property stdset="1"> | ||
325 | <name>name</name> | ||
326 | <cstring>authShared</cstring> | ||
327 | </property> | ||
328 | <property stdset="1"> | ||
329 | <name>text</name> | ||
330 | <string>Shared Key</string> | ||
331 | </property> | ||
332 | </widget> | ||
333 | </hbox> | ||
334 | </widget> | ||
335 | <widget> | ||
270 | <class>QButtonGroup</class> | 336 | <class>QButtonGroup</class> |
271 | <property stdset="1"> | 337 | <property stdset="1"> |
272 | <name>name</name> | 338 | <name>name</name> |
273 | <cstring>ButtonGroup44</cstring> | 339 | <cstring>ButtonGroup44</cstring> |
274 | </property> | 340 | </property> |
275 | <property stdset="1"> | 341 | <property stdset="1"> |
276 | <name>enabled</name> | 342 | <name>enabled</name> |
277 | <bool>false</bool> | 343 | <bool>false</bool> |
278 | </property> | 344 | </property> |
279 | <property stdset="1"> | 345 | <property stdset="1"> |
280 | <name>title</name> | 346 | <name>title</name> |
281 | <string>Key Setting</string> | 347 | <string>Key Setting</string> |
282 | </property> | 348 | </property> |
283 | <grid> | 349 | <grid> |
284 | <property stdset="1"> | 350 | <property stdset="1"> |
285 | <name>margin</name> | 351 | <name>margin</name> |
286 | <number>11</number> | 352 | <number>11</number> |
287 | </property> | 353 | </property> |
288 | <property stdset="1"> | 354 | <property stdset="1"> |
289 | <name>spacing</name> | 355 | <name>spacing</name> |
290 | <number>6</number> | 356 | <number>6</number> |
291 | </property> | 357 | </property> |
292 | <widget row="0" column="1" > | 358 | <widget row="0" column="1" > |
293 | <class>QLineEdit</class> | 359 | <class>QLineEdit</class> |
294 | <property stdset="1"> | 360 | <property stdset="1"> |
295 | <name>name</name> | 361 | <name>name</name> |
296 | <cstring>keyLineEdit0</cstring> | 362 | <cstring>keyLineEdit0</cstring> |
297 | </property> | 363 | </property> |
298 | </widget> | 364 | </widget> |
299 | <widget row="1" column="1" > | 365 | <widget row="1" column="1" > |
300 | <class>QLineEdit</class> | 366 | <class>QLineEdit</class> |
301 | <property stdset="1"> | 367 | <property stdset="1"> |
302 | <name>name</name> | 368 | <name>name</name> |
303 | <cstring>keyLineEdit1</cstring> | 369 | <cstring>keyLineEdit1</cstring> |
304 | </property> | 370 | </property> |
305 | </widget> | 371 | </widget> |
306 | <widget row="2" column="1" > | 372 | <widget row="2" column="1" > |
307 | <class>QLineEdit</class> | 373 | <class>QLineEdit</class> |
308 | <property stdset="1"> | 374 | <property stdset="1"> |
309 | <name>name</name> | 375 | <name>name</name> |
310 | <cstring>keyLineEdit2</cstring> | 376 | <cstring>keyLineEdit2</cstring> |
311 | </property> | 377 | </property> |
312 | </widget> | 378 | </widget> |
313 | <widget row="3" column="1" > | 379 | <widget row="3" column="1" > |
314 | <class>QLineEdit</class> | 380 | <class>QLineEdit</class> |
315 | <property stdset="1"> | 381 | <property stdset="1"> |
316 | <name>name</name> | 382 | <name>name</name> |
317 | <cstring>keyLineEdit3</cstring> | 383 | <cstring>keyLineEdit3</cstring> |
@@ -322,251 +388,130 @@ | |||
322 | <property stdset="1"> | 388 | <property stdset="1"> |
323 | <name>name</name> | 389 | <name>name</name> |
324 | <cstring>keyRadio0</cstring> | 390 | <cstring>keyRadio0</cstring> |
325 | </property> | 391 | </property> |
326 | <property stdset="1"> | 392 | <property stdset="1"> |
327 | <name>text</name> | 393 | <name>text</name> |
328 | <string>Key 1</string> | 394 | <string>Key 1</string> |
329 | </property> | 395 | </property> |
330 | <property stdset="1"> | 396 | <property stdset="1"> |
331 | <name>checked</name> | 397 | <name>checked</name> |
332 | <bool>true</bool> | 398 | <bool>true</bool> |
333 | </property> | 399 | </property> |
334 | </widget> | 400 | </widget> |
335 | <widget row="1" column="0" > | 401 | <widget row="1" column="0" > |
336 | <class>QRadioButton</class> | 402 | <class>QRadioButton</class> |
337 | <property stdset="1"> | 403 | <property stdset="1"> |
338 | <name>name</name> | 404 | <name>name</name> |
339 | <cstring>keyRadio1</cstring> | 405 | <cstring>keyRadio1</cstring> |
340 | </property> | 406 | </property> |
341 | <property stdset="1"> | 407 | <property stdset="1"> |
342 | <name>text</name> | 408 | <name>text</name> |
343 | <string>Key 2</string> | 409 | <string>Key 2</string> |
344 | </property> | 410 | </property> |
345 | </widget> | 411 | </widget> |
346 | <widget row="2" column="0" > | 412 | <widget row="2" column="0" > |
347 | <class>QRadioButton</class> | 413 | <class>QRadioButton</class> |
348 | <property stdset="1"> | 414 | <property stdset="1"> |
349 | <name>name</name> | 415 | <name>name</name> |
350 | <cstring>keyRadio2</cstring> | 416 | <cstring>keyRadio2</cstring> |
351 | </property> | 417 | </property> |
352 | <property stdset="1"> | 418 | <property stdset="1"> |
353 | <name>text</name> | 419 | <name>text</name> |
354 | <string>Key 3</string> | 420 | <string>Key 3</string> |
355 | </property> | 421 | </property> |
356 | </widget> | 422 | </widget> |
357 | <widget row="3" column="0" > | 423 | <widget row="3" column="0" > |
358 | <class>QRadioButton</class> | 424 | <class>QRadioButton</class> |
359 | <property stdset="1"> | 425 | <property stdset="1"> |
360 | <name>name</name> | 426 | <name>name</name> |
361 | <cstring>keyRadio3</cstring> | 427 | <cstring>keyRadio3</cstring> |
362 | </property> | 428 | </property> |
363 | <property stdset="1"> | 429 | <property stdset="1"> |
364 | <name>text</name> | 430 | <name>text</name> |
365 | <string>Key 4</string> | 431 | <string>Key 4</string> |
366 | </property> | 432 | </property> |
367 | </widget> | 433 | </widget> |
368 | </grid> | 434 | </grid> |
369 | </widget> | 435 | </widget> |
370 | <widget row="1" column="0" > | 436 | <spacer> |
371 | <class>QButtonGroup</class> | ||
372 | <property stdset="1"> | ||
373 | <name>name</name> | ||
374 | <cstring>ButtonGroup42</cstring> | ||
375 | </property> | ||
376 | <property stdset="1"> | ||
377 | <name>enabled</name> | ||
378 | <bool>false</bool> | ||
379 | </property> | ||
380 | <property stdset="1"> | ||
381 | <name>title</name> | ||
382 | <string>Key Length</string> | ||
383 | </property> | ||
384 | <vbox> | ||
385 | <property stdset="1"> | ||
386 | <name>margin</name> | ||
387 | <number>11</number> | ||
388 | </property> | ||
389 | <property stdset="1"> | ||
390 | <name>spacing</name> | ||
391 | <number>6</number> | ||
392 | </property> | ||
393 | <widget> | ||
394 | <class>QRadioButton</class> | ||
395 | <property stdset="1"> | ||
396 | <name>name</name> | ||
397 | <cstring>key40</cstring> | ||
398 | </property> | ||
399 | <property stdset="1"> | ||
400 | <name>text</name> | ||
401 | <string>40 Bits</string> | ||
402 | </property> | ||
403 | <property stdset="1"> | ||
404 | <name>checked</name> | ||
405 | <bool>true</bool> | ||
406 | </property> | ||
407 | </widget> | ||
408 | <widget> | ||
409 | <class>QRadioButton</class> | ||
410 | <property stdset="1"> | ||
411 | <name>name</name> | ||
412 | <cstring>key128</cstring> | ||
413 | </property> | ||
414 | <property stdset="1"> | ||
415 | <name>text</name> | ||
416 | <string>128 Bits</string> | ||
417 | </property> | ||
418 | </widget> | ||
419 | </vbox> | ||
420 | </widget> | ||
421 | <widget row="1" column="1" > | ||
422 | <class>QButtonGroup</class> | ||
423 | <property stdset="1"> | ||
424 | <name>name</name> | ||
425 | <cstring>ButtonGroup43</cstring> | ||
426 | </property> | ||
427 | <property stdset="1"> | ||
428 | <name>enabled</name> | ||
429 | <bool>false</bool> | ||
430 | </property> | ||
431 | <property stdset="1"> | ||
432 | <name>title</name> | ||
433 | <string>Authentication Type</string> | ||
434 | </property> | ||
435 | <vbox> | ||
436 | <property stdset="1"> | ||
437 | <name>margin</name> | ||
438 | <number>11</number> | ||
439 | </property> | ||
440 | <property stdset="1"> | ||
441 | <name>spacing</name> | ||
442 | <number>6</number> | ||
443 | </property> | ||
444 | <widget> | ||
445 | <class>QRadioButton</class> | ||
446 | <property stdset="1"> | ||
447 | <name>name</name> | ||
448 | <cstring>authOpen</cstring> | ||
449 | </property> | ||
450 | <property stdset="1"> | ||
451 | <name>text</name> | ||
452 | <string>Open System</string> | ||
453 | </property> | ||
454 | <property stdset="1"> | ||
455 | <name>checked</name> | ||
456 | <bool>true</bool> | ||
457 | </property> | ||
458 | </widget> | ||
459 | <widget> | ||
460 | <class>QRadioButton</class> | ||
461 | <property stdset="1"> | ||
462 | <name>name</name> | ||
463 | <cstring>authShared</cstring> | ||
464 | </property> | ||
465 | <property stdset="1"> | ||
466 | <name>text</name> | ||
467 | <string>Shared Key</string> | ||
468 | </property> | ||
469 | </widget> | ||
470 | </vbox> | ||
471 | </widget> | ||
472 | <spacer row="3" column="1" > | ||
473 | <property> | 437 | <property> |
474 | <name>name</name> | 438 | <name>name</name> |
475 | <cstring>Spacer30</cstring> | 439 | <cstring>Spacer30</cstring> |
476 | </property> | 440 | </property> |
477 | <property stdset="1"> | 441 | <property stdset="1"> |
478 | <name>orientation</name> | 442 | <name>orientation</name> |
479 | <enum>Vertical</enum> | 443 | <enum>Vertical</enum> |
480 | </property> | 444 | </property> |
481 | <property stdset="1"> | 445 | <property stdset="1"> |
482 | <name>sizeType</name> | 446 | <name>sizeType</name> |
483 | <enum>Expanding</enum> | 447 | <enum>Expanding</enum> |
484 | </property> | 448 | </property> |
485 | <property> | 449 | <property> |
486 | <name>sizeHint</name> | 450 | <name>sizeHint</name> |
487 | <size> | 451 | <size> |
488 | <width>20</width> | 452 | <width>20</width> |
489 | <height>20</height> | 453 | <height>20</height> |
490 | </size> | 454 | </size> |
491 | </property> | 455 | </property> |
492 | </spacer> | 456 | </spacer> |
493 | <widget row="0" column="0" rowspan="1" colspan="2" > | 457 | </vbox> |
494 | <class>QCheckBox</class> | ||
495 | <property stdset="1"> | ||
496 | <name>name</name> | ||
497 | <cstring>wepEnabled</cstring> | ||
498 | </property> | ||
499 | <property stdset="1"> | ||
500 | <name>text</name> | ||
501 | <string>Enable Wep</string> | ||
502 | </property> | ||
503 | </widget> | ||
504 | </grid> | ||
505 | </widget> | 458 | </widget> |
506 | </widget> | 459 | </widget> |
507 | </vbox> | 460 | </vbox> |
508 | </widget> | 461 | </widget> |
509 | <connections> | 462 | <connections> |
510 | <connection> | 463 | <connection> |
511 | <sender>essSpecific</sender> | 464 | <sender>essSpecific</sender> |
512 | <signal>toggled(bool)</signal> | 465 | <signal>toggled(bool)</signal> |
513 | <receiver>essSpecificLineEdit</receiver> | 466 | <receiver>essSpecificLineEdit</receiver> |
514 | <slot>setEnabled(bool)</slot> | 467 | <slot>setEnabled(bool)</slot> |
515 | </connection> | 468 | </connection> |
516 | <connection> | 469 | <connection> |
517 | <sender>network802</sender> | 470 | <sender>network802</sender> |
518 | <signal>clicked()</signal> | 471 | <signal>clicked()</signal> |
519 | <receiver>essSpecific</receiver> | 472 | <receiver>essSpecific</receiver> |
520 | <slot>animateClick()</slot> | 473 | <slot>animateClick()</slot> |
521 | </connection> | 474 | </connection> |
522 | <connection> | 475 | <connection> |
523 | <sender>network802</sender> | 476 | <sender>network802</sender> |
524 | <signal>toggled(bool)</signal> | 477 | <signal>toggled(bool)</signal> |
525 | <receiver>TextLabel2</receiver> | 478 | <receiver>TextLabel2</receiver> |
526 | <slot>setEnabled(bool)</slot> | 479 | <slot>setEnabled(bool)</slot> |
527 | </connection> | 480 | </connection> |
528 | <connection> | 481 | <connection> |
529 | <sender>network802</sender> | 482 | <sender>network802</sender> |
530 | <signal>toggled(bool)</signal> | 483 | <signal>toggled(bool)</signal> |
531 | <receiver>networkChannel</receiver> | 484 | <receiver>networkChannel</receiver> |
532 | <slot>setEnabled(bool)</slot> | 485 | <slot>setEnabled(bool)</slot> |
533 | </connection> | 486 | </connection> |
534 | <connection> | 487 | <connection> |
535 | <sender>wepEnabled</sender> | 488 | <sender>wepEnabled</sender> |
536 | <signal>toggled(bool)</signal> | 489 | <signal>toggled(bool)</signal> |
537 | <receiver>ButtonGroup42</receiver> | ||
538 | <slot>setEnabled(bool)</slot> | ||
539 | </connection> | ||
540 | <connection> | ||
541 | <sender>wepEnabled</sender> | ||
542 | <signal>toggled(bool)</signal> | ||
543 | <receiver>ButtonGroup43</receiver> | 490 | <receiver>ButtonGroup43</receiver> |
544 | <slot>setEnabled(bool)</slot> | 491 | <slot>setEnabled(bool)</slot> |
545 | </connection> | 492 | </connection> |
546 | <connection> | 493 | <connection> |
547 | <sender>wepEnabled</sender> | 494 | <sender>wepEnabled</sender> |
548 | <signal>toggled(bool)</signal> | 495 | <signal>toggled(bool)</signal> |
549 | <receiver>ButtonGroup44</receiver> | 496 | <receiver>ButtonGroup44</receiver> |
550 | <slot>setEnabled(bool)</slot> | 497 | <slot>setEnabled(bool)</slot> |
551 | </connection> | 498 | </connection> |
552 | </connections> | 499 | </connections> |
553 | <tabstops> | 500 | <tabstops> |
554 | <tabstop>tabWidget</tabstop> | 501 | <tabstop>tabWidget</tabstop> |
555 | <tabstop>essNon</tabstop> | 502 | <tabstop>essNon</tabstop> |
556 | <tabstop>essSpecificLineEdit</tabstop> | 503 | <tabstop>essSpecificLineEdit</tabstop> |
557 | <tabstop>networkInfrastructure</tabstop> | 504 | <tabstop>networkInfrastructure</tabstop> |
558 | <tabstop>networkChannel</tabstop> | 505 | <tabstop>networkChannel</tabstop> |
559 | <tabstop>key40</tabstop> | ||
560 | <tabstop>key128</tabstop> | ||
561 | <tabstop>authOpen</tabstop> | 506 | <tabstop>authOpen</tabstop> |
562 | <tabstop>authShared</tabstop> | 507 | <tabstop>authShared</tabstop> |
563 | <tabstop>keyRadio0</tabstop> | 508 | <tabstop>keyRadio0</tabstop> |
564 | <tabstop>keyLineEdit0</tabstop> | 509 | <tabstop>keyLineEdit0</tabstop> |
565 | <tabstop>keyRadio1</tabstop> | 510 | <tabstop>keyRadio1</tabstop> |
566 | <tabstop>keyLineEdit1</tabstop> | 511 | <tabstop>keyLineEdit1</tabstop> |
567 | <tabstop>keyRadio2</tabstop> | 512 | <tabstop>keyRadio2</tabstop> |
568 | <tabstop>keyLineEdit2</tabstop> | 513 | <tabstop>keyLineEdit2</tabstop> |
569 | <tabstop>keyRadio3</tabstop> | 514 | <tabstop>keyRadio3</tabstop> |
570 | <tabstop>keyLineEdit3</tabstop> | 515 | <tabstop>keyLineEdit3</tabstop> |
571 | </tabstops> | 516 | </tabstops> |
572 | </UI> | 517 | </UI> |
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 01d7e36..689eae2 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -1,247 +1,232 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | #include "interfacesetupimp.h" | ||
2 | 3 | ||
3 | /* Config class */ | ||
4 | #include <qpe/config.h> | ||
5 | /* Global namespace */ | ||
6 | #include <qpe/global.h> | ||
7 | /* system() */ | ||
8 | #include <stdlib.h> | ||
9 | #include <qfile.h> | 4 | #include <qfile.h> |
10 | #include <qdir.h> | 5 | #include <qdir.h> |
11 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
12 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
13 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
14 | #include <qspinbox.h> | 9 | #include <qspinbox.h> |
15 | #include <qradiobutton.h> | 10 | #include <qradiobutton.h> |
16 | #include <qcheckbox.h> | 11 | #include <qcheckbox.h> |
17 | #include <qregexp.h> | ||
18 | #include <qpe/config.h> | ||
19 | #include <qtabwidget.h> | 12 | #include <qtabwidget.h> |
20 | #include "interfacesetupimp.h" | ||
21 | 13 | ||
22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ | 14 | /* system() */ |
23 | config = new Config("wireless"); | 15 | #include <stdlib.h> |
24 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);//, Qt::WDestructiveClose); | ||
25 | //configure->setProfile(currentProfile); | ||
26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | ||
27 | 16 | ||
28 | readConfig(); | 17 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
29 | 18 | ||
30 | } | 19 | /** |
20 | * Constructor, read in the wireless.opts file for parsing later. | ||
21 | */ | ||
22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { | ||
23 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); | ||
24 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | ||
31 | 25 | ||
32 | WLANImp::~WLANImp( ){ | 26 | // Read in the config file. |
33 | delete config; | 27 | QString wlanFile = WIRELESS_OPTS; |
28 | QFile file(wlanFile); | ||
29 | if (file.open(IO_ReadOnly)){ | ||
30 | QTextStream stream( &file ); | ||
31 | QString line = ""; | ||
32 | while ( !stream.eof() ) { | ||
33 | line += stream.readLine(); | ||
34 | line += "\n"; | ||
35 | } | ||
36 | file.close(); | ||
37 | settingsFileText = QStringList::split("\n", line, true); | ||
38 | parseSettingFile(); | ||
39 | } | ||
40 | else | ||
41 | qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); | ||
34 | } | 42 | } |
35 | 43 | ||
44 | /** | ||
45 | * Change the profile for both wireless settings and network settings. | ||
46 | */ | ||
36 | void WLANImp::setProfile(QString &profile){ | 47 | void WLANImp::setProfile(QString &profile){ |
37 | interfaceSetup->setProfile(profile); | 48 | interfaceSetup->setProfile(profile); |
49 | parseSettingFile(); | ||
38 | } | 50 | } |
39 | 51 | ||
40 | void WLANImp::readConfig() | 52 | /** |
41 | { | 53 | * Parses the settings file that was read in and gets any setting from it. |
42 | qWarning( "WLANImp::readConfig() called." ); | 54 | */ |
43 | config->setGroup( "Properties" ); | 55 | void WLANImp::parseSettingFile(){ |
44 | QString ssid = config->readEntry( "SSID", "any" ); | 56 | bool foundCase = false; |
45 | if( ssid == "any" || ssid == "ANY" ){ | 57 | bool found = false; |
46 | essNon->setChecked( true ); | 58 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
47 | } else { | 59 | QString line = (*it).simplifyWhiteSpace(); |
48 | essSpecific->setChecked( true ); | 60 | if(line.contains("case")) |
49 | essSpecificLineEdit->setText( ssid ); | 61 | foundCase = true; |
50 | } | 62 | // See if we found our scheme to write or the sceme couldn't be found |
51 | QString mode = config->readEntry( "Mode", "Managed" ); | 63 | if((foundCase && line.contains("esac")) || |
52 | if( mode == "adhoc" ) { | 64 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) |
53 | network802->setChecked( true ); | 65 | found = true; |
54 | } else { | 66 | |
55 | networkInfrastructure->setChecked( true ); | 67 | if(line.contains(";;")) |
56 | } | 68 | found = false; |
57 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); | 69 | if(found){ |
58 | // config->readEntry( "RATE", "auto" ); | 70 | // write out scheme |
59 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 71 | if(line.contains("ESSID=")){ |
60 | config->readEntry( "AuthType", "opensystem" ); | 72 | QString id = line.mid(line.find("ESSID=")+6, line.length()); |
61 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 73 | if(id == "any"){ |
62 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 74 | essNon->setChecked(true); |
63 | switch( defaultkey ){ | 75 | essSpecific->setChecked(false); |
64 | case 0: | 76 | }else{ |
65 | keyRadio0->setChecked( true ); | 77 | essSpecific->setChecked(true); |
66 | break; | 78 | essSpecificLineEdit->setText(id); |
67 | case 1: | 79 | essNon->setChecked(false); |
68 | keyRadio1->setChecked( true ); | 80 | } |
69 | break; | 81 | } |
70 | case 2: | 82 | if(line.contains("MODE=")){ |
71 | keyRadio2->setChecked( true ); | 83 | QString mode = line.mid(line.find("MODE=")+5, line.length()); |
72 | break; | 84 | if(mode == "Managed"){ |
73 | case 3: | 85 | network802->setChecked( false ); |
74 | keyRadio3->setChecked( true ); | 86 | networkInfrastructure->setChecked( true ); |
75 | break; | 87 | } |
88 | else{ | ||
89 | network802->setChecked( true ); | ||
90 | networkInfrastructure->setChecked( false ); | ||
91 | } | ||
92 | } | ||
93 | if(line.contains("KEY=")){ | ||
94 | line.at(0) != '#' ? wepEnabled->setChecked(true) : wepEnabled->setChecked(false); | ||
95 | int s = line.find("KEY="); | ||
96 | line = line.mid(s+4, line.length()); | ||
97 | // Find first Key | ||
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); | ||
124 | authShared->setChecked(false); | ||
125 | } | ||
126 | else{ | ||
127 | authOpen->setChecked(false); | ||
128 | authShared->setChecked(true); | ||
129 | } | ||
130 | } | ||
131 | if(line.contains("CHANNEL=")){ | ||
132 | networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); | ||
133 | } | ||
76 | } | 134 | } |
77 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); | 135 | } |
78 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); | ||
79 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); | ||
80 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); | ||
81 | return; | ||
82 | } | 136 | } |
83 | 137 | ||
84 | bool WLANImp::writeConfig() | 138 | /** |
85 | { | 139 | * Saves settings to the wireless.opts file using the current profile |
86 | qWarning( "WLANImp::writeConfig() called." ); | 140 | */ |
87 | config->setGroup( "Properties" ); | 141 | void WLANImp::changeAndSaveSettingFile(){ |
88 | if( essNon->isChecked() ) { | 142 | QString wlanFile = WIRELESS_OPTS; |
89 | config->writeEntry( "SSID", "any" ); | 143 | QFile::remove(wlanFile); |
90 | } else { | 144 | QFile file(wlanFile); |
91 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); | 145 | |
92 | } | 146 | if (!file.open(IO_ReadWrite)){ |
93 | if( networkInfrastructure->isChecked() ){ | 147 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); |
94 | config->writeEntry( "Mode", "Managed" ); | 148 | return; |
95 | } else if( network802->isChecked() ){ | 149 | } |
96 | config->writeEntry( "Mode", "adhoc" ); | 150 | |
97 | } | 151 | QTextStream stream( &file ); |
98 | config->writeEntry( "CHANNEL", networkChannel->value() ); | 152 | bool foundCase = false; |
99 | // config->readEntry( "RATE", "auto" ); | 153 | bool found = false; |
100 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); | 154 | bool output = true; |
101 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); | 155 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
102 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); | 156 | QString line = (*it).simplifyWhiteSpace(); |
103 | if( keyRadio0->isChecked() ){ | 157 | if(line.contains("case")) |
104 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); | 158 | foundCase = true; |
105 | } else if( keyRadio1->isChecked() ){ | 159 | // See if we found our scheme to write or the sceme couldn't be found |
106 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); | 160 | if((foundCase && line.contains("esac") && !found) || |
107 | } else if( keyRadio2->isChecked() ){ | 161 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ |
108 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); | 162 | // write out scheme |
109 | } else if( keyRadio3->isChecked() ){ | 163 | found = true; |
110 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); | 164 | output = false; |
165 | |||
166 | if(!line.contains("esac")) | ||
167 | stream << line << "\n"; | ||
168 | |||
169 | stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; | ||
170 | stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n'; | ||
171 | if(!wepEnabled->isChecked()) | ||
172 | stream << "#"; | ||
173 | stream << "\tKEY="; | ||
174 | stream << keyLineEdit0->text() << " [1]"; | ||
175 | stream << keyLineEdit1->text() << " [2]"; | ||
176 | stream << keyLineEdit2->text() << " [3]"; | ||
177 | stream << keyLineEdit3->text() << " [4]"; | ||
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"; | ||
184 | stream << "\n"; | ||
185 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | ||
186 | stream << "\tRATE=auto\n"; | ||
187 | if(line.contains("esac")) | ||
188 | stream << line << "\n"; | ||
111 | } | 189 | } |
112 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 190 | if(line.contains(";;")) |
113 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 191 | output = true; |
114 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 192 | if(output) |
115 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 193 | stream << (*it) << '\n'; |
116 | return writeWirelessOpts( ); | 194 | } |
195 | file.close(); | ||
117 | } | 196 | } |
118 | 197 | ||
119 | /** | 198 | /** |
199 | * Check to see if the current config is valid | ||
200 | * Save wireless.opts, save interfaces | ||
120 | */ | 201 | */ |
121 | void WLANImp::accept() | 202 | void WLANImp::accept(){ |
122 | { | 203 | if(wepEnabled->isChecked()){ |
123 | if ( writeConfig() ){ | 204 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) |
124 | if(interfaceSetup->saveChanges()) | 205 | QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); |
125 | QDialog::accept(); | 206 | return; |
126 | } | 207 | } |
208 | |||
209 | // Ok settings are good here, save | ||
210 | changeAndSaveSettingFile(); | ||
211 | |||
212 | // Try to save the interfaces settings. | ||
213 | if(!interfaceSetup->saveChanges()) | ||
214 | return; | ||
215 | |||
216 | // Restart the device now that the settings have changed | ||
217 | QString initpath; | ||
218 | if( QDir("/etc/rc.d/init.d").exists() ) | ||
219 | initpath = "/etc/rc.d/init.d"; | ||
220 | else if( QDir("/etc/init.d").exists() ) | ||
221 | initpath = "/etc/init.d"; | ||
222 | if( initpath ) | ||
223 | system(QString("%1/pcmcia stop").arg(initpath)); | ||
224 | if( initpath ) | ||
225 | system(QString("%1/pcmcia start").arg(initpath)); | ||
226 | |||
227 | // Close out the dialog | ||
228 | QDialog::accept(); | ||
127 | } | 229 | } |
128 | 230 | ||
129 | bool WLANImp::writeWirelessOpts( QString scheme ) | 231 | // wlanimp.cpp |
130 | { | ||
131 | qWarning( "WLANImp::writeWirelessOpts entered." ); | ||
132 | QString prev = "/etc/pcmcia/wireless.opts"; | ||
133 | QFile prevFile(prev); | ||
134 | if ( !prevFile.open( IO_ReadOnly ) ) | ||
135 | return false; | ||
136 | |||
137 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | ||
138 | QFile tmpFile(tmp); | ||
139 | if ( !tmpFile.open( IO_WriteOnly ) ) | ||
140 | return false; | ||
141 | |||
142 | bool retval = true; | ||
143 | |||
144 | QTextStream in( &prevFile ); | ||
145 | QTextStream out( &tmpFile ); | ||
146 | |||
147 | config->setGroup("Properties"); | ||
148 | |||
149 | QString line; | ||
150 | bool found=false; | ||
151 | bool done=false; | ||
152 | while ( !in.atEnd() ) { | ||
153 | QString line = in.readLine(); | ||
154 | QString wline = line.simplifyWhiteSpace(); | ||
155 | if ( !done ) { | ||
156 | if ( found ) { | ||
157 | // skip existing entry for this scheme, and write our own. | ||
158 | if ( wline == ";;" ) { | ||
159 | found = false; | ||
160 | continue; | ||
161 | } else { | ||
162 | continue; | ||
163 | } | ||
164 | } else { | ||
165 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | ||
166 | found=true; | ||
167 | continue; // skip this line | ||
168 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | ||
169 | // end - add new entry | ||
170 | // Not all fields have a GUI, but all are supported | ||
171 | // in the letwork configuration files. | ||
172 | static const char* txtfields[] = { | ||
173 | 0 | ||
174 | }; | ||
175 | QString readmode = config->readEntry( "Mode", "Managed" ); | ||
176 | QString mode; | ||
177 | if( readmode == "Managed" ){ | ||
178 | mode = readmode; | ||
179 | } else if( readmode == "adhoc" ){ | ||
180 | mode = "Ad-Hoc"; | ||
181 | } | ||
182 | QString key; | ||
183 | if( wepEnabled->isChecked() ){ | ||
184 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | ||
185 | switch( defaultkey ){ | ||
186 | case 0: | ||
187 | key += keyLineEdit0->text(); | ||
188 | break; | ||
189 | case 1: | ||
190 | key += keyLineEdit1->text(); | ||
191 | break; | ||
192 | case 2: | ||
193 | key += keyLineEdit2->text(); | ||
194 | break; | ||
195 | case 3: | ||
196 | key += keyLineEdit3->text(); | ||
197 | break; | ||
198 | } | ||
199 | if( config->readEntry( "AuthType", "opensystem" ) == "opensystem") | ||
200 | key += " open"; | ||
201 | } | ||
202 | out << scheme << ",*,*,*)" << "\n" | ||
203 | << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n" | ||
204 | << " MODE=" << mode << "\n" | ||
205 | << " KEY=" << Global::shellQuote( key ) << "\n" | ||
206 | << " RATE=" << "auto" << "\n" | ||
207 | ; | ||
208 | if( mode != "Managed" ) | ||
209 | out << " CHANNEL=" << config->readNumEntry( "CHANNEL", 1 ) << "\n"; | ||
210 | const char** f = txtfields; | ||
211 | while (*f) { | ||
212 | out << " " << *f << "=" << config->readEntry(*f,"") << "\n"; | ||
213 | ++f; | ||
214 | } | ||
215 | out << " ;;\n"; | ||
216 | done = true; | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | out << line << "\n"; | ||
221 | } | ||
222 | 232 | ||
223 | prevFile.close(); | ||
224 | tmpFile.close(); | ||
225 | QString initpath; | ||
226 | //system("cardctl suspend"); | ||
227 | if( QDir("/etc/rc.d/init.d").exists() ){ | ||
228 | initpath = "/etc/rc.d/init.d"; | ||
229 | } else if( QDir("/etc/init.d").exists() ){ | ||
230 | initpath = "/etc/init.d"; | ||
231 | } | ||
232 | if( initpath ) | ||
233 | system(QString("%1/pcmcia stop").arg(initpath)); | ||
234 | |||
235 | if( system( "mv " + tmp + " " + prev ) ) | ||
236 | retval = false; | ||
237 | //#ifdef USE_SCHEMES | ||
238 | // if ( retval ) | ||
239 | //SchemeChanger::changeScheme(scheme); | ||
240 | //#endif | ||
241 | |||
242 | //system("cardctl resume"); | ||
243 | if( initpath ) | ||
244 | system(QString("%1/pcmcia start").arg(initpath)); | ||
245 | |||
246 | return retval; | ||
247 | } | ||
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index faa1674..f88e550 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h | |||
@@ -1,32 +1,31 @@ | |||
1 | #ifndef WLANIMP_H | 1 | #ifndef WLANIMP_H |
2 | #define WLANIMP_H | 2 | #define WLANIMP_H |
3 | 3 | ||
4 | #include "wlan.h" | 4 | #include "wlan.h" |
5 | #include <qstringlist.h> | ||
5 | 6 | ||
6 | class InterfaceSetupImp; | 7 | class InterfaceSetupImp; |
7 | class Interface; | 8 | class Interface; |
8 | class Config; | 9 | class Config; |
9 | 10 | ||
10 | class WLANImp : public WLAN { | 11 | class WLANImp : public WLAN { |
11 | Q_OBJECT | 12 | Q_OBJECT |
12 | 13 | ||
13 | public: | 14 | public: |
14 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); | 15 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); |
15 | ~WLANImp( ); | ||
16 | void setProfile(QString &profile); | 16 | void setProfile(QString &profile); |
17 | 17 | ||
18 | protected: | 18 | protected: |
19 | void accept(); | 19 | void accept(); |
20 | 20 | ||
21 | private: | 21 | private: |
22 | void readConfig(); | 22 | void parseSettingFile(); |
23 | bool writeConfig(); | 23 | void changeAndSaveSettingFile(); |
24 | bool writeWirelessOpts( QString scheme = "*" ); | 24 | |
25 | bool writeWlanngOpts( QString scheme = "*" ); | ||
26 | Config* config; | ||
27 | InterfaceSetupImp *interfaceSetup; | 25 | InterfaceSetupImp *interfaceSetup; |
28 | 26 | QStringList settingsFileText; | |
27 | QString currentProfile; | ||
29 | }; | 28 | }; |
30 | 29 | ||
31 | #endif | 30 | #endif |
32 | 31 | ||
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui index 9f33559..1b29a3e 100644 --- a/noncore/settings/networksettings/wlan/wlan.ui +++ b/noncore/settings/networksettings/wlan/wlan.ui | |||
@@ -1,62 +1,62 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WLAN</class> | 2 | <class>WLAN</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WLAN</cstring> | 7 | <cstring>WLAN</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>250</width> | 14 | <width>238</width> |
15 | <height>286</height> | 15 | <height>286</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Wireless LAN Setting</string> | 20 | <string>Wireless LAN Setting</string> |
21 | </property> | 21 | </property> |
22 | <property stdset="1"> | 22 | <property stdset="1"> |
23 | <name>sizeGripEnabled</name> | 23 | <name>sizeGripEnabled</name> |
24 | <bool>true</bool> | 24 | <bool>true</bool> |
25 | </property> | 25 | </property> |
26 | <property> | 26 | <property> |
27 | <name>layoutMargin</name> | 27 | <name>layoutMargin</name> |
28 | </property> | 28 | </property> |
29 | <vbox> | 29 | <vbox> |
30 | <property stdset="1"> | 30 | <property stdset="1"> |
31 | <name>margin</name> | 31 | <name>margin</name> |
32 | <number>0</number> | 32 | <number>0</number> |
33 | </property> | 33 | </property> |
34 | <property stdset="1"> | 34 | <property stdset="1"> |
35 | <name>spacing</name> | 35 | <name>spacing</name> |
36 | <number>6</number> | 36 | <number>6</number> |
37 | </property> | 37 | </property> |
38 | <widget> | 38 | <widget> |
39 | <class>QTabWidget</class> | 39 | <class>QTabWidget</class> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
41 | <name>name</name> | 41 | <name>name</name> |
42 | <cstring>tabWidget</cstring> | 42 | <cstring>tabWidget</cstring> |
43 | </property> | 43 | </property> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>enabled</name> | 45 | <name>enabled</name> |
46 | <bool>true</bool> | 46 | <bool>true</bool> |
47 | </property> | 47 | </property> |
48 | <widget> | 48 | <widget> |
49 | <class>QWidget</class> | 49 | <class>QWidget</class> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>name</name> | 51 | <name>name</name> |
52 | <cstring>ConfigPage</cstring> | 52 | <cstring>ConfigPage</cstring> |
53 | </property> | 53 | </property> |
54 | <attribute> | 54 | <attribute> |
55 | <name>title</name> | 55 | <name>title</name> |
56 | <string>WLAN General</string> | 56 | <string>WLAN General</string> |
57 | </attribute> | 57 | </attribute> |
58 | <vbox> | 58 | <vbox> |
59 | <property stdset="1"> | 59 | <property stdset="1"> |
60 | <name>margin</name> | 60 | <name>margin</name> |
61 | <number>11</number> | 61 | <number>11</number> |
62 | </property> | 62 | </property> |
@@ -134,184 +134,250 @@ | |||
134 | </property> | 134 | </property> |
135 | <grid> | 135 | <grid> |
136 | <property stdset="1"> | 136 | <property stdset="1"> |
137 | <name>margin</name> | 137 | <name>margin</name> |
138 | <number>11</number> | 138 | <number>11</number> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>spacing</name> | 141 | <name>spacing</name> |
142 | <number>6</number> | 142 | <number>6</number> |
143 | </property> | 143 | </property> |
144 | <widget row="0" column="0" rowspan="1" colspan="3" > | 144 | <widget row="0" column="0" rowspan="1" colspan="3" > |
145 | <class>QRadioButton</class> | 145 | <class>QRadioButton</class> |
146 | <property stdset="1"> | 146 | <property stdset="1"> |
147 | <name>name</name> | 147 | <name>name</name> |
148 | <cstring>networkInfrastructure</cstring> | 148 | <cstring>networkInfrastructure</cstring> |
149 | </property> | 149 | </property> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>text</name> | 151 | <name>text</name> |
152 | <string>Infrastructure</string> | 152 | <string>Infrastructure</string> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>checked</name> | 155 | <name>checked</name> |
156 | <bool>true</bool> | 156 | <bool>true</bool> |
157 | </property> | 157 | </property> |
158 | </widget> | 158 | </widget> |
159 | <widget row="2" column="0" > | 159 | <widget row="2" column="0" > |
160 | <class>QLabel</class> | 160 | <class>QLabel</class> |
161 | <property stdset="1"> | 161 | <property stdset="1"> |
162 | <name>name</name> | 162 | <name>name</name> |
163 | <cstring>TextLabel2</cstring> | 163 | <cstring>TextLabel2</cstring> |
164 | </property> | 164 | </property> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>enabled</name> | 166 | <name>enabled</name> |
167 | <bool>false</bool> | 167 | <bool>false</bool> |
168 | </property> | 168 | </property> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>text</name> | 170 | <name>text</name> |
171 | <string>Channel</string> | 171 | <string>Channel</string> |
172 | </property> | 172 | </property> |
173 | </widget> | 173 | </widget> |
174 | <widget row="1" column="0" rowspan="1" colspan="2" > | 174 | <widget row="1" column="0" rowspan="1" colspan="2" > |
175 | <class>QRadioButton</class> | 175 | <class>QRadioButton</class> |
176 | <property stdset="1"> | 176 | <property stdset="1"> |
177 | <name>name</name> | 177 | <name>name</name> |
178 | <cstring>network802</cstring> | 178 | <cstring>network802</cstring> |
179 | </property> | 179 | </property> |
180 | <property stdset="1"> | 180 | <property stdset="1"> |
181 | <name>text</name> | 181 | <name>text</name> |
182 | <string>802.11 Ad-Hoc</string> | 182 | <string>Ad-Hoc</string> |
183 | </property> | 183 | </property> |
184 | </widget> | 184 | </widget> |
185 | <widget row="2" column="1" > | 185 | <widget row="2" column="1" > |
186 | <class>QSpinBox</class> | 186 | <class>QSpinBox</class> |
187 | <property stdset="1"> | 187 | <property stdset="1"> |
188 | <name>name</name> | 188 | <name>name</name> |
189 | <cstring>networkChannel</cstring> | 189 | <cstring>networkChannel</cstring> |
190 | </property> | 190 | </property> |
191 | <property stdset="1"> | 191 | <property stdset="1"> |
192 | <name>enabled</name> | 192 | <name>enabled</name> |
193 | <bool>false</bool> | 193 | <bool>false</bool> |
194 | </property> | 194 | </property> |
195 | <property stdset="1"> | 195 | <property stdset="1"> |
196 | <name>maxValue</name> | 196 | <name>maxValue</name> |
197 | <number>11</number> | 197 | <number>11</number> |
198 | </property> | 198 | </property> |
199 | <property stdset="1"> | 199 | <property stdset="1"> |
200 | <name>minValue</name> | 200 | <name>minValue</name> |
201 | <number>1</number> | 201 | <number>1</number> |
202 | </property> | 202 | </property> |
203 | <property stdset="1"> | ||
204 | <name>value</name> | ||
205 | <number>6</number> | ||
206 | </property> | ||
203 | </widget> | 207 | </widget> |
204 | <spacer row="2" column="2" > | 208 | <spacer row="2" column="2" > |
205 | <property> | 209 | <property> |
206 | <name>name</name> | 210 | <name>name</name> |
207 | <cstring>Spacer32</cstring> | 211 | <cstring>Spacer32</cstring> |
208 | </property> | 212 | </property> |
209 | <property stdset="1"> | 213 | <property stdset="1"> |
210 | <name>orientation</name> | 214 | <name>orientation</name> |
211 | <enum>Horizontal</enum> | 215 | <enum>Horizontal</enum> |
212 | </property> | 216 | </property> |
213 | <property stdset="1"> | 217 | <property stdset="1"> |
214 | <name>sizeType</name> | 218 | <name>sizeType</name> |
215 | <enum>Expanding</enum> | 219 | <enum>Expanding</enum> |
216 | </property> | 220 | </property> |
217 | <property> | 221 | <property> |
218 | <name>sizeHint</name> | 222 | <name>sizeHint</name> |
219 | <size> | 223 | <size> |
220 | <width>20</width> | 224 | <width>20</width> |
221 | <height>20</height> | 225 | <height>20</height> |
222 | </size> | 226 | </size> |
223 | </property> | 227 | </property> |
224 | </spacer> | 228 | </spacer> |
225 | </grid> | 229 | </grid> |
226 | </widget> | 230 | </widget> |
227 | <spacer> | 231 | <spacer> |
228 | <property> | 232 | <property> |
229 | <name>name</name> | 233 | <name>name</name> |
230 | <cstring>Spacer31</cstring> | 234 | <cstring>Spacer31</cstring> |
231 | </property> | 235 | </property> |
232 | <property stdset="1"> | 236 | <property stdset="1"> |
233 | <name>orientation</name> | 237 | <name>orientation</name> |
234 | <enum>Vertical</enum> | 238 | <enum>Vertical</enum> |
235 | </property> | 239 | </property> |
236 | <property stdset="1"> | 240 | <property stdset="1"> |
237 | <name>sizeType</name> | 241 | <name>sizeType</name> |
238 | <enum>Expanding</enum> | 242 | <enum>Expanding</enum> |
239 | </property> | 243 | </property> |
240 | <property> | 244 | <property> |
241 | <name>sizeHint</name> | 245 | <name>sizeHint</name> |
242 | <size> | 246 | <size> |
243 | <width>20</width> | 247 | <width>20</width> |
244 | <height>20</height> | 248 | <height>20</height> |
245 | </size> | 249 | </size> |
246 | </property> | 250 | </property> |
247 | </spacer> | 251 | </spacer> |
248 | </vbox> | 252 | </vbox> |
249 | </widget> | 253 | </widget> |
250 | <widget> | 254 | <widget> |
251 | <class>QWidget</class> | 255 | <class>QWidget</class> |
252 | <property stdset="1"> | 256 | <property stdset="1"> |
253 | <name>name</name> | 257 | <name>name</name> |
254 | <cstring>WepPage</cstring> | 258 | <cstring>WepPage</cstring> |
255 | </property> | 259 | </property> |
256 | <attribute> | 260 | <attribute> |
257 | <name>title</name> | 261 | <name>title</name> |
258 | <string>Wep</string> | 262 | <string>Wep</string> |
259 | </attribute> | 263 | </attribute> |
260 | <grid> | 264 | <vbox> |
261 | <property stdset="1"> | 265 | <property stdset="1"> |
262 | <name>margin</name> | 266 | <name>margin</name> |
263 | <number>11</number> | 267 | <number>11</number> |
264 | </property> | 268 | </property> |
265 | <property stdset="1"> | 269 | <property stdset="1"> |
266 | <name>spacing</name> | 270 | <name>spacing</name> |
267 | <number>6</number> | 271 | <number>6</number> |
268 | </property> | 272 | </property> |
269 | <widget row="2" column="0" rowspan="1" colspan="2" > | 273 | <widget> |
274 | <class>QCheckBox</class> | ||
275 | <property stdset="1"> | ||
276 | <name>name</name> | ||
277 | <cstring>wepEnabled</cstring> | ||
278 | </property> | ||
279 | <property stdset="1"> | ||
280 | <name>text</name> | ||
281 | <string>Enable Wep</string> | ||
282 | </property> | ||
283 | </widget> | ||
284 | <widget> | ||
285 | <class>QButtonGroup</class> | ||
286 | <property stdset="1"> | ||
287 | <name>name</name> | ||
288 | <cstring>ButtonGroup43</cstring> | ||
289 | </property> | ||
290 | <property stdset="1"> | ||
291 | <name>enabled</name> | ||
292 | <bool>false</bool> | ||
293 | </property> | ||
294 | <property stdset="1"> | ||
295 | <name>title</name> | ||
296 | <string>Authentication Type</string> | ||
297 | </property> | ||
298 | <hbox> | ||
299 | <property stdset="1"> | ||
300 | <name>margin</name> | ||
301 | <number>11</number> | ||
302 | </property> | ||
303 | <property stdset="1"> | ||
304 | <name>spacing</name> | ||
305 | <number>6</number> | ||
306 | </property> | ||
307 | <widget> | ||
308 | <class>QRadioButton</class> | ||
309 | <property stdset="1"> | ||
310 | <name>name</name> | ||
311 | <cstring>authOpen</cstring> | ||
312 | </property> | ||
313 | <property stdset="1"> | ||
314 | <name>text</name> | ||
315 | <string>Open System</string> | ||
316 | </property> | ||
317 | <property stdset="1"> | ||
318 | <name>checked</name> | ||
319 | <bool>true</bool> | ||
320 | </property> | ||
321 | </widget> | ||
322 | <widget> | ||
323 | <class>QRadioButton</class> | ||
324 | <property stdset="1"> | ||
325 | <name>name</name> | ||
326 | <cstring>authShared</cstring> | ||
327 | </property> | ||
328 | <property stdset="1"> | ||
329 | <name>text</name> | ||
330 | <string>Shared Key</string> | ||
331 | </property> | ||
332 | </widget> | ||
333 | </hbox> | ||
334 | </widget> | ||
335 | <widget> | ||
270 | <class>QButtonGroup</class> | 336 | <class>QButtonGroup</class> |
271 | <property stdset="1"> | 337 | <property stdset="1"> |
272 | <name>name</name> | 338 | <name>name</name> |
273 | <cstring>ButtonGroup44</cstring> | 339 | <cstring>ButtonGroup44</cstring> |
274 | </property> | 340 | </property> |
275 | <property stdset="1"> | 341 | <property stdset="1"> |
276 | <name>enabled</name> | 342 | <name>enabled</name> |
277 | <bool>false</bool> | 343 | <bool>false</bool> |
278 | </property> | 344 | </property> |
279 | <property stdset="1"> | 345 | <property stdset="1"> |
280 | <name>title</name> | 346 | <name>title</name> |
281 | <string>Key Setting</string> | 347 | <string>Key Setting</string> |
282 | </property> | 348 | </property> |
283 | <grid> | 349 | <grid> |
284 | <property stdset="1"> | 350 | <property stdset="1"> |
285 | <name>margin</name> | 351 | <name>margin</name> |
286 | <number>11</number> | 352 | <number>11</number> |
287 | </property> | 353 | </property> |
288 | <property stdset="1"> | 354 | <property stdset="1"> |
289 | <name>spacing</name> | 355 | <name>spacing</name> |
290 | <number>6</number> | 356 | <number>6</number> |
291 | </property> | 357 | </property> |
292 | <widget row="0" column="1" > | 358 | <widget row="0" column="1" > |
293 | <class>QLineEdit</class> | 359 | <class>QLineEdit</class> |
294 | <property stdset="1"> | 360 | <property stdset="1"> |
295 | <name>name</name> | 361 | <name>name</name> |
296 | <cstring>keyLineEdit0</cstring> | 362 | <cstring>keyLineEdit0</cstring> |
297 | </property> | 363 | </property> |
298 | </widget> | 364 | </widget> |
299 | <widget row="1" column="1" > | 365 | <widget row="1" column="1" > |
300 | <class>QLineEdit</class> | 366 | <class>QLineEdit</class> |
301 | <property stdset="1"> | 367 | <property stdset="1"> |
302 | <name>name</name> | 368 | <name>name</name> |
303 | <cstring>keyLineEdit1</cstring> | 369 | <cstring>keyLineEdit1</cstring> |
304 | </property> | 370 | </property> |
305 | </widget> | 371 | </widget> |
306 | <widget row="2" column="1" > | 372 | <widget row="2" column="1" > |
307 | <class>QLineEdit</class> | 373 | <class>QLineEdit</class> |
308 | <property stdset="1"> | 374 | <property stdset="1"> |
309 | <name>name</name> | 375 | <name>name</name> |
310 | <cstring>keyLineEdit2</cstring> | 376 | <cstring>keyLineEdit2</cstring> |
311 | </property> | 377 | </property> |
312 | </widget> | 378 | </widget> |
313 | <widget row="3" column="1" > | 379 | <widget row="3" column="1" > |
314 | <class>QLineEdit</class> | 380 | <class>QLineEdit</class> |
315 | <property stdset="1"> | 381 | <property stdset="1"> |
316 | <name>name</name> | 382 | <name>name</name> |
317 | <cstring>keyLineEdit3</cstring> | 383 | <cstring>keyLineEdit3</cstring> |
@@ -322,251 +388,130 @@ | |||
322 | <property stdset="1"> | 388 | <property stdset="1"> |
323 | <name>name</name> | 389 | <name>name</name> |
324 | <cstring>keyRadio0</cstring> | 390 | <cstring>keyRadio0</cstring> |
325 | </property> | 391 | </property> |
326 | <property stdset="1"> | 392 | <property stdset="1"> |
327 | <name>text</name> | 393 | <name>text</name> |
328 | <string>Key 1</string> | 394 | <string>Key 1</string> |
329 | </property> | 395 | </property> |
330 | <property stdset="1"> | 396 | <property stdset="1"> |
331 | <name>checked</name> | 397 | <name>checked</name> |
332 | <bool>true</bool> | 398 | <bool>true</bool> |
333 | </property> | 399 | </property> |
334 | </widget> | 400 | </widget> |
335 | <widget row="1" column="0" > | 401 | <widget row="1" column="0" > |
336 | <class>QRadioButton</class> | 402 | <class>QRadioButton</class> |
337 | <property stdset="1"> | 403 | <property stdset="1"> |
338 | <name>name</name> | 404 | <name>name</name> |
339 | <cstring>keyRadio1</cstring> | 405 | <cstring>keyRadio1</cstring> |
340 | </property> | 406 | </property> |
341 | <property stdset="1"> | 407 | <property stdset="1"> |
342 | <name>text</name> | 408 | <name>text</name> |
343 | <string>Key 2</string> | 409 | <string>Key 2</string> |
344 | </property> | 410 | </property> |
345 | </widget> | 411 | </widget> |
346 | <widget row="2" column="0" > | 412 | <widget row="2" column="0" > |
347 | <class>QRadioButton</class> | 413 | <class>QRadioButton</class> |
348 | <property stdset="1"> | 414 | <property stdset="1"> |
349 | <name>name</name> | 415 | <name>name</name> |
350 | <cstring>keyRadio2</cstring> | 416 | <cstring>keyRadio2</cstring> |
351 | </property> | 417 | </property> |
352 | <property stdset="1"> | 418 | <property stdset="1"> |
353 | <name>text</name> | 419 | <name>text</name> |
354 | <string>Key 3</string> | 420 | <string>Key 3</string> |
355 | </property> | 421 | </property> |
356 | </widget> | 422 | </widget> |
357 | <widget row="3" column="0" > | 423 | <widget row="3" column="0" > |
358 | <class>QRadioButton</class> | 424 | <class>QRadioButton</class> |
359 | <property stdset="1"> | 425 | <property stdset="1"> |
360 | <name>name</name> | 426 | <name>name</name> |
361 | <cstring>keyRadio3</cstring> | 427 | <cstring>keyRadio3</cstring> |
362 | </property> | 428 | </property> |
363 | <property stdset="1"> | 429 | <property stdset="1"> |
364 | <name>text</name> | 430 | <name>text</name> |
365 | <string>Key 4</string> | 431 | <string>Key 4</string> |
366 | </property> | 432 | </property> |
367 | </widget> | 433 | </widget> |
368 | </grid> | 434 | </grid> |
369 | </widget> | 435 | </widget> |
370 | <widget row="1" column="0" > | 436 | <spacer> |
371 | <class>QButtonGroup</class> | ||
372 | <property stdset="1"> | ||
373 | <name>name</name> | ||
374 | <cstring>ButtonGroup42</cstring> | ||
375 | </property> | ||
376 | <property stdset="1"> | ||
377 | <name>enabled</name> | ||
378 | <bool>false</bool> | ||
379 | </property> | ||
380 | <property stdset="1"> | ||
381 | <name>title</name> | ||
382 | <string>Key Length</string> | ||
383 | </property> | ||
384 | <vbox> | ||
385 | <property stdset="1"> | ||
386 | <name>margin</name> | ||
387 | <number>11</number> | ||
388 | </property> | ||
389 | <property stdset="1"> | ||
390 | <name>spacing</name> | ||
391 | <number>6</number> | ||
392 | </property> | ||
393 | <widget> | ||
394 | <class>QRadioButton</class> | ||
395 | <property stdset="1"> | ||
396 | <name>name</name> | ||
397 | <cstring>key40</cstring> | ||
398 | </property> | ||
399 | <property stdset="1"> | ||
400 | <name>text</name> | ||
401 | <string>40 Bits</string> | ||
402 | </property> | ||
403 | <property stdset="1"> | ||
404 | <name>checked</name> | ||
405 | <bool>true</bool> | ||
406 | </property> | ||
407 | </widget> | ||
408 | <widget> | ||
409 | <class>QRadioButton</class> | ||
410 | <property stdset="1"> | ||
411 | <name>name</name> | ||
412 | <cstring>key128</cstring> | ||
413 | </property> | ||
414 | <property stdset="1"> | ||
415 | <name>text</name> | ||
416 | <string>128 Bits</string> | ||
417 | </property> | ||
418 | </widget> | ||
419 | </vbox> | ||
420 | </widget> | ||
421 | <widget row="1" column="1" > | ||
422 | <class>QButtonGroup</class> | ||
423 | <property stdset="1"> | ||
424 | <name>name</name> | ||
425 | <cstring>ButtonGroup43</cstring> | ||
426 | </property> | ||
427 | <property stdset="1"> | ||
428 | <name>enabled</name> | ||
429 | <bool>false</bool> | ||
430 | </property> | ||
431 | <property stdset="1"> | ||
432 | <name>title</name> | ||
433 | <string>Authentication Type</string> | ||
434 | </property> | ||
435 | <vbox> | ||
436 | <property stdset="1"> | ||
437 | <name>margin</name> | ||
438 | <number>11</number> | ||
439 | </property> | ||
440 | <property stdset="1"> | ||
441 | <name>spacing</name> | ||
442 | <number>6</number> | ||
443 | </property> | ||
444 | <widget> | ||
445 | <class>QRadioButton</class> | ||
446 | <property stdset="1"> | ||
447 | <name>name</name> | ||
448 | <cstring>authOpen</cstring> | ||
449 | </property> | ||
450 | <property stdset="1"> | ||
451 | <name>text</name> | ||
452 | <string>Open System</string> | ||
453 | </property> | ||
454 | <property stdset="1"> | ||
455 | <name>checked</name> | ||
456 | <bool>true</bool> | ||
457 | </property> | ||
458 | </widget> | ||
459 | <widget> | ||
460 | <class>QRadioButton</class> | ||
461 | <property stdset="1"> | ||
462 | <name>name</name> | ||
463 | <cstring>authShared</cstring> | ||
464 | </property> | ||
465 | <property stdset="1"> | ||
466 | <name>text</name> | ||
467 | <string>Shared Key</string> | ||
468 | </property> | ||
469 | </widget> | ||
470 | </vbox> | ||
471 | </widget> | ||
472 | <spacer row="3" column="1" > | ||
473 | <property> | 437 | <property> |
474 | <name>name</name> | 438 | <name>name</name> |
475 | <cstring>Spacer30</cstring> | 439 | <cstring>Spacer30</cstring> |
476 | </property> | 440 | </property> |
477 | <property stdset="1"> | 441 | <property stdset="1"> |
478 | <name>orientation</name> | 442 | <name>orientation</name> |
479 | <enum>Vertical</enum> | 443 | <enum>Vertical</enum> |
480 | </property> | 444 | </property> |
481 | <property stdset="1"> | 445 | <property stdset="1"> |
482 | <name>sizeType</name> | 446 | <name>sizeType</name> |
483 | <enum>Expanding</enum> | 447 | <enum>Expanding</enum> |
484 | </property> | 448 | </property> |
485 | <property> | 449 | <property> |
486 | <name>sizeHint</name> | 450 | <name>sizeHint</name> |
487 | <size> | 451 | <size> |
488 | <width>20</width> | 452 | <width>20</width> |
489 | <height>20</height> | 453 | <height>20</height> |
490 | </size> | 454 | </size> |
491 | </property> | 455 | </property> |
492 | </spacer> | 456 | </spacer> |
493 | <widget row="0" column="0" rowspan="1" colspan="2" > | 457 | </vbox> |
494 | <class>QCheckBox</class> | ||
495 | <property stdset="1"> | ||
496 | <name>name</name> | ||
497 | <cstring>wepEnabled</cstring> | ||
498 | </property> | ||
499 | <property stdset="1"> | ||
500 | <name>text</name> | ||
501 | <string>Enable Wep</string> | ||
502 | </property> | ||
503 | </widget> | ||
504 | </grid> | ||
505 | </widget> | 458 | </widget> |
506 | </widget> | 459 | </widget> |
507 | </vbox> | 460 | </vbox> |
508 | </widget> | 461 | </widget> |
509 | <connections> | 462 | <connections> |
510 | <connection> | 463 | <connection> |
511 | <sender>essSpecific</sender> | 464 | <sender>essSpecific</sender> |
512 | <signal>toggled(bool)</signal> | 465 | <signal>toggled(bool)</signal> |
513 | <receiver>essSpecificLineEdit</receiver> | 466 | <receiver>essSpecificLineEdit</receiver> |
514 | <slot>setEnabled(bool)</slot> | 467 | <slot>setEnabled(bool)</slot> |
515 | </connection> | 468 | </connection> |
516 | <connection> | 469 | <connection> |
517 | <sender>network802</sender> | 470 | <sender>network802</sender> |
518 | <signal>clicked()</signal> | 471 | <signal>clicked()</signal> |
519 | <receiver>essSpecific</receiver> | 472 | <receiver>essSpecific</receiver> |
520 | <slot>animateClick()</slot> | 473 | <slot>animateClick()</slot> |
521 | </connection> | 474 | </connection> |
522 | <connection> | 475 | <connection> |
523 | <sender>network802</sender> | 476 | <sender>network802</sender> |
524 | <signal>toggled(bool)</signal> | 477 | <signal>toggled(bool)</signal> |
525 | <receiver>TextLabel2</receiver> | 478 | <receiver>TextLabel2</receiver> |
526 | <slot>setEnabled(bool)</slot> | 479 | <slot>setEnabled(bool)</slot> |
527 | </connection> | 480 | </connection> |
528 | <connection> | 481 | <connection> |
529 | <sender>network802</sender> | 482 | <sender>network802</sender> |
530 | <signal>toggled(bool)</signal> | 483 | <signal>toggled(bool)</signal> |
531 | <receiver>networkChannel</receiver> | 484 | <receiver>networkChannel</receiver> |
532 | <slot>setEnabled(bool)</slot> | 485 | <slot>setEnabled(bool)</slot> |
533 | </connection> | 486 | </connection> |
534 | <connection> | 487 | <connection> |
535 | <sender>wepEnabled</sender> | 488 | <sender>wepEnabled</sender> |
536 | <signal>toggled(bool)</signal> | 489 | <signal>toggled(bool)</signal> |
537 | <receiver>ButtonGroup42</receiver> | ||
538 | <slot>setEnabled(bool)</slot> | ||
539 | </connection> | ||
540 | <connection> | ||
541 | <sender>wepEnabled</sender> | ||
542 | <signal>toggled(bool)</signal> | ||
543 | <receiver>ButtonGroup43</receiver> | 490 | <receiver>ButtonGroup43</receiver> |
544 | <slot>setEnabled(bool)</slot> | 491 | <slot>setEnabled(bool)</slot> |
545 | </connection> | 492 | </connection> |
546 | <connection> | 493 | <connection> |
547 | <sender>wepEnabled</sender> | 494 | <sender>wepEnabled</sender> |
548 | <signal>toggled(bool)</signal> | 495 | <signal>toggled(bool)</signal> |
549 | <receiver>ButtonGroup44</receiver> | 496 | <receiver>ButtonGroup44</receiver> |
550 | <slot>setEnabled(bool)</slot> | 497 | <slot>setEnabled(bool)</slot> |
551 | </connection> | 498 | </connection> |
552 | </connections> | 499 | </connections> |
553 | <tabstops> | 500 | <tabstops> |
554 | <tabstop>tabWidget</tabstop> | 501 | <tabstop>tabWidget</tabstop> |
555 | <tabstop>essNon</tabstop> | 502 | <tabstop>essNon</tabstop> |
556 | <tabstop>essSpecificLineEdit</tabstop> | 503 | <tabstop>essSpecificLineEdit</tabstop> |
557 | <tabstop>networkInfrastructure</tabstop> | 504 | <tabstop>networkInfrastructure</tabstop> |
558 | <tabstop>networkChannel</tabstop> | 505 | <tabstop>networkChannel</tabstop> |
559 | <tabstop>key40</tabstop> | ||
560 | <tabstop>key128</tabstop> | ||
561 | <tabstop>authOpen</tabstop> | 506 | <tabstop>authOpen</tabstop> |
562 | <tabstop>authShared</tabstop> | 507 | <tabstop>authShared</tabstop> |
563 | <tabstop>keyRadio0</tabstop> | 508 | <tabstop>keyRadio0</tabstop> |
564 | <tabstop>keyLineEdit0</tabstop> | 509 | <tabstop>keyLineEdit0</tabstop> |
565 | <tabstop>keyRadio1</tabstop> | 510 | <tabstop>keyRadio1</tabstop> |
566 | <tabstop>keyLineEdit1</tabstop> | 511 | <tabstop>keyLineEdit1</tabstop> |
567 | <tabstop>keyRadio2</tabstop> | 512 | <tabstop>keyRadio2</tabstop> |
568 | <tabstop>keyLineEdit2</tabstop> | 513 | <tabstop>keyLineEdit2</tabstop> |
569 | <tabstop>keyRadio3</tabstop> | 514 | <tabstop>keyRadio3</tabstop> |
570 | <tabstop>keyLineEdit3</tabstop> | 515 | <tabstop>keyLineEdit3</tabstop> |
571 | </tabstops> | 516 | </tabstops> |
572 | </UI> | 517 | </UI> |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 01d7e36..689eae2 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -1,247 +1,232 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | #include "interfacesetupimp.h" | ||
2 | 3 | ||
3 | /* Config class */ | ||
4 | #include <qpe/config.h> | ||
5 | /* Global namespace */ | ||
6 | #include <qpe/global.h> | ||
7 | /* system() */ | ||
8 | #include <stdlib.h> | ||
9 | #include <qfile.h> | 4 | #include <qfile.h> |
10 | #include <qdir.h> | 5 | #include <qdir.h> |
11 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
12 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
13 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
14 | #include <qspinbox.h> | 9 | #include <qspinbox.h> |
15 | #include <qradiobutton.h> | 10 | #include <qradiobutton.h> |
16 | #include <qcheckbox.h> | 11 | #include <qcheckbox.h> |
17 | #include <qregexp.h> | ||
18 | #include <qpe/config.h> | ||
19 | #include <qtabwidget.h> | 12 | #include <qtabwidget.h> |
20 | #include "interfacesetupimp.h" | ||
21 | 13 | ||
22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ | 14 | /* system() */ |
23 | config = new Config("wireless"); | 15 | #include <stdlib.h> |
24 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);//, Qt::WDestructiveClose); | ||
25 | //configure->setProfile(currentProfile); | ||
26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | ||
27 | 16 | ||
28 | readConfig(); | 17 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
29 | 18 | ||
30 | } | 19 | /** |
20 | * Constructor, read in the wireless.opts file for parsing later. | ||
21 | */ | ||
22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl), currentProfile("*") { | ||
23 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i); | ||
24 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | ||
31 | 25 | ||
32 | WLANImp::~WLANImp( ){ | 26 | // Read in the config file. |
33 | delete config; | 27 | QString wlanFile = WIRELESS_OPTS; |
28 | QFile file(wlanFile); | ||
29 | if (file.open(IO_ReadOnly)){ | ||
30 | QTextStream stream( &file ); | ||
31 | QString line = ""; | ||
32 | while ( !stream.eof() ) { | ||
33 | line += stream.readLine(); | ||
34 | line += "\n"; | ||
35 | } | ||
36 | file.close(); | ||
37 | settingsFileText = QStringList::split("\n", line, true); | ||
38 | parseSettingFile(); | ||
39 | } | ||
40 | else | ||
41 | qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); | ||
34 | } | 42 | } |
35 | 43 | ||
44 | /** | ||
45 | * Change the profile for both wireless settings and network settings. | ||
46 | */ | ||
36 | void WLANImp::setProfile(QString &profile){ | 47 | void WLANImp::setProfile(QString &profile){ |
37 | interfaceSetup->setProfile(profile); | 48 | interfaceSetup->setProfile(profile); |
49 | parseSettingFile(); | ||
38 | } | 50 | } |
39 | 51 | ||
40 | void WLANImp::readConfig() | 52 | /** |
41 | { | 53 | * Parses the settings file that was read in and gets any setting from it. |
42 | qWarning( "WLANImp::readConfig() called." ); | 54 | */ |
43 | config->setGroup( "Properties" ); | 55 | void WLANImp::parseSettingFile(){ |
44 | QString ssid = config->readEntry( "SSID", "any" ); | 56 | bool foundCase = false; |
45 | if( ssid == "any" || ssid == "ANY" ){ | 57 | bool found = false; |
46 | essNon->setChecked( true ); | 58 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
47 | } else { | 59 | QString line = (*it).simplifyWhiteSpace(); |
48 | essSpecific->setChecked( true ); | 60 | if(line.contains("case")) |
49 | essSpecificLineEdit->setText( ssid ); | 61 | foundCase = true; |
50 | } | 62 | // See if we found our scheme to write or the sceme couldn't be found |
51 | QString mode = config->readEntry( "Mode", "Managed" ); | 63 | if((foundCase && line.contains("esac")) || |
52 | if( mode == "adhoc" ) { | 64 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) |
53 | network802->setChecked( true ); | 65 | found = true; |
54 | } else { | 66 | |
55 | networkInfrastructure->setChecked( true ); | 67 | if(line.contains(";;")) |
56 | } | 68 | found = false; |
57 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); | 69 | if(found){ |
58 | // config->readEntry( "RATE", "auto" ); | 70 | // write out scheme |
59 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 71 | if(line.contains("ESSID=")){ |
60 | config->readEntry( "AuthType", "opensystem" ); | 72 | QString id = line.mid(line.find("ESSID=")+6, line.length()); |
61 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 73 | if(id == "any"){ |
62 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 74 | essNon->setChecked(true); |
63 | switch( defaultkey ){ | 75 | essSpecific->setChecked(false); |
64 | case 0: | 76 | }else{ |
65 | keyRadio0->setChecked( true ); | 77 | essSpecific->setChecked(true); |
66 | break; | 78 | essSpecificLineEdit->setText(id); |
67 | case 1: | 79 | essNon->setChecked(false); |
68 | keyRadio1->setChecked( true ); | 80 | } |
69 | break; | 81 | } |
70 | case 2: | 82 | if(line.contains("MODE=")){ |
71 | keyRadio2->setChecked( true ); | 83 | QString mode = line.mid(line.find("MODE=")+5, line.length()); |
72 | break; | 84 | if(mode == "Managed"){ |
73 | case 3: | 85 | network802->setChecked( false ); |
74 | keyRadio3->setChecked( true ); | 86 | networkInfrastructure->setChecked( true ); |
75 | break; | 87 | } |
88 | else{ | ||
89 | network802->setChecked( true ); | ||
90 | networkInfrastructure->setChecked( false ); | ||
91 | } | ||
92 | } | ||
93 | if(line.contains("KEY=")){ | ||
94 | line.at(0) != '#' ? wepEnabled->setChecked(true) : wepEnabled->setChecked(false); | ||
95 | int s = line.find("KEY="); | ||
96 | line = line.mid(s+4, line.length()); | ||
97 | // Find first Key | ||
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); | ||
124 | authShared->setChecked(false); | ||
125 | } | ||
126 | else{ | ||
127 | authOpen->setChecked(false); | ||
128 | authShared->setChecked(true); | ||
129 | } | ||
130 | } | ||
131 | if(line.contains("CHANNEL=")){ | ||
132 | networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); | ||
133 | } | ||
76 | } | 134 | } |
77 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); | 135 | } |
78 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); | ||
79 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); | ||
80 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); | ||
81 | return; | ||
82 | } | 136 | } |
83 | 137 | ||
84 | bool WLANImp::writeConfig() | 138 | /** |
85 | { | 139 | * Saves settings to the wireless.opts file using the current profile |
86 | qWarning( "WLANImp::writeConfig() called." ); | 140 | */ |
87 | config->setGroup( "Properties" ); | 141 | void WLANImp::changeAndSaveSettingFile(){ |
88 | if( essNon->isChecked() ) { | 142 | QString wlanFile = WIRELESS_OPTS; |
89 | config->writeEntry( "SSID", "any" ); | 143 | QFile::remove(wlanFile); |
90 | } else { | 144 | QFile file(wlanFile); |
91 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); | 145 | |
92 | } | 146 | if (!file.open(IO_ReadWrite)){ |
93 | if( networkInfrastructure->isChecked() ){ | 147 | qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); |
94 | config->writeEntry( "Mode", "Managed" ); | 148 | return; |
95 | } else if( network802->isChecked() ){ | 149 | } |
96 | config->writeEntry( "Mode", "adhoc" ); | 150 | |
97 | } | 151 | QTextStream stream( &file ); |
98 | config->writeEntry( "CHANNEL", networkChannel->value() ); | 152 | bool foundCase = false; |
99 | // config->readEntry( "RATE", "auto" ); | 153 | bool found = false; |
100 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); | 154 | bool output = true; |
101 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); | 155 | for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { |
102 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); | 156 | QString line = (*it).simplifyWhiteSpace(); |
103 | if( keyRadio0->isChecked() ){ | 157 | if(line.contains("case")) |
104 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); | 158 | foundCase = true; |
105 | } else if( keyRadio1->isChecked() ){ | 159 | // See if we found our scheme to write or the sceme couldn't be found |
106 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); | 160 | if((foundCase && line.contains("esac") && !found) || |
107 | } else if( keyRadio2->isChecked() ){ | 161 | (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ |
108 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); | 162 | // write out scheme |
109 | } else if( keyRadio3->isChecked() ){ | 163 | found = true; |
110 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); | 164 | output = false; |
165 | |||
166 | if(!line.contains("esac")) | ||
167 | stream << line << "\n"; | ||
168 | |||
169 | stream << "\tESSID=" << (essNon->isChecked() == true ? QString("any") : essSpecificLineEdit->text()) << '\n'; | ||
170 | stream << "\tMODE=" << (networkInfrastructure->isChecked() == true ? "Managed" : "AdHoc") << '\n'; | ||
171 | if(!wepEnabled->isChecked()) | ||
172 | stream << "#"; | ||
173 | stream << "\tKEY="; | ||
174 | stream << keyLineEdit0->text() << " [1]"; | ||
175 | stream << keyLineEdit1->text() << " [2]"; | ||
176 | stream << keyLineEdit2->text() << " [3]"; | ||
177 | stream << keyLineEdit3->text() << " [4]"; | ||
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"; | ||
184 | stream << "\n"; | ||
185 | stream << "\tCHANNEL=" << networkChannel->value() << "\n"; | ||
186 | stream << "\tRATE=auto\n"; | ||
187 | if(line.contains("esac")) | ||
188 | stream << line << "\n"; | ||
111 | } | 189 | } |
112 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 190 | if(line.contains(";;")) |
113 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 191 | output = true; |
114 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 192 | if(output) |
115 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 193 | stream << (*it) << '\n'; |
116 | return writeWirelessOpts( ); | 194 | } |
195 | file.close(); | ||
117 | } | 196 | } |
118 | 197 | ||
119 | /** | 198 | /** |
199 | * Check to see if the current config is valid | ||
200 | * Save wireless.opts, save interfaces | ||
120 | */ | 201 | */ |
121 | void WLANImp::accept() | 202 | void WLANImp::accept(){ |
122 | { | 203 | if(wepEnabled->isChecked()){ |
123 | if ( writeConfig() ){ | 204 | if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) |
124 | if(interfaceSetup->saveChanges()) | 205 | QMessageBox::information(this, "", "Please enter a key for WEP.", QMessageBox::Ok); |
125 | QDialog::accept(); | 206 | return; |
126 | } | 207 | } |
208 | |||
209 | // Ok settings are good here, save | ||
210 | changeAndSaveSettingFile(); | ||
211 | |||
212 | // Try to save the interfaces settings. | ||
213 | if(!interfaceSetup->saveChanges()) | ||
214 | return; | ||
215 | |||
216 | // Restart the device now that the settings have changed | ||
217 | QString initpath; | ||
218 | if( QDir("/etc/rc.d/init.d").exists() ) | ||
219 | initpath = "/etc/rc.d/init.d"; | ||
220 | else if( QDir("/etc/init.d").exists() ) | ||
221 | initpath = "/etc/init.d"; | ||
222 | if( initpath ) | ||
223 | system(QString("%1/pcmcia stop").arg(initpath)); | ||
224 | if( initpath ) | ||
225 | system(QString("%1/pcmcia start").arg(initpath)); | ||
226 | |||
227 | // Close out the dialog | ||
228 | QDialog::accept(); | ||
127 | } | 229 | } |
128 | 230 | ||
129 | bool WLANImp::writeWirelessOpts( QString scheme ) | 231 | // wlanimp.cpp |
130 | { | ||
131 | qWarning( "WLANImp::writeWirelessOpts entered." ); | ||
132 | QString prev = "/etc/pcmcia/wireless.opts"; | ||
133 | QFile prevFile(prev); | ||
134 | if ( !prevFile.open( IO_ReadOnly ) ) | ||
135 | return false; | ||
136 | |||
137 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | ||
138 | QFile tmpFile(tmp); | ||
139 | if ( !tmpFile.open( IO_WriteOnly ) ) | ||
140 | return false; | ||
141 | |||
142 | bool retval = true; | ||
143 | |||
144 | QTextStream in( &prevFile ); | ||
145 | QTextStream out( &tmpFile ); | ||
146 | |||
147 | config->setGroup("Properties"); | ||
148 | |||
149 | QString line; | ||
150 | bool found=false; | ||
151 | bool done=false; | ||
152 | while ( !in.atEnd() ) { | ||
153 | QString line = in.readLine(); | ||
154 | QString wline = line.simplifyWhiteSpace(); | ||
155 | if ( !done ) { | ||
156 | if ( found ) { | ||
157 | // skip existing entry for this scheme, and write our own. | ||
158 | if ( wline == ";;" ) { | ||
159 | found = false; | ||
160 | continue; | ||
161 | } else { | ||
162 | continue; | ||
163 | } | ||
164 | } else { | ||
165 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | ||
166 | found=true; | ||
167 | continue; // skip this line | ||
168 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | ||
169 | // end - add new entry | ||
170 | // Not all fields have a GUI, but all are supported | ||
171 | // in the letwork configuration files. | ||
172 | static const char* txtfields[] = { | ||
173 | 0 | ||
174 | }; | ||
175 | QString readmode = config->readEntry( "Mode", "Managed" ); | ||
176 | QString mode; | ||
177 | if( readmode == "Managed" ){ | ||
178 | mode = readmode; | ||
179 | } else if( readmode == "adhoc" ){ | ||
180 | mode = "Ad-Hoc"; | ||
181 | } | ||
182 | QString key; | ||
183 | if( wepEnabled->isChecked() ){ | ||
184 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | ||
185 | switch( defaultkey ){ | ||
186 | case 0: | ||
187 | key += keyLineEdit0->text(); | ||
188 | break; | ||
189 | case 1: | ||
190 | key += keyLineEdit1->text(); | ||
191 | break; | ||
192 | case 2: | ||
193 | key += keyLineEdit2->text(); | ||
194 | break; | ||
195 | case 3: | ||
196 | key += keyLineEdit3->text(); | ||
197 | break; | ||
198 | } | ||
199 | if( config->readEntry( "AuthType", "opensystem" ) == "opensystem") | ||
200 | key += " open"; | ||
201 | } | ||
202 | out << scheme << ",*,*,*)" << "\n" | ||
203 | << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n" | ||
204 | << " MODE=" << mode << "\n" | ||
205 | << " KEY=" << Global::shellQuote( key ) << "\n" | ||
206 | << " RATE=" << "auto" << "\n" | ||
207 | ; | ||
208 | if( mode != "Managed" ) | ||
209 | out << " CHANNEL=" << config->readNumEntry( "CHANNEL", 1 ) << "\n"; | ||
210 | const char** f = txtfields; | ||
211 | while (*f) { | ||
212 | out << " " << *f << "=" << config->readEntry(*f,"") << "\n"; | ||
213 | ++f; | ||
214 | } | ||
215 | out << " ;;\n"; | ||
216 | done = true; | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | out << line << "\n"; | ||
221 | } | ||
222 | 232 | ||
223 | prevFile.close(); | ||
224 | tmpFile.close(); | ||
225 | QString initpath; | ||
226 | //system("cardctl suspend"); | ||
227 | if( QDir("/etc/rc.d/init.d").exists() ){ | ||
228 | initpath = "/etc/rc.d/init.d"; | ||
229 | } else if( QDir("/etc/init.d").exists() ){ | ||
230 | initpath = "/etc/init.d"; | ||
231 | } | ||
232 | if( initpath ) | ||
233 | system(QString("%1/pcmcia stop").arg(initpath)); | ||
234 | |||
235 | if( system( "mv " + tmp + " " + prev ) ) | ||
236 | retval = false; | ||
237 | //#ifdef USE_SCHEMES | ||
238 | // if ( retval ) | ||
239 | //SchemeChanger::changeScheme(scheme); | ||
240 | //#endif | ||
241 | |||
242 | //system("cardctl resume"); | ||
243 | if( initpath ) | ||
244 | system(QString("%1/pcmcia start").arg(initpath)); | ||
245 | |||
246 | return retval; | ||
247 | } | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h index faa1674..f88e550 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.h +++ b/noncore/settings/networksettings/wlan/wlanimp.h | |||
@@ -1,32 +1,31 @@ | |||
1 | #ifndef WLANIMP_H | 1 | #ifndef WLANIMP_H |
2 | #define WLANIMP_H | 2 | #define WLANIMP_H |
3 | 3 | ||
4 | #include "wlan.h" | 4 | #include "wlan.h" |
5 | #include <qstringlist.h> | ||
5 | 6 | ||
6 | class InterfaceSetupImp; | 7 | class InterfaceSetupImp; |
7 | class Interface; | 8 | class Interface; |
8 | class Config; | 9 | class Config; |
9 | 10 | ||
10 | class WLANImp : public WLAN { | 11 | class WLANImp : public WLAN { |
11 | Q_OBJECT | 12 | Q_OBJECT |
12 | 13 | ||
13 | public: | 14 | public: |
14 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); | 15 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); |
15 | ~WLANImp( ); | ||
16 | void setProfile(QString &profile); | 16 | void setProfile(QString &profile); |
17 | 17 | ||
18 | protected: | 18 | protected: |
19 | void accept(); | 19 | void accept(); |
20 | 20 | ||
21 | private: | 21 | private: |
22 | void readConfig(); | 22 | void parseSettingFile(); |
23 | bool writeConfig(); | 23 | void changeAndSaveSettingFile(); |
24 | bool writeWirelessOpts( QString scheme = "*" ); | 24 | |
25 | bool writeWlanngOpts( QString scheme = "*" ); | ||
26 | Config* config; | ||
27 | InterfaceSetupImp *interfaceSetup; | 25 | InterfaceSetupImp *interfaceSetup; |
28 | 26 | QStringList settingsFileText; | |
27 | QString currentProfile; | ||
29 | }; | 28 | }; |
30 | 29 | ||
31 | #endif | 30 | #endif |
32 | 31 | ||