summaryrefslogtreecommitdiff
path: root/noncore
authorkergoth <kergoth>2003-04-14 23:31:22 (UTC)
committer kergoth <kergoth>2003-04-14 23:31:22 (UTC)
commitfb07cc161b4adc5bc250569599a7164af2d7caba (patch) (unidiff)
tree1f391e35146e81835af5e0a395896b3fe3c0d46b /noncore
parent68c558ca78e5416145b64ca87fd01361f033ef34 (diff)
downloadopie-fb07cc161b4adc5bc250569599a7164af2d7caba.zip
opie-fb07cc161b4adc5bc250569599a7164af2d7caba.tar.gz
opie-fb07cc161b4adc5bc250569599a7164af2d7caba.tar.bz2
Add new wireless parser that uses the wireless-tools if-pre-up.d
script to handle wireless configuration, as opposed to pcmcia-cs wireless.opts. This has a number of benefits. In addition to improving clarity, this means one can now configure their wireless non-pcmcia interfaces using networksettings. The only real question is, how to handle the fact that its largely useless without the if-pre-up.d script? I'll adapt the existing wlanimp.(cpp|h) to the new .ui, and leave it as a compiletime selection for now.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/wlan.pro14
-rw-r--r--noncore/settings/networksettings/wlan/wlan.ui664
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp266
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.h37
4 files changed, 735 insertions, 246 deletions
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro
index f193bcc..9ddc154 100644
--- a/noncore/settings/networksettings/wlan/wlan.pro
+++ b/noncore/settings/networksettings/wlan/wlan.pro
@@ -2,8 +2,8 @@ TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug 3 #CONFIG += qt warn_on debug
4DESTDIR = $(OPIEDIR)/plugins/networksettings 4DESTDIR = $(OPIEDIR)/plugins/networksettings
5 HEADERS = wlanimp.h infoimp.h wlanmodule.h wextensions.h 5 HEADERS = infoimp.h wlanmodule.h wextensions.h
6 SOURCES = wlanimp.cpp infoimp.cpp wlanmodule.cpp wextensions.cpp 6 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 7 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
8 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe -L../interfaces/ -linterfaces 9LIBS += -lqpe -L../interfaces/ -linterfaces
@@ -11,6 +11,16 @@ INTERFACES = wlan.ui info.ui
11 TARGET = wlanplugin 11 TARGET = wlanplugin
12 VERSION = 1.0.0 12 VERSION = 1.0.0
13 13
14#CONFIG += wirelessopts
14 15
16wirelessopts {
17 HEADERS+= wlanimp.h
18 SOURCES+= wlanimp.cpp
19}
20
21! wirelessopts {
22 HEADERS+= wlanimp2.h
23 SOURCES += wlanimp2.cpp
24}
15 25
16include ( $(OPIEDIR)/include.pro ) 26include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui
index 744c559..e7c8dbb 100644
--- a/noncore/settings/networksettings/wlan/wlan.ui
+++ b/noncore/settings/networksettings/wlan/wlan.ui
@@ -11,13 +11,13 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>239</width> 14 <width>255</width>
15 <height>277</height> 15 <height>299</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 Configuration</string>
21 </property> 21 </property>
22 <property stdset="1"> 22 <property stdset="1">
23 <name>sizeGripEnabled</name> 23 <name>sizeGripEnabled</name>
@@ -55,176 +55,327 @@
55 <name>title</name> 55 <name>title</name>
56 <string>General</string> 56 <string>General</string>
57 </attribute> 57 </attribute>
58 <vbox> 58 <spacer>
59 <property>
60 <name>name</name>
61 <cstring>Spacer31</cstring>
62 </property>
59 <property stdset="1"> 63 <property stdset="1">
60 <name>margin</name> 64 <name>orientation</name>
61 <number>11</number> 65 <enum>Vertical</enum>
62 </property> 66 </property>
63 <property stdset="1"> 67 <property stdset="1">
64 <name>spacing</name> 68 <name>sizeType</name>
65 <number>6</number> 69 <enum>Expanding</enum>
66 </property> 70 </property>
67 <widget> 71 <property>
68 <class>QCheckBox</class> 72 <name>sizeHint</name>
69 <property stdset="1"> 73 <size>
70 <name>name</name> 74 <width>20</width>
71 <cstring>essAny</cstring> 75 <height>20</height>
72 </property> 76 </size>
73 <property stdset="1"> 77 </property>
78 </spacer>
79 <widget>
80 <class>QLabel</class>
81 <property stdset="1">
82 <name>name</name>
83 <cstring>modeLabel</cstring>
84 </property>
85 <property stdset="1">
86 <name>enabled</name>
87 <bool>true</bool>
88 </property>
89 <property stdset="1">
90 <name>geometry</name>
91 <rect>
92 <x>11</x>
93 <y>11</y>
94 <width>84</width>
95 <height>29</height>
96 </rect>
97 </property>
98 <property stdset="1">
99 <name>sizePolicy</name>
100 <sizepolicy>
101 <hsizetype>1</hsizetype>
102 <vsizetype>1</vsizetype>
103 </sizepolicy>
104 </property>
105 <property stdset="1">
106 <name>text</name>
107 <string>Mode</string>
108 </property>
109 </widget>
110 <widget>
111 <class>QLabel</class>
112 <property stdset="1">
113 <name>name</name>
114 <cstring>essidLabel</cstring>
115 </property>
116 <property stdset="1">
117 <name>enabled</name>
118 <bool>true</bool>
119 </property>
120 <property stdset="1">
121 <name>geometry</name>
122 <rect>
123 <x>11</x>
124 <y>46</y>
125 <width>84</width>
126 <height>29</height>
127 </rect>
128 </property>
129 <property stdset="1">
130 <name>sizePolicy</name>
131 <sizepolicy>
132 <hsizetype>1</hsizetype>
133 <vsizetype>1</vsizetype>
134 </sizepolicy>
135 </property>
136 <property stdset="1">
137 <name>text</name>
138 <string>ESS-ID</string>
139 </property>
140 </widget>
141 <widget>
142 <class>QSpinBox</class>
143 <property stdset="1">
144 <name>name</name>
145 <cstring>networkChannel</cstring>
146 </property>
147 <property stdset="1">
148 <name>enabled</name>
149 <bool>false</bool>
150 </property>
151 <property stdset="1">
152 <name>geometry</name>
153 <rect>
154 <x>146</x>
155 <y>139</y>
156 <width>58</width>
157 <height>25</height>
158 </rect>
159 </property>
160 <property stdset="1">
161 <name>maxValue</name>
162 <number>15</number>
163 </property>
164 <property stdset="1">
165 <name>minValue</name>
166 <number>1</number>
167 </property>
168 <property stdset="1">
169 <name>value</name>
170 <number>1</number>
171 </property>
172 </widget>
173 <widget>
174 <class>QLineEdit</class>
175 <property stdset="1">
176 <name>name</name>
177 <cstring>macEdit</cstring>
178 </property>
179 <property stdset="1">
180 <name>enabled</name>
181 <bool>false</bool>
182 </property>
183 <property stdset="1">
184 <name>geometry</name>
185 <rect>
186 <x>56</x>
187 <y>108</y>
188 <width>182</width>
189 <height>25</height>
190 </rect>
191 </property>
192 <property stdset="1">
193 <name>sizePolicy</name>
194 <sizepolicy>
195 <hsizetype>5</hsizetype>
196 <vsizetype>1</vsizetype>
197 </sizepolicy>
198 </property>
199 </widget>
200 <widget>
201 <class>QLabel</class>
202 <property stdset="1">
203 <name>name</name>
204 <cstring>macLabel</cstring>
205 </property>
206 <property stdset="1">
207 <name>enabled</name>
208 <bool>false</bool>
209 </property>
210 <property stdset="1">
211 <name>geometry</name>
212 <rect>
213 <x>11</x>
214 <y>108</y>
215 <width>39</width>
216 <height>25</height>
217 </rect>
218 </property>
219 <property stdset="1">
220 <name>text</name>
221 <string>MAC</string>
222 </property>
223 </widget>
224 <widget>
225 <class>QCheckBox</class>
226 <property stdset="1">
227 <name>name</name>
228 <cstring>specifyAp</cstring>
229 </property>
230 <property stdset="1">
231 <name>geometry</name>
232 <rect>
233 <x>11</x>
234 <y>81</y>
235 <width>227</width>
236 <height>21</height>
237 </rect>
238 </property>
239 <property stdset="1">
240 <name>text</name>
241 <string>Specify &amp;Access Point</string>
242 </property>
243 </widget>
244 <widget>
245 <class>QCheckBox</class>
246 <property stdset="1">
247 <name>name</name>
248 <cstring>specifyChan</cstring>
249 </property>
250 <property stdset="1">
251 <name>geometry</name>
252 <rect>
253 <x>11</x>
254 <y>141</y>
255 <width>129</width>
256 <height>21</height>
257 </rect>
258 </property>
259 <property stdset="1">
260 <name>text</name>
261 <string>Specify &amp;Channel</string>
262 </property>
263 </widget>
264 <spacer>
265 <property>
266 <name>name</name>
267 <cstring>Spacer10</cstring>
268 </property>
269 <property stdset="1">
270 <name>orientation</name>
271 <enum>Horizontal</enum>
272 </property>
273 <property stdset="1">
274 <name>sizeType</name>
275 <enum>Expanding</enum>
276 </property>
277 <property>
278 <name>sizeHint</name>
279 <size>
280 <width>20</width>
281 <height>20</height>
282 </size>
283 </property>
284 </spacer>
285 <widget>
286 <class>QComboBox</class>
287 <item>
288 <property>
74 <name>text</name> 289 <name>text</name>
75 <string>&amp;Specify Access Point</string> 290 <string>Auto</string>
76 </property> 291 </property>
77 </widget> 292 </item>
78 <widget> 293 <item>
79 <class>QGroupBox</class>
80 <property stdset="1">
81 <name>name</name>
82 <cstring>GroupBox1</cstring>
83 </property>
84 <property stdset="1">
85 <name>enabled</name>
86 <bool>false</bool>
87 </property>
88 <property stdset="1">
89 <name>title</name>
90 <string>Specific &amp;Access Point Settings</string>
91 </property>
92 <grid>
93 <property stdset="1">
94 <name>margin</name>
95 <number>11</number>
96 </property>
97 <property stdset="1">
98 <name>spacing</name>
99 <number>6</number>
100 </property>
101 <widget row="0" column="0" >
102 <class>QLabel</class>
103 <property stdset="1">
104 <name>name</name>
105 <cstring>TextLabel1</cstring>
106 </property>
107 <property stdset="1">
108 <name>text</name>
109 <string>ESS-ID</string>
110 </property>
111 </widget>
112 <widget row="1" column="0" >
113 <class>QLabel</class>
114 <property stdset="1">
115 <name>name</name>
116 <cstring>TextLabel2</cstring>
117 </property>
118 <property stdset="1">
119 <name>text</name>
120 <string>Network Type</string>
121 </property>
122 </widget>
123 <widget row="0" column="1" rowspan="1" colspan="2" >
124 <class>QLineEdit</class>
125 <property stdset="1">
126 <name>name</name>
127 <cstring>essSpecificLineEdit</cstring>
128 </property>
129 </widget>
130 <widget row="1" column="1" rowspan="1" colspan="2" >
131 <class>QComboBox</class>
132 <item>
133 <property>
134 <name>text</name>
135 <string>Infrastructure</string>
136 </property>
137 </item>
138 <item>
139 <property>
140 <name>text</name>
141 <string>Ad-Hoc</string>
142 </property>
143 </item>
144 <property stdset="1">
145 <name>name</name>
146 <cstring>networkType</cstring>
147 </property>
148 </widget>
149 <widget row="2" column="0" >
150 <class>QLabel</class>
151 <property stdset="1">
152 <name>name</name>
153 <cstring>channelLabel</cstring>
154 </property>
155 <property stdset="1">
156 <name>text</name>
157 <string>Channel</string>
158 </property>
159 </widget>
160 <widget row="2" column="1" >
161 <class>QSpinBox</class>
162 <property stdset="1">
163 <name>name</name>
164 <cstring>networkChannel</cstring>
165 </property>
166 <property stdset="1">
167 <name>enabled</name>
168 <bool>false</bool>
169 </property>
170 <property stdset="1">
171 <name>maxValue</name>
172 <number>15</number>
173 </property>
174 <property stdset="1">
175 <name>minValue</name>
176 <number>1</number>
177 </property>
178 <property stdset="1">
179 <name>value</name>
180 <number>6</number>
181 </property>
182 </widget>
183 <spacer row="2" column="2" >
184 <property>
185 <name>name</name>
186 <cstring>Spacer4</cstring>
187 </property>
188 <property stdset="1">
189 <name>orientation</name>
190 <enum>Horizontal</enum>
191 </property>
192 <property stdset="1">
193 <name>sizeType</name>
194 <enum>Expanding</enum>
195 </property>
196 <property>
197 <name>sizeHint</name>
198 <size>
199 <width>20</width>
200 <height>20</height>
201 </size>
202 </property>
203 </spacer>
204 </grid>
205 </widget>
206 <spacer>
207 <property> 294 <property>
208 <name>name</name> 295 <name>text</name>
209 <cstring>Spacer31</cstring> 296 <string>Managed</string>
210 </property>
211 <property stdset="1">
212 <name>orientation</name>
213 <enum>Vertical</enum>
214 </property> 297 </property>
215 <property stdset="1"> 298 </item>
216 <name>sizeType</name> 299 <item>
217 <enum>Expanding</enum> 300 <property>
301 <name>text</name>
302 <string>Ad-Hoc</string>
218 </property> 303 </property>
304 </item>
305 <property stdset="1">
306 <name>name</name>
307 <cstring>mode</cstring>
308 </property>
309 <property stdset="1">
310 <name>enabled</name>
311 <bool>true</bool>
312 </property>
313 <property stdset="1">
314 <name>geometry</name>
315 <rect>
316 <x>101</x>
317 <y>11</y>
318 <width>103</width>
319 <height>29</height>
320 </rect>
321 </property>
322 <property stdset="1">
323 <name>sizePolicy</name>
324 <sizepolicy>
325 <hsizetype>1</hsizetype>
326 <vsizetype>0</vsizetype>
327 </sizepolicy>
328 </property>
329 </widget>
330 <widget>
331 <class>QComboBox</class>
332 <item>
219 <property> 333 <property>
220 <name>sizeHint</name> 334 <name>text</name>
221 <size> 335 <string>any</string>
222 <width>20</width>
223 <height>20</height>
224 </size>
225 </property> 336 </property>
226 </spacer> 337 </item>
227 </vbox> 338 <property stdset="1">
339 <name>name</name>
340 <cstring>essid</cstring>
341 </property>
342 <property stdset="1">
343 <name>geometry</name>
344 <rect>
345 <x>101</x>
346 <y>46</y>
347 <width>103</width>
348 <height>29</height>
349 </rect>
350 </property>
351 <property stdset="1">
352 <name>sizePolicy</name>
353 <sizepolicy>
354 <hsizetype>7</hsizetype>
355 <vsizetype>0</vsizetype>
356 </sizepolicy>
357 </property>
358 <property stdset="1">
359 <name>editable</name>
360 <bool>true</bool>
361 </property>
362 <property stdset="1">
363 <name>currentItem</name>
364 <number>0</number>
365 </property>
366 <property stdset="1">
367 <name>sizeLimit</name>
368 <number>5</number>
369 </property>
370 <property stdset="1">
371 <name>autoCompletion</name>
372 <bool>true</bool>
373 </property>
374 <property stdset="1">
375 <name>duplicatesEnabled</name>
376 <bool>false</bool>
377 </property>
378 </widget>
228 </widget> 379 </widget>
229 <widget> 380 <widget>
230 <class>QWidget</class> 381 <class>QWidget</class>
@@ -236,7 +387,7 @@
236 <name>title</name> 387 <name>title</name>
237 <string>Encryption</string> 388 <string>Encryption</string>
238 </attribute> 389 </attribute>
239 <vbox> 390 <grid>
240 <property stdset="1"> 391 <property stdset="1">
241 <name>margin</name> 392 <name>margin</name>
242 <number>11</number> 393 <number>11</number>
@@ -245,69 +396,39 @@
245 <name>spacing</name> 396 <name>spacing</name>
246 <number>6</number> 397 <number>6</number>
247 </property> 398 </property>
248 <widget> 399 <spacer row="0" column="0" >
249 <class>QCheckBox</class> 400 <property>
250 <property stdset="1">
251 <name>name</name> 401 <name>name</name>
252 <cstring>wepEnabled</cstring> 402 <cstring>Spacer30</cstring>
253 </property> 403 </property>
254 <property stdset="1"> 404 <property stdset="1">
255 <name>text</name> 405 <name>orientation</name>
256 <string>&amp;Enable WEP</string> 406 <enum>Vertical</enum>
257 </property> 407 </property>
258 </widget>
259 <widget>
260 <class>QButtonGroup</class>
261 <property stdset="1"> 408 <property stdset="1">
262 <name>name</name> 409 <name>sizeType</name>
263 <cstring>ButtonGroup43</cstring> 410 <enum>Expanding</enum>
411 </property>
412 <property>
413 <name>sizeHint</name>
414 <size>
415 <width>20</width>
416 <height>20</height>
417 </size>
264 </property> 418 </property>
419 </spacer>
420 <widget row="0" column="0" >
421 <class>QCheckBox</class>
265 <property stdset="1"> 422 <property stdset="1">
266 <name>enabled</name> 423 <name>name</name>
267 <bool>false</bool> 424 <cstring>wepEnabled</cstring>
268 </property> 425 </property>
269 <property stdset="1"> 426 <property stdset="1">
270 <name>title</name> 427 <name>text</name>
271 <string>&amp;Authentication Type</string> 428 <string>&amp;Enable Encryption</string>
272 </property> 429 </property>
273 <hbox>
274 <property stdset="1">
275 <name>margin</name>
276 <number>11</number>
277 </property>
278 <property stdset="1">
279 <name>spacing</name>
280 <number>6</number>
281 </property>
282 <widget>
283 <class>QRadioButton</class>
284 <property stdset="1">
285 <name>name</name>
286 <cstring>authOpen</cstring>
287 </property>
288 <property stdset="1">
289 <name>text</name>
290 <string>&amp;Open System</string>
291 </property>
292 <property stdset="1">
293 <name>checked</name>
294 <bool>true</bool>
295 </property>
296 </widget>
297 <widget>
298 <class>QRadioButton</class>
299 <property stdset="1">
300 <name>name</name>
301 <cstring>authShared</cstring>
302 </property>
303 <property stdset="1">
304 <name>text</name>
305 <string>&amp;Shared Key</string>
306 </property>
307 </widget>
308 </hbox>
309 </widget> 430 </widget>
310 <widget> 431 <widget row="1" column="0" >
311 <class>QButtonGroup</class> 432 <class>QButtonGroup</class>
312 <property stdset="1"> 433 <property stdset="1">
313 <name>name</name> 434 <name>name</name>
@@ -382,7 +503,7 @@
382 </property> 503 </property>
383 <property stdset="1"> 504 <property stdset="1">
384 <name>text</name> 505 <name>text</name>
385 <string>Key 1</string> 506 <string>Key &amp;1</string>
386 </property> 507 </property>
387 <property stdset="1"> 508 <property stdset="1">
388 <name>checked</name> 509 <name>checked</name>
@@ -397,7 +518,7 @@
397 </property> 518 </property>
398 <property stdset="1"> 519 <property stdset="1">
399 <name>text</name> 520 <name>text</name>
400 <string>Key 2</string> 521 <string>Key &amp;2</string>
401 </property> 522 </property>
402 </widget> 523 </widget>
403 <widget row="2" column="0" > 524 <widget row="2" column="0" >
@@ -408,7 +529,7 @@
408 </property> 529 </property>
409 <property stdset="1"> 530 <property stdset="1">
410 <name>text</name> 531 <name>text</name>
411 <string>Key 3</string> 532 <string>Key &amp;3</string>
412 </property> 533 </property>
413 </widget> 534 </widget>
414 <widget row="3" column="0" > 535 <widget row="3" column="0" >
@@ -419,42 +540,96 @@
419 </property> 540 </property>
420 <property stdset="1"> 541 <property stdset="1">
421 <name>text</name> 542 <name>text</name>
422 <string>Key 4</string> 543 <string>Key &amp;4</string>
423 </property> 544 </property>
424 </widget> 545 </widget>
425 </grid> 546 </grid>
426 </widget> 547 </widget>
427 <spacer> 548 <widget row="2" column="0" >
428 <property> 549 <class>QButtonGroup</class>
550 <property stdset="1">
429 <name>name</name> 551 <name>name</name>
430 <cstring>Spacer30</cstring> 552 <cstring>NonEncButtonGroup</cstring>
431 </property> 553 </property>
432 <property stdset="1"> 554 <property stdset="1">
433 <name>orientation</name> 555 <name>enabled</name>
434 <enum>Vertical</enum> 556 <bool>false</bool>
435 </property> 557 </property>
436 <property stdset="1"> 558 <property stdset="1">
437 <name>sizeType</name> 559 <name>title</name>
438 <enum>Expanding</enum> 560 <string>Non-encrypted Packets</string>
439 </property> 561 </property>
440 <property> 562 <property stdset="1">
441 <name>sizeHint</name> 563 <name>radioButtonExclusive</name>
442 <size> 564 <bool>true</bool>
443 <width>20</width>
444 <height>20</height>
445 </size>
446 </property> 565 </property>
447 </spacer> 566 <grid>
448 </vbox> 567 <property stdset="1">
568 <name>margin</name>
569 <number>11</number>
570 </property>
571 <property stdset="1">
572 <name>spacing</name>
573 <number>6</number>
574 </property>
575 <widget row="0" column="0" >
576 <class>QRadioButton</class>
577 <property stdset="1">
578 <name>name</name>
579 <cstring>acceptNonEnc</cstring>
580 </property>
581 <property stdset="1">
582 <name>text</name>
583 <string>&amp;Accept</string>
584 </property>
585 <property stdset="1">
586 <name>checked</name>
587 <bool>true</bool>
588 </property>
589 <property stdset="1">
590 <name>buttonGroupId</name>
591 <number>0</number>
592 </property>
593 </widget>
594 <widget row="0" column="1" >
595 <class>QRadioButton</class>
596 <property stdset="1">
597 <name>name</name>
598 <cstring>rejectNonEnc</cstring>
599 </property>
600 <property stdset="1">
601 <name>text</name>
602 <string>&amp;Reject</string>
603 </property>
604 <property stdset="1">
605 <name>buttonGroupId</name>
606 <number>1</number>
607 </property>
608 </widget>
609 </grid>
610 </widget>
611 </grid>
449 </widget> 612 </widget>
450 </widget> 613 </widget>
451 </vbox> 614 </vbox>
452</widget> 615</widget>
453<connections> 616<connections>
454 <connection> 617 <connection>
455 <sender>wepEnabled</sender> 618 <sender>specifyAp</sender>
619 <signal>toggled(bool)</signal>
620 <receiver>macLabel</receiver>
621 <slot>setEnabled(bool)</slot>
622 </connection>
623 <connection>
624 <sender>specifyAp</sender>
625 <signal>toggled(bool)</signal>
626 <receiver>macEdit</receiver>
627 <slot>setEnabled(bool)</slot>
628 </connection>
629 <connection>
630 <sender>specifyChan</sender>
456 <signal>toggled(bool)</signal> 631 <signal>toggled(bool)</signal>
457 <receiver>ButtonGroup43</receiver> 632 <receiver>networkChannel</receiver>
458 <slot>setEnabled(bool)</slot> 633 <slot>setEnabled(bool)</slot>
459 </connection> 634 </connection>
460 <connection> 635 <connection>
@@ -464,21 +639,15 @@
464 <slot>setEnabled(bool)</slot> 639 <slot>setEnabled(bool)</slot>
465 </connection> 640 </connection>
466 <connection> 641 <connection>
467 <sender>essAny</sender> 642 <sender>wepEnabled</sender>
468 <signal>toggled(bool)</signal> 643 <signal>toggled(bool)</signal>
469 <receiver>GroupBox1</receiver> 644 <receiver>NonEncButtonGroup</receiver>
470 <slot>setEnabled(bool)</slot> 645 <slot>setEnabled(bool)</slot>
471 </connection> 646 </connection>
472</connections> 647</connections>
473<tabstops> 648<tabstops>
474 <tabstop>tabWidget</tabstop> 649 <tabstop>tabWidget</tabstop>
475 <tabstop>essAny</tabstop>
476 <tabstop>essSpecificLineEdit</tabstop>
477 <tabstop>networkType</tabstop>
478 <tabstop>networkChannel</tabstop>
479 <tabstop>wepEnabled</tabstop> 650 <tabstop>wepEnabled</tabstop>
480 <tabstop>authOpen</tabstop>
481 <tabstop>authShared</tabstop>
482 <tabstop>keyRadio0</tabstop> 651 <tabstop>keyRadio0</tabstop>
483 <tabstop>keyLineEdit0</tabstop> 652 <tabstop>keyLineEdit0</tabstop>
484 <tabstop>keyRadio1</tabstop> 653 <tabstop>keyRadio1</tabstop>
@@ -487,5 +656,12 @@
487 <tabstop>keyLineEdit2</tabstop> 656 <tabstop>keyLineEdit2</tabstop>
488 <tabstop>keyRadio3</tabstop> 657 <tabstop>keyRadio3</tabstop>
489 <tabstop>keyLineEdit3</tabstop> 658 <tabstop>keyLineEdit3</tabstop>
659 <tabstop>acceptNonEnc</tabstop>
660 <tabstop>mode</tabstop>
661 <tabstop>essid</tabstop>
662 <tabstop>specifyAp</tabstop>
663 <tabstop>macEdit</tabstop>
664 <tabstop>specifyChan</tabstop>
665 <tabstop>networkChannel</tabstop>
490</tabstops> 666</tabstops>
491</UI> 667</UI>
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
new file mode 100644
index 0000000..01c9668
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -0,0 +1,266 @@
1#include "wlanimp2.h"
2#include "interfacesetupimp.h"
3
4#include <qfile.h>
5#include <qdir.h>
6#include <qtextstream.h>
7#include <qmessagebox.h>
8#include <qlineedit.h>
9#include <qlabel.h>
10#include <qspinbox.h>
11#include <qradiobutton.h>
12#include <qcheckbox.h>
13#include <qtabwidget.h>
14#include <qcombobox.h>
15
16#ifdef QWS
17 #include <opie/oprocess.h>
18#else
19 #define OProcess KProcess
20 #include <kprocess.h>
21#endif
22
23#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts"
24#define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools"
25
26/**
27 * Constructor, read in the wireless.opts file for parsing later.
28 */
29WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), currentProfile("*"), interface(i) {
30 interfaces = new Interfaces;
31 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
32 tabWidget->insertTab(interfaceSetup, "TCP/IP");
33
34 // Check sanity - the existance of the wireless-tools if-pre-up script
35 QFile file(QString(PREUP));
36 if (file.exists()) {
37 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools"));
38 }
39}
40
41WLANImp::~WLANImp() {
42 delete interfaces;
43}
44
45/**
46 * Change the profile for both wireless settings and network settings.
47 */
48void WLANImp::setProfile(const QString &profile){
49 interfaceSetup->setProfile(profile);
50 parseOpts();
51}
52
53void WLANImp::parseOpts() {
54 bool error;
55 QString opt;
56
57 if (! interfaces->isInterfaceSet())
58 return;
59
60
61 opt = interfaces->getInterfaceOption("wireless_essid", error);
62 if(opt == "any" || opt == "off" || opt.isNull()){
63 essid->setEditText("any");
64 } else {
65 essid->setEditText(opt);
66 }
67
68 opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace();
69 if (opt == "Auto") {
70 mode->setCurrentItem(0);
71 } else if (opt == "Ad-Hoc") {
72 mode->setCurrentItem(2);
73 } else {
74 // Managed/Infrastructure mode
75 mode->setCurrentItem(1);
76 }
77
78 opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace();
79 if (! opt.isNull()) {
80 specifyAp->setChecked(true);
81 macEdit->setText(opt);
82 }
83
84 opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace();
85 if (! opt.isNull()) {
86 specifyChan->setChecked(true);
87 networkChannel->setValue(opt.toInt());
88 }
89
90 opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace();
91 if (opt.isNull())
92 opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace();
93 parseKeyStr(opt);
94}
95
96void WLANImp::parseKeyStr(QString keystr) {
97 int loc = 0;
98 int index = 1;
99 QString key;
100 QStringList keys = QStringList::split(QRegExp("\\s+"), keystr);
101 int enc = -1; // encryption state
102
103 for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) {
104 if ((*it).left(3) == "off") {
105 // encryption disabled
106 enc = 0;
107 } else if ((*it).left(2) == "on") {
108 // encryption enabled
109 enc = 1;
110 } else if ((*it).left(4) == "open") {
111 // open mode, accept non encrypted packets
112 acceptNonEnc->setChecked(true);
113 } else if ((*it).left(10) == "restricted") {
114 // restricted mode, only accept encrypted packets
115 rejectNonEnc->setChecked(true);
116 } else if ((*it).left(3) == "key") {
117 // new set of options
118 } else if ((*it).left(1) == "[") {
119 index = (*it).mid(1, 1).toInt();
120 // switch current key to index
121 switch (index) {
122 case 1:
123 keyRadio0->setChecked(true);
124 break;
125 case 2:
126 keyRadio1->setChecked(true);
127 break;
128 case 3:
129 keyRadio2->setChecked(true);
130 break;
131 case 4:
132 keyRadio3->setChecked(true);
133 break;
134 }
135 } else {
136 // key
137 key = (*it);
138 }
139 if (! key.isNull()) {
140 if (enc == -1)
141 enc = 1;
142 QStringList::Iterator next = ++it;
143 if (it == keys.end()) {
144 break;
145 }
146 if ((*(next)).left(1) == "[") {
147 // set key at index
148 index = (*(next)).mid(1, 1).toInt();
149 } else {
150 index = 1;
151 }
152 switch (index) {
153 case 1:
154 keyLineEdit0->setText(key);
155 break;
156 case 2:
157 keyLineEdit1->setText(key);
158 break;
159 case 3:
160 keyLineEdit2->setText(key);
161 break;
162 case 4:
163 keyLineEdit3->setText(key);
164 break;
165 }
166 key = QString::null;
167 }
168 }
169 if (enc == 1) {
170 wepEnabled->setChecked(true);
171 } else {
172 wepEnabled->setChecked(false);
173 }
174}
175
176/**
177 * Check to see if the current config is valid
178 * Save interfaces
179 */
180void WLANImp::accept() {
181 if (wepEnabled->isChecked()) {
182 if ((keyRadio0->isChecked() && keyLineEdit0->text().isEmpty()) ||
183 (keyRadio1->isChecked() && keyLineEdit1->text().isEmpty()) ||
184 (keyRadio2->isChecked() && keyLineEdit2->text().isEmpty()) ||
185 (keyRadio3->isChecked() && keyLineEdit3->text().isEmpty())) {
186 QMessageBox::information(this, "Error", "Please enter a WEP key.", QMessageBox::Ok);
187 return;
188 }
189 }
190
191 if (essid->currentText().isEmpty()) {
192 QMessageBox::information(this, "Error", "Please select/enter an ESSID.", QMessageBox::Ok);
193 return;
194 }
195
196 if (specifyAp->isChecked() && macEdit->text().isEmpty()) {
197 QMessageBox::information(this, "Error", "Please enter the MAC address of the Access Point.", QMessageBox::Ok);
198 return;
199 }
200
201 // Try to save the interfaces settings.
202 writeOpts();
203
204 // Close out the dialog
205 QDialog::accept();
206}
207
208void WLANImp::writeOpts() {
209 bool error = false;
210
211 interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText());
212 interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText());
213
214 if (specifyAp->isChecked()) {
215 interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text());
216 } else {
217 interfaces->removeInterfaceOption(QString("wireless_ap"));
218 }
219
220 if (specifyChan->isChecked()) {
221 interfaces->setInterfaceOption(QString("wireless_channel"), networkChannel->text());
222 } else {
223 interfaces->removeInterfaceOption(QString("wireless_channel"));
224 }
225
226 if (wepEnabled->isChecked()) {
227 QStringList keyList;
228
229 if (! keyLineEdit0->text().isNull()) {
230 keyList += keyLineEdit0->text();
231 keyList += "[1]";
232 } else if (! keyLineEdit1->text().isNull()) {
233 keyList += keyLineEdit1->text();
234 keyList += "[2]";
235 } else if (! keyLineEdit2->text().isNull()) {
236 keyList += keyLineEdit2->text();
237 keyList += "[3]";
238 } else if (! keyLineEdit3->text().isNull()) {
239 keyList += keyLineEdit3->text();
240 keyList += "[4]";
241 }
242 if (acceptNonEnc->isChecked()) {
243 keyList += "open";
244 } else {
245 keyList += "restricted";
246 }
247
248 keyList += "key";
249 if (keyRadio0->isChecked()) {
250 keyList += "[1]";
251 } else if (keyRadio1->isChecked()) {
252 keyList += "[2]";
253 } else if (keyRadio2->isChecked()) {
254 keyList += "[3]";
255 } else if (keyRadio3->isChecked()) {
256 keyList += "[4]";
257 }
258 interfaces->setInterfaceOption(QString("wireless_key"), keyList.join(QString(" ")));
259 } else {
260 interfaces->removeInterfaceOption(QString("wireless_key"));
261 }
262 interfaces->removeInterfaceOption(QString("wireless_enc"));
263
264 if(!interfaceSetup->saveChanges())
265 return;
266}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.h b/noncore/settings/networksettings/wlan/wlanimp2.h
new file mode 100644
index 0000000..992d09a
--- a/dev/null
+++ b/noncore/settings/networksettings/wlan/wlanimp2.h
@@ -0,0 +1,37 @@
1#ifndef WLANIMP_H
2#define WLANIMP_H
3
4#include "wlan.h"
5#include "interfaces.h"
6#include <qstringlist.h>
7
8class InterfaceSetupImp;
9class Interface;
10class Config;
11
12class WLANImp : public WLAN {
13 Q_OBJECT
14
15public:
16 WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 );
17 ~WLANImp();
18 void setProfile(const QString &profile);
19
20protected:
21 void accept();
22
23private:
24 void parseOpts();
25 void writeOpts();
26
27 void parseKeyStr(QString keystr);
28
29 InterfaceSetupImp *interfaceSetup;
30 Interfaces *interfaces;
31 Interface *interface;
32
33 QString currentProfile;
34};
35
36#endif
37