Diffstat (limited to 'noncore/settings/networksettings/wlan') (more/less context) (show whitespace changes)
7 files changed, 446 insertions, 197 deletions
diff --git a/noncore/settings/networksettings/wlan/config.in b/noncore/settings/networksettings/wlan/config.in index 53bcb1e..e459788 100644 --- a/noncore/settings/networksettings/wlan/config.in +++ b/noncore/settings/networksettings/wlan/config.in | |||
@@ -3,2 +3,4 @@ | |||
3 | default "n" if NETWORKSETUP | 3 | default "n" if NETWORKSETUP |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES && LIBOPIE2NET |
5 | #comment "opie-networksettingsplugin-wlan needs libopie, libopie2net and networksetup" | ||
6 | #depends !( LIBOPIE2NET && LIBOPIE && NETWORKSETUP) \ No newline at end of file | ||
diff --git a/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control b/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control index 719337f..ec3078d 100644 --- a/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control +++ b/noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control | |||
@@ -6,3 +6,3 @@ Maintainer: Patrick S. Vogt <tille@handhelds.org> | |||
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings | 7 | Depends: opie-networksettings, libopie2net (1.8.1) |
8 | Description: Network settings wavelan plugin. | 8 | Description: Network settings wavelan plugin. |
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro index 552c669..82a5b2f 100644 --- a/noncore/settings/networksettings/wlan/wlan.pro +++ b/noncore/settings/networksettings/wlan/wlan.pro | |||
@@ -10,3 +10,3 @@ INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ | |||
10 | DEPENDPATH+= $(OPIEDIR)/include | 10 | DEPENDPATH+= $(OPIEDIR)/include |
11 | LIBS += -lqpe -L../interfaces/ -linterfaces | 11 | LIBS += -lqpe -L../interfaces/ -linterfaces -lopienet2 |
12 | INTERFACES= wlan.ui info.ui | 12 | INTERFACES= wlan.ui info.ui |
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui index 7e39e23..195ead9 100644 --- a/noncore/settings/networksettings/wlan/wlan.ui +++ b/noncore/settings/networksettings/wlan/wlan.ui | |||
@@ -13,4 +13,4 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>247</width> | 14 | <width>216</width> |
15 | <height>299</height> | 15 | <height>342</height> |
16 | </rect> | 16 | </rect> |
@@ -47,2 +47,8 @@ | |||
47 | </property> | 47 | </property> |
48 | <property> | ||
49 | <name>layoutMargin</name> | ||
50 | </property> | ||
51 | <property> | ||
52 | <name>layoutSpacing</name> | ||
53 | </property> | ||
48 | <widget> | 54 | <widget> |
@@ -57,31 +63,47 @@ | |||
57 | </attribute> | 63 | </attribute> |
58 | <spacer> | 64 | <vbox> |
59 | <property> | 65 | <property stdset="1"> |
66 | <name>margin</name> | ||
67 | <number>3</number> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>spacing</name> | ||
71 | <number>2</number> | ||
72 | </property> | ||
73 | <widget> | ||
74 | <class>QLayoutWidget</class> | ||
75 | <property stdset="1"> | ||
60 | <name>name</name> | 76 | <name>name</name> |
61 | <cstring>Spacer31</cstring> | 77 | <cstring>Layout1</cstring> |
62 | </property> | 78 | </property> |
79 | <grid> | ||
63 | <property stdset="1"> | 80 | <property stdset="1"> |
64 | <name>orientation</name> | 81 | <name>margin</name> |
65 | <enum>Vertical</enum> | 82 | <number>0</number> |
66 | </property> | 83 | </property> |
67 | <property stdset="1"> | 84 | <property stdset="1"> |
68 | <name>sizeType</name> | 85 | <name>spacing</name> |
69 | <enum>Expanding</enum> | 86 | <number>6</number> |
70 | </property> | 87 | </property> |
88 | <widget row="1" column="1" > | ||
89 | <class>QComboBox</class> | ||
90 | <item> | ||
71 | <property> | 91 | <property> |
72 | <name>sizeHint</name> | 92 | <name>text</name> |
73 | <size> | 93 | <string>any</string> |
74 | <width>20</width> | ||
75 | <height>20</height> | ||
76 | </size> | ||
77 | </property> | 94 | </property> |
78 | </spacer> | 95 | </item> |
79 | <widget> | ||
80 | <class>QLabel</class> | ||
81 | <property stdset="1"> | 96 | <property stdset="1"> |
82 | <name>name</name> | 97 | <name>name</name> |
83 | <cstring>modeLabel</cstring> | 98 | <cstring>essid</cstring> |
84 | </property> | 99 | </property> |
85 | <property stdset="1"> | 100 | <property stdset="1"> |
86 | <name>enabled</name> | 101 | <name>sizePolicy</name> |
102 | <sizepolicy> | ||
103 | <hsizetype>7</hsizetype> | ||
104 | <vsizetype>0</vsizetype> | ||
105 | </sizepolicy> | ||
106 | </property> | ||
107 | <property stdset="1"> | ||
108 | <name>editable</name> | ||
87 | <bool>true</bool> | 109 | <bool>true</bool> |
@@ -89,23 +111,19 @@ | |||
89 | <property stdset="1"> | 111 | <property stdset="1"> |
90 | <name>geometry</name> | 112 | <name>currentItem</name> |
91 | <rect> | 113 | <number>0</number> |
92 | <x>11</x> | ||
93 | <y>11</y> | ||
94 | <width>84</width> | ||
95 | <height>29</height> | ||
96 | </rect> | ||
97 | </property> | 114 | </property> |
98 | <property stdset="1"> | 115 | <property stdset="1"> |
99 | <name>sizePolicy</name> | 116 | <name>sizeLimit</name> |
100 | <sizepolicy> | 117 | <number>5</number> |
101 | <hsizetype>1</hsizetype> | ||
102 | <vsizetype>1</vsizetype> | ||
103 | </sizepolicy> | ||
104 | </property> | 118 | </property> |
105 | <property stdset="1"> | 119 | <property stdset="1"> |
106 | <name>text</name> | 120 | <name>autoCompletion</name> |
107 | <string>Mode</string> | 121 | <bool>true</bool> |
122 | </property> | ||
123 | <property stdset="1"> | ||
124 | <name>duplicatesEnabled</name> | ||
125 | <bool>false</bool> | ||
108 | </property> | 126 | </property> |
109 | </widget> | 127 | </widget> |
110 | <widget> | 128 | <widget row="1" column="0" > |
111 | <class>QLabel</class> | 129 | <class>QLabel</class> |
@@ -120,11 +138,2 @@ | |||
120 | <property stdset="1"> | 138 | <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> | 139 | <name>sizePolicy</name> |
@@ -137,42 +146,34 @@ | |||
137 | <name>text</name> | 146 | <name>text</name> |
138 | <string>ESS-ID</string> | 147 | <string>SSID</string> |
139 | </property> | 148 | </property> |
140 | </widget> | 149 | </widget> |
141 | <widget> | 150 | <widget row="0" column="1" > |
142 | <class>QSpinBox</class> | 151 | <class>QComboBox</class> |
143 | <property stdset="1"> | 152 | <item> |
144 | <name>name</name> | 153 | <property> |
145 | <cstring>networkChannel</cstring> | 154 | <name>text</name> |
146 | </property> | 155 | <string>Infrastructure</string> |
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> | 156 | </property> |
160 | <property stdset="1"> | 157 | </item> |
161 | <name>maxValue</name> | 158 | <item> |
162 | <number>15</number> | 159 | <property> |
160 | <name>text</name> | ||
161 | <string>Auto</string> | ||
163 | </property> | 162 | </property> |
164 | <property stdset="1"> | 163 | </item> |
165 | <name>minValue</name> | 164 | <item> |
166 | <number>1</number> | 165 | <property> |
166 | <name>text</name> | ||
167 | <string>Managed</string> | ||
167 | </property> | 168 | </property> |
168 | <property stdset="1"> | 169 | </item> |
169 | <name>value</name> | 170 | <item> |
170 | <number>1</number> | 171 | <property> |
172 | <name>text</name> | ||
173 | <string>Ad-Hoc</string> | ||
171 | </property> | 174 | </property> |
172 | </widget> | 175 | </item> |
173 | <widget> | ||
174 | <class>QLineEdit</class> | ||
175 | <property stdset="1"> | 176 | <property stdset="1"> |
176 | <name>name</name> | 177 | <name>name</name> |
177 | <cstring>macEdit</cstring> | 178 | <cstring>mode</cstring> |
178 | </property> | 179 | </property> |
@@ -180,12 +181,3 @@ | |||
180 | <name>enabled</name> | 181 | <name>enabled</name> |
181 | <bool>false</bool> | 182 | <bool>true</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> | 183 | </property> |
@@ -194,4 +186,4 @@ | |||
194 | <sizepolicy> | 186 | <sizepolicy> |
195 | <hsizetype>5</hsizetype> | 187 | <hsizetype>7</hsizetype> |
196 | <vsizetype>1</vsizetype> | 188 | <vsizetype>0</vsizetype> |
197 | </sizepolicy> | 189 | </sizepolicy> |
@@ -199,3 +191,3 @@ | |||
199 | </widget> | 191 | </widget> |
200 | <widget> | 192 | <widget row="0" column="0" > |
201 | <class>QLabel</class> | 193 | <class>QLabel</class> |
@@ -203,3 +195,3 @@ | |||
203 | <name>name</name> | 195 | <name>name</name> |
204 | <cstring>macLabel</cstring> | 196 | <cstring>modeLabel</cstring> |
205 | </property> | 197 | </property> |
@@ -207,12 +199,10 @@ | |||
207 | <name>enabled</name> | 199 | <name>enabled</name> |
208 | <bool>false</bool> | 200 | <bool>true</bool> |
209 | </property> | 201 | </property> |
210 | <property stdset="1"> | 202 | <property stdset="1"> |
211 | <name>geometry</name> | 203 | <name>sizePolicy</name> |
212 | <rect> | 204 | <sizepolicy> |
213 | <x>11</x> | 205 | <hsizetype>1</hsizetype> |
214 | <y>108</y> | 206 | <vsizetype>1</vsizetype> |
215 | <width>39</width> | 207 | </sizepolicy> |
216 | <height>25</height> | ||
217 | </rect> | ||
218 | </property> | 208 | </property> |
@@ -220,5 +210,7 @@ | |||
220 | <name>text</name> | 210 | <name>text</name> |
221 | <string>MAC</string> | 211 | <string>Mode</string> |
222 | </property> | 212 | </property> |
223 | </widget> | 213 | </widget> |
214 | </grid> | ||
215 | </widget> | ||
224 | <widget> | 216 | <widget> |
@@ -230,11 +222,2 @@ | |||
230 | <property stdset="1"> | 222 | <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> | 223 | <name>text</name> |
@@ -244,62 +227,40 @@ | |||
244 | <widget> | 227 | <widget> |
245 | <class>QCheckBox</class> | 228 | <class>QLayoutWidget</class> |
246 | <property stdset="1"> | 229 | <property stdset="1"> |
247 | <name>name</name> | 230 | <name>name</name> |
248 | <cstring>specifyChan</cstring> | 231 | <cstring>Layout3</cstring> |
249 | </property> | 232 | </property> |
233 | <hbox> | ||
250 | <property stdset="1"> | 234 | <property stdset="1"> |
251 | <name>geometry</name> | 235 | <name>margin</name> |
252 | <rect> | 236 | <number>0</number> |
253 | <x>11</x> | ||
254 | <y>141</y> | ||
255 | <width>129</width> | ||
256 | <height>21</height> | ||
257 | </rect> | ||
258 | </property> | 237 | </property> |
259 | <property stdset="1"> | 238 | <property stdset="1"> |
260 | <name>text</name> | 239 | <name>spacing</name> |
261 | <string>Specify &Channel</string> | 240 | <number>6</number> |
262 | </property> | 241 | </property> |
263 | </widget> | 242 | <widget> |
264 | <spacer> | 243 | <class>QLabel</class> |
265 | <property> | 244 | <property stdset="1"> |
266 | <name>name</name> | 245 | <name>name</name> |
267 | <cstring>Spacer10</cstring> | 246 | <cstring>macLabel</cstring> |
268 | </property> | 247 | </property> |
269 | <property stdset="1"> | 248 | <property stdset="1"> |
270 | <name>orientation</name> | 249 | <name>enabled</name> |
271 | <enum>Horizontal</enum> | 250 | <bool>false</bool> |
272 | </property> | 251 | </property> |
273 | <property stdset="1"> | 252 | <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> | ||
289 | <name>text</name> | 253 | <name>text</name> |
290 | <string>any</string> | 254 | <string>MAC</string> |
291 | </property> | 255 | </property> |
292 | </item> | 256 | </widget> |
257 | <widget> | ||
258 | <class>QLineEdit</class> | ||
293 | <property stdset="1"> | 259 | <property stdset="1"> |
294 | <name>name</name> | 260 | <name>name</name> |
295 | <cstring>essid</cstring> | 261 | <cstring>macEdit</cstring> |
296 | </property> | 262 | </property> |
297 | <property stdset="1"> | 263 | <property stdset="1"> |
298 | <name>geometry</name> | 264 | <name>enabled</name> |
299 | <rect> | 265 | <bool>false</bool> |
300 | <x>101</x> | ||
301 | <y>46</y> | ||
302 | <width>103</width> | ||
303 | <height>29</height> | ||
304 | </rect> | ||
305 | </property> | 266 | </property> |
@@ -309,11 +270,17 @@ | |||
309 | <hsizetype>7</hsizetype> | 270 | <hsizetype>7</hsizetype> |
310 | <vsizetype>0</vsizetype> | 271 | <vsizetype>1</vsizetype> |
311 | </sizepolicy> | 272 | </sizepolicy> |
312 | </property> | 273 | </property> |
274 | </widget> | ||
275 | </hbox> | ||
276 | </widget> | ||
277 | <widget> | ||
278 | <class>QLayoutWidget</class> | ||
313 | <property stdset="1"> | 279 | <property stdset="1"> |
314 | <name>editable</name> | 280 | <name>name</name> |
315 | <bool>true</bool> | 281 | <cstring>Layout4</cstring> |
316 | </property> | 282 | </property> |
283 | <hbox> | ||
317 | <property stdset="1"> | 284 | <property stdset="1"> |
318 | <name>currentItem</name> | 285 | <name>margin</name> |
319 | <number>0</number> | 286 | <number>0</number> |
@@ -321,65 +288,116 @@ | |||
321 | <property stdset="1"> | 288 | <property stdset="1"> |
322 | <name>sizeLimit</name> | 289 | <name>spacing</name> |
323 | <number>5</number> | 290 | <number>6</number> |
324 | </property> | 291 | </property> |
292 | <widget> | ||
293 | <class>QCheckBox</class> | ||
325 | <property stdset="1"> | 294 | <property stdset="1"> |
326 | <name>autoCompletion</name> | 295 | <name>name</name> |
327 | <bool>true</bool> | 296 | <cstring>specifyChan</cstring> |
328 | </property> | 297 | </property> |
329 | <property stdset="1"> | 298 | <property stdset="1"> |
330 | <name>duplicatesEnabled</name> | 299 | <name>text</name> |
300 | <string>Specify &Channel</string> | ||
301 | </property> | ||
302 | </widget> | ||
303 | <widget> | ||
304 | <class>QSpinBox</class> | ||
305 | <property stdset="1"> | ||
306 | <name>name</name> | ||
307 | <cstring>networkChannel</cstring> | ||
308 | </property> | ||
309 | <property stdset="1"> | ||
310 | <name>enabled</name> | ||
331 | <bool>false</bool> | 311 | <bool>false</bool> |
332 | </property> | 312 | </property> |
313 | <property stdset="1"> | ||
314 | <name>maxValue</name> | ||
315 | <number>15</number> | ||
316 | </property> | ||
317 | <property stdset="1"> | ||
318 | <name>minValue</name> | ||
319 | <number>1</number> | ||
320 | </property> | ||
321 | <property stdset="1"> | ||
322 | <name>value</name> | ||
323 | <number>1</number> | ||
324 | </property> | ||
325 | </widget> | ||
326 | </hbox> | ||
333 | </widget> | 327 | </widget> |
334 | <widget> | 328 | <widget> |
335 | <class>QComboBox</class> | 329 | <class>QPushButton</class> |
336 | <item> | 330 | <property stdset="1"> |
337 | <property> | 331 | <name>name</name> |
332 | <cstring>rescanButton</cstring> | ||
333 | </property> | ||
334 | <property stdset="1"> | ||
338 | <name>text</name> | 335 | <name>text</name> |
339 | <string>Infrastructure</string> | 336 | <string>Rescan Neighbourhood</string> |
340 | </property> | 337 | </property> |
341 | </item> | 338 | </widget> |
342 | <item> | 339 | <widget> |
340 | <class>QListView</class> | ||
341 | <column> | ||
343 | <property> | 342 | <property> |
344 | <name>text</name> | 343 | <name>text</name> |
345 | <string>Auto</string> | 344 | <string></string> |
346 | </property> | 345 | </property> |
347 | </item> | 346 | <property> |
348 | <item> | 347 | <name>clickable</name> |
348 | <bool>true</bool> | ||
349 | </property> | ||
350 | <property> | ||
351 | <name>resizeable</name> | ||
352 | <bool>true</bool> | ||
353 | </property> | ||
354 | </column> | ||
355 | <column> | ||
349 | <property> | 356 | <property> |
350 | <name>text</name> | 357 | <name>text</name> |
351 | <string>Managed</string> | 358 | <string>SSID</string> |
352 | </property> | 359 | </property> |
353 | </item> | 360 | <property> |
354 | <item> | 361 | <name>clickable</name> |
362 | <bool>true</bool> | ||
363 | </property> | ||
364 | <property> | ||
365 | <name>resizeable</name> | ||
366 | <bool>true</bool> | ||
367 | </property> | ||
368 | </column> | ||
369 | <column> | ||
355 | <property> | 370 | <property> |
356 | <name>text</name> | 371 | <name>text</name> |
357 | <string>Ad-Hoc</string> | 372 | <string>Chn</string> |
358 | </property> | 373 | </property> |
359 | </item> | 374 | <property> |
360 | <property stdset="1"> | 375 | <name>clickable</name> |
361 | <name>name</name> | 376 | <bool>true</bool> |
362 | <cstring>mode</cstring> | ||
363 | </property> | 377 | </property> |
364 | <property stdset="1"> | 378 | <property> |
365 | <name>enabled</name> | 379 | <name>resizeable</name> |
366 | <bool>true</bool> | 380 | <bool>true</bool> |
367 | </property> | 381 | </property> |
368 | <property stdset="1"> | 382 | </column> |
369 | <name>geometry</name> | 383 | <column> |
370 | <rect> | 384 | <property> |
371 | <x>101</x> | 385 | <name>text</name> |
372 | <y>11</y> | 386 | <string>MAC</string> |
373 | <width>103</width> | 387 | </property> |
374 | <height>29</height> | 388 | <property> |
375 | </rect> | 389 | <name>clickable</name> |
390 | <bool>true</bool> | ||
391 | </property> | ||
392 | <property> | ||
393 | <name>resizeable</name> | ||
394 | <bool>true</bool> | ||
376 | </property> | 395 | </property> |
396 | </column> | ||
377 | <property stdset="1"> | 397 | <property stdset="1"> |
378 | <name>sizePolicy</name> | 398 | <name>name</name> |
379 | <sizepolicy> | 399 | <cstring>netView</cstring> |
380 | <hsizetype>1</hsizetype> | ||
381 | <vsizetype>0</vsizetype> | ||
382 | </sizepolicy> | ||
383 | </property> | 400 | </property> |
384 | </widget> | 401 | </widget> |
402 | </vbox> | ||
385 | </widget> | 403 | </widget> |
@@ -398,3 +416,3 @@ | |||
398 | <name>margin</name> | 416 | <name>margin</name> |
399 | <number>11</number> | 417 | <number>7</number> |
400 | </property> | 418 | </property> |
@@ -402,3 +420,3 @@ | |||
402 | <name>spacing</name> | 420 | <name>spacing</name> |
403 | <number>6</number> | 421 | <number>3</number> |
404 | </property> | 422 | </property> |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 8bf004f..719be1b 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -220,3 +220,3 @@ void WLANImp::accept(){ | |||
220 | if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ | 220 | if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ |
221 | QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); | 221 | QMessageBox::information(this, "Error", "Please enter a SSID.", QMessageBox::Ok); |
222 | return; | 222 | return; |
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index 26e3aa9..7ce096f 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -4,4 +4,12 @@ | |||
4 | 4 | ||
5 | #include "../interfaces/interface.h" | ||
6 | |||
7 | #include <assert.h> | ||
8 | #include <errno.h> | ||
9 | #include <string.h> | ||
10 | |||
11 | #include <qapplication.h> | ||
5 | #include <qfile.h> | 12 | #include <qfile.h> |
6 | #include <qdir.h> | 13 | #include <qdir.h> |
14 | #include <qdialog.h> | ||
7 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
@@ -12,2 +20,3 @@ | |||
12 | #include <qradiobutton.h> | 20 | #include <qradiobutton.h> |
21 | #include <qpushbutton.h> | ||
13 | #include <qcheckbox.h> | 22 | #include <qcheckbox.h> |
@@ -15,5 +24,11 @@ | |||
15 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qlistview.h> | ||
26 | #include <qvbox.h> | ||
27 | #include <qprogressbar.h> | ||
16 | 28 | ||
17 | #ifdef QWS | 29 | #ifdef QWS |
30 | #include <qpe/resource.h> | ||
18 | #include <opie/oprocess.h> | 31 | #include <opie/oprocess.h> |
32 | #include <opie2/onetwork.h> | ||
33 | #include <opie2/opcap.h> | ||
19 | #else | 34 | #else |
@@ -24,3 +39,3 @@ | |||
24 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" | 39 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
25 | #define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools" | 40 | #define PREUP "/etc/network/if-pre-up.d/wireless-tools" |
26 | 41 | ||
@@ -39,2 +54,9 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W | |||
39 | } | 54 | } |
55 | |||
56 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); | ||
57 | connect( netView, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectNetwork( QListViewItem* ) ) ); | ||
58 | netView->setColumnAlignment( col_chn, AlignCenter ); | ||
59 | netView->setItemMargin( 3 ); | ||
60 | netView->setAllColumnsShowFocus( true ); | ||
61 | |||
40 | } | 62 | } |
@@ -276 +298,193 @@ void WLANImp::writeOpts() { | |||
276 | } | 298 | } |
299 | |||
300 | /* | ||
301 | * Scan for possible wireless networks around... | ||
302 | * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> | ||
303 | */ | ||
304 | |||
305 | void WLANImp::rescanNeighbourhood() | ||
306 | { | ||
307 | QString name = interface->getInterfaceName(); | ||
308 | qDebug( "rescanNeighbourhood via '%s'", (const char*) name ); | ||
309 | |||
310 | OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); | ||
311 | assert( wiface ); | ||
312 | |||
313 | // try to guess device type | ||
314 | QString devicetype; | ||
315 | QFile m( "/proc/modules" ); | ||
316 | if ( m.open( IO_ReadOnly ) ) | ||
317 | { | ||
318 | QString line; | ||
319 | QTextStream modules( &m ); | ||
320 | while( !modules.atEnd() && !devicetype ) | ||
321 | { | ||
322 | modules >> line; | ||
323 | if ( line.contains( "cisco" ) ) devicetype = "cisco"; | ||
324 | else if ( line.contains( "hostap" ) ) devicetype = "hostap"; | ||
325 | else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ | ||
326 | else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; | ||
327 | } | ||
328 | } | ||
329 | if ( devicetype.isEmpty() ) | ||
330 | { | ||
331 | qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); | ||
332 | return; | ||
333 | } | ||
334 | else | ||
335 | { | ||
336 | qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); | ||
337 | } | ||
338 | |||
339 | // configure interface to receive 802.11 management frames | ||
340 | |||
341 | wiface->setUp( true ); | ||
342 | wiface->setPromiscuousMode( true ); | ||
343 | |||
344 | if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); | ||
345 | else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); | ||
346 | else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); | ||
347 | else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); | ||
348 | else | ||
349 | { | ||
350 | qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); | ||
351 | return; | ||
352 | } | ||
353 | |||
354 | wiface->setMonitorMode( true ); | ||
355 | if ( !wiface->monitorMode() ) | ||
356 | { | ||
357 | qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); | ||
358 | return; | ||
359 | } | ||
360 | |||
361 | // open a packet capturer | ||
362 | OPacketCapturer* cap = new OPacketCapturer(); | ||
363 | cap->open( name ); | ||
364 | if ( !cap->isOpen() ) | ||
365 | { | ||
366 | qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); | ||
367 | return; | ||
368 | } | ||
369 | |||
370 | // display splash screen | ||
371 | QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); | ||
372 | splash->setLineWidth( 2 ); | ||
373 | splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); | ||
374 | QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); | ||
375 | QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); | ||
376 | QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); | ||
377 | vbox->addWidget( lab ); | ||
378 | vbox->addWidget( pb ); | ||
379 | pb->setCenterIndicator( true ); | ||
380 | pb->setFixedHeight( pb->sizeHint().height() ); | ||
381 | QWidget* widgetDesktop = qApp->desktop(); | ||
382 | int dw = widgetDesktop->width(); | ||
383 | int dh = widgetDesktop->height(); | ||
384 | int pw = vbox->sizeHint().width(); | ||
385 | int ph = vbox->sizeHint().height(); | ||
386 | splash->setGeometry((dw-pw)/2,(dh-ph)/2,pw,ph); | ||
387 | splash->show(); | ||
388 | splash->raise(); | ||
389 | qApp->processEvents(); | ||
390 | |||
391 | // set capturer to non-blocking mode | ||
392 | cap->setBlocking( false ); | ||
393 | |||
394 | for ( int i = 1; i <= wiface->channels(); ++i ) | ||
395 | { | ||
396 | wiface->setChannel( i ); | ||
397 | pb->setProgress( i ); | ||
398 | qApp->processEvents(); | ||
399 | qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); | ||
400 | OPacket* p = cap->next( 1000 ); | ||
401 | if ( !p ) | ||
402 | { | ||
403 | qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); | ||
408 | handlePacket( p ); | ||
409 | } | ||
410 | } | ||
411 | |||
412 | cap->close(); | ||
413 | wiface->setMonitorMode( false ); | ||
414 | wiface->setPromiscuousMode( true ); | ||
415 | |||
416 | splash->hide(); | ||
417 | delete splash; | ||
418 | |||
419 | } | ||
420 | |||
421 | void WLANImp::handlePacket( OPacket* p ) | ||
422 | { | ||
423 | |||
424 | // check if we received a beacon frame | ||
425 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | ||
426 | if ( beacon && beacon->managementType() == "Beacon" ) | ||
427 | { | ||
428 | |||
429 | QString type; | ||
430 | if ( beacon->canIBSS() ) | ||
431 | { | ||
432 | type = "adhoc"; | ||
433 | } | ||
434 | else if ( beacon->canESS() ) | ||
435 | { | ||
436 | type = "managed"; | ||
437 | } | ||
438 | else | ||
439 | { | ||
440 | qWarning( "handlePacket(): invalid frame [possibly noise] detected!" ); | ||
441 | return; | ||
442 | } | ||
443 | |||
444 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | ||
445 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | ||
446 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | ||
447 | int channel = ds ? ds->channel() : -1; | ||
448 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | ||
449 | displayFoundNetwork( type, channel, essid, header->macAddress2() ); | ||
450 | } | ||
451 | } | ||
452 | |||
453 | |||
454 | void WLANImp::displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac ) | ||
455 | { | ||
456 | |||
457 | qDebug( "found network: <%s>, chn %d, ssid '%s', mac '%s'", (const char*) mode, channel, | ||
458 | (const char*) ssid, | ||
459 | (const char*) mac.toString() ); | ||
460 | |||
461 | QListViewItemIterator it( netView ); | ||
462 | while ( it.current() && it.current()->text( col_ssid ) != ssid ) ++it; | ||
463 | if ( !it.current() ) // ssid didn't show up yet | ||
464 | { | ||
465 | QListViewItem* item = new QListViewItem( netView, mode.left( 1 ).upper(), ssid, QString::number( channel ), mac.toString() ); | ||
466 | QString name; | ||
467 | name.sprintf( "networksettings/%s", (const char*) mode ); | ||
468 | item->setPixmap( col_mode, Resource::loadPixmap( name ) ); | ||
469 | qApp->processEvents(); | ||
470 | } | ||
471 | |||
472 | } | ||
473 | |||
474 | |||
475 | void WLANImp::selectNetwork( QListViewItem* item ) | ||
476 | { | ||
477 | bool ok; | ||
478 | if ( item ) | ||
479 | { | ||
480 | specifyAp->setChecked(true); | ||
481 | macEdit->setText( item->text( col_mac ) ); | ||
482 | specifyChan->setChecked( item->text( col_mode ) == "A" ); | ||
483 | networkChannel->setValue( item->text( col_chn ).toInt( &ok ) ); | ||
484 | essid->setEditText( item->text( col_ssid ) ); | ||
485 | if ( item->text( col_mode ) == "A" ) | ||
486 | mode->setCurrentItem( 3 ); | ||
487 | else | ||
488 | mode->setCurrentItem( 2 ); | ||
489 | } | ||
490 | } | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.h b/noncore/settings/networksettings/wlan/wlanimp2.h index 992d09a..a777203 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.h +++ b/noncore/settings/networksettings/wlan/wlanimp2.h | |||
@@ -6,2 +6,3 @@ | |||
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | #include <opie2/onetutils.h> | ||
7 | 8 | ||
@@ -10,2 +11,9 @@ class Interface; | |||
10 | class Config; | 11 | class Config; |
12 | class OPacket; | ||
13 | class QListViewItem; | ||
14 | |||
15 | const int col_mode= 0; | ||
16 | const int col_ssid = 1; | ||
17 | const int col_chn = 2; | ||
18 | const int col_mac = 3; | ||
11 | 19 | ||
@@ -19,2 +27,6 @@ public: | |||
19 | 27 | ||
28 | public slots: | ||
29 | void rescanNeighbourhood(); | ||
30 | void selectNetwork( QListViewItem* ); | ||
31 | |||
20 | protected: | 32 | protected: |
@@ -28,2 +40,5 @@ private: | |||
28 | 40 | ||
41 | void handlePacket( OPacket* ); | ||
42 | void displayFoundNetwork( const QString& mode, int channel, const QString& ssid, const OMacAddress& mac ); | ||
43 | |||
29 | InterfaceSetupImp *interfaceSetup; | 44 | InterfaceSetupImp *interfaceSetup; |