summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/config.in4
-rw-r--r--noncore/settings/networksettings/wlan/opie-networksettingsplugin-wlan.control2
-rw-r--r--noncore/settings/networksettings/wlan/wlan.pro2
-rw-r--r--noncore/settings/networksettings/wlan/wlan.ui402
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp216
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.h15
-rw-r--r--pics/networksettings/adhoc.pngbin0 -> 694 bytes
-rw-r--r--pics/networksettings/managed.pngbin0 -> 410 bytes
9 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
@@ -1,4 +1,6 @@
1 config WLAN 1 config WLAN
2 boolean "opie-networksettingsplugin-wlan (wireless LAN module)" 2 boolean "opie-networksettingsplugin-wlan (wireless LAN module)"
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
@@ -4,7 +4,7 @@ Priority: optional
4Section: opie/settings 4Section: opie/settings
5Maintainer: Patrick S. Vogt <tille@handhelds.org> 5Maintainer: Patrick S. Vogt <tille@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: opie-networksettings 7Depends: opie-networksettings, libopie2net (1.8.1)
8Description: Network settings wavelan plugin. 8Description: Network settings wavelan plugin.
9 9
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
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
@@ -8,7 +8,7 @@ HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h
8 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp 8 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp
9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
10 DEPENDPATH+= $(OPIEDIR)/include 10 DEPENDPATH+= $(OPIEDIR)/include
11LIBS += -lqpe -L../interfaces/ -linterfaces 11LIBS += -lqpe -L../interfaces/ -linterfaces -lopienet2
12 INTERFACES= wlan.ui info.ui 12 INTERFACES= wlan.ui info.ui
13 TARGET = wlan 13 TARGET = wlan
14 VERSION = 1.0.0 14 VERSION = 1.0.0
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
@@ -11,8 +11,8 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
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>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
@@ -45,6 +45,12 @@
45 <name>enabled</name> 45 <name>enabled</name>
46 <bool>true</bool> 46 <bool>true</bool>
47 </property> 47 </property>
48 <property>
49 <name>layoutMargin</name>
50 </property>
51 <property>
52 <name>layoutSpacing</name>
53 </property>
48 <widget> 54 <widget>
49 <class>QWidget</class> 55 <class>QWidget</class>
50 <property stdset="1"> 56 <property stdset="1">
@@ -55,59 +61,71 @@
55 <name>title</name> 61 <name>title</name>
56 <string>General</string> 62 <string>General</string>
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>
88 </property> 110 </property>
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>
112 <property stdset="1"> 130 <property stdset="1">
113 <name>name</name> 131 <name>name</name>
@@ -118,15 +136,6 @@
118 <bool>true</bool> 136 <bool>true</bool>
119 </property> 137 </property>
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>
131 <sizepolicy> 140 <sizepolicy>
132 <hsizetype>1</hsizetype> 141 <hsizetype>1</hsizetype>
@@ -135,92 +144,75 @@
135 </property> 144 </property>
136 <property stdset="1"> 145 <property stdset="1">
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>
179 <property stdset="1"> 180 <property stdset="1">
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>
192 <property stdset="1"> 184 <property stdset="1">
193 <name>sizePolicy</name> 185 <name>sizePolicy</name>
194 <sizepolicy> 186 <sizepolicy>
195 <hsizetype>5</hsizetype> 187 <hsizetype>7</hsizetype>
196 <vsizetype>1</vsizetype> 188 <vsizetype>0</vsizetype>
197 </sizepolicy> 189 </sizepolicy>
198 </property> 190 </property>
199 </widget> 191 </widget>
200 <widget> 192 <widget row="0" column="0" >
201 <class>QLabel</class> 193 <class>QLabel</class>
202 <property stdset="1"> 194 <property stdset="1">
203 <name>name</name> 195 <name>name</name>
204 <cstring>macLabel</cstring> 196 <cstring>modeLabel</cstring>
205 </property> 197 </property>
206 <property stdset="1"> 198 <property stdset="1">
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>
219 <property stdset="1"> 209 <property stdset="1">
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>
225 <class>QCheckBox</class> 217 <class>QCheckBox</class>
226 <property stdset="1"> 218 <property stdset="1">
@@ -228,160 +220,186 @@
228 <cstring>specifyAp</cstring> 220 <cstring>specifyAp</cstring>
229 </property> 221 </property>
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>
241 <string>Specify &amp;Access Point</string> 224 <string>Specify &amp;Access Point</string>
242 </property> 225 </property>
243 </widget> 226 </widget>
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 &amp;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>
306 <property stdset="1"> 267 <property stdset="1">
307 <name>sizePolicy</name> 268 <name>sizePolicy</name>
308 <sizepolicy> 269 <sizepolicy>
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>
320 </property> 287 </property>
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 &amp;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>
386 <widget> 404 <widget>
387 <class>QWidget</class> 405 <class>QWidget</class>
@@ -396,11 +414,11 @@
396 <grid> 414 <grid>
397 <property stdset="1"> 415 <property stdset="1">
398 <name>margin</name> 416 <name>margin</name>
399 <number>11</number> 417 <number>7</number>
400 </property> 418 </property>
401 <property stdset="1"> 419 <property stdset="1">
402 <name>spacing</name> 420 <name>spacing</name>
403 <number>6</number> 421 <number>3</number>
404 </property> 422 </property>
405 <widget row="0" column="0" > 423 <widget row="0" column="0" >
406 <class>QCheckBox</class> 424 <class>QCheckBox</class>
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
@@ -218,7 +218,7 @@ void WLANImp::accept(){
218 } 218 }
219 219
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;
223 } 223 }
224 224
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
@@ -2,27 +2,42 @@
2#include "keyedit.h" 2#include "keyedit.h"
3#include "interfacesetupimp.h" 3#include "interfacesetupimp.h"
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>
8#include <qmessagebox.h> 16#include <qmessagebox.h>
9#include <qlineedit.h> 17#include <qlineedit.h>
10#include <qlabel.h> 18#include <qlabel.h>
11#include <qspinbox.h> 19#include <qspinbox.h>
12#include <qradiobutton.h> 20#include <qradiobutton.h>
21#include <qpushbutton.h>
13#include <qcheckbox.h> 22#include <qcheckbox.h>
14#include <qtabwidget.h> 23#include <qtabwidget.h>
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
20 #define OProcess KProcess 35 #define OProcess KProcess
21 #include <kprocess.h> 36 #include <kprocess.h>
22#endif 37#endif
23 38
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
27/** 42/**
28 * Constructor, read in the wireless.opts file for parsing later. 43 * Constructor, read in the wireless.opts file for parsing later.
@@ -37,6 +52,13 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W
37 if (file.exists()) { 52 if (file.exists()) {
38 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); 53 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools"));
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}
41 63
42WLANImp::~WLANImp() { 64WLANImp::~WLANImp() {
@@ -274,3 +296,195 @@ void WLANImp::writeOpts() {
274 296
275 QDialog::accept(); 297 QDialog::accept();
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
305void 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
421void 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
454void 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
475void 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
@@ -4,10 +4,18 @@
4#include "wlan.h" 4#include "wlan.h"
5#include "interfaces.h" 5#include "interfaces.h"
6#include <qstringlist.h> 6#include <qstringlist.h>
7#include <opie2/onetutils.h>
7 8
8class InterfaceSetupImp; 9class InterfaceSetupImp;
9class Interface; 10class Interface;
10class Config; 11class Config;
12class OPacket;
13class QListViewItem;
14
15const int col_mode= 0;
16const int col_ssid = 1;
17const int col_chn = 2;
18const int col_mac = 3;
11 19
12class WLANImp : public WLAN { 20class WLANImp : public WLAN {
13 Q_OBJECT 21 Q_OBJECT
@@ -17,6 +25,10 @@ public:
17 ~WLANImp(); 25 ~WLANImp();
18 void setProfile(const QString &profile); 26 void setProfile(const QString &profile);
19 27
28public slots:
29 void rescanNeighbourhood();
30 void selectNetwork( QListViewItem* );
31
20protected: 32protected:
21 void accept(); 33 void accept();
22 34
@@ -26,6 +38,9 @@ private:
26 38
27 void parseKeyStr(QString keystr); 39 void parseKeyStr(QString keystr);
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;
30 Interfaces *interfaces; 45 Interfaces *interfaces;
31 Interface *interface; 46 Interface *interface;
diff --git a/pics/networksettings/adhoc.png b/pics/networksettings/adhoc.png
new file mode 100644
index 0000000..dcf5ad2
--- a/dev/null
+++ b/pics/networksettings/adhoc.png
Binary files differ
diff --git a/pics/networksettings/managed.png b/pics/networksettings/managed.png
new file mode 100644
index 0000000..4554533
--- a/dev/null
+++ b/pics/networksettings/managed.png
Binary files differ