summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindow.ui2
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/noncore/settings/networksettings/mainwindow.ui b/noncore/settings/networksettings/mainwindow.ui
index 8e17cb3..f61a1ae 100644
--- a/noncore/settings/networksettings/mainwindow.ui
+++ b/noncore/settings/networksettings/mainwindow.ui
@@ -1,427 +1,427 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>MainWindow</class> 2<class>MainWindow</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>MainWindow</cstring> 7 <cstring>MainWindow</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>240</width> 14 <width>240</width>
15 <height>289</height> 15 <height>289</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>Network Settings</string> 20 <string>Network Settings</string>
21 </property> 21 </property>
22 <vbox> 22 <vbox>
23 <property stdset="1"> 23 <property stdset="1">
24 <name>margin</name> 24 <name>margin</name>
25 <number>0</number> 25 <number>0</number>
26 </property> 26 </property>
27 <property stdset="1"> 27 <property stdset="1">
28 <name>spacing</name> 28 <name>spacing</name>
29 <number>6</number> 29 <number>6</number>
30 </property> 30 </property>
31 <widget> 31 <widget>
32 <class>QTabWidget</class> 32 <class>QTabWidget</class>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>name</name> 34 <name>name</name>
35 <cstring>tabWidget</cstring> 35 <cstring>tabWidget</cstring>
36 </property> 36 </property>
37 <property> 37 <property>
38 <name>layoutMargin</name> 38 <name>layoutMargin</name>
39 </property> 39 </property>
40 <widget> 40 <widget>
41 <class>QWidget</class> 41 <class>QWidget</class>
42 <property stdset="1"> 42 <property stdset="1">
43 <name>name</name> 43 <name>name</name>
44 <cstring>Widget3</cstring> 44 <cstring>Widget3</cstring>
45 </property> 45 </property>
46 <attribute> 46 <attribute>
47 <name>title</name> 47 <name>title</name>
48 <string>Connections</string> 48 <string>Connections</string>
49 </attribute> 49 </attribute>
50 <vbox> 50 <vbox>
51 <property stdset="1"> 51 <property stdset="1">
52 <name>margin</name> 52 <name>margin</name>
53 <number>0</number> 53 <number>0</number>
54 </property> 54 </property>
55 <property stdset="1"> 55 <property stdset="1">
56 <name>spacing</name> 56 <name>spacing</name>
57 <number>6</number> 57 <number>6</number>
58 </property> 58 </property>
59 <widget> 59 <widget>
60 <class>QListView</class> 60 <class>QListView</class>
61 <column> 61 <column>
62 <property> 62 <property>
63 <name>text</name> 63 <name>text</name>
64 <string>s</string> 64 <string>s</string>
65 </property> 65 </property>
66 <property> 66 <property>
67 <name>clickable</name> 67 <name>clickable</name>
68 <bool>true</bool> 68 <bool>true</bool>
69 </property> 69 </property>
70 <property> 70 <property>
71 <name>resizeable</name> 71 <name>resizeable</name>
72 <bool>true</bool> 72 <bool>true</bool>
73 </property> 73 </property>
74 </column> 74 </column>
75 <column> 75 <column>
76 <property> 76 <property>
77 <name>text</name> 77 <name>text</name>
78 <string>t</string> 78 <string>t</string>
79 </property> 79 </property>
80 <property> 80 <property>
81 <name>clickable</name> 81 <name>clickable</name>
82 <bool>true</bool> 82 <bool>true</bool>
83 </property> 83 </property>
84 <property> 84 <property>
85 <name>resizeable</name> 85 <name>resizeable</name>
86 <bool>true</bool> 86 <bool>true</bool>
87 </property> 87 </property>
88 </column> 88 </column>
89 <column> 89 <column>
90 <property> 90 <property>
91 <name>text</name> 91 <name>text</name>
92 <string>Name</string> 92 <string>Name</string>
93 </property> 93 </property>
94 <property> 94 <property>
95 <name>clickable</name> 95 <name>clickable</name>
96 <bool>true</bool> 96 <bool>true</bool>
97 </property> 97 </property>
98 <property> 98 <property>
99 <name>resizeable</name> 99 <name>resizeable</name>
100 <bool>true</bool> 100 <bool>true</bool>
101 </property> 101 </property>
102 </column> 102 </column>
103 <column> 103 <column>
104 <property> 104 <property>
105 <name>text</name> 105 <name>text</name>
106 <string>in</string> 106 <string>in</string>
107 </property> 107 </property>
108 <property> 108 <property>
109 <name>clickable</name> 109 <name>clickable</name>
110 <bool>true</bool> 110 <bool>true</bool>
111 </property> 111 </property>
112 <property> 112 <property>
113 <name>resizeable</name> 113 <name>resizeable</name>
114 <bool>true</bool> 114 <bool>true</bool>
115 </property> 115 </property>
116 </column> 116 </column>
117 <column> 117 <column>
118 <property> 118 <property>
119 <name>text</name> 119 <name>text</name>
120 <string>IP</string> 120 <string>IP</string>
121 </property> 121 </property>
122 <property> 122 <property>
123 <name>clickable</name> 123 <name>clickable</name>
124 <bool>true</bool> 124 <bool>true</bool>
125 </property> 125 </property>
126 <property> 126 <property>
127 <name>resizeable</name> 127 <name>resizeable</name>
128 <bool>true</bool> 128 <bool>true</bool>
129 </property> 129 </property>
130 </column> 130 </column>
131 <property stdset="1"> 131 <property stdset="1">
132 <name>name</name> 132 <name>name</name>
133 <cstring>connectionList</cstring> 133 <cstring>connectionList</cstring>
134 </property> 134 </property>
135 <property stdset="1"> 135 <property stdset="1">
136 <name>allColumnsShowFocus</name> 136 <name>allColumnsShowFocus</name>
137 <bool>true</bool> 137 <bool>true</bool>
138 </property> 138 </property>
139 </widget> 139 </widget>
140 <widget> 140 <widget>
141 <class>QLayoutWidget</class> 141 <class>QLayoutWidget</class>
142 <property stdset="1"> 142 <property stdset="1">
143 <name>name</name> 143 <name>name</name>
144 <cstring>Layout2</cstring> 144 <cstring>Layout2</cstring>
145 </property> 145 </property>
146 <property> 146 <property>
147 <name>layoutMargin</name> 147 <name>layoutMargin</name>
148 </property> 148 </property>
149 <grid> 149 <grid>
150 <property stdset="1"> 150 <property stdset="1">
151 <name>margin</name> 151 <name>margin</name>
152 <number>5</number> 152 <number>5</number>
153 </property> 153 </property>
154 <property stdset="1"> 154 <property stdset="1">
155 <name>spacing</name> 155 <name>spacing</name>
156 <number>6</number> 156 <number>6</number>
157 </property> 157 </property>
158 <widget row="1" column="0" > 158 <widget row="1" column="0" >
159 <class>QPushButton</class> 159 <class>QPushButton</class>
160 <property stdset="1"> 160 <property stdset="1">
161 <name>name</name> 161 <name>name</name>
162 <cstring>addConnectionButton</cstring> 162 <cstring>addConnectionButton</cstring>
163 </property> 163 </property>
164 <property stdset="1"> 164 <property stdset="1">
165 <name>text</name> 165 <name>text</name>
166 <string>&amp;Add</string> 166 <string>&amp;Add</string>
167 </property> 167 </property>
168 </widget> 168 </widget>
169 <widget row="0" column="0" > 169 <widget row="0" column="0" >
170 <class>QPushButton</class> 170 <class>QPushButton</class>
171 <property stdset="1"> 171 <property stdset="1">
172 <name>name</name> 172 <name>name</name>
173 <cstring>informationConnectionButton</cstring> 173 <cstring>informationConnectionButton</cstring>
174 </property> 174 </property>
175 <property stdset="1"> 175 <property stdset="1">
176 <name>text</name> 176 <name>text</name>
177 <string>&amp;Information</string> 177 <string>&amp;Start/Stop</string>
178 </property> 178 </property>
179 </widget> 179 </widget>
180 <widget row="0" column="1" > 180 <widget row="0" column="1" >
181 <class>QPushButton</class> 181 <class>QPushButton</class>
182 <property stdset="1"> 182 <property stdset="1">
183 <name>name</name> 183 <name>name</name>
184 <cstring>configureConnectionButton</cstring> 184 <cstring>configureConnectionButton</cstring>
185 </property> 185 </property>
186 <property stdset="1"> 186 <property stdset="1">
187 <name>text</name> 187 <name>text</name>
188 <string>&amp;Configure</string> 188 <string>&amp;Configure</string>
189 </property> 189 </property>
190 </widget> 190 </widget>
191 <widget row="1" column="1" > 191 <widget row="1" column="1" >
192 <class>QPushButton</class> 192 <class>QPushButton</class>
193 <property stdset="1"> 193 <property stdset="1">
194 <name>name</name> 194 <name>name</name>
195 <cstring>removeConnectionButton</cstring> 195 <cstring>removeConnectionButton</cstring>
196 </property> 196 </property>
197 <property stdset="1"> 197 <property stdset="1">
198 <name>text</name> 198 <name>text</name>
199 <string>&amp;Remove</string> 199 <string>&amp;Remove</string>
200 </property> 200 </property>
201 </widget> 201 </widget>
202 </grid> 202 </grid>
203 </widget> 203 </widget>
204 </vbox> 204 </vbox>
205 </widget> 205 </widget>
206 <widget> 206 <widget>
207 <class>QWidget</class> 207 <class>QWidget</class>
208 <property stdset="1"> 208 <property stdset="1">
209 <name>name</name> 209 <name>name</name>
210 <cstring>tab</cstring> 210 <cstring>tab</cstring>
211 </property> 211 </property>
212 <attribute> 212 <attribute>
213 <name>title</name> 213 <name>title</name>
214 <string>Profiles</string> 214 <string>Profiles</string>
215 </attribute> 215 </attribute>
216 <grid> 216 <grid>
217 <property stdset="1"> 217 <property stdset="1">
218 <name>margin</name> 218 <name>margin</name>
219 <number>11</number> 219 <number>11</number>
220 </property> 220 </property>
221 <property stdset="1"> 221 <property stdset="1">
222 <name>spacing</name> 222 <name>spacing</name>
223 <number>6</number> 223 <number>6</number>
224 </property> 224 </property>
225 <spacer row="7" column="2" > 225 <spacer row="7" column="2" >
226 <property> 226 <property>
227 <name>name</name> 227 <name>name</name>
228 <cstring>Spacer16</cstring> 228 <cstring>Spacer16</cstring>
229 </property> 229 </property>
230 <property stdset="1"> 230 <property stdset="1">
231 <name>orientation</name> 231 <name>orientation</name>
232 <enum>Vertical</enum> 232 <enum>Vertical</enum>
233 </property> 233 </property>
234 <property stdset="1"> 234 <property stdset="1">
235 <name>sizeType</name> 235 <name>sizeType</name>
236 <enum>Expanding</enum> 236 <enum>Expanding</enum>
237 </property> 237 </property>
238 <property> 238 <property>
239 <name>sizeHint</name> 239 <name>sizeHint</name>
240 <size> 240 <size>
241 <width>20</width> 241 <width>20</width>
242 <height>20</height> 242 <height>20</height>
243 </size> 243 </size>
244 </property> 244 </property>
245 </spacer> 245 </spacer>
246 <widget row="0" column="1" > 246 <widget row="0" column="1" >
247 <class>QLabel</class> 247 <class>QLabel</class>
248 <property stdset="1"> 248 <property stdset="1">
249 <name>name</name> 249 <name>name</name>
250 <cstring>currentProfileLabel</cstring> 250 <cstring>currentProfileLabel</cstring>
251 </property> 251 </property>
252 <property stdset="1"> 252 <property stdset="1">
253 <name>frameShape</name> 253 <name>frameShape</name>
254 <enum>Panel</enum> 254 <enum>Panel</enum>
255 </property> 255 </property>
256 <property stdset="1"> 256 <property stdset="1">
257 <name>frameShadow</name> 257 <name>frameShadow</name>
258 <enum>Sunken</enum> 258 <enum>Sunken</enum>
259 </property> 259 </property>
260 <property stdset="1"> 260 <property stdset="1">
261 <name>text</name> 261 <name>text</name>
262 <string>All</string> 262 <string>All</string>
263 </property> 263 </property>
264 </widget> 264 </widget>
265 <widget row="3" column="2" > 265 <widget row="3" column="2" >
266 <class>QPushButton</class> 266 <class>QPushButton</class>
267 <property stdset="1"> 267 <property stdset="1">
268 <name>name</name> 268 <name>name</name>
269 <cstring>setCurrentProfileButton</cstring> 269 <cstring>setCurrentProfileButton</cstring>
270 </property> 270 </property>
271 <property stdset="1"> 271 <property stdset="1">
272 <name>text</name> 272 <name>text</name>
273 <string>&amp;Set Current</string> 273 <string>&amp;Set Current</string>
274 </property> 274 </property>
275 </widget> 275 </widget>
276 <widget row="5" column="0" rowspan="1" colspan="3" > 276 <widget row="5" column="0" rowspan="1" colspan="3" >
277 <class>Line</class> 277 <class>Line</class>
278 <property stdset="1"> 278 <property stdset="1">
279 <name>name</name> 279 <name>name</name>
280 <cstring>Line6</cstring> 280 <cstring>Line6</cstring>
281 </property> 281 </property>
282 <property stdset="1"> 282 <property stdset="1">
283 <name>orientation</name> 283 <name>orientation</name>
284 <enum>Horizontal</enum> 284 <enum>Horizontal</enum>
285 </property> 285 </property>
286 </widget> 286 </widget>
287 <widget row="1" column="0" rowspan="1" colspan="3" > 287 <widget row="1" column="0" rowspan="1" colspan="3" >
288 <class>Line</class> 288 <class>Line</class>
289 <property stdset="1"> 289 <property stdset="1">
290 <name>name</name> 290 <name>name</name>
291 <cstring>Line1</cstring> 291 <cstring>Line1</cstring>
292 </property> 292 </property>
293 <property stdset="1"> 293 <property stdset="1">
294 <name>orientation</name> 294 <name>orientation</name>
295 <enum>Horizontal</enum> 295 <enum>Horizontal</enum>
296 </property> 296 </property>
297 </widget> 297 </widget>
298 <widget row="0" column="0" > 298 <widget row="0" column="0" >
299 <class>QLabel</class> 299 <class>QLabel</class>
300 <property stdset="1"> 300 <property stdset="1">
301 <name>name</name> 301 <name>name</name>
302 <cstring>TextLabel1</cstring> 302 <cstring>TextLabel1</cstring>
303 </property> 303 </property>
304 <property stdset="1"> 304 <property stdset="1">
305 <name>text</name> 305 <name>text</name>
306 <string>Current Profile</string> 306 <string>Current Profile</string>
307 </property> 307 </property>
308 </widget> 308 </widget>
309 <widget row="4" column="2" > 309 <widget row="4" column="2" >
310 <class>QPushButton</class> 310 <class>QPushButton</class>
311 <property stdset="1"> 311 <property stdset="1">
312 <name>name</name> 312 <name>name</name>
313 <cstring>removeProfileButton</cstring> 313 <cstring>removeProfileButton</cstring>
314 </property> 314 </property>
315 <property stdset="1"> 315 <property stdset="1">
316 <name>text</name> 316 <name>text</name>
317 <string>&amp;Remove</string> 317 <string>&amp;Remove</string>
318 </property> 318 </property>
319 </widget> 319 </widget>
320 <widget row="3" column="0" rowspan="2" colspan="2" > 320 <widget row="3" column="0" rowspan="2" colspan="2" >
321 <class>QListBox</class> 321 <class>QListBox</class>
322 <property stdset="1"> 322 <property stdset="1">
323 <name>name</name> 323 <name>name</name>
324 <cstring>profilesList</cstring> 324 <cstring>profilesList</cstring>
325 </property> 325 </property>
326 </widget> 326 </widget>
327 <spacer row="0" column="2" > 327 <spacer row="0" column="2" >
328 <property> 328 <property>
329 <name>name</name> 329 <name>name</name>
330 <cstring>Spacer2</cstring> 330 <cstring>Spacer2</cstring>
331 </property> 331 </property>
332 <property stdset="1"> 332 <property stdset="1">
333 <name>orientation</name> 333 <name>orientation</name>
334 <enum>Horizontal</enum> 334 <enum>Horizontal</enum>
335 </property> 335 </property>
336 <property stdset="1"> 336 <property stdset="1">
337 <name>sizeType</name> 337 <name>sizeType</name>
338 <enum>Expanding</enum> 338 <enum>Expanding</enum>
339 </property> 339 </property>
340 <property> 340 <property>
341 <name>sizeHint</name> 341 <name>sizeHint</name>
342 <size> 342 <size>
343 <width>20</width> 343 <width>20</width>
344 <height>20</height> 344 <height>20</height>
345 </size> 345 </size>
346 </property> 346 </property>
347 </spacer> 347 </spacer>
348 <widget row="2" column="0" > 348 <widget row="2" column="0" >
349 <class>QLabel</class> 349 <class>QLabel</class>
350 <property stdset="1"> 350 <property stdset="1">
351 <name>name</name> 351 <name>name</name>
352 <cstring>TextLabel1_2</cstring> 352 <cstring>TextLabel1_2</cstring>
353 </property> 353 </property>
354 <property stdset="1"> 354 <property stdset="1">
355 <name>text</name> 355 <name>text</name>
356 <string>Profiles</string> 356 <string>Profiles</string>
357 </property> 357 </property>
358 </widget> 358 </widget>
359 <widget row="6" column="0" rowspan="1" colspan="3" > 359 <widget row="6" column="0" rowspan="1" colspan="3" >
360 <class>QLayoutWidget</class> 360 <class>QLayoutWidget</class>
361 <property stdset="1"> 361 <property stdset="1">
362 <name>name</name> 362 <name>name</name>
363 <cstring>Layout6</cstring> 363 <cstring>Layout6</cstring>
364 </property> 364 </property>
365 <hbox> 365 <hbox>
366 <property stdset="1"> 366 <property stdset="1">
367 <name>margin</name> 367 <name>margin</name>
368 <number>0</number> 368 <number>0</number>
369 </property> 369 </property>
370 <property stdset="1"> 370 <property stdset="1">
371 <name>spacing</name> 371 <name>spacing</name>
372 <number>6</number> 372 <number>6</number>
373 </property> 373 </property>
374 <widget> 374 <widget>
375 <class>QLabel</class> 375 <class>QLabel</class>
376 <property stdset="1"> 376 <property stdset="1">
377 <name>name</name> 377 <name>name</name>
378 <cstring>TextLabel1_3</cstring> 378 <cstring>TextLabel1_3</cstring>
379 </property> 379 </property>
380 <property stdset="1"> 380 <property stdset="1">
381 <name>text</name> 381 <name>text</name>
382 <string>New Profile</string> 382 <string>New Profile</string>
383 </property> 383 </property>
384 </widget> 384 </widget>
385 <widget> 385 <widget>
386 <class>QLineEdit</class> 386 <class>QLineEdit</class>
387 <property stdset="1"> 387 <property stdset="1">
388 <name>name</name> 388 <name>name</name>
389 <cstring>newProfile</cstring> 389 <cstring>newProfile</cstring>
390 </property> 390 </property>
391 </widget> 391 </widget>
392 <widget> 392 <widget>
393 <class>QPushButton</class> 393 <class>QPushButton</class>
394 <property stdset="1"> 394 <property stdset="1">
395 <name>name</name> 395 <name>name</name>
396 <cstring>newProfileButton</cstring> 396 <cstring>newProfileButton</cstring>
397 </property> 397 </property>
398 <property stdset="1"> 398 <property stdset="1">
399 <name>enabled</name> 399 <name>enabled</name>
400 <bool>false</bool> 400 <bool>false</bool>
401 </property> 401 </property>
402 <property stdset="1"> 402 <property stdset="1">
403 <name>text</name> 403 <name>text</name>
404 <string>&amp;Add</string> 404 <string>&amp;Add</string>
405 </property> 405 </property>
406 </widget> 406 </widget>
407 </hbox> 407 </hbox>
408 </widget> 408 </widget>
409 </grid> 409 </grid>
410 </widget> 410 </widget>
411 </widget> 411 </widget>
412 </vbox> 412 </vbox>
413</widget> 413</widget>
414<tabstops> 414<tabstops>
415 <tabstop>tabWidget</tabstop> 415 <tabstop>tabWidget</tabstop>
416 <tabstop>connectionList</tabstop> 416 <tabstop>connectionList</tabstop>
417 <tabstop>informationConnectionButton</tabstop> 417 <tabstop>informationConnectionButton</tabstop>
418 <tabstop>configureConnectionButton</tabstop> 418 <tabstop>configureConnectionButton</tabstop>
419 <tabstop>addConnectionButton</tabstop> 419 <tabstop>addConnectionButton</tabstop>
420 <tabstop>removeConnectionButton</tabstop> 420 <tabstop>removeConnectionButton</tabstop>
421 <tabstop>profilesList</tabstop> 421 <tabstop>profilesList</tabstop>
422 <tabstop>setCurrentProfileButton</tabstop> 422 <tabstop>setCurrentProfileButton</tabstop>
423 <tabstop>removeProfileButton</tabstop> 423 <tabstop>removeProfileButton</tabstop>
424 <tabstop>newProfile</tabstop> 424 <tabstop>newProfile</tabstop>
425 <tabstop>newProfileButton</tabstop> 425 <tabstop>newProfileButton</tabstop>
426</tabstops> 426</tabstops>
427</UI> 427</UI>
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 56bbd2c..a61f620 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -39,567 +39,567 @@
39#include <qfile.h> 39#include <qfile.h>
40#include <qtextstream.h> 40#include <qtextstream.h>
41#include <qregexp.h> 41#include <qregexp.h>
42 42
43#include <net/if.h> 43#include <net/if.h>
44#include <sys/ioctl.h> 44#include <sys/ioctl.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
46 46
47#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" 47#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
48#define _PROCNETDEV "/proc/net/dev" 48#define _PROCNETDEV "/proc/net/dev"
49 49
50MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name), advancedUserMode(true), scheme(DEFAULT_SCHEME){ 50MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name), advancedUserMode(true), scheme(DEFAULT_SCHEME){
51 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 51 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
52 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 52 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
53 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 53 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
54 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 54 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
55 55
56 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 56 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
57 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 57 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
58 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 58 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
59 59
60 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 60 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
61 // Load connections. 61 // Load connections.
62 // /usr/local/kde/lib/libinterfaces.la 62 // /usr/local/kde/lib/libinterfaces.la
63#ifdef QWS 63#ifdef QWS
64 loadModules(QPEApplication::qpeDir() + "/plugins/networksettings"); 64 loadModules(QPEApplication::qpeDir() + "/plugins/networksettings");
65#else 65#else
66 loader = KLibLoader::self(); 66 loader = KLibLoader::self();
67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); 67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib"));
68#endif 68#endif
69 getAllInterfaces(); 69 getAllInterfaces();
70 70
71 Interfaces i; 71 Interfaces i;
72 QStringList list = i.getInterfaceList(); 72 QStringList list = i.getInterfaceList();
73 QMap<QString, Interface*>::Iterator it; 73 QMap<QString, Interface*>::Iterator it;
74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { 74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
75 bool found = false; 75 bool found = false;
76 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ 76 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
77 if(it.key() == (*ni)) 77 if(it.key() == (*ni))
78 found = true; 78 found = true;
79 } 79 }
80 if(!found){ 80 if(!found){
81 if(!(*ni).contains("_")){ 81 if(!(*ni).contains("_")){
82 Interface *i = new Interface(this, *ni, false); 82 Interface *i = new Interface(this, *ni, false);
83 i->setAttached(false); 83 i->setAttached(false);
84 i->setHardwareName("Disconnected"); 84 i->setHardwareName("Disconnected");
85 interfaceNames.insert(i->getInterfaceName(), i); 85 interfaceNames.insert(i->getInterfaceName(), i);
86 updateInterface(i); 86 updateInterface(i);
87 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 87 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 //getInterfaceList(); 92 //getInterfaceList();
93 connectionList->header()->hide(); 93 connectionList->header()->hide();
94 94
95 Config cfg("NetworkSetup"); 95 Config cfg("NetworkSetup");
96 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 96 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
97 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 97 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
98 profilesList->insertItem((*it)); 98 profilesList->insertItem((*it));
99 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 99 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
100 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 100 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
101 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 101 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
102 102
103 QFile file(scheme); 103 QFile file(scheme);
104 if ( file.open(IO_ReadOnly) ) { // file opened successfully 104 if ( file.open(IO_ReadOnly) ) { // file opened successfully
105 QTextStream stream( &file ); // use a text stream 105 QTextStream stream( &file ); // use a text stream
106 while ( !stream.eof() ) { // until end of file... 106 while ( !stream.eof() ) { // until end of file...
107 QString line = stream.readLine(); // line of text excluding '\n' 107 QString line = stream.readLine(); // line of text excluding '\n'
108 if(line.contains("SCHEME")){ 108 if(line.contains("SCHEME")){
109 line = line.mid(7, line.length()); 109 line = line.mid(7, line.length());
110 currentProfileLabel->setText(line); 110 currentProfileLabel->setText(line);
111 break; 111 break;
112 } 112 }
113 } 113 }
114 file.close(); 114 file.close();
115 } 115 }
116} 116}
117 117
118/** 118/**
119 * Deconstructor. Save profiles. Delete loaded libraries. 119 * Deconstructor. Save profiles. Delete loaded libraries.
120 */ 120 */
121MainWindowImp::~MainWindowImp(){ 121MainWindowImp::~MainWindowImp(){
122 // Save profiles. 122 // Save profiles.
123 Config cfg("NetworkSetup"); 123 Config cfg("NetworkSetup");
124 cfg.setGroup("General"); 124 cfg.setGroup("General");
125 cfg.writeEntry("Profiles", profiles.join(" ")); 125 cfg.writeEntry("Profiles", profiles.join(" "));
126 126
127 // Delete all interfaces that don't have owners. 127 // Delete all interfaces that don't have owners.
128 QMap<Interface*, QListViewItem*>::Iterator iIt; 128 QMap<Interface*, QListViewItem*>::Iterator iIt;
129 for( iIt = items.begin(); iIt != items.end(); ++iIt ){ 129 for( iIt = items.begin(); iIt != items.end(); ++iIt ){
130 if(iIt.key()->getModuleOwner() == NULL) 130 if(iIt.key()->getModuleOwner() == NULL)
131 delete iIt.key(); 131 delete iIt.key();
132 } 132 }
133 133
134#ifdef QWS 134#ifdef QWS
135 // Delete Modules and Libraries 135 // Delete Modules and Libraries
136 QMap<Module*, QLibrary*>::Iterator it; 136 QMap<Module*, QLibrary*>::Iterator it;
137 for( it = libraries.begin(); it != libraries.end(); ++it ){ 137 for( it = libraries.begin(); it != libraries.end(); ++it ){
138 delete it.key(); 138 delete it.key();
139 // I wonder why I can't delete the libraries 139 // I wonder why I can't delete the libraries
140 // What fucking shit this is. 140 // What fucking shit this is.
141 //delete it.data(); 141 //delete it.data();
142 } 142 }
143#else 143#else
144 // klibloader automaticly deletes the libraries for us... 144 // klibloader automaticly deletes the libraries for us...
145#endif 145#endif
146} 146}
147 147
148/** 148/**
149 * Query the kernel for all of the interfaces. 149 * Query the kernel for all of the interfaces.
150 */ 150 */
151void MainWindowImp::getAllInterfaces(){ 151void MainWindowImp::getAllInterfaces(){
152 int sockfd = socket(PF_INET, SOCK_DGRAM, 0); 152 int sockfd = socket(PF_INET, SOCK_DGRAM, 0);
153 if(sockfd == -1) 153 if(sockfd == -1)
154 return; 154 return;
155 155
156 struct ifreq ifr; 156 struct ifreq ifr;
157 QStringList ifaces; 157 QStringList ifaces;
158 QFile procFile(QString(_PROCNETDEV)); 158 QFile procFile(QString(_PROCNETDEV));
159 int result; 159 int result;
160 160
161 if (! procFile.exists()) { 161 if (! procFile.exists()) {
162 struct ifreq ifrs[100]; 162 struct ifreq ifrs[100];
163 struct ifconf ifc; 163 struct ifconf ifc;
164 ifc.ifc_len = sizeof(ifrs); 164 ifc.ifc_len = sizeof(ifrs);
165 ifc.ifc_req = ifrs; 165 ifc.ifc_req = ifrs;
166 result = ioctl(sockfd, SIOCGIFCONF, &ifc); 166 result = ioctl(sockfd, SIOCGIFCONF, &ifc);
167 167
168 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) { 168 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) {
169 struct ifreq *pifr = &ifrs[i]; 169 struct ifreq *pifr = &ifrs[i];
170 170
171 ifaces += pifr->ifr_name; 171 ifaces += pifr->ifr_name;
172 } 172 }
173 } else { 173 } else {
174 procFile.open(IO_ReadOnly); 174 procFile.open(IO_ReadOnly);
175 QString line; 175 QString line;
176 QTextStream procTs(&procFile); 176 QTextStream procTs(&procFile);
177 int loc = -1; 177 int loc = -1;
178 178
179 procTs.readLine(); // eat a line 179 procTs.readLine(); // eat a line
180 procTs.readLine(); // eat a line 180 procTs.readLine(); // eat a line
181 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { 181 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) {
182 if((loc = line.find(":")) != -1) { 182 if((loc = line.find(":")) != -1) {
183 ifaces += line.left(loc); 183 ifaces += line.left(loc);
184 } 184 }
185 } 185 }
186 } 186 }
187 187
188 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) { 188 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) {
189 int flags = 0, family; 189 int flags = 0, family;
190 Interface *i = NULL; 190 Interface *i = NULL;
191 191
192 strcpy(ifr.ifr_name, (*it).latin1()); 192 strcpy(ifr.ifr_name, (*it).latin1());
193 193
194 struct ifreq ifcopy; 194 struct ifreq ifcopy;
195 ifcopy = ifr; 195 ifcopy = ifr;
196 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); 196 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
197 flags = ifcopy.ifr_flags; 197 flags = ifcopy.ifr_flags;
198 i = new Interface(this, ifr.ifr_name, false); 198 i = new Interface(this, ifr.ifr_name, false);
199 i->setAttached(true); 199 i->setAttached(true);
200 if ((flags & IFF_UP) == IFF_UP) 200 if ((flags & IFF_UP) == IFF_UP)
201 i->setStatus(true); 201 i->setStatus(true);
202 else 202 else
203 i->setStatus(false); 203 i->setStatus(false);
204 204
205 if ((flags & IFF_BROADCAST) == IFF_BROADCAST) 205 if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
206 i->setHardwareName("Ethernet"); 206 i->setHardwareName("Ethernet");
207 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) 207 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
208 i->setHardwareName("Point to Point"); 208 i->setHardwareName("Point to Point");
209 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) 209 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
210 i->setHardwareName("Multicast"); 210 i->setHardwareName("Multicast");
211 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) 211 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
212 i->setHardwareName("Loopback"); 212 i->setHardwareName("Loopback");
213 else 213 else
214 i->setHardwareName("Unknown"); 214 i->setHardwareName("Unknown");
215 215
216 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); 216 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name);
217 interfaceNames.insert(i->getInterfaceName(), i); 217 interfaceNames.insert(i->getInterfaceName(), i);
218 updateInterface(i); 218 updateInterface(i);
219 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 219 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
220 } 220 }
221} 221}
222 222
223/** 223/**
224 * Load all modules that are found in the path 224 * Load all modules that are found in the path
225 * @param path a directory that is scaned for any plugins that can be loaded 225 * @param path a directory that is scaned for any plugins that can be loaded
226 * and attempts to load them 226 * and attempts to load them
227 */ 227 */
228void MainWindowImp::loadModules(const QString &path){ 228void MainWindowImp::loadModules(const QString &path){
229#ifdef DEBUG 229#ifdef DEBUG
230 qDebug("MainWindowImp::loadModules: %s", path.latin1()); 230 qDebug("MainWindowImp::loadModules: %s", path.latin1());
231#endif 231#endif
232 QDir d(path); 232 QDir d(path);
233 if(!d.exists()) 233 if(!d.exists())
234 return; 234 return;
235 235
236 // Don't want sym links 236 // Don't want sym links
237 d.setFilter( QDir::Files | QDir::NoSymLinks ); 237 d.setFilter( QDir::Files | QDir::NoSymLinks );
238 const QFileInfoList *list = d.entryInfoList(); 238 const QFileInfoList *list = d.entryInfoList();
239 QFileInfoListIterator it( *list ); 239 QFileInfoListIterator it( *list );
240 QFileInfo *fi; 240 QFileInfo *fi;
241 while ( (fi=it.current()) ) { 241 while ( (fi=it.current()) ) {
242#ifdef QWS 242#ifdef QWS
243 if(fi->fileName().contains(".so")){ 243 if(fi->fileName().contains(".so")){
244#else 244#else
245 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")){ 245 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")){
246#endif 246#endif
247 loadPlugin(path + "/" + fi->fileName()); 247 loadPlugin(path + "/" + fi->fileName());
248 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); 248 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1());
249 } 249 }
250 ++it; 250 ++it;
251 } 251 }
252} 252}
253 253
254/** 254/**
255 * Attempt to load a function and resolve a function. 255 * Attempt to load a function and resolve a function.
256 * @param pluginFileName - the name of the file in which to attempt to load 256 * @param pluginFileName - the name of the file in which to attempt to load
257 * @param resolveString - function pointer to resolve 257 * @param resolveString - function pointer to resolve
258 * @return pointer to the function with name resolveString or NULL 258 * @return pointer to the function with name resolveString or NULL
259 */ 259 */
260Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ 260Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){
261#ifdef DEBUG 261#ifdef DEBUG
262 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); 262 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1());
263#endif 263#endif
264#ifdef QWS 264#ifdef QWS
265 QLibrary *lib = new QLibrary(pluginFileName); 265 QLibrary *lib = new QLibrary(pluginFileName);
266 void *functionPointer = lib->resolve(resolveString); 266 void *functionPointer = lib->resolve(resolveString);
267 if( !functionPointer ){ 267 if( !functionPointer ){
268#ifdef DEBUG 268#ifdef DEBUG
269 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); 269 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1());
270#endif 270#endif
271 delete lib; 271 delete lib;
272 return NULL; 272 return NULL;
273 } 273 }
274 // Try to get an object. 274 // Try to get an object.
275 Module *object = ((Module* (*)()) functionPointer)(); 275 Module *object = ((Module* (*)()) functionPointer)();
276 if(object == NULL){ 276 if(object == NULL){
277#ifdef DEBUG 277#ifdef DEBUG
278 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 278 qDebug("MainWindowImp: Couldn't create object, but did load library!");
279#endif 279#endif
280 delete lib; 280 delete lib;
281 return NULL; 281 return NULL;
282 } 282 }
283 283
284 // Store for deletion later 284 // Store for deletion later
285 libraries.insert(object, lib); 285 libraries.insert(object, lib);
286 return object; 286 return object;
287 287
288#else 288#else
289 QLibrary *lib = loader->library(pluginFileName); 289 QLibrary *lib = loader->library(pluginFileName);
290 if( !lib || !lib->hasSymbol(resolveString) ){ 290 if( !lib || !lib->hasSymbol(resolveString) ){
291 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 291 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
292 return NULL; 292 return NULL;
293 } 293 }
294 // Try to get an object. 294 // Try to get an object.
295 Module *object = ((Module* (*)()) lib->symbol(resolveString))(); 295 Module *object = ((Module* (*)()) lib->symbol(resolveString))();
296 if(object == NULL){ 296 if(object == NULL){
297#ifdef DEBUG 297#ifdef DEBUG
298 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 298 qDebug("MainWindowImp: Couldn't create object, but did load library!");
299#endif 299#endif
300 return NULL; 300 return NULL;
301 } 301 }
302#ifdef DEBUG 302#ifdef DEBUG
303 qDebug("MainWindowImp::loadPlugin:: Found object, storing."); 303 qDebug("MainWindowImp::loadPlugin:: Found object, storing.");
304#endif 304#endif
305 // Store for deletion later 305 // Store for deletion later
306 libraries.insert(object, lib); 306 libraries.insert(object, lib);
307 return object; 307 return object;
308#endif 308#endif
309} 309}
310 310
311/** 311/**
312 * The Add button was clicked. Bring up the add dialog and if OK is hit 312 * The Add button was clicked. Bring up the add dialog and if OK is hit
313 * load the plugin and append it to the list 313 * load the plugin and append it to the list
314 */ 314 */
315void MainWindowImp::addClicked(){ 315void MainWindowImp::addClicked(){
316 QMap<Module*, QLibrary*>::Iterator it; 316 QMap<Module*, QLibrary*>::Iterator it;
317 QMap<QString, QString> list; 317 QMap<QString, QString> list;
318 QMap<QString, Module*> newInterfaceOwners; 318 QMap<QString, Module*> newInterfaceOwners;
319 //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); 319 //list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port");
320 //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port"); 320 //list.insert("IrDa (PPP) / (ADD_TEST)", "A dialup connection over the IdDa port");
321 for( it = libraries.begin(); it != libraries.end(); ++it ){ 321 for( it = libraries.begin(); it != libraries.end(); ++it ){
322 if(it.key()){ 322 if(it.key()){
323 (it.key())->possibleNewInterfaces(list); 323 (it.key())->possibleNewInterfaces(list);
324 } 324 }
325 } 325 }
326 // See if the list has anything that we can add. 326 // See if the list has anything that we can add.
327 if(list.count() == 0){ 327 if(list.count() == 0){
328 QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); 328 QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok);
329 return; 329 return;
330 } 330 }
331 AddConnectionImp addNewConnection(this, "AddConnectionImp", true); 331 AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
332 addNewConnection.addConnections(list); 332 addNewConnection.addConnections(list);
333 addNewConnection.showMaximized(); 333 addNewConnection.showMaximized();
334 if(QDialog::Accepted == addNewConnection.exec()){ 334 if(QDialog::Accepted == addNewConnection.exec()){
335 QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); 335 QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
336 if(!item) 336 if(!item)
337 return; 337 return;
338 338
339 for( it = libraries.begin(); it != libraries.end(); ++it ){ 339 for( it = libraries.begin(); it != libraries.end(); ++it ){
340 if(it.key()){ 340 if(it.key()){
341 Interface *i = (it.key())->addNewInterface(item->text(0)); 341 Interface *i = (it.key())->addNewInterface(item->text(0));
342 if(i){ 342 if(i){
343 qDebug("iface name %s",i->getInterfaceName().latin1()); 343 qDebug("iface name %s",i->getInterfaceName().latin1());
344 interfaceNames.insert(i->getInterfaceName(), i); 344 interfaceNames.insert(i->getInterfaceName(), i);
345 updateInterface(i); 345 updateInterface(i);
346 } 346 }
347 } 347 }
348 } 348 }
349 } 349 }
350} 350}
351 351
352/** 352/**
353 * Prompt the user to see if they really want to do this. 353 * Prompt the user to see if they really want to do this.
354 * If they do then remove from the list and unload. 354 * If they do then remove from the list and unload.
355 */ 355 */
356void MainWindowImp::removeClicked(){ 356void MainWindowImp::removeClicked(){
357 QListViewItem *item = connectionList->currentItem(); 357 QListViewItem *item = connectionList->currentItem();
358 if(!item) { 358 if(!item) {
359 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 359 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
360 return; 360 return;
361 } 361 }
362 362
363 Interface *i = interfaceItems[item]; 363 Interface *i = interfaceItems[item];
364 if(i->getModuleOwner() == NULL){ 364 if(i->getModuleOwner() == NULL){
365 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); 365 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
366 } 366 }
367 else{ 367 else{
368 if(!i->getModuleOwner()->remove(i)) 368 if(!i->getModuleOwner()->remove(i))
369 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); 369 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok);
370 else{ 370 else{
371 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); 371 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
372 // TODO memory managment.... 372 // TODO memory managment....
373 // who deletes the interface? 373 // who deletes the interface?
374 } 374 }
375 } 375 }
376} 376}
377 377
378/** 378/**
379 * Pull up the configure about the currently selected interface. 379 * Pull up the configure about the currently selected interface.
380 * Report an error if no interface is selected. 380 * Report an error if no interface is selected.
381 * If the interface has a module owner then request its configure. 381 * If the interface has a module owner then request its configure.
382 */ 382 */
383void MainWindowImp::configureClicked(){ 383void MainWindowImp::configureClicked(){
384 QListViewItem *item = connectionList->currentItem(); 384 QListViewItem *item = connectionList->currentItem();
385 if(!item){ 385 if(!item){
386 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); 386 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
387 return; 387 return;
388 } 388 }
389 389
390 QString currentProfileText = currentProfileLabel->text(); 390 QString currentProfileText = currentProfileLabel->text();
391 if(currentProfileText.upper() == "ALL"); 391 if(currentProfileText.upper() == "ALL");
392 currentProfileText = ""; 392 currentProfileText = "";
393 393
394 Interface *i = interfaceItems[item]; 394 Interface *i = interfaceItems[item];
395 395
396 if(i->getModuleOwner()){ 396 if(i->getModuleOwner()){
397 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 397 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
398 if(moduleConfigure != NULL){ 398 if(moduleConfigure != NULL){
399 i->getModuleOwner()->setProfile(currentProfileText); 399 i->getModuleOwner()->setProfile(currentProfileText);
400 moduleConfigure->showMaximized(); 400 moduleConfigure->showMaximized();
401 return; 401 return;
402 } 402 }
403 } 403 }
404 404
405 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose ); 405 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose );
406 configure->setProfile(currentProfileText); 406 configure->setProfile(currentProfileText);
407 configure->showMaximized(); 407 configure->showMaximized();
408} 408}
409 409
410/** 410/**
411 * Pull up the information about the currently selected interface. 411 * Pull up the information about the currently selected interface.
412 * Report an error if no interface is selected. 412 * Report an error if no interface is selected.
413 * If the interface has a module owner then request its configure. 413 * If the interface has a module owner then request its configure.
414 */ 414 */
415void MainWindowImp::informationClicked(){ 415void MainWindowImp::informationClicked(){
416 QListViewItem *item = connectionList->currentItem(); 416 QListViewItem *item = connectionList->currentItem();
417 if(!item){ 417 if(!item){
418 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 418 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
419 return; 419 return;
420 } 420 }
421 421
422 Interface *i = interfaceItems[item]; 422 Interface *i = interfaceItems[item];
423 if(!i->isAttached()){ 423// if(!i->isAttached()){
424 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 424// QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
425 return; 425// return;
426 } 426// }
427 427
428 if(i->getModuleOwner()){ 428 if(i->getModuleOwner()){
429 QWidget *moduleInformation = i->getModuleOwner()->information(i); 429 QWidget *moduleInformation = i->getModuleOwner()->information(i);
430 if(moduleInformation != NULL){ 430 if(moduleInformation != NULL){
431 moduleInformation->showMaximized(); 431 moduleInformation->showMaximized();
432#ifdef DEBUG 432#ifdef DEBUG
433 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); 433 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed.");
434#endif 434#endif
435 return; 435 return;
436 } 436 }
437 } 437 }
438 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 438 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
439 information->showMaximized(); 439 information->showMaximized();
440} 440}
441 441
442/** 442/**
443 * Update this interface. If no QListViewItem exists create one. 443 * Update this interface. If no QListViewItem exists create one.
444 * @param Interface* pointer to the interface that needs to be updated. 444 * @param Interface* pointer to the interface that needs to be updated.
445 */ 445 */
446void MainWindowImp::updateInterface(Interface *i){ 446void MainWindowImp::updateInterface(Interface *i){
447 if(!advancedUserMode){ 447 if(!advancedUserMode){
448 if(i->getInterfaceName() == "lo") 448 if(i->getInterfaceName() == "lo")
449 return; 449 return;
450 } 450 }
451 451
452 QListViewItem *item = NULL; 452 QListViewItem *item = NULL;
453 453
454 // Find the interface, making it if needed. 454 // Find the interface, making it if needed.
455 if(items.find(i) == items.end()){ 455 if(items.find(i) == items.end()){
456 item = new QListViewItem(connectionList, "", "", ""); 456 item = new QListViewItem(connectionList, "", "", "");
457 // See if you can't find a module owner for this interface 457 // See if you can't find a module owner for this interface
458 QMap<Module*, QLibrary*>::Iterator it; 458 QMap<Module*, QLibrary*>::Iterator it;
459 for( it = libraries.begin(); it != libraries.end(); ++it ){ 459 for( it = libraries.begin(); it != libraries.end(); ++it ){
460 if(it.key()->isOwner(i)) 460 if(it.key()->isOwner(i))
461 i->setModuleOwner(it.key()); 461 i->setModuleOwner(it.key());
462 } 462 }
463 items.insert(i, item); 463 items.insert(i, item);
464 interfaceItems.insert(item, i); 464 interfaceItems.insert(item, i);
465 } 465 }
466 else 466 else
467 item = items[i]; 467 item = items[i];
468 468
469 // Update the icons and information 469 // Update the icons and information
470#ifdef QWS 470#ifdef QWS
471 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); 471 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
472#else 472#else
473 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); 473 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down")));
474#endif 474#endif
475 475
476 QString typeName = "lan"; 476 QString typeName = "lan";
477 if(i->getHardwareName().contains("Local Loopback")) 477 if(i->getHardwareName().contains("Local Loopback"))
478 typeName = "lo"; 478 typeName = "lo";
479 if(i->getInterfaceName().contains("irda")) 479 if(i->getInterfaceName().contains("irda"))
480 typeName = "irda"; 480 typeName = "irda";
481 if(i->getInterfaceName().contains("wlan")) 481 if(i->getInterfaceName().contains("wlan"))
482 typeName = "wlan"; 482 typeName = "wlan";
483 if(i->getInterfaceName().contains("usb")) 483 if(i->getInterfaceName().contains("usb"))
484 typeName = "usb"; 484 typeName = "usb";
485 485
486 if(!i->isAttached()) 486 if(!i->isAttached())
487 typeName = "connect_no"; 487 typeName = "connect_no";
488 // Actually try to use the Module 488 // Actually try to use the Module
489 if(i->getModuleOwner() != NULL) 489 if(i->getModuleOwner() != NULL)
490 typeName = i->getModuleOwner()->getPixmapName(i); 490 typeName = i->getModuleOwner()->getPixmapName(i);
491 491
492#ifdef QWS 492#ifdef QWS
493 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); 493 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName)));
494#else 494#else
495 item->setPixmap(1, (SmallIcon(typeName))); 495 item->setPixmap(1, (SmallIcon(typeName)));
496#endif 496#endif
497 item->setText(2, i->getHardwareName()); 497 item->setText(2, i->getHardwareName());
498 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 498 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
499 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 499 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
500} 500}
501 501
502void MainWindowImp::newProfileChanged(const QString& newText){ 502void MainWindowImp::newProfileChanged(const QString& newText){
503 if(newText.length() > 0) 503 if(newText.length() > 0)
504 newProfileButton->setEnabled(true); 504 newProfileButton->setEnabled(true);
505 else 505 else
506 newProfileButton->setEnabled(false); 506 newProfileButton->setEnabled(false);
507} 507}
508 508
509/** 509/**
510 * Adds a new profile to the list of profiles. 510 * Adds a new profile to the list of profiles.
511 * Don't add profiles that already exists. 511 * Don't add profiles that already exists.
512 * Appends to the list and QStringList 512 * Appends to the list and QStringList
513 */ 513 */
514void MainWindowImp::addProfile(){ 514void MainWindowImp::addProfile(){
515 QString newProfileName = newProfile->text(); 515 QString newProfileName = newProfile->text();
516 if(profiles.grep(newProfileName).count() > 0){ 516 if(profiles.grep(newProfileName).count() > 0){
517 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); 517 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
518 return; 518 return;
519 } 519 }
520 profiles.append(newProfileName); 520 profiles.append(newProfileName);
521 profilesList->insertItem(newProfileName); 521 profilesList->insertItem(newProfileName);
522} 522}
523 523
524/** 524/**
525 * Removes the currently selected profile in the combo. 525 * Removes the currently selected profile in the combo.
526 * Doesn't delete if there are less then 2 profiles. 526 * Doesn't delete if there are less then 2 profiles.
527 */ 527 */
528void MainWindowImp::removeProfile(){ 528void MainWindowImp::removeProfile(){
529 if(profilesList->count() <= 1){ 529 if(profilesList->count() <= 1){
530 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); 530 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
531 return; 531 return;
532 } 532 }
533 QString profileToRemove = profilesList->currentText(); 533 QString profileToRemove = profilesList->currentText();
534 if(profileToRemove == "All"){ 534 if(profileToRemove == "All"){
535 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); 535 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok);
536 return; 536 return;
537 } 537 }
538 // Can't remove the curent profile 538 // Can't remove the curent profile
539 if(profileToRemove == currentProfileLabel->text()){ 539 if(profileToRemove == currentProfileLabel->text()){
540 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); 540 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok);
541 return; 541 return;
542 542
543 } 543 }
544 544
545 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ 545 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){
546 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); 546 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
547 profilesList->clear(); 547 profilesList->clear();
548 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 548 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
549 profilesList->insertItem((*it)); 549 profilesList->insertItem((*it));
550 550
551 // Remove any interface settings and mappings. 551 // Remove any interface settings and mappings.
552 Interfaces interfaces; 552 Interfaces interfaces;
553 // Go through them one by one 553 // Go through them one by one
554 QMap<Interface*, QListViewItem*>::Iterator it; 554 QMap<Interface*, QListViewItem*>::Iterator it;
555 for( it = items.begin(); it != items.end(); ++it ){ 555 for( it = items.begin(); it != items.end(); ++it ){
556 QString interfaceName = it.key()->getInterfaceName(); 556 QString interfaceName = it.key()->getInterfaceName();
557 qDebug(interfaceName.latin1()); 557 qDebug(interfaceName.latin1());
558 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){ 558 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){
559 interfaces.removeInterface(); 559 interfaces.removeInterface();
560 if(interfaces.setMapping(interfaceName)){ 560 if(interfaces.setMapping(interfaceName)){
561 if(profilesList->count() == 1) 561 if(profilesList->count() == 1)
562 interfaces.removeMapping(); 562 interfaces.removeMapping();
563 else{ 563 else{
564 interfaces.removeMap("map", interfaceName + "_" + profileToRemove); 564 interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
565 } 565 }
566 } 566 }
567 interfaces.write(); 567 interfaces.write();
568 break; 568 break;
569 } 569 }
570 } 570 }
571 } 571 }
572} 572}
573 573
574/** 574/**
575 * A new profile has been selected, change. 575 * A new profile has been selected, change.
576 * @param newProfile the new profile. 576 * @param newProfile the new profile.
577 */ 577 */
578void MainWindowImp::changeProfile(){ 578void MainWindowImp::changeProfile(){
579 if(profilesList->currentItem() == -1){ 579 if(profilesList->currentItem() == -1){
580 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); 580 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
581 return; 581 return;
582 } 582 }
583 QString newProfile = profilesList->text(profilesList->currentItem()); 583 QString newProfile = profilesList->text(profilesList->currentItem());
584 if(newProfile != currentProfileLabel->text()){ 584 if(newProfile != currentProfileLabel->text()){
585 currentProfileLabel->setText(newProfile); 585 currentProfileLabel->setText(newProfile);
586 QFile::remove(scheme); 586 QFile::remove(scheme);
587 QFile file(scheme); 587 QFile file(scheme);
588 if ( file.open(IO_ReadWrite) ) { 588 if ( file.open(IO_ReadWrite) ) {
589 QTextStream stream( &file ); 589 QTextStream stream( &file );
590 stream << QString("SCHEME=%1").arg(newProfile); 590 stream << QString("SCHEME=%1").arg(newProfile);
591 file.close(); 591 file.close();
592 } 592 }
593 // restart all up devices? 593 // restart all up devices?
594 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ 594 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){
595 // Go through them one by one 595 // Go through them one by one
596 QMap<Interface*, QListViewItem*>::Iterator it; 596 QMap<Interface*, QListViewItem*>::Iterator it;
597 for( it = items.begin(); it != items.end(); ++it ){ 597 for( it = items.begin(); it != items.end(); ++it ){
598 if(it.key()->getStatus() == true) 598 if(it.key()->getStatus() == true)
599 it.key()->restart(); 599 it.key()->restart();
600 } 600 }
601 } 601 }
602 } 602 }
603 // TODO change the profile in the modules 603 // TODO change the profile in the modules
604} 604}
605 605