summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network
authorwimpie <wimpie>2004-04-02 18:29:49 (UTC)
committer wimpie <wimpie>2004-04-02 18:29:49 (UTC)
commit5334b639c9f97793bcae4f50f7b47c7a2ada4e2f (patch) (unidiff)
treef55aebd4314ab878bc39b6b08b8323a8ef78d803 /noncore/settings/networksettings2/network
parent7c8922b37b5bb7696c0ff2cbc999e2936b9b509f (diff)
downloadopie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.zip
opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.gz
opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.bz2
First import of NS2 app
Diffstat (limited to 'noncore/settings/networksettings2/network') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/network/config.in4
-rw-r--r--noncore/settings/networksettings2/network/network.pro18
-rw-r--r--noncore/settings/networksettings2/network/networkGUI.ui1071
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp64
-rw-r--r--noncore/settings/networksettings2/network/network_NN.h44
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp170
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.h45
-rw-r--r--noncore/settings/networksettings2/network/networkdata.h22
-rw-r--r--noncore/settings/networksettings2/network/networkedit.cpp160
-rw-r--r--noncore/settings/networksettings2/network/networkedit.h21
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp63
-rw-r--r--noncore/settings/networksettings2/network/networkrun.h20
12 files changed, 1702 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/network/config.in b/noncore/settings/networksettings2/network/config.in
new file mode 100644
index 0000000..9dab059
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/config.in
@@ -0,0 +1,4 @@
1 config NS2NS2WORK
2 boolean "opie-networksettings2plugin-ipsetup (set up TCP/IP)"
3 default "n" if NS2
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE
diff --git a/noncore/settings/networksettings2/network/network.pro b/noncore/settings/networksettings2/network/network.pro
new file mode 100644
index 0000000..f9b2b7f
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network.pro
@@ -0,0 +1,18 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = network_NN.h \
5 network_NNI.h \
6 networkedit.h
7 SOURCES = network_NN.cpp \
8 network_NNI.cpp \
9 networkedit.cpp \
10 networkrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe
14 INTERFACES= networkGUI.ui
15 TARGET = network
16 VERSION = 1.0.0
17
18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/network/networkGUI.ui b/noncore/settings/networksettings2/network/networkGUI.ui
new file mode 100644
index 0000000..9115ec0
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkGUI.ui
@@ -0,0 +1,1071 @@
1<!DOCTYPE UI><UI>
2<class>NetworkGUI</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>NetworkGUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>293</width>
15 <height>254</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Interface Configuration</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>0</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QTabWidget</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TabWidget11</cstring>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property>
49 <widget>
50 <class>QWidget</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>tab</cstring>
54 </property>
55 <attribute>
56 <name>title</name>
57 <string>Setup</string>
58 </attribute>
59 <vbox>
60 <property stdset="1">
61 <name>margin</name>
62 <number>0</number>
63 </property>
64 <property stdset="1">
65 <name>spacing</name>
66 <number>0</number>
67 </property>
68 <widget>
69 <class>QCheckBox</class>
70 <property stdset="1">
71 <name>name</name>
72 <cstring>DHCP_CB</cstring>
73 </property>
74 <property stdset="1">
75 <name>text</name>
76 <string>Address from server</string>
77 </property>
78 <property stdset="1">
79 <name>checked</name>
80 <bool>true</bool>
81 </property>
82 </widget>
83 <widget>
84 <class>QLayoutWidget</class>
85 <property stdset="1">
86 <name>name</name>
87 <cstring>Layout3</cstring>
88 </property>
89 <hbox>
90 <property stdset="1">
91 <name>margin</name>
92 <number>0</number>
93 </property>
94 <property stdset="1">
95 <name>spacing</name>
96 <number>6</number>
97 </property>
98 <spacer>
99 <property>
100 <name>name</name>
101 <cstring>Spacer6</cstring>
102 </property>
103 <property stdset="1">
104 <name>orientation</name>
105 <enum>Horizontal</enum>
106 </property>
107 <property stdset="1">
108 <name>sizeType</name>
109 <enum>Fixed</enum>
110 </property>
111 <property>
112 <name>sizeHint</name>
113 <size>
114 <width>20</width>
115 <height>20</height>
116 </size>
117 </property>
118 </spacer>
119 <widget>
120 <class>QFrame</class>
121 <property stdset="1">
122 <name>name</name>
123 <cstring>StaticIP_GB</cstring>
124 </property>
125 <property stdset="1">
126 <name>enabled</name>
127 <bool>false</bool>
128 </property>
129 <property stdset="1">
130 <name>sizePolicy</name>
131 <sizepolicy>
132 <hsizetype>7</hsizetype>
133 <vsizetype>5</vsizetype>
134 </sizepolicy>
135 </property>
136 <property stdset="1">
137 <name>frameShape</name>
138 <enum>NoFrame</enum>
139 </property>
140 <property stdset="1">
141 <name>frameShadow</name>
142 <enum>Raised</enum>
143 </property>
144 <property>
145 <name>layoutMargin</name>
146 </property>
147 <property>
148 <name>layoutSpacing</name>
149 </property>
150 <grid>
151 <property stdset="1">
152 <name>margin</name>
153 <number>0</number>
154 </property>
155 <property stdset="1">
156 <name>spacing</name>
157 <number>1</number>
158 </property>
159 <widget row="0" column="0" >
160 <class>QLabel</class>
161 <property stdset="1">
162 <name>name</name>
163 <cstring>TextLabel4</cstring>
164 </property>
165 <property stdset="1">
166 <name>text</name>
167 <string>IP Address</string>
168 </property>
169 <property stdset="1">
170 <name>alignment</name>
171 <set>AlignCenter</set>
172 </property>
173 <property>
174 <name>hAlign</name>
175 </property>
176 </widget>
177 <widget row="1" column="0" >
178 <class>QLabel</class>
179 <property stdset="1">
180 <name>name</name>
181 <cstring>TextLabel5</cstring>
182 </property>
183 <property stdset="1">
184 <name>text</name>
185 <string>Subnet Mask</string>
186 </property>
187 <property stdset="1">
188 <name>alignment</name>
189 <set>AlignCenter</set>
190 </property>
191 <property>
192 <name>hAlign</name>
193 </property>
194 </widget>
195 <widget row="4" column="0" >
196 <class>QLabel</class>
197 <property stdset="1">
198 <name>name</name>
199 <cstring>TextLabel2</cstring>
200 </property>
201 <property stdset="1">
202 <name>text</name>
203 <string>First DNS</string>
204 </property>
205 <property stdset="1">
206 <name>alignment</name>
207 <set>AlignCenter</set>
208 </property>
209 <property>
210 <name>hAlign</name>
211 </property>
212 </widget>
213 <widget row="3" column="0" >
214 <class>QLabel</class>
215 <property stdset="1">
216 <name>name</name>
217 <cstring>TextLabel1_2</cstring>
218 </property>
219 <property stdset="1">
220 <name>text</name>
221 <string>Gateway</string>
222 </property>
223 <property stdset="1">
224 <name>alignment</name>
225 <set>AlignCenter</set>
226 </property>
227 <property>
228 <name>hAlign</name>
229 </property>
230 </widget>
231 <widget row="2" column="0" >
232 <class>QLabel</class>
233 <property stdset="1">
234 <name>name</name>
235 <cstring>TextLabel1</cstring>
236 </property>
237 <property stdset="1">
238 <name>text</name>
239 <string>Broadcast</string>
240 </property>
241 <property stdset="1">
242 <name>alignment</name>
243 <set>AlignCenter</set>
244 </property>
245 <property>
246 <name>hAlign</name>
247 </property>
248 </widget>
249 <widget row="5" column="0" >
250 <class>QLabel</class>
251 <property stdset="1">
252 <name>name</name>
253 <cstring>TextLabel3</cstring>
254 </property>
255 <property stdset="1">
256 <name>text</name>
257 <string>Second DNS</string>
258 </property>
259 <property stdset="1">
260 <name>alignment</name>
261 <set>AlignCenter</set>
262 </property>
263 <property>
264 <name>hAlign</name>
265 </property>
266 </widget>
267 <widget row="0" column="1" >
268 <class>QLineEdit</class>
269 <property stdset="1">
270 <name>name</name>
271 <cstring>IPAddress_LE</cstring>
272 </property>
273 </widget>
274 <widget row="1" column="1" >
275 <class>QLineEdit</class>
276 <property stdset="1">
277 <name>name</name>
278 <cstring>SubnetMask_LE</cstring>
279 </property>
280 <property stdset="1">
281 <name>text</name>
282 <string>255.255.255.0</string>
283 </property>
284 </widget>
285 <widget row="2" column="1" >
286 <class>QLineEdit</class>
287 <property stdset="1">
288 <name>name</name>
289 <cstring>Broadcast_LE</cstring>
290 </property>
291 </widget>
292 <widget row="3" column="1" >
293 <class>QLineEdit</class>
294 <property stdset="1">
295 <name>name</name>
296 <cstring>Gateway_LE</cstring>
297 </property>
298 </widget>
299 <widget row="4" column="1" >
300 <class>QLineEdit</class>
301 <property stdset="1">
302 <name>name</name>
303 <cstring>DNS1_LE</cstring>
304 </property>
305 </widget>
306 <widget row="5" column="1" >
307 <class>QLineEdit</class>
308 <property stdset="1">
309 <name>name</name>
310 <cstring>DNS2_LE</cstring>
311 </property>
312 </widget>
313 </grid>
314 </widget>
315 </hbox>
316 </widget>
317 <widget>
318 <class>QLabel</class>
319 <property stdset="1">
320 <name>name</name>
321 <cstring>TextLabel2_2</cstring>
322 </property>
323 <property stdset="1">
324 <name>text</name>
325 <string>DHCP Settings</string>
326 </property>
327 </widget>
328 <widget>
329 <class>QLayoutWidget</class>
330 <property stdset="1">
331 <name>name</name>
332 <cstring>Layout5</cstring>
333 </property>
334 <hbox>
335 <property stdset="1">
336 <name>margin</name>
337 <number>0</number>
338 </property>
339 <property stdset="1">
340 <name>spacing</name>
341 <number>6</number>
342 </property>
343 <spacer>
344 <property>
345 <name>name</name>
346 <cstring>Spacer26</cstring>
347 </property>
348 <property stdset="1">
349 <name>orientation</name>
350 <enum>Horizontal</enum>
351 </property>
352 <property stdset="1">
353 <name>sizeType</name>
354 <enum>Fixed</enum>
355 </property>
356 <property>
357 <name>sizeHint</name>
358 <size>
359 <width>20</width>
360 <height>20</height>
361 </size>
362 </property>
363 </spacer>
364 <widget>
365 <class>QFrame</class>
366 <property stdset="1">
367 <name>name</name>
368 <cstring>Frame27</cstring>
369 </property>
370 <property stdset="1">
371 <name>sizePolicy</name>
372 <sizepolicy>
373 <hsizetype>7</hsizetype>
374 <vsizetype>5</vsizetype>
375 </sizepolicy>
376 </property>
377 <property stdset="1">
378 <name>frameShape</name>
379 <enum>NoFrame</enum>
380 </property>
381 <property stdset="1">
382 <name>frameShadow</name>
383 <enum>Raised</enum>
384 </property>
385 <property>
386 <name>layoutMargin</name>
387 </property>
388 <property>
389 <name>layoutSpacing</name>
390 </property>
391 <hbox>
392 <property stdset="1">
393 <name>margin</name>
394 <number>0</number>
395 </property>
396 <property stdset="1">
397 <name>spacing</name>
398 <number>2</number>
399 </property>
400 <widget>
401 <class>QCheckBox</class>
402 <property stdset="1">
403 <name>name</name>
404 <cstring>SendHostname_CB</cstring>
405 </property>
406 <property stdset="1">
407 <name>text</name>
408 <string>Send hostname</string>
409 </property>
410 </widget>
411 <widget>
412 <class>QLineEdit</class>
413 <property stdset="1">
414 <name>name</name>
415 <cstring>Hostname_LE</cstring>
416 </property>
417 <property stdset="1">
418 <name>enabled</name>
419 <bool>false</bool>
420 </property>
421 <property stdset="1">
422 <name>sizePolicy</name>
423 <sizepolicy>
424 <hsizetype>7</hsizetype>
425 <vsizetype>0</vsizetype>
426 </sizepolicy>
427 </property>
428 </widget>
429 </hbox>
430 </widget>
431 </hbox>
432 </widget>
433 <spacer>
434 <property>
435 <name>name</name>
436 <cstring>Spacer38</cstring>
437 </property>
438 <property stdset="1">
439 <name>orientation</name>
440 <enum>Vertical</enum>
441 </property>
442 <property stdset="1">
443 <name>sizeType</name>
444 <enum>Expanding</enum>
445 </property>
446 <property>
447 <name>sizeHint</name>
448 <size>
449 <width>20</width>
450 <height>20</height>
451 </size>
452 </property>
453 </spacer>
454 </vbox>
455 </widget>
456 <widget>
457 <class>QWidget</class>
458 <property stdset="1">
459 <name>name</name>
460 <cstring>tab</cstring>
461 </property>
462 <attribute>
463 <name>title</name>
464 <string>Extra commands</string>
465 </attribute>
466 <vbox>
467 <property stdset="1">
468 <name>margin</name>
469 <number>0</number>
470 </property>
471 <property stdset="1">
472 <name>spacing</name>
473 <number>2</number>
474 </property>
475 <widget>
476 <class>QLineEdit</class>
477 <property stdset="1">
478 <name>name</name>
479 <cstring>Command_LE</cstring>
480 </property>
481 </widget>
482 <widget>
483 <class>QTabWidget</class>
484 <property stdset="1">
485 <name>name</name>
486 <cstring>Tab_TB</cstring>
487 </property>
488 <property>
489 <name>layoutMargin</name>
490 </property>
491 <property>
492 <name>layoutSpacing</name>
493 </property>
494 <widget>
495 <class>QWidget</class>
496 <property stdset="1">
497 <name>name</name>
498 <cstring>tab</cstring>
499 </property>
500 <attribute>
501 <name>title</name>
502 <string>Pre-Up</string>
503 </attribute>
504 <hbox>
505 <property stdset="1">
506 <name>margin</name>
507 <number>0</number>
508 </property>
509 <property stdset="1">
510 <name>spacing</name>
511 <number>2</number>
512 </property>
513 <widget>
514 <class>QListBox</class>
515 <property stdset="1">
516 <name>name</name>
517 <cstring>PreUp_LB</cstring>
518 </property>
519 </widget>
520 <widget>
521 <class>QFrame</class>
522 <property stdset="1">
523 <name>name</name>
524 <cstring>Frame5_2</cstring>
525 </property>
526 <property stdset="1">
527 <name>sizePolicy</name>
528 <sizepolicy>
529 <hsizetype>0</hsizetype>
530 <vsizetype>7</vsizetype>
531 </sizepolicy>
532 </property>
533 <property stdset="1">
534 <name>frameShape</name>
535 <enum>StyledPanel</enum>
536 </property>
537 <property stdset="1">
538 <name>frameShadow</name>
539 <enum>Raised</enum>
540 </property>
541 <property>
542 <name>layoutMargin</name>
543 </property>
544 <property>
545 <name>layoutSpacing</name>
546 </property>
547 <vbox>
548 <property stdset="1">
549 <name>margin</name>
550 <number>0</number>
551 </property>
552 <property stdset="1">
553 <name>spacing</name>
554 <number>1</number>
555 </property>
556 <widget>
557 <class>QToolButton</class>
558 <property stdset="1">
559 <name>name</name>
560 <cstring>AddPreUp_TB</cstring>
561 </property>
562 <property stdset="1">
563 <name>text</name>
564 <string>...</string>
565 </property>
566 </widget>
567 <widget>
568 <class>QToolButton</class>
569 <property stdset="1">
570 <name>name</name>
571 <cstring>DeletePreUp_TB</cstring>
572 </property>
573 <property stdset="1">
574 <name>text</name>
575 <string>...</string>
576 </property>
577 </widget>
578 <widget>
579 <class>QToolButton</class>
580 <property stdset="1">
581 <name>name</name>
582 <cstring>UpPreUp_TB</cstring>
583 </property>
584 <property stdset="1">
585 <name>text</name>
586 <string>...</string>
587 </property>
588 </widget>
589 <widget>
590 <class>QToolButton</class>
591 <property stdset="1">
592 <name>name</name>
593 <cstring>DownPreUp_TB</cstring>
594 </property>
595 <property stdset="1">
596 <name>text</name>
597 <string>...</string>
598 </property>
599 </widget>
600 <spacer>
601 <property>
602 <name>name</name>
603 <cstring>Spacer5_2_2</cstring>
604 </property>
605 <property stdset="1">
606 <name>orientation</name>
607 <enum>Vertical</enum>
608 </property>
609 <property stdset="1">
610 <name>sizeType</name>
611 <enum>Expanding</enum>
612 </property>
613 <property>
614 <name>sizeHint</name>
615 <size>
616 <width>20</width>
617 <height>20</height>
618 </size>
619 </property>
620 </spacer>
621 </vbox>
622 </widget>
623 </hbox>
624 </widget>
625 <widget>
626 <class>QWidget</class>
627 <property stdset="1">
628 <name>name</name>
629 <cstring>tab</cstring>
630 </property>
631 <attribute>
632 <name>title</name>
633 <string>Post-Up</string>
634 </attribute>
635 <hbox>
636 <property stdset="1">
637 <name>margin</name>
638 <number>0</number>
639 </property>
640 <property stdset="1">
641 <name>spacing</name>
642 <number>2</number>
643 </property>
644 <widget>
645 <class>QListBox</class>
646 <property stdset="1">
647 <name>name</name>
648 <cstring>PostUp_LB</cstring>
649 </property>
650 </widget>
651 <widget>
652 <class>QFrame</class>
653 <property stdset="1">
654 <name>name</name>
655 <cstring>Frame5</cstring>
656 </property>
657 <property stdset="1">
658 <name>sizePolicy</name>
659 <sizepolicy>
660 <hsizetype>0</hsizetype>
661 <vsizetype>7</vsizetype>
662 </sizepolicy>
663 </property>
664 <property stdset="1">
665 <name>frameShape</name>
666 <enum>StyledPanel</enum>
667 </property>
668 <property stdset="1">
669 <name>frameShadow</name>
670 <enum>Raised</enum>
671 </property>
672 <property>
673 <name>layoutMargin</name>
674 </property>
675 <property>
676 <name>layoutSpacing</name>
677 </property>
678 <vbox>
679 <property stdset="1">
680 <name>margin</name>
681 <number>0</number>
682 </property>
683 <property stdset="1">
684 <name>spacing</name>
685 <number>1</number>
686 </property>
687 <widget>
688 <class>QToolButton</class>
689 <property stdset="1">
690 <name>name</name>
691 <cstring>AddPostUp_TB</cstring>
692 </property>
693 <property stdset="1">
694 <name>text</name>
695 <string>...</string>
696 </property>
697 </widget>
698 <widget>
699 <class>QToolButton</class>
700 <property stdset="1">
701 <name>name</name>
702 <cstring>DeletePostUp_TB</cstring>
703 </property>
704 <property stdset="1">
705 <name>text</name>
706 <string>...</string>
707 </property>
708 </widget>
709 <widget>
710 <class>QToolButton</class>
711 <property stdset="1">
712 <name>name</name>
713 <cstring>UpPostUp_TB</cstring>
714 </property>
715 <property stdset="1">
716 <name>text</name>
717 <string>...</string>
718 </property>
719 </widget>
720 <widget>
721 <class>QToolButton</class>
722 <property stdset="1">
723 <name>name</name>
724 <cstring>DownPostUp_TB</cstring>
725 </property>
726 <property stdset="1">
727 <name>text</name>
728 <string>...</string>
729 </property>
730 </widget>
731 <spacer>
732 <property>
733 <name>name</name>
734 <cstring>Spacer5_5</cstring>
735 </property>
736 <property stdset="1">
737 <name>orientation</name>
738 <enum>Vertical</enum>
739 </property>
740 <property stdset="1">
741 <name>sizeType</name>
742 <enum>Expanding</enum>
743 </property>
744 <property>
745 <name>sizeHint</name>
746 <size>
747 <width>20</width>
748 <height>20</height>
749 </size>
750 </property>
751 </spacer>
752 </vbox>
753 </widget>
754 </hbox>
755 </widget>
756 <widget>
757 <class>QWidget</class>
758 <property stdset="1">
759 <name>name</name>
760 <cstring>tab</cstring>
761 </property>
762 <attribute>
763 <name>title</name>
764 <string>Pre-Down</string>
765 </attribute>
766 <hbox>
767 <property stdset="1">
768 <name>margin</name>
769 <number>0</number>
770 </property>
771 <property stdset="1">
772 <name>spacing</name>
773 <number>2</number>
774 </property>
775 <widget>
776 <class>QListBox</class>
777 <property stdset="1">
778 <name>name</name>
779 <cstring>PreDown_LB</cstring>
780 </property>
781 </widget>
782 <widget>
783 <class>QFrame</class>
784 <property stdset="1">
785 <name>name</name>
786 <cstring>Frame5_3</cstring>
787 </property>
788 <property stdset="1">
789 <name>sizePolicy</name>
790 <sizepolicy>
791 <hsizetype>0</hsizetype>
792 <vsizetype>3</vsizetype>
793 </sizepolicy>
794 </property>
795 <property stdset="1">
796 <name>frameShape</name>
797 <enum>StyledPanel</enum>
798 </property>
799 <property stdset="1">
800 <name>frameShadow</name>
801 <enum>Raised</enum>
802 </property>
803 <property>
804 <name>layoutMargin</name>
805 </property>
806 <property>
807 <name>layoutSpacing</name>
808 </property>
809 <vbox>
810 <property stdset="1">
811 <name>margin</name>
812 <number>0</number>
813 </property>
814 <property stdset="1">
815 <name>spacing</name>
816 <number>1</number>
817 </property>
818 <widget>
819 <class>QToolButton</class>
820 <property stdset="1">
821 <name>name</name>
822 <cstring>AddPreDown_TB</cstring>
823 </property>
824 <property stdset="1">
825 <name>text</name>
826 <string>...</string>
827 </property>
828 </widget>
829 <widget>
830 <class>QToolButton</class>
831 <property stdset="1">
832 <name>name</name>
833 <cstring>DeletePreDown_TB</cstring>
834 </property>
835 <property stdset="1">
836 <name>text</name>
837 <string>...</string>
838 </property>
839 </widget>
840 <widget>
841 <class>QToolButton</class>
842 <property stdset="1">
843 <name>name</name>
844 <cstring>UpPreDown_TB</cstring>
845 </property>
846 <property stdset="1">
847 <name>text</name>
848 <string>...</string>
849 </property>
850 </widget>
851 <widget>
852 <class>QToolButton</class>
853 <property stdset="1">
854 <name>name</name>
855 <cstring>DownPreDown_TB</cstring>
856 </property>
857 <property stdset="1">
858 <name>text</name>
859 <string>...</string>
860 </property>
861 </widget>
862 <spacer>
863 <property>
864 <name>name</name>
865 <cstring>Spacer5_3_2</cstring>
866 </property>
867 <property stdset="1">
868 <name>orientation</name>
869 <enum>Vertical</enum>
870 </property>
871 <property stdset="1">
872 <name>sizeType</name>
873 <enum>Expanding</enum>
874 </property>
875 <property>
876 <name>sizeHint</name>
877 <size>
878 <width>20</width>
879 <height>20</height>
880 </size>
881 </property>
882 </spacer>
883 </vbox>
884 </widget>
885 </hbox>
886 </widget>
887 <widget>
888 <class>QWidget</class>
889 <property stdset="1">
890 <name>name</name>
891 <cstring>tab</cstring>
892 </property>
893 <attribute>
894 <name>title</name>
895 <string>Post-Down</string>
896 </attribute>
897 <hbox>
898 <property stdset="1">
899 <name>margin</name>
900 <number>0</number>
901 </property>
902 <property stdset="1">
903 <name>spacing</name>
904 <number>2</number>
905 </property>
906 <widget>
907 <class>QListBox</class>
908 <property stdset="1">
909 <name>name</name>
910 <cstring>PostDown_LB</cstring>
911 </property>
912 </widget>
913 <widget>
914 <class>QFrame</class>
915 <property stdset="1">
916 <name>name</name>
917 <cstring>Frame5_4</cstring>
918 </property>
919 <property stdset="1">
920 <name>sizePolicy</name>
921 <sizepolicy>
922 <hsizetype>0</hsizetype>
923 <vsizetype>7</vsizetype>
924 </sizepolicy>
925 </property>
926 <property stdset="1">
927 <name>frameShape</name>
928 <enum>StyledPanel</enum>
929 </property>
930 <property stdset="1">
931 <name>frameShadow</name>
932 <enum>Raised</enum>
933 </property>
934 <property>
935 <name>layoutMargin</name>
936 </property>
937 <property>
938 <name>layoutSpacing</name>
939 </property>
940 <vbox>
941 <property stdset="1">
942 <name>margin</name>
943 <number>0</number>
944 </property>
945 <property stdset="1">
946 <name>spacing</name>
947 <number>1</number>
948 </property>
949 <widget>
950 <class>QToolButton</class>
951 <property stdset="1">
952 <name>name</name>
953 <cstring>AddPostDown_TB</cstring>
954 </property>
955 <property stdset="1">
956 <name>text</name>
957 <string>...</string>
958 </property>
959 </widget>
960 <widget>
961 <class>QToolButton</class>
962 <property stdset="1">
963 <name>name</name>
964 <cstring>DeletePostDown_TB</cstring>
965 </property>
966 <property stdset="1">
967 <name>text</name>
968 <string>...</string>
969 </property>
970 </widget>
971 <widget>
972 <class>QToolButton</class>
973 <property stdset="1">
974 <name>name</name>
975 <cstring>UpPostDown_TB</cstring>
976 </property>
977 <property stdset="1">
978 <name>text</name>
979 <string>...</string>
980 </property>
981 </widget>
982 <widget>
983 <class>QToolButton</class>
984 <property stdset="1">
985 <name>name</name>
986 <cstring>DownPostDown_TB</cstring>
987 </property>
988 <property stdset="1">
989 <name>text</name>
990 <string>...</string>
991 </property>
992 </widget>
993 <spacer>
994 <property>
995 <name>name</name>
996 <cstring>Spacer5_4</cstring>
997 </property>
998 <property stdset="1">
999 <name>orientation</name>
1000 <enum>Vertical</enum>
1001 </property>
1002 <property stdset="1">
1003 <name>sizeType</name>
1004 <enum>Expanding</enum>
1005 </property>
1006 <property>
1007 <name>sizeHint</name>
1008 <size>
1009 <width>20</width>
1010 <height>20</height>
1011 </size>
1012 </property>
1013 </spacer>
1014 </vbox>
1015 </widget>
1016 </hbox>
1017 </widget>
1018 </widget>
1019 </vbox>
1020 </widget>
1021 </widget>
1022 </vbox>
1023</widget>
1024<connections>
1025 <connection>
1026 <sender>DHCP_CB</sender>
1027 <signal>toggled(bool)</signal>
1028 <receiver>StaticIP_GB</receiver>
1029 <slot>setDisabled(bool)</slot>
1030 </connection>
1031 <connection>
1032 <sender>SubnetMask_LE</sender>
1033 <signal>textChanged(const QString&amp;)</signal>
1034 <receiver>NetworkGUI</receiver>
1035 <slot>SLOT_NetmaskModified( const QString &amp; )</slot>
1036 </connection>
1037 <connection>
1038 <sender>IPAddress_LE</sender>
1039 <signal>textChanged(const QString&amp;)</signal>
1040 <receiver>NetworkGUI</receiver>
1041 <slot>SLOT_NetmaskModified( const QString &amp; )</slot>
1042 </connection>
1043 <connection>
1044 <sender>DHCP_CB</sender>
1045 <signal>toggled(bool)</signal>
1046 <receiver>Frame27</receiver>
1047 <slot>setEnabled(bool)</slot>
1048 </connection>
1049 <connection>
1050 <sender>DHCP_CB</sender>
1051 <signal>toggled(bool)</signal>
1052 <receiver>TextLabel2_2</receiver>
1053 <slot>setEnabled(bool)</slot>
1054 </connection>
1055 <connection>
1056 <sender>SendHostname_CB</sender>
1057 <signal>toggled(bool)</signal>
1058 <receiver>Hostname_LE</receiver>
1059 <slot>setEnabled(bool)</slot>
1060 </connection>
1061 <slot access="public">SLOT_NetmaskModified( const QString &amp; )</slot>
1062</connections>
1063<tabstops>
1064 <tabstop>DHCP_CB</tabstop>
1065 <tabstop>IPAddress_LE</tabstop>
1066 <tabstop>SubnetMask_LE</tabstop>
1067 <tabstop>Gateway_LE</tabstop>
1068 <tabstop>DNS1_LE</tabstop>
1069 <tabstop>DNS2_LE</tabstop>
1070</tabstops>
1071</UI>
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
new file mode 100644
index 0000000..bb371ad
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -0,0 +1,64 @@
1#include "network_NN.h"
2#include "network_NNI.h"
3
4static const char * NetworkNeeds[] =
5 { "device",
6 0
7 };
8
9/**
10 * Constructor, find all of the possible interfaces
11 */
12NetworkNetNode::NetworkNetNode() : ANetNode() {
13}
14
15/**
16 * Delete any interfaces that we own.
17 */
18NetworkNetNode::~NetworkNetNode(){
19}
20
21const QString NetworkNetNode::nodeDescription(){
22 return tr("\
23<p>Sets up TCP/IP options.</p>\
24<p>Use this to configure the TCP/IP protocol</p>\
25"
26);
27}
28
29ANetNodeInstance * NetworkNetNode::createInstance( void ) {
30 return new ANetwork( this );
31}
32
33const char ** NetworkNetNode::needs( void ) {
34 return NetworkNeeds;
35}
36
37const char * NetworkNetNode::provides( void ) {
38 return "connection";
39}
40
41bool NetworkNetNode::generateProperFilesFor(
42 ANetNodeInstance * ) {
43 return 1;
44}
45
46bool NetworkNetNode::hasDataFor( const QString & S ) {
47 if( S == "interfaces" ) {
48 return 1;
49 }
50 return 0;
51}
52
53bool NetworkNetNode::generateDataForCommonFile(
54 SystemFile & S,
55 long DevNr,
56 ANetNodeInstance * NNI ) {
57 return ((ANetwork *)NNI)->generateDataForCommonFile(S, DevNr);
58}
59
60extern "C" {
61void create_plugin( QList<ANetNode> & PNN ) {
62 PNN.append( new NetworkNetNode() );
63}
64}
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h
new file mode 100644
index 0000000..3b0cd64
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NN.h
@@ -0,0 +1,44 @@
1#ifndef NETWORK_NETNODE_H
2#define NETWORK_NETNODE_H
3
4#include "netnode.h"
5
6class ANetwork;
7
8class NetworkNetNode : public ANetNode{
9
10 Q_OBJECT
11
12public:
13
14 NetworkNetNode();
15 virtual ~NetworkNetNode();
16
17 virtual const QString pixmapName()
18 { return "tcpip"; }
19
20 virtual const QString nodeName()
21 { return tr("IP Configuration"); }
22
23 virtual const QString nodeDescription() ;
24
25 virtual ANetNodeInstance * createInstance( void );
26
27 virtual const char ** needs( void );
28 virtual const char * provides( void );
29
30 virtual bool generateProperFilesFor( ANetNodeInstance * NNI );
31 virtual bool hasDataFor( const QString & S );
32 virtual bool generateDataForCommonFile(
33 SystemFile & SF, long DevNr, ANetNodeInstance * NNI );
34
35private:
36
37};
38
39extern "C"
40{
41 void create_plugin( QList<ANetNode> & PNN );
42};
43
44#endif
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
new file mode 100644
index 0000000..7130764
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -0,0 +1,170 @@
1#include <system.h>
2#include <asdevice.h>
3#include "networkedit.h"
4#include "network_NNI.h"
5#include "network_NN.h"
6
7ANetwork::ANetwork( NetworkNetNode * PNN ) : ANetNodeInstance( PNN ) {
8 Data.UseDHCP = 1;
9 Data.IPAddress = "";
10 Data.NetMask = "";
11 Data.Broadcast = "";
12 Data.Gateway = "";
13 Data.DNS1 = "";
14 Data.DNS2 = "";
15 Data.SendHostname = 0;
16 Data.Hostname = "";
17 Data.PreUp_SL.clear();
18 Data.PreDown_SL.clear();
19 Data.PostUp_SL.clear();
20 Data.PostDown_SL.clear();
21 GUI = 0;
22 RT = 0;
23}
24
25void ANetwork::setSpecificAttribute( QString & A, QString & V ) {
26 if( A == "usedhcp" ) {
27 Data.UseDHCP = (V == "yes");
28 } else if( A == "sendhostname" ) {
29 Data.SendHostname = (V=="yes");
30 } else if( A == "hostname" ) {
31 Data.Hostname = V;
32 } else if( A == "ipaddress" ) {
33 Data.IPAddress = V;
34 } else if( A == "netmask" ) {
35 Data.NetMask = V;
36 } else if( A == "broadcast" ) {
37 Data.Broadcast = V;
38 } else if( A == "gateway" ) {
39 Data.Gateway = V;
40 } else if( A == "dns1" ) {
41 Data.DNS1 = V;
42 } else if( A == "dns2" ) {
43 Data.DNS2 = V;
44 } else if( A == "preup" ) {
45 Data.PreUp_SL.append( V );
46 } else if( A == "predown" ) {
47 Data.PreDown_SL.append( V );
48 } else if( A == "postup" ) {
49 Data.PostUp_SL.append( V );
50 } else if( A == "postdown" ) {
51 Data.PostDown_SL.append( V );
52 }
53}
54
55void ANetwork::saveSpecificAttribute( QTextStream & TS ) {
56 TS << "usedhcp=" << ((Data.UseDHCP) ? "yes" : "no") << endl;
57 TS << "sendhostname=" << ((Data.SendHostname) ? "yes" : "no") << endl;
58 TS << "hostname=" << Data.Hostname << endl;
59 TS << "ipaddress=" << Data.IPAddress << endl;
60 TS << "netmask=" << Data.NetMask << endl;
61 TS << "broadcast=" << Data.Broadcast << endl;
62 TS << "gateway=" << Data.Gateway << endl;
63 TS << "dns1=" << Data.DNS1 << endl;
64 TS << "dns2=" << Data.DNS2 << endl;
65 for ( QStringList::Iterator it = Data.PreUp_SL.begin();
66 it != Data.PreUp_SL.end();
67 ++it ) {
68 TS << "preup=" << quote(*it) << endl;
69 }
70 for ( QStringList::Iterator it = Data.PreDown_SL.begin();
71 it != Data.PreDown_SL.end();
72 ++it ) {
73 TS << "predown=" << quote(*it) << endl;
74 }
75 for ( QStringList::Iterator it = Data.PostUp_SL.begin();
76 it != Data.PostUp_SL.end();
77 ++it ) {
78 TS << "postup=" << quote(*it) << endl;
79 }
80 for ( QStringList::Iterator it = Data.PostDown_SL.begin();
81 it != Data.PostDown_SL.end();
82 ++it ) {
83 TS << "postdown=" << quote(*it) << endl;
84 }
85}
86
87QWidget * ANetwork::edit( QWidget * parent ) {
88 GUI = new NetworkEdit( parent );
89 GUI->showData( Data );
90 return GUI;
91}
92
93QString ANetwork::acceptable( void ) {
94 return ( GUI ) ? GUI->acceptable( ) : QString();
95}
96
97void ANetwork::commit( void ) {
98 if( GUI && GUI->commit( Data ) )
99 setModified( 1 );
100}
101
102bool ANetwork::generateDataForCommonFile( SystemFile & S, long DevNr ) {
103 AsDevice * Dev = runtime()->device();
104 QString NIC = Dev->genNic( DevNr );
105
106 if( S.name() == "interfaces" ) {
107 // generate mapping stanza for this interface
108 S << "# check if " << NIC << " can be brought UP" << endl;
109 S << "mapping " << NIC << endl;
110 S << " script networksettings2-request" << endl << endl;
111
112 // we can safely call from here since device item is deeper
113 if( Data.UseDHCP ) {
114 S << "iface " << NIC << "-c" << connection()->number() <<
115 "-allowed inet dhcp" << endl;
116 S << " up echo \"" << NIC << "\" > /tmp/profile-" << connection()->number() <<
117 ".up" << Data.IPAddress << endl;
118 if( Data.SendHostname ) {
119 S << " hostname "<< Data.Hostname << endl;
120 }
121
122 S << " down rm -f /tmp/profile-" << connection()->number() <<
123 ".up" << Data.IPAddress << endl;
124 } else {
125 S << "iface " << NIC << "-c" << connection()->number() <<
126 "-allowed inet static" << endl;
127 S << " up echo \"" << NIC << "\" > /tmp/profile-" << connection()->number() <<
128 ".up" << Data.IPAddress << endl;
129 S << " down rm -f /tmp/profile-" << connection()->number() <<
130 ".up" << Data.IPAddress << endl;
131 S << " address " << Data.IPAddress << endl;
132 S << " broadcast " << Data.Broadcast << endl;
133 S << " netmask " << Data.NetMask << endl;
134
135 // derive network address = IPAddress & netmask
136 { QString NW;
137 QStringList ipal = QStringList::split( '.', Data.IPAddress );
138 QStringList nmal = QStringList::split( '.', Data.NetMask );
139
140 NW = QString( "%1.%2.%3.%4" ).
141 arg( ipal[0].toShort() & nmal[0].toShort() ).
142 arg( ipal[1].toShort() & nmal[1].toShort() ).
143 arg( ipal[2].toShort() & nmal[2].toShort() ).
144 arg( ipal[3].toShort() & nmal[3].toShort() );
145 S << " network " << NW << endl;
146 }
147 }
148 for ( QStringList::Iterator it = Data.PreUp_SL.begin();
149 it != Data.PreUp_SL.end();
150 ++it ) {
151 S << " pre-up " << (*it) << endl;
152 }
153 for ( QStringList::Iterator it = Data.PostUp_SL.begin();
154 it != Data.PostUp_SL.end();
155 ++it ) {
156 S << " up " << (*it) << endl;
157 }
158 for ( QStringList::Iterator it = Data.PreDown_SL.begin();
159 it != Data.PreDown_SL.end();
160 ++it ) {
161 S << " down " << (*it) << endl;
162 }
163 for ( QStringList::Iterator it = Data.PostDown_SL.begin();
164 it != Data.PostDown_SL.end();
165 ++it ) {
166 S << " post-down " << (*it) << endl;
167 }
168 }
169 return 0;
170}
diff --git a/noncore/settings/networksettings2/network/network_NNI.h b/noncore/settings/networksettings2/network/network_NNI.h
new file mode 100644
index 0000000..b98ff6e
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/network_NNI.h
@@ -0,0 +1,45 @@
1#ifndef NETWORK_H
2#define NETWORK_H
3
4#include <netnode.h>
5#include "networkdata.h"
6#include "networkrun.h"
7
8class NetworkNetNode;
9class NetworkEdit;
10class SystemFile;
11
12class ANetwork : public ANetNodeInstance{
13
14public :
15
16 ANetwork( NetworkNetNode * PNN );
17
18 QWidget * edit( QWidget * parent );
19 QString acceptable( void );
20 void commit( void );
21
22 RuntimeInfo * runtime( void )
23 { if( RT == 0 )
24 RT = new NetworkRun( this, Data );
25 return RT;
26 }
27
28 virtual void * data( void )
29 { return (void *)&Data; }
30
31 bool generateDataForCommonFile( SystemFile & S, long DevNr );
32
33protected :
34
35 virtual void setSpecificAttribute( QString & Attr, QString & Value );
36 virtual void saveSpecificAttribute( QTextStream & TS );
37
38private :
39
40 NetworkEdit * GUI;
41 NetworkData_t Data;
42 NetworkRun * RT;
43};
44
45#endif
diff --git a/noncore/settings/networksettings2/network/networkdata.h b/noncore/settings/networksettings2/network/networkdata.h
new file mode 100644
index 0000000..2c5da37
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkdata.h
@@ -0,0 +1,22 @@
1#ifndef NETWORK_DATA_H
2#define NETWORK_DATA_H
3
4#include <qstring.h>
5#include <qstringlist.h>
6typedef struct NetworkData {
7 bool UseDHCP;
8 QString Hostname;
9 bool SendHostname;
10 QString IPAddress;
11 QString NetMask;
12 QString Gateway;
13 QString Broadcast;
14 QString DNS1;
15 QString DNS2;
16 QStringList PreUp_SL;
17 QStringList PostUp_SL;
18 QStringList PreDown_SL;
19 QStringList PostDown_SL;
20} NetworkData_t;
21
22#endif
diff --git a/noncore/settings/networksettings2/network/networkedit.cpp b/noncore/settings/networksettings2/network/networkedit.cpp
new file mode 100644
index 0000000..b17d745
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkedit.cpp
@@ -0,0 +1,160 @@
1#include <qtoolbutton.h>
2#include <qcheckbox.h>
3#include <qlineedit.h>
4#include <qlistbox.h>
5#include <GUIUtils.h>
6#include <resources.h>
7#include "networkedit.h"
8
9NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){
10
11 AddPreDown_TB->setPixmap( NSResources->getPixmap( "add" ) );
12 AddPreUp_TB->setPixmap( NSResources->getPixmap( "add" ) );
13 AddPostDown_TB->setPixmap( NSResources->getPixmap( "add" ) );
14 AddPostUp_TB->setPixmap( NSResources->getPixmap( "add" ) );
15
16 DeletePreDown_TB->setPixmap( NSResources->getPixmap( "remove" ) );
17 DeletePreUp_TB->setPixmap( NSResources->getPixmap( "remove" ) );
18 DeletePostDown_TB->setPixmap( NSResources->getPixmap( "remove" ) );
19 DeletePostUp_TB->setPixmap( NSResources->getPixmap( "remove" ) );
20
21 UpPreDown_TB->setPixmap( NSResources->getPixmap( "up" ) );
22 UpPreUp_TB->setPixmap( NSResources->getPixmap( "up" ) );
23 UpPostDown_TB->setPixmap( NSResources->getPixmap( "up" ) );
24 UpPostUp_TB->setPixmap( NSResources->getPixmap( "up" ) );
25
26 DownPreDown_TB->setPixmap( NSResources->getPixmap( "down" ) );
27 DownPreUp_TB->setPixmap( NSResources->getPixmap( "down" ) );
28 DownPostDown_TB->setPixmap( NSResources->getPixmap( "down" ) );
29 DownPostUp_TB->setPixmap( NSResources->getPixmap( "down" ) );
30
31}
32
33QString NetworkEdit::acceptable( void ) {
34 if( DHCP_CB->isChecked() ) {
35 if( SendHostname_CB->isChecked() )
36 if( Hostname_LE->text().isEmpty() )
37 return tr("Hostname needed");
38 return QString();
39 }
40
41 if( IPAddress_LE->text().isEmpty() )
42 return tr("IPAddress needed");
43 if( Broadcast_LE->text().isEmpty() )
44 return tr("Broadcast needed");
45 if( SubnetMask_LE->text().isEmpty() )
46 return tr("Subnet mask needed");
47
48 // valid IP ?
49 if( ! validIP( IPAddress_LE->text() ) )
50 return tr("IPAddress not valid");
51 if( ! validIP( SubnetMask_LE->text() ) )
52 return tr("Subnet mask not valid");
53 if( ! validIP( Broadcast_LE->text() ) )
54 return tr("Broadcast address not valid");
55 if( Gateway_LE->text().isEmpty() &&
56 ! validIP( Gateway_LE->text() ) )
57 return tr("Gateway address not valid");
58 if( DNS1_LE->text().isEmpty() &&
59 ! validIP( DNS1_LE->text() ) )
60 return tr("DNS1 address not valid");
61 if( DNS2_LE->text().isEmpty() &&
62 ! validIP( DNS2_LE->text() ) )
63 return tr("DNS2 address not valid");
64 return QString();
65}
66
67bool NetworkEdit::commit( NetworkData_t & Data ) {
68 bool SM = 0;
69 CBM( Data.UseDHCP, DHCP_CB, SM );
70 TXTM( Data.IPAddress, IPAddress_LE, SM );
71 CBM( Data.SendHostname, SendHostname_CB, SM );
72 TXTM( Data.Hostname, Hostname_LE, SM );
73 TXTM( Data.Gateway, Gateway_LE, SM );
74 TXTM( Data.Broadcast, Broadcast_LE, SM );
75 TXTM( Data.NetMask, SubnetMask_LE, SM );
76 TXTM( Data.DNS1, DNS1_LE, SM );
77 TXTM( Data.DNS2, DNS2_LE, SM );
78
79 SM |= updateList( Data.PreUp_SL, PreUp_LB );
80 SM |= updateList( Data.PostUp_SL, PostUp_LB );
81 SM |= updateList( Data.PreDown_SL, PreDown_LB );
82 SM |= updateList( Data.PostDown_SL, PostDown_LB );
83
84 return SM;
85}
86
87void NetworkEdit::showData( NetworkData_t & Data ) {
88 DHCP_CB->setChecked( Data.UseDHCP );
89 SendHostname_CB->setChecked( Data.SendHostname );
90 Hostname_LE->setText( Data.Hostname );
91 IPAddress_LE->setText( Data.IPAddress );
92 Gateway_LE->setText( Data.Gateway );
93 SubnetMask_LE->setText( Data.NetMask );
94 Broadcast_LE->setText( Data.Broadcast );
95 DNS1_LE->setText( Data.DNS1 );
96 DNS2_LE->setText( Data.DNS2 );
97
98 populateList( Data.PreUp_SL, PreUp_LB );
99 populateList( Data.PostUp_SL, PostUp_LB );
100 populateList( Data.PreDown_SL, PreDown_LB );
101 populateList( Data.PostDown_SL, PostDown_LB );
102}
103
104bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) {
105 bool Changed;
106 QStringList NewSL;
107
108 // collect new list
109 for( unsigned int i = 0; i < LB->count() ; i ++ ) {
110 NewSL.append( LB->text(i) );
111 }
112
113 // check if at least ONE item in new list is NEW
114 Changed = 0;
115 for ( QStringList::Iterator it = NewSL.begin();
116 it != NewSL.end();
117 ++it ) {
118 if( SL.findIndex( (*it) ) < 0 ) {
119 // new or modified item
120 Changed = 1;
121 SL = NewSL;
122 break;
123 }
124 }
125 return Changed;
126}
127
128void NetworkEdit::populateList( QStringList & SL, QListBox * LB ) {
129 LB->clear();
130 for ( QStringList::Iterator it = SL.begin();
131 it != SL.end();
132 ++it ) {
133 LB->insertItem( (*it) );
134 }
135}
136
137void NetworkEdit::SLOT_NetmaskModified( const QString & ) {
138 QString IP, SN;
139 IP = IPAddress_LE->text();
140 SN = SubnetMask_LE->text();
141 if( IP.isEmpty() || SN.isEmpty() )
142 return;
143
144 if( ! validIP(IP) || ! validIP( SN ) )
145 return;
146
147 // if all ones
148 // broadcast = (IPAddress | ~netmask )
149 { QString NW;
150 QStringList ipal = QStringList::split( '.', IP );
151 QStringList nmal = QStringList::split( '.', SN );
152
153 NW = QString( "%1.%2.%3.%4" ).
154 arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ).
155 arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ).
156 arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ).
157 arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) );
158 Broadcast_LE->setText( NW );
159 }
160}
diff --git a/noncore/settings/networksettings2/network/networkedit.h b/noncore/settings/networksettings2/network/networkedit.h
new file mode 100644
index 0000000..9ed4e84
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkedit.h
@@ -0,0 +1,21 @@
1#include "networkdata.h"
2#include "networkGUI.h"
3
4class NetworkEdit : public NetworkGUI {
5
6public :
7
8 NetworkEdit( QWidget * parent );
9 QString acceptable( void );
10 bool commit( NetworkData_t & Data );
11 void showData( NetworkData_t & Data );
12
13public slots :
14
15 void SLOT_NetmaskModified( const QString & S );
16
17private :
18
19 bool updateList( QStringList &SL, QListBox * LB );
20 void populateList( QStringList &SL, QListBox * LB );
21};
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
new file mode 100644
index 0000000..e732bfa
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -0,0 +1,63 @@
1#include <system.h>
2#include <asdevice.h>
3#include "networkrun.h"
4
5void NetworkRun::detectState( NodeCollection * NC ) {
6 RuntimeInfo * RI = netNode()->nextNode()->runtime();
7 AsDevice * Next = RI->asDevice();
8 InterfaceInfo * II = Next->assignedInterface();
9
10 if( II ) {
11 // device has assigned interface
12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) );
13 }
14
15 // has no interface -> delegate
16 RI->detectState( NC );
17}
18
19bool NetworkRun::setState( NodeCollection * NC, Action_t A ) {
20 // we handle UP and DOWN
21 RuntimeInfo * RI = netNode()->nextNode()->runtime();
22 AsDevice * Next = RI->asDevice();
23 InterfaceInfo * II = Next->assignedInterface();
24
25 if( A == Up ) {
26 // we can bring UP if lower level is available
27 if( NC->currentState() == Available ) {
28 QString S;
29 S.sprintf( "ifup %s=manual", II->Name.latin1() );
30 NSResources->system().execute( S );
31 NC->setCurrentState( IsUp );
32 }
33 return 1;
34 } else if( A == Down ) {
35 if( NC->currentState() == IsUp ) {
36 QString S;
37 S.sprintf( "ifdown %s", II->Name.latin1() );
38 NSResources->system().execute( S );
39 NC->setCurrentState( Available );
40 }
41 return 1;
42 }
43 // delegate
44 return RI->setState( NC, A );
45}
46
47bool NetworkRun::canSetState( State_t Curr, Action_t A ) {
48 // we handle UP and DOWN
49 RuntimeInfo * RI = netNode()->nextNode()->runtime();
50
51 if( A == Up ) {
52 return ( Curr == Available );
53 } else if( A == Down ) {
54 return ( Curr == IsUp );
55 }
56 // delegate
57 return RI->canSetState( Curr, A );
58}
59
60bool NetworkRun::handlesInterface( const QString & S ) {
61 // donno -> pass deeper
62 return netNode()->nextNode()->runtime()->handlesInterface(S);
63}
diff --git a/noncore/settings/networksettings2/network/networkrun.h b/noncore/settings/networksettings2/network/networkrun.h
new file mode 100644
index 0000000..f3d840e
--- a/dev/null
+++ b/noncore/settings/networksettings2/network/networkrun.h
@@ -0,0 +1,20 @@
1#include <asconnection.h>
2#include "networkdata.h"
3
4class NetworkRun : public AsConnection {
5
6public :
7
8 NetworkRun( ANetNodeInstance * NNI,
9 NetworkData & Data ) : AsConnection( NNI )
10 { }
11
12protected :
13
14 void detectState( NodeCollection * );
15 bool setState( NodeCollection * ,Action_t A );
16 bool canSetState( State_t , Action_t A );
17
18 bool handlesInterface( const QString & I );
19
20};