-rw-r--r-- | noncore/net/networksetup/wlan/wlan.ui | 572 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 235 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 27 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 85 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.h | 38 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlansetup.pro | 12 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlan.ui | 572 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 235 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.h | 27 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 85 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.h | 38 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlansetup.pro | 12 |
12 files changed, 1938 insertions, 0 deletions
diff --git a/noncore/net/networksetup/wlan/wlan.ui b/noncore/net/networksetup/wlan/wlan.ui new file mode 100644 index 0000000..dcacbe8 --- a/dev/null +++ b/noncore/net/networksetup/wlan/wlan.ui | |||
@@ -0,0 +1,572 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>WLAN</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>WLAN</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>254</width> | ||
15 | <height>286</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Wireless LAN Setting</string> | ||
21 | </property> | ||
22 | <property stdset="1"> | ||
23 | <name>sizeGripEnabled</name> | ||
24 | <bool>true</bool> | ||
25 | </property> | ||
26 | <property> | ||
27 | <name>layoutMargin</name> | ||
28 | </property> | ||
29 | <vbox> | ||
30 | <property stdset="1"> | ||
31 | <name>margin</name> | ||
32 | <number>0</number> | ||
33 | </property> | ||
34 | <property stdset="1"> | ||
35 | <name>spacing</name> | ||
36 | <number>6</number> | ||
37 | </property> | ||
38 | <widget> | ||
39 | <class>QTabWidget</class> | ||
40 | <property stdset="1"> | ||
41 | <name>name</name> | ||
42 | <cstring>tabWidget</cstring> | ||
43 | </property> | ||
44 | <property stdset="1"> | ||
45 | <name>enabled</name> | ||
46 | <bool>true</bool> | ||
47 | </property> | ||
48 | <widget> | ||
49 | <class>QWidget</class> | ||
50 | <property stdset="1"> | ||
51 | <name>name</name> | ||
52 | <cstring>ConfigPage</cstring> | ||
53 | </property> | ||
54 | <attribute> | ||
55 | <name>title</name> | ||
56 | <string>Config</string> | ||
57 | </attribute> | ||
58 | <vbox> | ||
59 | <property stdset="1"> | ||
60 | <name>margin</name> | ||
61 | <number>11</number> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>spacing</name> | ||
65 | <number>6</number> | ||
66 | </property> | ||
67 | <widget> | ||
68 | <class>QButtonGroup</class> | ||
69 | <property stdset="1"> | ||
70 | <name>name</name> | ||
71 | <cstring>ButtonGroup45</cstring> | ||
72 | </property> | ||
73 | <property stdset="1"> | ||
74 | <name>title</name> | ||
75 | <string>ESS ID</string> | ||
76 | </property> | ||
77 | <vbox> | ||
78 | <property stdset="1"> | ||
79 | <name>margin</name> | ||
80 | <number>11</number> | ||
81 | </property> | ||
82 | <property stdset="1"> | ||
83 | <name>spacing</name> | ||
84 | <number>6</number> | ||
85 | </property> | ||
86 | <widget> | ||
87 | <class>QRadioButton</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>essNon</cstring> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>text</name> | ||
94 | <string>Non-Spec ESSID: "ANY"</string> | ||
95 | </property> | ||
96 | <property stdset="1"> | ||
97 | <name>checked</name> | ||
98 | <bool>true</bool> | ||
99 | </property> | ||
100 | </widget> | ||
101 | <widget> | ||
102 | <class>QRadioButton</class> | ||
103 | <property stdset="1"> | ||
104 | <name>name</name> | ||
105 | <cstring>essSpecific</cstring> | ||
106 | </property> | ||
107 | <property stdset="1"> | ||
108 | <name>text</name> | ||
109 | <string>Specific ESSID</string> | ||
110 | </property> | ||
111 | </widget> | ||
112 | <widget> | ||
113 | <class>QLineEdit</class> | ||
114 | <property stdset="1"> | ||
115 | <name>name</name> | ||
116 | <cstring>essSpecificLineEdit</cstring> | ||
117 | </property> | ||
118 | <property stdset="1"> | ||
119 | <name>enabled</name> | ||
120 | <bool>false</bool> | ||
121 | </property> | ||
122 | </widget> | ||
123 | </vbox> | ||
124 | </widget> | ||
125 | <widget> | ||
126 | <class>QButtonGroup</class> | ||
127 | <property stdset="1"> | ||
128 | <name>name</name> | ||
129 | <cstring>ButtonGroup46</cstring> | ||
130 | </property> | ||
131 | <property stdset="1"> | ||
132 | <name>title</name> | ||
133 | <string>Network Type</string> | ||
134 | </property> | ||
135 | <grid> | ||
136 | <property stdset="1"> | ||
137 | <name>margin</name> | ||
138 | <number>11</number> | ||
139 | </property> | ||
140 | <property stdset="1"> | ||
141 | <name>spacing</name> | ||
142 | <number>6</number> | ||
143 | </property> | ||
144 | <widget row="0" column="0" rowspan="1" colspan="3" > | ||
145 | <class>QRadioButton</class> | ||
146 | <property stdset="1"> | ||
147 | <name>name</name> | ||
148 | <cstring>networkInfrastructure</cstring> | ||
149 | </property> | ||
150 | <property stdset="1"> | ||
151 | <name>text</name> | ||
152 | <string>Infrastructure</string> | ||
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>checked</name> | ||
156 | <bool>true</bool> | ||
157 | </property> | ||
158 | </widget> | ||
159 | <widget row="2" column="0" > | ||
160 | <class>QLabel</class> | ||
161 | <property stdset="1"> | ||
162 | <name>name</name> | ||
163 | <cstring>TextLabel2</cstring> | ||
164 | </property> | ||
165 | <property stdset="1"> | ||
166 | <name>enabled</name> | ||
167 | <bool>false</bool> | ||
168 | </property> | ||
169 | <property stdset="1"> | ||
170 | <name>text</name> | ||
171 | <string>Channel</string> | ||
172 | </property> | ||
173 | </widget> | ||
174 | <widget row="1" column="0" rowspan="1" colspan="2" > | ||
175 | <class>QRadioButton</class> | ||
176 | <property stdset="1"> | ||
177 | <name>name</name> | ||
178 | <cstring>network802</cstring> | ||
179 | </property> | ||
180 | <property stdset="1"> | ||
181 | <name>text</name> | ||
182 | <string>802.11 Ad-Hoc</string> | ||
183 | </property> | ||
184 | </widget> | ||
185 | <widget row="2" column="1" > | ||
186 | <class>QSpinBox</class> | ||
187 | <property stdset="1"> | ||
188 | <name>name</name> | ||
189 | <cstring>networkChannel</cstring> | ||
190 | </property> | ||
191 | <property stdset="1"> | ||
192 | <name>enabled</name> | ||
193 | <bool>false</bool> | ||
194 | </property> | ||
195 | <property stdset="1"> | ||
196 | <name>maxValue</name> | ||
197 | <number>11</number> | ||
198 | </property> | ||
199 | <property stdset="1"> | ||
200 | <name>minValue</name> | ||
201 | <number>1</number> | ||
202 | </property> | ||
203 | </widget> | ||
204 | <spacer row="2" column="2" > | ||
205 | <property> | ||
206 | <name>name</name> | ||
207 | <cstring>Spacer32</cstring> | ||
208 | </property> | ||
209 | <property stdset="1"> | ||
210 | <name>orientation</name> | ||
211 | <enum>Horizontal</enum> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>sizeType</name> | ||
215 | <enum>Expanding</enum> | ||
216 | </property> | ||
217 | <property> | ||
218 | <name>sizeHint</name> | ||
219 | <size> | ||
220 | <width>20</width> | ||
221 | <height>20</height> | ||
222 | </size> | ||
223 | </property> | ||
224 | </spacer> | ||
225 | </grid> | ||
226 | </widget> | ||
227 | <spacer> | ||
228 | <property> | ||
229 | <name>name</name> | ||
230 | <cstring>Spacer31</cstring> | ||
231 | </property> | ||
232 | <property stdset="1"> | ||
233 | <name>orientation</name> | ||
234 | <enum>Vertical</enum> | ||
235 | </property> | ||
236 | <property stdset="1"> | ||
237 | <name>sizeType</name> | ||
238 | <enum>Expanding</enum> | ||
239 | </property> | ||
240 | <property> | ||
241 | <name>sizeHint</name> | ||
242 | <size> | ||
243 | <width>20</width> | ||
244 | <height>20</height> | ||
245 | </size> | ||
246 | </property> | ||
247 | </spacer> | ||
248 | </vbox> | ||
249 | </widget> | ||
250 | <widget> | ||
251 | <class>QWidget</class> | ||
252 | <property stdset="1"> | ||
253 | <name>name</name> | ||
254 | <cstring>WepPage</cstring> | ||
255 | </property> | ||
256 | <attribute> | ||
257 | <name>title</name> | ||
258 | <string>Wep</string> | ||
259 | </attribute> | ||
260 | <grid> | ||
261 | <property stdset="1"> | ||
262 | <name>margin</name> | ||
263 | <number>11</number> | ||
264 | </property> | ||
265 | <property stdset="1"> | ||
266 | <name>spacing</name> | ||
267 | <number>6</number> | ||
268 | </property> | ||
269 | <widget row="2" column="0" rowspan="1" colspan="2" > | ||
270 | <class>QButtonGroup</class> | ||
271 | <property stdset="1"> | ||
272 | <name>name</name> | ||
273 | <cstring>ButtonGroup44</cstring> | ||
274 | </property> | ||
275 | <property stdset="1"> | ||
276 | <name>enabled</name> | ||
277 | <bool>false</bool> | ||
278 | </property> | ||
279 | <property stdset="1"> | ||
280 | <name>title</name> | ||
281 | <string>Key Setting</string> | ||
282 | </property> | ||
283 | <grid> | ||
284 | <property stdset="1"> | ||
285 | <name>margin</name> | ||
286 | <number>11</number> | ||
287 | </property> | ||
288 | <property stdset="1"> | ||
289 | <name>spacing</name> | ||
290 | <number>6</number> | ||
291 | </property> | ||
292 | <widget row="0" column="1" > | ||
293 | <class>QLineEdit</class> | ||
294 | <property stdset="1"> | ||
295 | <name>name</name> | ||
296 | <cstring>keyLineEdit0</cstring> | ||
297 | </property> | ||
298 | </widget> | ||
299 | <widget row="1" column="1" > | ||
300 | <class>QLineEdit</class> | ||
301 | <property stdset="1"> | ||
302 | <name>name</name> | ||
303 | <cstring>keyLineEdit1</cstring> | ||
304 | </property> | ||
305 | </widget> | ||
306 | <widget row="2" column="1" > | ||
307 | <class>QLineEdit</class> | ||
308 | <property stdset="1"> | ||
309 | <name>name</name> | ||
310 | <cstring>keyLineEdit2</cstring> | ||
311 | </property> | ||
312 | </widget> | ||
313 | <widget row="3" column="1" > | ||
314 | <class>QLineEdit</class> | ||
315 | <property stdset="1"> | ||
316 | <name>name</name> | ||
317 | <cstring>keyLineEdit3</cstring> | ||
318 | </property> | ||
319 | </widget> | ||
320 | <widget row="0" column="0" > | ||
321 | <class>QRadioButton</class> | ||
322 | <property stdset="1"> | ||
323 | <name>name</name> | ||
324 | <cstring>keyRadio0</cstring> | ||
325 | </property> | ||
326 | <property stdset="1"> | ||
327 | <name>text</name> | ||
328 | <string>Key 1</string> | ||
329 | </property> | ||
330 | <property stdset="1"> | ||
331 | <name>checked</name> | ||
332 | <bool>true</bool> | ||
333 | </property> | ||
334 | </widget> | ||
335 | <widget row="1" column="0" > | ||
336 | <class>QRadioButton</class> | ||
337 | <property stdset="1"> | ||
338 | <name>name</name> | ||
339 | <cstring>keyRadio1</cstring> | ||
340 | </property> | ||
341 | <property stdset="1"> | ||
342 | <name>text</name> | ||
343 | <string>Key 2</string> | ||
344 | </property> | ||
345 | </widget> | ||
346 | <widget row="2" column="0" > | ||
347 | <class>QRadioButton</class> | ||
348 | <property stdset="1"> | ||
349 | <name>name</name> | ||
350 | <cstring>keyRadio2</cstring> | ||
351 | </property> | ||
352 | <property stdset="1"> | ||
353 | <name>text</name> | ||
354 | <string>Key 3</string> | ||
355 | </property> | ||
356 | </widget> | ||
357 | <widget row="3" column="0" > | ||
358 | <class>QRadioButton</class> | ||
359 | <property stdset="1"> | ||
360 | <name>name</name> | ||
361 | <cstring>keyRadio3</cstring> | ||
362 | </property> | ||
363 | <property stdset="1"> | ||
364 | <name>text</name> | ||
365 | <string>Key 4</string> | ||
366 | </property> | ||
367 | </widget> | ||
368 | </grid> | ||
369 | </widget> | ||
370 | <widget row="1" column="0" > | ||
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> | ||
474 | <name>name</name> | ||
475 | <cstring>Spacer30</cstring> | ||
476 | </property> | ||
477 | <property stdset="1"> | ||
478 | <name>orientation</name> | ||
479 | <enum>Vertical</enum> | ||
480 | </property> | ||
481 | <property stdset="1"> | ||
482 | <name>sizeType</name> | ||
483 | <enum>Expanding</enum> | ||
484 | </property> | ||
485 | <property> | ||
486 | <name>sizeHint</name> | ||
487 | <size> | ||
488 | <width>20</width> | ||
489 | <height>20</height> | ||
490 | </size> | ||
491 | </property> | ||
492 | </spacer> | ||
493 | <widget row="0" column="0" rowspan="1" colspan="2" > | ||
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> | ||
506 | </widget> | ||
507 | </vbox> | ||
508 | </widget> | ||
509 | <connections> | ||
510 | <connection> | ||
511 | <sender>essSpecific</sender> | ||
512 | <signal>toggled(bool)</signal> | ||
513 | <receiver>essSpecificLineEdit</receiver> | ||
514 | <slot>setEnabled(bool)</slot> | ||
515 | </connection> | ||
516 | <connection> | ||
517 | <sender>network802</sender> | ||
518 | <signal>clicked()</signal> | ||
519 | <receiver>essSpecific</receiver> | ||
520 | <slot>animateClick()</slot> | ||
521 | </connection> | ||
522 | <connection> | ||
523 | <sender>network802</sender> | ||
524 | <signal>toggled(bool)</signal> | ||
525 | <receiver>TextLabel2</receiver> | ||
526 | <slot>setEnabled(bool)</slot> | ||
527 | </connection> | ||
528 | <connection> | ||
529 | <sender>network802</sender> | ||
530 | <signal>toggled(bool)</signal> | ||
531 | <receiver>networkChannel</receiver> | ||
532 | <slot>setEnabled(bool)</slot> | ||
533 | </connection> | ||
534 | <connection> | ||
535 | <sender>wepEnabled</sender> | ||
536 | <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> | ||
544 | <slot>setEnabled(bool)</slot> | ||
545 | </connection> | ||
546 | <connection> | ||
547 | <sender>wepEnabled</sender> | ||
548 | <signal>toggled(bool)</signal> | ||
549 | <receiver>ButtonGroup44</receiver> | ||
550 | <slot>setEnabled(bool)</slot> | ||
551 | </connection> | ||
552 | </connections> | ||
553 | <tabstops> | ||
554 | <tabstop>tabWidget</tabstop> | ||
555 | <tabstop>essNon</tabstop> | ||
556 | <tabstop>essSpecificLineEdit</tabstop> | ||
557 | <tabstop>networkInfrastructure</tabstop> | ||
558 | <tabstop>networkChannel</tabstop> | ||
559 | <tabstop>key40</tabstop> | ||
560 | <tabstop>key128</tabstop> | ||
561 | <tabstop>authOpen</tabstop> | ||
562 | <tabstop>authShared</tabstop> | ||
563 | <tabstop>keyRadio0</tabstop> | ||
564 | <tabstop>keyLineEdit0</tabstop> | ||
565 | <tabstop>keyRadio1</tabstop> | ||
566 | <tabstop>keyLineEdit1</tabstop> | ||
567 | <tabstop>keyRadio2</tabstop> | ||
568 | <tabstop>keyLineEdit2</tabstop> | ||
569 | <tabstop>keyRadio3</tabstop> | ||
570 | <tabstop>keyLineEdit3</tabstop> | ||
571 | </tabstops> | ||
572 | </UI> | ||
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp new file mode 100644 index 0000000..60ffeeb --- a/dev/null +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -0,0 +1,235 @@ | |||
1 | #include "wlanimp.h" | ||
2 | |||
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> | ||
10 | #include <qdir.h> | ||
11 | #include <qtextstream.h> | ||
12 | #include <qmessagebox.h> | ||
13 | #include <qlineedit.h> | ||
14 | #include <qspinbox.h> | ||
15 | #include <qradiobutton.h> | ||
16 | #include <qcheckbox.h> | ||
17 | #include <qregexp.h> | ||
18 | |||
19 | WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){ | ||
20 | readConfig(); | ||
21 | } | ||
22 | |||
23 | void WLANImp::readConfig() | ||
24 | { | ||
25 | qWarning( "WLANImp::readConfig() called." ); | ||
26 | config.setGroup( "Properties" ); | ||
27 | QString ssid = config.readEntry( "SSID", "any" ); | ||
28 | if( ssid == "any" || ssid == "ANY" ){ | ||
29 | essNon->setChecked( TRUE ); | ||
30 | } else { | ||
31 | essSpecific->setChecked( TRUE ); | ||
32 | essSpecificLineEdit->setText( ssid ); | ||
33 | } | ||
34 | QString mode = config.readEntry( "Mode", "Managed" ); | ||
35 | if( mode == "adhoc" ) { | ||
36 | network802->setChecked( TRUE ); | ||
37 | } else { | ||
38 | networkInfrastructure->setChecked( TRUE ); | ||
39 | } | ||
40 | networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) ); | ||
41 | // config.readEntry( "RATE", "auto" ); | ||
42 | config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( TRUE ) : wepEnabled->setChecked( FALSE ); | ||
43 | config.readEntry( "AuthType", "opensystem" ); | ||
44 | config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( TRUE ) : key128->setChecked( TRUE ); | ||
45 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | ||
46 | switch( defaultkey ){ | ||
47 | case 0: | ||
48 | keyRadio0->setChecked( TRUE ); | ||
49 | break; | ||
50 | case 1: | ||
51 | keyRadio1->setChecked( TRUE ); | ||
52 | break; | ||
53 | case 2: | ||
54 | keyRadio2->setChecked( TRUE ); | ||
55 | break; | ||
56 | case 3: | ||
57 | keyRadio3->setChecked( TRUE ); | ||
58 | break; | ||
59 | } | ||
60 | keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" )); | ||
61 | keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" )); | ||
62 | keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" )); | ||
63 | keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" )); | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | bool WLANImp::writeConfig() | ||
68 | { | ||
69 | qWarning( "WLANImp::writeConfig() called." ); | ||
70 | config.setGroup( "Properties" ); | ||
71 | if( essNon->isChecked() ) { | ||
72 | config.writeEntry( "SSID", "any" ); | ||
73 | } else { | ||
74 | config.writeEntry( "SSID", essSpecificLineEdit->text() ); | ||
75 | } | ||
76 | if( networkInfrastructure->isChecked() ){ | ||
77 | config.writeEntry( "Mode", "Managed" ); | ||
78 | } else if( network802->isChecked() ){ | ||
79 | config.writeEntry( "Mode", "adhoc" ); | ||
80 | } | ||
81 | config.writeEntry( "CHANNEL", networkChannel->value() ); | ||
82 | // config.readEntry( "RATE", "auto" ); | ||
83 | wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" ); | ||
84 | authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" ); | ||
85 | key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" ); | ||
86 | if( keyRadio0->isChecked() ){ | ||
87 | config.writeEntry( "dot11WEPDefaultKeyID", 0 ); | ||
88 | } else if( keyRadio1->isChecked() ){ | ||
89 | config.writeEntry( "dot11WEPDefaultKeyID", 1 ); | ||
90 | } else if( keyRadio2->isChecked() ){ | ||
91 | config.writeEntry( "dot11WEPDefaultKeyID", 2 ); | ||
92 | } else if( keyRadio3->isChecked() ){ | ||
93 | config.writeEntry( "dot11WEPDefaultKeyID", 3 ); | ||
94 | } | ||
95 | config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | ||
96 | config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | ||
97 | config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | ||
98 | config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | ||
99 | return writeWirelessOpts( config ); | ||
100 | // return TRUE; | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | */ | ||
105 | void WLANImp::accept() | ||
106 | { | ||
107 | if ( writeConfig() ) | ||
108 | QDialog::accept(); | ||
109 | } | ||
110 | |||
111 | void WLANImp::done ( int r ) | ||
112 | { | ||
113 | QDialog::done ( r ); | ||
114 | close ( ); | ||
115 | } | ||
116 | |||
117 | bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | ||
118 | { | ||
119 | qWarning( "WLANImp::writeWirelessOpts entered." ); | ||
120 | QString prev = "/etc/pcmcia/wireless.opts"; | ||
121 | QFile prevFile(prev); | ||
122 | if ( !prevFile.open( IO_ReadOnly ) ) | ||
123 | return FALSE; | ||
124 | |||
125 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | ||
126 | QFile tmpFile(tmp); | ||
127 | if ( !tmpFile.open( IO_WriteOnly ) ) | ||
128 | return FALSE; | ||
129 | |||
130 | bool retval = TRUE; | ||
131 | |||
132 | QTextStream in( &prevFile ); | ||
133 | QTextStream out( &tmpFile ); | ||
134 | |||
135 | config.setGroup("Properties"); | ||
136 | |||
137 | QString line; | ||
138 | bool found=FALSE; | ||
139 | bool done=FALSE; | ||
140 | while ( !in.atEnd() ) { | ||
141 | QString line = in.readLine(); | ||
142 | QString wline = line.simplifyWhiteSpace(); | ||
143 | if ( !done ) { | ||
144 | if ( found ) { | ||
145 | // skip existing entry for this scheme, and write our own. | ||
146 | if ( wline == ";;" ) { | ||
147 | found = FALSE; | ||
148 | continue; | ||
149 | } else { | ||
150 | continue; | ||
151 | } | ||
152 | } else { | ||
153 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | ||
154 | found=TRUE; | ||
155 | continue; // skip this line | ||
156 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | ||
157 | // end - add new entry | ||
158 | // Not all fields have a GUI, but all are supported | ||
159 | // in the letwork configuration files. | ||
160 | static const char* txtfields[] = { | ||
161 | 0 | ||
162 | }; | ||
163 | QString readmode = config.readEntry( "Mode", "Managed" ); | ||
164 | QString mode; | ||
165 | if( readmode == "Managed" ){ | ||
166 | mode = readmode; | ||
167 | } else if( readmode == "adhoc" ){ | ||
168 | mode = "Ad-Hoc"; | ||
169 | } | ||
170 | QString key; | ||
171 | if( wepEnabled->isChecked() ){ | ||
172 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | ||
173 | switch( defaultkey ){ | ||
174 | case 0: | ||
175 | key += keyLineEdit0->text(); | ||
176 | break; | ||
177 | case 1: | ||
178 | key += keyLineEdit1->text(); | ||
179 | break; | ||
180 | case 2: | ||
181 | key += keyLineEdit2->text(); | ||
182 | break; | ||
183 | case 3: | ||
184 | key += keyLineEdit3->text(); | ||
185 | break; | ||
186 | } | ||
187 | if( config.readEntry( "AuthType", "opensystem" ) == "opensystem") | ||
188 | key += " open"; | ||
189 | } | ||
190 | out << scheme << ",*,*,*)" << "\n" | ||
191 | << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n" | ||
192 | << " MODE=" << mode << "\n" | ||
193 | << " KEY=" << Global::shellQuote( key ) << "\n" | ||
194 | << " RATE=" << "auto" << "\n" | ||
195 | ; | ||
196 | if( mode != "Managed" ) | ||
197 | out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n"; | ||
198 | const char** f = txtfields; | ||
199 | while (*f) { | ||
200 | out << " " << *f << "=" << config.readEntry(*f,"") << "\n"; | ||
201 | ++f; | ||
202 | } | ||
203 | out << " ;;\n"; | ||
204 | done = TRUE; | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | out << line << "\n"; | ||
209 | } | ||
210 | |||
211 | prevFile.close(); | ||
212 | tmpFile.close(); | ||
213 | QString initpath; | ||
214 | //system("cardctl suspend"); | ||
215 | if( QDir("/etc/rc.d/init.d").exists() ){ | ||
216 | initpath = "/etc/rc.d/init.d"; | ||
217 | } else if( QDir("/etc/init.d").exists() ){ | ||
218 | initpath = "/etc/init.d"; | ||
219 | } | ||
220 | if( initpath ) | ||
221 | system(QString("%1/pcmcia stop").arg(initpath)); | ||
222 | |||
223 | if( system( "mv " + tmp + " " + prev ) ) | ||
224 | retval = FALSE; | ||
225 | //#ifdef USE_SCHEMES | ||
226 | // if ( retval ) | ||
227 | //SchemeChanger::changeScheme(scheme); | ||
228 | //#endif | ||
229 | |||
230 | //system("cardctl resume"); | ||
231 | if( initpath ) | ||
232 | system(QString("%1/pcmcia start").arg(initpath)); | ||
233 | |||
234 | return retval; | ||
235 | } | ||
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h new file mode 100644 index 0000000..8e355ce --- a/dev/null +++ b/noncore/net/networksetup/wlan/wlanimp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef WLANIMP_H | ||
2 | #define WLANIMP_H | ||
3 | |||
4 | #include "wlan.h" | ||
5 | |||
6 | class Config; | ||
7 | |||
8 | class WLANImp : public WLAN { | ||
9 | Q_OBJECT | ||
10 | |||
11 | public: | ||
12 | WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0); | ||
13 | |||
14 | protected: | ||
15 | void accept(); | ||
16 | void done ( int r ); | ||
17 | |||
18 | private: | ||
19 | void readConfig(); | ||
20 | bool writeConfig(); | ||
21 | bool writeWirelessOpts( Config &cfg, QString scheme = "*" ); | ||
22 | bool writeWlanngOpts( Config &cfg, QString scheme = "*" ); | ||
23 | Config& config; | ||
24 | }; | ||
25 | |||
26 | #endif | ||
27 | |||
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp new file mode 100644 index 0000000..632f7e4 --- a/dev/null +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | #include "wlanmodule.h" | ||
2 | #include <qpe/config.h> | ||
3 | #include "wlanimp.h" | ||
4 | |||
5 | /** | ||
6 | * Constructor, find all of the possible interfaces | ||
7 | */ | ||
8 | WLANModule::WLANModule() : Module() { | ||
9 | // get output from iwconfig | ||
10 | } | ||
11 | |||
12 | /** | ||
13 | * get the icon name for this device. | ||
14 | * @param Interface* can be used in determining the icon. | ||
15 | * @return QString the icon name (minus .png, .gif etc) | ||
16 | */ | ||
17 | QString WLANModule::getPixmapName(Interface* ){ | ||
18 | return "wlan"; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Check to see if the interface i is owned by this module. | ||
23 | * @return bool true if i is owned by this module, false otherwise. | ||
24 | */ | ||
25 | bool WLANModule::isOwner(Interface *i){ | ||
26 | if(i->getInterfaceName() == "eth0") | ||
27 | return true; | ||
28 | return false; | ||
29 | } | ||
30 | |||
31 | /** | ||
32 | * Create, set tabWiget and return the WLANConfigure Module | ||
33 | * @param tabWidget a pointer to the tab widget that this configure has. | ||
34 | * @return QWidget* pointer to the tab widget in this modules configure. | ||
35 | */ | ||
36 | QWidget *WLANModule::configure(QTabWidget **tabWidget){ | ||
37 | Config cfg("wireless"); | ||
38 | WLANImp *wlanconfig = new WLANImp(cfg); | ||
39 | (*tabWidget) = wlanconfig->tabWidget; | ||
40 | return wlanconfig; | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Create, set tabWiget and return the Information Module | ||
45 | * @param tabWidget a pointer to the tab widget that this information has. | ||
46 | * @return QWidget* pointer to the tab widget in this modules info. | ||
47 | */ | ||
48 | QWidget *WLANModule::information(QTabWidget **tabWidget){ | ||
49 | return NULL; | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * | ||
54 | */ | ||
55 | QList<Interface> WLANModule::getInterfaces(){ | ||
56 | return list | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * Return a list of possible new interfaces | ||
61 | */ | ||
62 | QMap<QString, QString> WLANModule::possibleNewInterfaces(){ | ||
63 | //return list; | ||
64 | } | ||
65 | |||
66 | /** | ||
67 | * Attempt to add a new interface as defined by name | ||
68 | * @param name the name of the type of interface that should be created given | ||
69 | * by possibleNewInterfaces(); | ||
70 | * @return Interface* NULL if it was unable to be created. | ||
71 | */ | ||
72 | Interface *WLANModule::addNewInterface(QString name){ | ||
73 | return NULL; | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * Attempts to remove the interface, doesn't delete i | ||
78 | * @return bool true if successfull, false otherwise. | ||
79 | */ | ||
80 | bool WLANModule::remove(Interface* i){ | ||
81 | return false; | ||
82 | } | ||
83 | |||
84 | // wlanmodule.cpp | ||
85 | |||
diff --git a/noncore/net/networksetup/wlan/wlanmodule.h b/noncore/net/networksetup/wlan/wlanmodule.h new file mode 100644 index 0000000..1fbf6a9 --- a/dev/null +++ b/noncore/net/networksetup/wlan/wlanmodule.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef WLAN_MODULE_H | ||
2 | #define WLAN_MODULE_H | ||
3 | |||
4 | #include "module.h" | ||
5 | |||
6 | class WLANModule : Module{ | ||
7 | |||
8 | signals: | ||
9 | void updateInterface(Interface *i); | ||
10 | |||
11 | public: | ||
12 | WLANModule(); | ||
13 | |||
14 | virtual bool isOwner(Interface *); | ||
15 | virtual QWidget *configure(QTabWidget **tabWidget); | ||
16 | virtual QWidget *information(QTabWidget **tabWidget); | ||
17 | virtual QList<Interface> getInterfaces(); | ||
18 | virtual QMap<QString, QString> possibleNewInterfaces(); | ||
19 | virtual Interface *addNewInterface(QString name); | ||
20 | virtual bool remove(Interface* i); | ||
21 | virtual QString getPixmapName(Interface* i); | ||
22 | |||
23 | private: | ||
24 | QList<Interface> list; | ||
25 | |||
26 | }; | ||
27 | |||
28 | extern "C" | ||
29 | { | ||
30 | void* create_plugin() { | ||
31 | return new WLANModule(); | ||
32 | } | ||
33 | }; | ||
34 | |||
35 | #endif | ||
36 | |||
37 | // wlanmodule.h | ||
38 | |||
diff --git a/noncore/net/networksetup/wlan/wlansetup.pro b/noncore/net/networksetup/wlan/wlansetup.pro new file mode 100644 index 0000000..7102adb --- a/dev/null +++ b/noncore/net/networksetup/wlan/wlansetup.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | #CONFIG += qt warn_on debug | ||
4 | #DESTDIR = $(OPIEDIR)/bin | ||
5 | HEADERS = wlanimp.h wlanmodule.h | ||
6 | SOURCES = wlanimp.cpp wlanmodule.cpp | ||
7 | INCLUDEPATH+= $(OPIEDIR)/include ../ | ||
8 | DEPENDPATH+= $(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | INTERFACES= wlan.ui | ||
11 | TARGET = wlanplugin | ||
12 | VERSION = 1.0.0 | ||
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui new file mode 100644 index 0000000..dcacbe8 --- a/dev/null +++ b/noncore/settings/networksettings/wlan/wlan.ui | |||
@@ -0,0 +1,572 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>WLAN</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>WLAN</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>254</width> | ||
15 | <height>286</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Wireless LAN Setting</string> | ||
21 | </property> | ||
22 | <property stdset="1"> | ||
23 | <name>sizeGripEnabled</name> | ||
24 | <bool>true</bool> | ||
25 | </property> | ||
26 | <property> | ||
27 | <name>layoutMargin</name> | ||
28 | </property> | ||
29 | <vbox> | ||
30 | <property stdset="1"> | ||
31 | <name>margin</name> | ||
32 | <number>0</number> | ||
33 | </property> | ||
34 | <property stdset="1"> | ||
35 | <name>spacing</name> | ||
36 | <number>6</number> | ||
37 | </property> | ||
38 | <widget> | ||
39 | <class>QTabWidget</class> | ||
40 | <property stdset="1"> | ||
41 | <name>name</name> | ||
42 | <cstring>tabWidget</cstring> | ||
43 | </property> | ||
44 | <property stdset="1"> | ||
45 | <name>enabled</name> | ||
46 | <bool>true</bool> | ||
47 | </property> | ||
48 | <widget> | ||
49 | <class>QWidget</class> | ||
50 | <property stdset="1"> | ||
51 | <name>name</name> | ||
52 | <cstring>ConfigPage</cstring> | ||
53 | </property> | ||
54 | <attribute> | ||
55 | <name>title</name> | ||
56 | <string>Config</string> | ||
57 | </attribute> | ||
58 | <vbox> | ||
59 | <property stdset="1"> | ||
60 | <name>margin</name> | ||
61 | <number>11</number> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>spacing</name> | ||
65 | <number>6</number> | ||
66 | </property> | ||
67 | <widget> | ||
68 | <class>QButtonGroup</class> | ||
69 | <property stdset="1"> | ||
70 | <name>name</name> | ||
71 | <cstring>ButtonGroup45</cstring> | ||
72 | </property> | ||
73 | <property stdset="1"> | ||
74 | <name>title</name> | ||
75 | <string>ESS ID</string> | ||
76 | </property> | ||
77 | <vbox> | ||
78 | <property stdset="1"> | ||
79 | <name>margin</name> | ||
80 | <number>11</number> | ||
81 | </property> | ||
82 | <property stdset="1"> | ||
83 | <name>spacing</name> | ||
84 | <number>6</number> | ||
85 | </property> | ||
86 | <widget> | ||
87 | <class>QRadioButton</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>essNon</cstring> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>text</name> | ||
94 | <string>Non-Spec ESSID: "ANY"</string> | ||
95 | </property> | ||
96 | <property stdset="1"> | ||
97 | <name>checked</name> | ||
98 | <bool>true</bool> | ||
99 | </property> | ||
100 | </widget> | ||
101 | <widget> | ||
102 | <class>QRadioButton</class> | ||
103 | <property stdset="1"> | ||
104 | <name>name</name> | ||
105 | <cstring>essSpecific</cstring> | ||
106 | </property> | ||
107 | <property stdset="1"> | ||
108 | <name>text</name> | ||
109 | <string>Specific ESSID</string> | ||
110 | </property> | ||
111 | </widget> | ||
112 | <widget> | ||
113 | <class>QLineEdit</class> | ||
114 | <property stdset="1"> | ||
115 | <name>name</name> | ||
116 | <cstring>essSpecificLineEdit</cstring> | ||
117 | </property> | ||
118 | <property stdset="1"> | ||
119 | <name>enabled</name> | ||
120 | <bool>false</bool> | ||
121 | </property> | ||
122 | </widget> | ||
123 | </vbox> | ||
124 | </widget> | ||
125 | <widget> | ||
126 | <class>QButtonGroup</class> | ||
127 | <property stdset="1"> | ||
128 | <name>name</name> | ||
129 | <cstring>ButtonGroup46</cstring> | ||
130 | </property> | ||
131 | <property stdset="1"> | ||
132 | <name>title</name> | ||
133 | <string>Network Type</string> | ||
134 | </property> | ||
135 | <grid> | ||
136 | <property stdset="1"> | ||
137 | <name>margin</name> | ||
138 | <number>11</number> | ||
139 | </property> | ||
140 | <property stdset="1"> | ||
141 | <name>spacing</name> | ||
142 | <number>6</number> | ||
143 | </property> | ||
144 | <widget row="0" column="0" rowspan="1" colspan="3" > | ||
145 | <class>QRadioButton</class> | ||
146 | <property stdset="1"> | ||
147 | <name>name</name> | ||
148 | <cstring>networkInfrastructure</cstring> | ||
149 | </property> | ||
150 | <property stdset="1"> | ||
151 | <name>text</name> | ||
152 | <string>Infrastructure</string> | ||
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>checked</name> | ||
156 | <bool>true</bool> | ||
157 | </property> | ||
158 | </widget> | ||
159 | <widget row="2" column="0" > | ||
160 | <class>QLabel</class> | ||
161 | <property stdset="1"> | ||
162 | <name>name</name> | ||
163 | <cstring>TextLabel2</cstring> | ||
164 | </property> | ||
165 | <property stdset="1"> | ||
166 | <name>enabled</name> | ||
167 | <bool>false</bool> | ||
168 | </property> | ||
169 | <property stdset="1"> | ||
170 | <name>text</name> | ||
171 | <string>Channel</string> | ||
172 | </property> | ||
173 | </widget> | ||
174 | <widget row="1" column="0" rowspan="1" colspan="2" > | ||
175 | <class>QRadioButton</class> | ||
176 | <property stdset="1"> | ||
177 | <name>name</name> | ||
178 | <cstring>network802</cstring> | ||
179 | </property> | ||
180 | <property stdset="1"> | ||
181 | <name>text</name> | ||
182 | <string>802.11 Ad-Hoc</string> | ||
183 | </property> | ||
184 | </widget> | ||
185 | <widget row="2" column="1" > | ||
186 | <class>QSpinBox</class> | ||
187 | <property stdset="1"> | ||
188 | <name>name</name> | ||
189 | <cstring>networkChannel</cstring> | ||
190 | </property> | ||
191 | <property stdset="1"> | ||
192 | <name>enabled</name> | ||
193 | <bool>false</bool> | ||
194 | </property> | ||
195 | <property stdset="1"> | ||
196 | <name>maxValue</name> | ||
197 | <number>11</number> | ||
198 | </property> | ||
199 | <property stdset="1"> | ||
200 | <name>minValue</name> | ||
201 | <number>1</number> | ||
202 | </property> | ||
203 | </widget> | ||
204 | <spacer row="2" column="2" > | ||
205 | <property> | ||
206 | <name>name</name> | ||
207 | <cstring>Spacer32</cstring> | ||
208 | </property> | ||
209 | <property stdset="1"> | ||
210 | <name>orientation</name> | ||
211 | <enum>Horizontal</enum> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>sizeType</name> | ||
215 | <enum>Expanding</enum> | ||
216 | </property> | ||
217 | <property> | ||
218 | <name>sizeHint</name> | ||
219 | <size> | ||
220 | <width>20</width> | ||
221 | <height>20</height> | ||
222 | </size> | ||
223 | </property> | ||
224 | </spacer> | ||
225 | </grid> | ||
226 | </widget> | ||
227 | <spacer> | ||
228 | <property> | ||
229 | <name>name</name> | ||
230 | <cstring>Spacer31</cstring> | ||
231 | </property> | ||
232 | <property stdset="1"> | ||
233 | <name>orientation</name> | ||
234 | <enum>Vertical</enum> | ||
235 | </property> | ||
236 | <property stdset="1"> | ||
237 | <name>sizeType</name> | ||
238 | <enum>Expanding</enum> | ||
239 | </property> | ||
240 | <property> | ||
241 | <name>sizeHint</name> | ||
242 | <size> | ||
243 | <width>20</width> | ||
244 | <height>20</height> | ||
245 | </size> | ||
246 | </property> | ||
247 | </spacer> | ||
248 | </vbox> | ||
249 | </widget> | ||
250 | <widget> | ||
251 | <class>QWidget</class> | ||
252 | <property stdset="1"> | ||
253 | <name>name</name> | ||
254 | <cstring>WepPage</cstring> | ||
255 | </property> | ||
256 | <attribute> | ||
257 | <name>title</name> | ||
258 | <string>Wep</string> | ||
259 | </attribute> | ||
260 | <grid> | ||
261 | <property stdset="1"> | ||
262 | <name>margin</name> | ||
263 | <number>11</number> | ||
264 | </property> | ||
265 | <property stdset="1"> | ||
266 | <name>spacing</name> | ||
267 | <number>6</number> | ||
268 | </property> | ||
269 | <widget row="2" column="0" rowspan="1" colspan="2" > | ||
270 | <class>QButtonGroup</class> | ||
271 | <property stdset="1"> | ||
272 | <name>name</name> | ||
273 | <cstring>ButtonGroup44</cstring> | ||
274 | </property> | ||
275 | <property stdset="1"> | ||
276 | <name>enabled</name> | ||
277 | <bool>false</bool> | ||
278 | </property> | ||
279 | <property stdset="1"> | ||
280 | <name>title</name> | ||
281 | <string>Key Setting</string> | ||
282 | </property> | ||
283 | <grid> | ||
284 | <property stdset="1"> | ||
285 | <name>margin</name> | ||
286 | <number>11</number> | ||
287 | </property> | ||
288 | <property stdset="1"> | ||
289 | <name>spacing</name> | ||
290 | <number>6</number> | ||
291 | </property> | ||
292 | <widget row="0" column="1" > | ||
293 | <class>QLineEdit</class> | ||
294 | <property stdset="1"> | ||
295 | <name>name</name> | ||
296 | <cstring>keyLineEdit0</cstring> | ||
297 | </property> | ||
298 | </widget> | ||
299 | <widget row="1" column="1" > | ||
300 | <class>QLineEdit</class> | ||
301 | <property stdset="1"> | ||
302 | <name>name</name> | ||
303 | <cstring>keyLineEdit1</cstring> | ||
304 | </property> | ||
305 | </widget> | ||
306 | <widget row="2" column="1" > | ||
307 | <class>QLineEdit</class> | ||
308 | <property stdset="1"> | ||
309 | <name>name</name> | ||
310 | <cstring>keyLineEdit2</cstring> | ||
311 | </property> | ||
312 | </widget> | ||
313 | <widget row="3" column="1" > | ||
314 | <class>QLineEdit</class> | ||
315 | <property stdset="1"> | ||
316 | <name>name</name> | ||
317 | <cstring>keyLineEdit3</cstring> | ||
318 | </property> | ||
319 | </widget> | ||
320 | <widget row="0" column="0" > | ||
321 | <class>QRadioButton</class> | ||
322 | <property stdset="1"> | ||
323 | <name>name</name> | ||
324 | <cstring>keyRadio0</cstring> | ||
325 | </property> | ||
326 | <property stdset="1"> | ||
327 | <name>text</name> | ||
328 | <string>Key 1</string> | ||
329 | </property> | ||
330 | <property stdset="1"> | ||
331 | <name>checked</name> | ||
332 | <bool>true</bool> | ||
333 | </property> | ||
334 | </widget> | ||
335 | <widget row="1" column="0" > | ||
336 | <class>QRadioButton</class> | ||
337 | <property stdset="1"> | ||
338 | <name>name</name> | ||
339 | <cstring>keyRadio1</cstring> | ||
340 | </property> | ||
341 | <property stdset="1"> | ||
342 | <name>text</name> | ||
343 | <string>Key 2</string> | ||
344 | </property> | ||
345 | </widget> | ||
346 | <widget row="2" column="0" > | ||
347 | <class>QRadioButton</class> | ||
348 | <property stdset="1"> | ||
349 | <name>name</name> | ||
350 | <cstring>keyRadio2</cstring> | ||
351 | </property> | ||
352 | <property stdset="1"> | ||
353 | <name>text</name> | ||
354 | <string>Key 3</string> | ||
355 | </property> | ||
356 | </widget> | ||
357 | <widget row="3" column="0" > | ||
358 | <class>QRadioButton</class> | ||
359 | <property stdset="1"> | ||
360 | <name>name</name> | ||
361 | <cstring>keyRadio3</cstring> | ||
362 | </property> | ||
363 | <property stdset="1"> | ||
364 | <name>text</name> | ||
365 | <string>Key 4</string> | ||
366 | </property> | ||
367 | </widget> | ||
368 | </grid> | ||
369 | </widget> | ||
370 | <widget row="1" column="0" > | ||
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> | ||
474 | <name>name</name> | ||
475 | <cstring>Spacer30</cstring> | ||
476 | </property> | ||
477 | <property stdset="1"> | ||
478 | <name>orientation</name> | ||
479 | <enum>Vertical</enum> | ||
480 | </property> | ||
481 | <property stdset="1"> | ||
482 | <name>sizeType</name> | ||
483 | <enum>Expanding</enum> | ||
484 | </property> | ||
485 | <property> | ||
486 | <name>sizeHint</name> | ||
487 | <size> | ||
488 | <width>20</width> | ||
489 | <height>20</height> | ||
490 | </size> | ||
491 | </property> | ||
492 | </spacer> | ||
493 | <widget row="0" column="0" rowspan="1" colspan="2" > | ||
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> | ||
506 | </widget> | ||
507 | </vbox> | ||
508 | </widget> | ||
509 | <connections> | ||
510 | <connection> | ||
511 | <sender>essSpecific</sender> | ||
512 | <signal>toggled(bool)</signal> | ||
513 | <receiver>essSpecificLineEdit</receiver> | ||
514 | <slot>setEnabled(bool)</slot> | ||
515 | </connection> | ||
516 | <connection> | ||
517 | <sender>network802</sender> | ||
518 | <signal>clicked()</signal> | ||
519 | <receiver>essSpecific</receiver> | ||
520 | <slot>animateClick()</slot> | ||
521 | </connection> | ||
522 | <connection> | ||
523 | <sender>network802</sender> | ||
524 | <signal>toggled(bool)</signal> | ||
525 | <receiver>TextLabel2</receiver> | ||
526 | <slot>setEnabled(bool)</slot> | ||
527 | </connection> | ||
528 | <connection> | ||
529 | <sender>network802</sender> | ||
530 | <signal>toggled(bool)</signal> | ||
531 | <receiver>networkChannel</receiver> | ||
532 | <slot>setEnabled(bool)</slot> | ||
533 | </connection> | ||
534 | <connection> | ||
535 | <sender>wepEnabled</sender> | ||
536 | <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> | ||
544 | <slot>setEnabled(bool)</slot> | ||
545 | </connection> | ||
546 | <connection> | ||
547 | <sender>wepEnabled</sender> | ||
548 | <signal>toggled(bool)</signal> | ||
549 | <receiver>ButtonGroup44</receiver> | ||
550 | <slot>setEnabled(bool)</slot> | ||
551 | </connection> | ||
552 | </connections> | ||
553 | <tabstops> | ||
554 | <tabstop>tabWidget</tabstop> | ||
555 | <tabstop>essNon</tabstop> | ||
556 | <tabstop>essSpecificLineEdit</tabstop> | ||
557 | <tabstop>networkInfrastructure</tabstop> | ||
558 | <tabstop>networkChannel</tabstop> | ||
559 | <tabstop>key40</tabstop> | ||
560 | <tabstop>key128</tabstop> | ||
561 | <tabstop>authOpen</tabstop> | ||
562 | <tabstop>authShared</tabstop> | ||
563 | <tabstop>keyRadio0</tabstop> | ||
564 | <tabstop>keyLineEdit0</tabstop> | ||
565 | <tabstop>keyRadio1</tabstop> | ||
566 | <tabstop>keyLineEdit1</tabstop> | ||
567 | <tabstop>keyRadio2</tabstop> | ||
568 | <tabstop>keyLineEdit2</tabstop> | ||
569 | <tabstop>keyRadio3</tabstop> | ||
570 | <tabstop>keyLineEdit3</tabstop> | ||
571 | </tabstops> | ||
572 | </UI> | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp new file mode 100644 index 0000000..60ffeeb --- a/dev/null +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -0,0 +1,235 @@ | |||
1 | #include "wlanimp.h" | ||
2 | |||
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> | ||
10 | #include <qdir.h> | ||
11 | #include <qtextstream.h> | ||
12 | #include <qmessagebox.h> | ||
13 | #include <qlineedit.h> | ||
14 | #include <qspinbox.h> | ||
15 | #include <qradiobutton.h> | ||
16 | #include <qcheckbox.h> | ||
17 | #include <qregexp.h> | ||
18 | |||
19 | WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){ | ||
20 | readConfig(); | ||
21 | } | ||
22 | |||
23 | void WLANImp::readConfig() | ||
24 | { | ||
25 | qWarning( "WLANImp::readConfig() called." ); | ||
26 | config.setGroup( "Properties" ); | ||
27 | QString ssid = config.readEntry( "SSID", "any" ); | ||
28 | if( ssid == "any" || ssid == "ANY" ){ | ||
29 | essNon->setChecked( TRUE ); | ||
30 | } else { | ||
31 | essSpecific->setChecked( TRUE ); | ||
32 | essSpecificLineEdit->setText( ssid ); | ||
33 | } | ||
34 | QString mode = config.readEntry( "Mode", "Managed" ); | ||
35 | if( mode == "adhoc" ) { | ||
36 | network802->setChecked( TRUE ); | ||
37 | } else { | ||
38 | networkInfrastructure->setChecked( TRUE ); | ||
39 | } | ||
40 | networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) ); | ||
41 | // config.readEntry( "RATE", "auto" ); | ||
42 | config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( TRUE ) : wepEnabled->setChecked( FALSE ); | ||
43 | config.readEntry( "AuthType", "opensystem" ); | ||
44 | config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( TRUE ) : key128->setChecked( TRUE ); | ||
45 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | ||
46 | switch( defaultkey ){ | ||
47 | case 0: | ||
48 | keyRadio0->setChecked( TRUE ); | ||
49 | break; | ||
50 | case 1: | ||
51 | keyRadio1->setChecked( TRUE ); | ||
52 | break; | ||
53 | case 2: | ||
54 | keyRadio2->setChecked( TRUE ); | ||
55 | break; | ||
56 | case 3: | ||
57 | keyRadio3->setChecked( TRUE ); | ||
58 | break; | ||
59 | } | ||
60 | keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" )); | ||
61 | keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" )); | ||
62 | keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" )); | ||
63 | keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" )); | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | bool WLANImp::writeConfig() | ||
68 | { | ||
69 | qWarning( "WLANImp::writeConfig() called." ); | ||
70 | config.setGroup( "Properties" ); | ||
71 | if( essNon->isChecked() ) { | ||
72 | config.writeEntry( "SSID", "any" ); | ||
73 | } else { | ||
74 | config.writeEntry( "SSID", essSpecificLineEdit->text() ); | ||
75 | } | ||
76 | if( networkInfrastructure->isChecked() ){ | ||
77 | config.writeEntry( "Mode", "Managed" ); | ||
78 | } else if( network802->isChecked() ){ | ||
79 | config.writeEntry( "Mode", "adhoc" ); | ||
80 | } | ||
81 | config.writeEntry( "CHANNEL", networkChannel->value() ); | ||
82 | // config.readEntry( "RATE", "auto" ); | ||
83 | wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" ); | ||
84 | authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" ); | ||
85 | key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" ); | ||
86 | if( keyRadio0->isChecked() ){ | ||
87 | config.writeEntry( "dot11WEPDefaultKeyID", 0 ); | ||
88 | } else if( keyRadio1->isChecked() ){ | ||
89 | config.writeEntry( "dot11WEPDefaultKeyID", 1 ); | ||
90 | } else if( keyRadio2->isChecked() ){ | ||
91 | config.writeEntry( "dot11WEPDefaultKeyID", 2 ); | ||
92 | } else if( keyRadio3->isChecked() ){ | ||
93 | config.writeEntry( "dot11WEPDefaultKeyID", 3 ); | ||
94 | } | ||
95 | config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | ||
96 | config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | ||
97 | config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | ||
98 | config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | ||
99 | return writeWirelessOpts( config ); | ||
100 | // return TRUE; | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | */ | ||
105 | void WLANImp::accept() | ||
106 | { | ||
107 | if ( writeConfig() ) | ||
108 | QDialog::accept(); | ||
109 | } | ||
110 | |||
111 | void WLANImp::done ( int r ) | ||
112 | { | ||
113 | QDialog::done ( r ); | ||
114 | close ( ); | ||
115 | } | ||
116 | |||
117 | bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | ||
118 | { | ||
119 | qWarning( "WLANImp::writeWirelessOpts entered." ); | ||
120 | QString prev = "/etc/pcmcia/wireless.opts"; | ||
121 | QFile prevFile(prev); | ||
122 | if ( !prevFile.open( IO_ReadOnly ) ) | ||
123 | return FALSE; | ||
124 | |||
125 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | ||
126 | QFile tmpFile(tmp); | ||
127 | if ( !tmpFile.open( IO_WriteOnly ) ) | ||
128 | return FALSE; | ||
129 | |||
130 | bool retval = TRUE; | ||
131 | |||
132 | QTextStream in( &prevFile ); | ||
133 | QTextStream out( &tmpFile ); | ||
134 | |||
135 | config.setGroup("Properties"); | ||
136 | |||
137 | QString line; | ||
138 | bool found=FALSE; | ||
139 | bool done=FALSE; | ||
140 | while ( !in.atEnd() ) { | ||
141 | QString line = in.readLine(); | ||
142 | QString wline = line.simplifyWhiteSpace(); | ||
143 | if ( !done ) { | ||
144 | if ( found ) { | ||
145 | // skip existing entry for this scheme, and write our own. | ||
146 | if ( wline == ";;" ) { | ||
147 | found = FALSE; | ||
148 | continue; | ||
149 | } else { | ||
150 | continue; | ||
151 | } | ||
152 | } else { | ||
153 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | ||
154 | found=TRUE; | ||
155 | continue; // skip this line | ||
156 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | ||
157 | // end - add new entry | ||
158 | // Not all fields have a GUI, but all are supported | ||
159 | // in the letwork configuration files. | ||
160 | static const char* txtfields[] = { | ||
161 | 0 | ||
162 | }; | ||
163 | QString readmode = config.readEntry( "Mode", "Managed" ); | ||
164 | QString mode; | ||
165 | if( readmode == "Managed" ){ | ||
166 | mode = readmode; | ||
167 | } else if( readmode == "adhoc" ){ | ||
168 | mode = "Ad-Hoc"; | ||
169 | } | ||
170 | QString key; | ||
171 | if( wepEnabled->isChecked() ){ | ||
172 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | ||
173 | switch( defaultkey ){ | ||
174 | case 0: | ||
175 | key += keyLineEdit0->text(); | ||
176 | break; | ||
177 | case 1: | ||
178 | key += keyLineEdit1->text(); | ||
179 | break; | ||
180 | case 2: | ||
181 | key += keyLineEdit2->text(); | ||
182 | break; | ||
183 | case 3: | ||
184 | key += keyLineEdit3->text(); | ||
185 | break; | ||
186 | } | ||
187 | if( config.readEntry( "AuthType", "opensystem" ) == "opensystem") | ||
188 | key += " open"; | ||
189 | } | ||
190 | out << scheme << ",*,*,*)" << "\n" | ||
191 | << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n" | ||
192 | << " MODE=" << mode << "\n" | ||
193 | << " KEY=" << Global::shellQuote( key ) << "\n" | ||
194 | << " RATE=" << "auto" << "\n" | ||
195 | ; | ||
196 | if( mode != "Managed" ) | ||
197 | out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n"; | ||
198 | const char** f = txtfields; | ||
199 | while (*f) { | ||
200 | out << " " << *f << "=" << config.readEntry(*f,"") << "\n"; | ||
201 | ++f; | ||
202 | } | ||
203 | out << " ;;\n"; | ||
204 | done = TRUE; | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | out << line << "\n"; | ||
209 | } | ||
210 | |||
211 | prevFile.close(); | ||
212 | tmpFile.close(); | ||
213 | QString initpath; | ||
214 | //system("cardctl suspend"); | ||
215 | if( QDir("/etc/rc.d/init.d").exists() ){ | ||
216 | initpath = "/etc/rc.d/init.d"; | ||
217 | } else if( QDir("/etc/init.d").exists() ){ | ||
218 | initpath = "/etc/init.d"; | ||
219 | } | ||
220 | if( initpath ) | ||
221 | system(QString("%1/pcmcia stop").arg(initpath)); | ||
222 | |||
223 | if( system( "mv " + tmp + " " + prev ) ) | ||
224 | retval = FALSE; | ||
225 | //#ifdef USE_SCHEMES | ||
226 | // if ( retval ) | ||
227 | //SchemeChanger::changeScheme(scheme); | ||
228 | //#endif | ||
229 | |||
230 | //system("cardctl resume"); | ||
231 | if( initpath ) | ||
232 | system(QString("%1/pcmcia start").arg(initpath)); | ||
233 | |||
234 | return retval; | ||
235 | } | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h new file mode 100644 index 0000000..8e355ce --- a/dev/null +++ b/noncore/settings/networksettings/wlan/wlanimp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef WLANIMP_H | ||
2 | #define WLANIMP_H | ||
3 | |||
4 | #include "wlan.h" | ||
5 | |||
6 | class Config; | ||
7 | |||
8 | class WLANImp : public WLAN { | ||
9 | Q_OBJECT | ||
10 | |||
11 | public: | ||
12 | WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0); | ||
13 | |||
14 | protected: | ||
15 | void accept(); | ||
16 | void done ( int r ); | ||
17 | |||
18 | private: | ||
19 | void readConfig(); | ||
20 | bool writeConfig(); | ||
21 | bool writeWirelessOpts( Config &cfg, QString scheme = "*" ); | ||
22 | bool writeWlanngOpts( Config &cfg, QString scheme = "*" ); | ||
23 | Config& config; | ||
24 | }; | ||
25 | |||
26 | #endif | ||
27 | |||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp new file mode 100644 index 0000000..632f7e4 --- a/dev/null +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | #include "wlanmodule.h" | ||
2 | #include <qpe/config.h> | ||
3 | #include "wlanimp.h" | ||
4 | |||
5 | /** | ||
6 | * Constructor, find all of the possible interfaces | ||
7 | */ | ||
8 | WLANModule::WLANModule() : Module() { | ||
9 | // get output from iwconfig | ||
10 | } | ||
11 | |||
12 | /** | ||
13 | * get the icon name for this device. | ||
14 | * @param Interface* can be used in determining the icon. | ||
15 | * @return QString the icon name (minus .png, .gif etc) | ||
16 | */ | ||
17 | QString WLANModule::getPixmapName(Interface* ){ | ||
18 | return "wlan"; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Check to see if the interface i is owned by this module. | ||
23 | * @return bool true if i is owned by this module, false otherwise. | ||
24 | */ | ||
25 | bool WLANModule::isOwner(Interface *i){ | ||
26 | if(i->getInterfaceName() == "eth0") | ||
27 | return true; | ||
28 | return false; | ||
29 | } | ||
30 | |||
31 | /** | ||
32 | * Create, set tabWiget and return the WLANConfigure Module | ||
33 | * @param tabWidget a pointer to the tab widget that this configure has. | ||
34 | * @return QWidget* pointer to the tab widget in this modules configure. | ||
35 | */ | ||
36 | QWidget *WLANModule::configure(QTabWidget **tabWidget){ | ||
37 | Config cfg("wireless"); | ||
38 | WLANImp *wlanconfig = new WLANImp(cfg); | ||
39 | (*tabWidget) = wlanconfig->tabWidget; | ||
40 | return wlanconfig; | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Create, set tabWiget and return the Information Module | ||
45 | * @param tabWidget a pointer to the tab widget that this information has. | ||
46 | * @return QWidget* pointer to the tab widget in this modules info. | ||
47 | */ | ||
48 | QWidget *WLANModule::information(QTabWidget **tabWidget){ | ||
49 | return NULL; | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * | ||
54 | */ | ||
55 | QList<Interface> WLANModule::getInterfaces(){ | ||
56 | return list | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * Return a list of possible new interfaces | ||
61 | */ | ||
62 | QMap<QString, QString> WLANModule::possibleNewInterfaces(){ | ||
63 | //return list; | ||
64 | } | ||
65 | |||
66 | /** | ||
67 | * Attempt to add a new interface as defined by name | ||
68 | * @param name the name of the type of interface that should be created given | ||
69 | * by possibleNewInterfaces(); | ||
70 | * @return Interface* NULL if it was unable to be created. | ||
71 | */ | ||
72 | Interface *WLANModule::addNewInterface(QString name){ | ||
73 | return NULL; | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * Attempts to remove the interface, doesn't delete i | ||
78 | * @return bool true if successfull, false otherwise. | ||
79 | */ | ||
80 | bool WLANModule::remove(Interface* i){ | ||
81 | return false; | ||
82 | } | ||
83 | |||
84 | // wlanmodule.cpp | ||
85 | |||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.h b/noncore/settings/networksettings/wlan/wlanmodule.h new file mode 100644 index 0000000..1fbf6a9 --- a/dev/null +++ b/noncore/settings/networksettings/wlan/wlanmodule.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef WLAN_MODULE_H | ||
2 | #define WLAN_MODULE_H | ||
3 | |||
4 | #include "module.h" | ||
5 | |||
6 | class WLANModule : Module{ | ||
7 | |||
8 | signals: | ||
9 | void updateInterface(Interface *i); | ||
10 | |||
11 | public: | ||
12 | WLANModule(); | ||
13 | |||
14 | virtual bool isOwner(Interface *); | ||
15 | virtual QWidget *configure(QTabWidget **tabWidget); | ||
16 | virtual QWidget *information(QTabWidget **tabWidget); | ||
17 | virtual QList<Interface> getInterfaces(); | ||
18 | virtual QMap<QString, QString> possibleNewInterfaces(); | ||
19 | virtual Interface *addNewInterface(QString name); | ||
20 | virtual bool remove(Interface* i); | ||
21 | virtual QString getPixmapName(Interface* i); | ||
22 | |||
23 | private: | ||
24 | QList<Interface> list; | ||
25 | |||
26 | }; | ||
27 | |||
28 | extern "C" | ||
29 | { | ||
30 | void* create_plugin() { | ||
31 | return new WLANModule(); | ||
32 | } | ||
33 | }; | ||
34 | |||
35 | #endif | ||
36 | |||
37 | // wlanmodule.h | ||
38 | |||
diff --git a/noncore/settings/networksettings/wlan/wlansetup.pro b/noncore/settings/networksettings/wlan/wlansetup.pro new file mode 100644 index 0000000..7102adb --- a/dev/null +++ b/noncore/settings/networksettings/wlan/wlansetup.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | #CONFIG += qt warn_on debug | ||
4 | #DESTDIR = $(OPIEDIR)/bin | ||
5 | HEADERS = wlanimp.h wlanmodule.h | ||
6 | SOURCES = wlanimp.cpp wlanmodule.cpp | ||
7 | INCLUDEPATH+= $(OPIEDIR)/include ../ | ||
8 | DEPENDPATH+= $(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | INTERFACES= wlan.ui | ||
11 | TARGET = wlanplugin | ||
12 | VERSION = 1.0.0 | ||