Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (show whitespace changes)
20 files changed, 2101 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui new file mode 100644 index 0000000..826843a --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui | |||
@@ -0,0 +1,432 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PPPAuthGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>PPPAuthGUI</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>249</width> | ||
15 | <height>209</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>PPPAuth</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>QButtonGroup</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>ButtonGroup1</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>frameShape</name> | ||
45 | <enum>NoFrame</enum> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>title</name> | ||
49 | <string></string> | ||
50 | </property> | ||
51 | <property> | ||
52 | <name>layoutMargin</name> | ||
53 | </property> | ||
54 | <property> | ||
55 | <name>layoutSpacing</name> | ||
56 | </property> | ||
57 | <vbox> | ||
58 | <property stdset="1"> | ||
59 | <name>margin</name> | ||
60 | <number>0</number> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>spacing</name> | ||
64 | <number>0</number> | ||
65 | </property> | ||
66 | <widget> | ||
67 | <class>QRadioButton</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>Login_RB</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>text</name> | ||
74 | <string>Login</string> | ||
75 | </property> | ||
76 | <property stdset="1"> | ||
77 | <name>checked</name> | ||
78 | <bool>true</bool> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <widget> | ||
82 | <class>QLayoutWidget</class> | ||
83 | <property stdset="1"> | ||
84 | <name>name</name> | ||
85 | <cstring>Layout3</cstring> | ||
86 | </property> | ||
87 | <hbox> | ||
88 | <property stdset="1"> | ||
89 | <name>margin</name> | ||
90 | <number>0</number> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>spacing</name> | ||
94 | <number>6</number> | ||
95 | </property> | ||
96 | <spacer> | ||
97 | <property> | ||
98 | <name>name</name> | ||
99 | <cstring>Spacer3</cstring> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>orientation</name> | ||
103 | <enum>Horizontal</enum> | ||
104 | </property> | ||
105 | <property stdset="1"> | ||
106 | <name>sizeType</name> | ||
107 | <enum>Fixed</enum> | ||
108 | </property> | ||
109 | <property> | ||
110 | <name>sizeHint</name> | ||
111 | <size> | ||
112 | <width>16</width> | ||
113 | <height>20</height> | ||
114 | </size> | ||
115 | </property> | ||
116 | </spacer> | ||
117 | <widget> | ||
118 | <class>QGroupBox</class> | ||
119 | <property stdset="1"> | ||
120 | <name>name</name> | ||
121 | <cstring>GroupBox1</cstring> | ||
122 | </property> | ||
123 | <property stdset="1"> | ||
124 | <name>sizePolicy</name> | ||
125 | <sizepolicy> | ||
126 | <hsizetype>7</hsizetype> | ||
127 | <vsizetype>5</vsizetype> | ||
128 | </sizepolicy> | ||
129 | </property> | ||
130 | <property stdset="1"> | ||
131 | <name>frameShape</name> | ||
132 | <enum>NoFrame</enum> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
135 | <name>title</name> | ||
136 | <string></string> | ||
137 | </property> | ||
138 | <property> | ||
139 | <name>layoutMargin</name> | ||
140 | </property> | ||
141 | <property> | ||
142 | <name>layoutSpacing</name> | ||
143 | </property> | ||
144 | <grid> | ||
145 | <property stdset="1"> | ||
146 | <name>margin</name> | ||
147 | <number>2</number> | ||
148 | </property> | ||
149 | <property stdset="1"> | ||
150 | <name>spacing</name> | ||
151 | <number>1</number> | ||
152 | </property> | ||
153 | <widget row="0" column="0" > | ||
154 | <class>QLineEdit</class> | ||
155 | <property stdset="1"> | ||
156 | <name>name</name> | ||
157 | <cstring>LoginExpect_LE</cstring> | ||
158 | </property> | ||
159 | <property stdset="1"> | ||
160 | <name>text</name> | ||
161 | <string>ogin:</string> | ||
162 | </property> | ||
163 | </widget> | ||
164 | <widget row="0" column="1" > | ||
165 | <class>QLineEdit</class> | ||
166 | <property stdset="1"> | ||
167 | <name>name</name> | ||
168 | <cstring>LoginSend_LE</cstring> | ||
169 | </property> | ||
170 | </widget> | ||
171 | <widget row="1" column="0" > | ||
172 | <class>QLineEdit</class> | ||
173 | <property stdset="1"> | ||
174 | <name>name</name> | ||
175 | <cstring>PasswordExpect_LE</cstring> | ||
176 | </property> | ||
177 | <property stdset="1"> | ||
178 | <name>text</name> | ||
179 | <string>assword:</string> | ||
180 | </property> | ||
181 | </widget> | ||
182 | <widget row="1" column="1" > | ||
183 | <class>QLineEdit</class> | ||
184 | <property stdset="1"> | ||
185 | <name>name</name> | ||
186 | <cstring>PasswordSend_LE</cstring> | ||
187 | </property> | ||
188 | </widget> | ||
189 | </grid> | ||
190 | </widget> | ||
191 | </hbox> | ||
192 | </widget> | ||
193 | <widget> | ||
194 | <class>QRadioButton</class> | ||
195 | <property stdset="1"> | ||
196 | <name>name</name> | ||
197 | <cstring>PapChap_RB</cstring> | ||
198 | </property> | ||
199 | <property stdset="1"> | ||
200 | <name>text</name> | ||
201 | <string>Pap/Chap/EAP</string> | ||
202 | </property> | ||
203 | </widget> | ||
204 | <widget> | ||
205 | <class>QLayoutWidget</class> | ||
206 | <property stdset="1"> | ||
207 | <name>name</name> | ||
208 | <cstring>Layout5</cstring> | ||
209 | </property> | ||
210 | <hbox> | ||
211 | <property stdset="1"> | ||
212 | <name>margin</name> | ||
213 | <number>0</number> | ||
214 | </property> | ||
215 | <property stdset="1"> | ||
216 | <name>spacing</name> | ||
217 | <number>6</number> | ||
218 | </property> | ||
219 | <spacer> | ||
220 | <property> | ||
221 | <name>name</name> | ||
222 | <cstring>Spacer3_2</cstring> | ||
223 | </property> | ||
224 | <property stdset="1"> | ||
225 | <name>orientation</name> | ||
226 | <enum>Horizontal</enum> | ||
227 | </property> | ||
228 | <property stdset="1"> | ||
229 | <name>sizeType</name> | ||
230 | <enum>Fixed</enum> | ||
231 | </property> | ||
232 | <property> | ||
233 | <name>sizeHint</name> | ||
234 | <size> | ||
235 | <width>16</width> | ||
236 | <height>20</height> | ||
237 | </size> | ||
238 | </property> | ||
239 | </spacer> | ||
240 | <widget> | ||
241 | <class>QGroupBox</class> | ||
242 | <property stdset="1"> | ||
243 | <name>name</name> | ||
244 | <cstring>GroupBox3</cstring> | ||
245 | </property> | ||
246 | <property stdset="1"> | ||
247 | <name>enabled</name> | ||
248 | <bool>false</bool> | ||
249 | </property> | ||
250 | <property stdset="1"> | ||
251 | <name>sizePolicy</name> | ||
252 | <sizepolicy> | ||
253 | <hsizetype>7</hsizetype> | ||
254 | <vsizetype>5</vsizetype> | ||
255 | </sizepolicy> | ||
256 | </property> | ||
257 | <property stdset="1"> | ||
258 | <name>frameShape</name> | ||
259 | <enum>NoFrame</enum> | ||
260 | </property> | ||
261 | <property stdset="1"> | ||
262 | <name>title</name> | ||
263 | <string></string> | ||
264 | </property> | ||
265 | <property> | ||
266 | <name>layoutMargin</name> | ||
267 | </property> | ||
268 | <property> | ||
269 | <name>layoutSpacing</name> | ||
270 | </property> | ||
271 | <grid> | ||
272 | <property stdset="1"> | ||
273 | <name>margin</name> | ||
274 | <number>2</number> | ||
275 | </property> | ||
276 | <property stdset="1"> | ||
277 | <name>spacing</name> | ||
278 | <number>1</number> | ||
279 | </property> | ||
280 | <widget row="2" column="0" > | ||
281 | <class>QLabel</class> | ||
282 | <property stdset="1"> | ||
283 | <name>name</name> | ||
284 | <cstring>TextLabel1_2</cstring> | ||
285 | </property> | ||
286 | <property stdset="1"> | ||
287 | <name>text</name> | ||
288 | <string>Server</string> | ||
289 | </property> | ||
290 | </widget> | ||
291 | <widget row="3" column="0" > | ||
292 | <class>QLabel</class> | ||
293 | <property stdset="1"> | ||
294 | <name>name</name> | ||
295 | <cstring>TextLabel1_3</cstring> | ||
296 | </property> | ||
297 | <property stdset="1"> | ||
298 | <name>text</name> | ||
299 | <string>Secret</string> | ||
300 | </property> | ||
301 | </widget> | ||
302 | <widget row="0" column="1" > | ||
303 | <class>QComboBox</class> | ||
304 | <item> | ||
305 | <property> | ||
306 | <name>text</name> | ||
307 | <string>PAP</string> | ||
308 | </property> | ||
309 | </item> | ||
310 | <item> | ||
311 | <property> | ||
312 | <name>text</name> | ||
313 | <string>CHAP</string> | ||
314 | </property> | ||
315 | </item> | ||
316 | <item> | ||
317 | <property> | ||
318 | <name>text</name> | ||
319 | <string>EAP</string> | ||
320 | </property> | ||
321 | </item> | ||
322 | <property stdset="1"> | ||
323 | <name>name</name> | ||
324 | <cstring>AuthMethod_CB</cstring> | ||
325 | </property> | ||
326 | </widget> | ||
327 | <widget row="1" column="0" > | ||
328 | <class>QLabel</class> | ||
329 | <property stdset="1"> | ||
330 | <name>name</name> | ||
331 | <cstring>TextLabel1</cstring> | ||
332 | </property> | ||
333 | <property stdset="1"> | ||
334 | <name>text</name> | ||
335 | <string>Client</string> | ||
336 | </property> | ||
337 | </widget> | ||
338 | <widget row="0" column="0" > | ||
339 | <class>QLabel</class> | ||
340 | <property stdset="1"> | ||
341 | <name>name</name> | ||
342 | <cstring>TextLabel1_4</cstring> | ||
343 | </property> | ||
344 | <property stdset="1"> | ||
345 | <name>text</name> | ||
346 | <string>Method</string> | ||
347 | </property> | ||
348 | </widget> | ||
349 | <widget row="1" column="1" rowspan="1" colspan="2" > | ||
350 | <class>QLineEdit</class> | ||
351 | <property stdset="1"> | ||
352 | <name>name</name> | ||
353 | <cstring>Client_LE</cstring> | ||
354 | </property> | ||
355 | <property stdset="1"> | ||
356 | <name>text</name> | ||
357 | <string>*</string> | ||
358 | </property> | ||
359 | </widget> | ||
360 | <widget row="2" column="1" rowspan="1" colspan="2" > | ||
361 | <class>QLineEdit</class> | ||
362 | <property stdset="1"> | ||
363 | <name>name</name> | ||
364 | <cstring>Server_LE</cstring> | ||
365 | </property> | ||
366 | <property stdset="1"> | ||
367 | <name>text</name> | ||
368 | <string>*</string> | ||
369 | </property> | ||
370 | </widget> | ||
371 | <widget row="3" column="1" rowspan="1" colspan="2" > | ||
372 | <class>QLineEdit</class> | ||
373 | <property stdset="1"> | ||
374 | <name>name</name> | ||
375 | <cstring>Secret_LE</cstring> | ||
376 | </property> | ||
377 | </widget> | ||
378 | <spacer row="0" column="2" > | ||
379 | <property> | ||
380 | <name>name</name> | ||
381 | <cstring>Spacer7</cstring> | ||
382 | </property> | ||
383 | <property stdset="1"> | ||
384 | <name>orientation</name> | ||
385 | <enum>Horizontal</enum> | ||
386 | </property> | ||
387 | <property stdset="1"> | ||
388 | <name>sizeType</name> | ||
389 | <enum>Expanding</enum> | ||
390 | </property> | ||
391 | <property> | ||
392 | <name>sizeHint</name> | ||
393 | <size> | ||
394 | <width>20</width> | ||
395 | <height>20</height> | ||
396 | </size> | ||
397 | </property> | ||
398 | </spacer> | ||
399 | </grid> | ||
400 | </widget> | ||
401 | </hbox> | ||
402 | </widget> | ||
403 | <widget> | ||
404 | <class>QRadioButton</class> | ||
405 | <property stdset="1"> | ||
406 | <name>name</name> | ||
407 | <cstring>Terminal_RB</cstring> | ||
408 | </property> | ||
409 | <property stdset="1"> | ||
410 | <name>text</name> | ||
411 | <string>Terminal</string> | ||
412 | </property> | ||
413 | </widget> | ||
414 | </vbox> | ||
415 | </widget> | ||
416 | </vbox> | ||
417 | </widget> | ||
418 | <connections> | ||
419 | <connection> | ||
420 | <sender>PapChap_RB</sender> | ||
421 | <signal>toggled(bool)</signal> | ||
422 | <receiver>GroupBox3</receiver> | ||
423 | <slot>setEnabled(bool)</slot> | ||
424 | </connection> | ||
425 | <connection> | ||
426 | <sender>Login_RB</sender> | ||
427 | <signal>toggled(bool)</signal> | ||
428 | <receiver>GroupBox1</receiver> | ||
429 | <slot>setEnabled(bool)</slot> | ||
430 | </connection> | ||
431 | </connections> | ||
432 | </UI> | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp new file mode 100644 index 0000000..f305cc4 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <qcombobox.h> | ||
3 | #include <qmessagebox.h> | ||
4 | #include <qradiobutton.h> | ||
5 | #include <qlineedit.h> | ||
6 | #include <GUIUtils.h> | ||
7 | #include "PPPAuthedit.h" | ||
8 | |||
9 | PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){ | ||
10 | } | ||
11 | |||
12 | QString PPPAuthEdit::acceptable( void ) { | ||
13 | if( Login_RB->isChecked() ) { | ||
14 | if( LoginSend_LE->text().isEmpty() ) | ||
15 | return tr("Login send missing"); | ||
16 | if( LoginExpect_LE->text().isEmpty() ) | ||
17 | return tr("Login expect missing"); | ||
18 | if( PasswordSend_LE->text().isEmpty() ) | ||
19 | return tr("Password send missing"); | ||
20 | if( PasswordExpect_LE->text().isEmpty() ) | ||
21 | return tr("Password expect missing"); | ||
22 | } else if( PapChap_RB->isChecked() ) { | ||
23 | if( Client_LE->text().isEmpty() ) | ||
24 | return tr("Pap/Chap/EAP client id missing"); | ||
25 | if( Server_LE->text().isEmpty() ) | ||
26 | return tr("Pap/Chap/EAP server id missing"); | ||
27 | if( Secret_LE->text().isEmpty() ) | ||
28 | return tr("Pap/Chap/EAP secret id missing"); | ||
29 | } | ||
30 | return QString(); | ||
31 | } | ||
32 | |||
33 | bool PPPAuthEdit::commit( PPPData_t & D ) { | ||
34 | bool SM = 0; | ||
35 | |||
36 | if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || | ||
37 | ( D.Auth.Mode == 1 && ! PapChap_RB->isChecked() ) || | ||
38 | ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { | ||
39 | // mode modifed | ||
40 | SM = 1; | ||
41 | D.Auth.Mode = ( Login_RB->isChecked() ) ? | ||
42 | 0 : | ||
43 | ( ( PapChap_RB->isChecked() ) ? | ||
44 | 1 : 2 ); | ||
45 | } | ||
46 | |||
47 | if( Login_RB->isChecked() ) { | ||
48 | TXTM( D.Auth.Login.Expect, LoginExpect_LE, SM ); | ||
49 | TXTM( D.Auth.Login.Send, LoginSend_LE, SM ); | ||
50 | TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM ); | ||
51 | TXTM( D.Auth.Password.Send, PasswordSend_LE, SM ); | ||
52 | } else if( PapChap_RB->isChecked() ) { | ||
53 | TXTM( D.Auth.Client, Client_LE, SM ); | ||
54 | TXTM( D.Auth.Server, Server_LE, SM ); | ||
55 | TXTM( D.Auth.Secret, Secret_LE, SM ); | ||
56 | CIM( D.Auth.PCEMode, AuthMethod_CB, SM ); | ||
57 | } | ||
58 | return SM; | ||
59 | } | ||
60 | |||
61 | void PPPAuthEdit::showData( PPPData_t & D ) { | ||
62 | |||
63 | switch( D.Auth.Mode ) { | ||
64 | case 0 : | ||
65 | Login_RB->isChecked(); | ||
66 | break; | ||
67 | case 1 : | ||
68 | PapChap_RB->isChecked(); | ||
69 | break; | ||
70 | case 2 : | ||
71 | Terminal_RB->isChecked(); | ||
72 | break; | ||
73 | } | ||
74 | |||
75 | LoginExpect_LE->setText( D.Auth.Login.Expect ); | ||
76 | PasswordExpect_LE->setText( D.Auth.Password.Expect ); | ||
77 | LoginSend_LE->setText( D.Auth.Login.Send ); | ||
78 | PasswordSend_LE->setText( D.Auth.Password.Send ); | ||
79 | |||
80 | Client_LE->setText( D.Auth.Client ); | ||
81 | Server_LE->setText( D.Auth.Server ); | ||
82 | Secret_LE->setText( D.Auth.Secret ); | ||
83 | |||
84 | AuthMethod_CB->setCurrentItem( D.Auth.PCEMode ); | ||
85 | } | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h new file mode 100644 index 0000000..cbd540e --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #include "pppdata.h" | ||
2 | #include "PPPAuthGUI.h" | ||
3 | |||
4 | class PPPAuthEdit : public PPPAuthGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | PPPAuthEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( PPPData_t & Data ); | ||
11 | void showData( PPPData_t & Data ); | ||
12 | |||
13 | private : | ||
14 | |||
15 | }; | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSGUI.ui b/noncore/settings/networksettings2/ppp/PPPDNSGUI.ui new file mode 100644 index 0000000..0ed136f --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPDNSGUI.ui | |||
@@ -0,0 +1,340 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PPPDNSGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>PPPDNSGUI</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>228</width> | ||
15 | <height>169</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>PPPDNS</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>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QButtonGroup</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>ButtonGroup18</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>frameShape</name> | ||
45 | <enum>NoFrame</enum> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>title</name> | ||
49 | <string></string> | ||
50 | </property> | ||
51 | <property> | ||
52 | <name>layoutMargin</name> | ||
53 | </property> | ||
54 | <property> | ||
55 | <name>layoutSpacing</name> | ||
56 | </property> | ||
57 | <vbox> | ||
58 | <property stdset="1"> | ||
59 | <name>margin</name> | ||
60 | <number>2</number> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>spacing</name> | ||
64 | <number>2</number> | ||
65 | </property> | ||
66 | <widget> | ||
67 | <class>QRadioButton</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>DNSServerAssigned_RB</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>text</name> | ||
74 | <string>Server assigned</string> | ||
75 | </property> | ||
76 | <property stdset="1"> | ||
77 | <name>checked</name> | ||
78 | <bool>true</bool> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <widget> | ||
82 | <class>QRadioButton</class> | ||
83 | <property stdset="1"> | ||
84 | <name>name</name> | ||
85 | <cstring>DNSFixed_RB</cstring> | ||
86 | </property> | ||
87 | <property stdset="1"> | ||
88 | <name>text</name> | ||
89 | <string>Fixed</string> | ||
90 | </property> | ||
91 | </widget> | ||
92 | <widget> | ||
93 | <class>QLayoutWidget</class> | ||
94 | <property stdset="1"> | ||
95 | <name>name</name> | ||
96 | <cstring>Layout13</cstring> | ||
97 | </property> | ||
98 | <hbox> | ||
99 | <property stdset="1"> | ||
100 | <name>margin</name> | ||
101 | <number>0</number> | ||
102 | </property> | ||
103 | <property stdset="1"> | ||
104 | <name>spacing</name> | ||
105 | <number>6</number> | ||
106 | </property> | ||
107 | <spacer> | ||
108 | <property> | ||
109 | <name>name</name> | ||
110 | <cstring>Spacer29</cstring> | ||
111 | </property> | ||
112 | <property stdset="1"> | ||
113 | <name>orientation</name> | ||
114 | <enum>Horizontal</enum> | ||
115 | </property> | ||
116 | <property stdset="1"> | ||
117 | <name>sizeType</name> | ||
118 | <enum>Fixed</enum> | ||
119 | </property> | ||
120 | <property> | ||
121 | <name>sizeHint</name> | ||
122 | <size> | ||
123 | <width>20</width> | ||
124 | <height>20</height> | ||
125 | </size> | ||
126 | </property> | ||
127 | </spacer> | ||
128 | <widget> | ||
129 | <class>QFrame</class> | ||
130 | <property stdset="1"> | ||
131 | <name>name</name> | ||
132 | <cstring>Frame21</cstring> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
135 | <name>enabled</name> | ||
136 | <bool>false</bool> | ||
137 | </property> | ||
138 | <property stdset="1"> | ||
139 | <name>sizePolicy</name> | ||
140 | <sizepolicy> | ||
141 | <hsizetype>7</hsizetype> | ||
142 | <vsizetype>5</vsizetype> | ||
143 | </sizepolicy> | ||
144 | </property> | ||
145 | <property stdset="1"> | ||
146 | <name>frameShape</name> | ||
147 | <enum>NoFrame</enum> | ||
148 | </property> | ||
149 | <property stdset="1"> | ||
150 | <name>frameShadow</name> | ||
151 | <enum>Raised</enum> | ||
152 | </property> | ||
153 | <property> | ||
154 | <name>layoutMargin</name> | ||
155 | </property> | ||
156 | <property> | ||
157 | <name>layoutSpacing</name> | ||
158 | </property> | ||
159 | <grid> | ||
160 | <property stdset="1"> | ||
161 | <name>margin</name> | ||
162 | <number>2</number> | ||
163 | </property> | ||
164 | <property stdset="1"> | ||
165 | <name>spacing</name> | ||
166 | <number>2</number> | ||
167 | </property> | ||
168 | <widget row="0" column="0" > | ||
169 | <class>QLabel</class> | ||
170 | <property stdset="1"> | ||
171 | <name>name</name> | ||
172 | <cstring>TextLabel5</cstring> | ||
173 | </property> | ||
174 | <property stdset="1"> | ||
175 | <name>text</name> | ||
176 | <string>DomainName</string> | ||
177 | </property> | ||
178 | </widget> | ||
179 | <widget row="1" column="0" > | ||
180 | <class>QLabel</class> | ||
181 | <property stdset="1"> | ||
182 | <name>name</name> | ||
183 | <cstring>TextLabel6</cstring> | ||
184 | </property> | ||
185 | <property stdset="1"> | ||
186 | <name>text</name> | ||
187 | <string>Address</string> | ||
188 | </property> | ||
189 | </widget> | ||
190 | <widget row="0" column="1" > | ||
191 | <class>QLineEdit</class> | ||
192 | <property stdset="1"> | ||
193 | <name>name</name> | ||
194 | <cstring>DomainName_LE</cstring> | ||
195 | </property> | ||
196 | </widget> | ||
197 | <widget row="1" column="1" > | ||
198 | <class>QLineEdit</class> | ||
199 | <property stdset="1"> | ||
200 | <name>name</name> | ||
201 | <cstring>ServerAddress_LE</cstring> | ||
202 | </property> | ||
203 | </widget> | ||
204 | <widget row="3" column="1" > | ||
205 | <class>QListBox</class> | ||
206 | <property stdset="1"> | ||
207 | <name>name</name> | ||
208 | <cstring>Servers_LB</cstring> | ||
209 | </property> | ||
210 | </widget> | ||
211 | <widget row="2" column="1" > | ||
212 | <class>QFrame</class> | ||
213 | <property stdset="1"> | ||
214 | <name>name</name> | ||
215 | <cstring>Frame22</cstring> | ||
216 | </property> | ||
217 | <property stdset="1"> | ||
218 | <name>sizePolicy</name> | ||
219 | <sizepolicy> | ||
220 | <hsizetype>7</hsizetype> | ||
221 | <vsizetype>0</vsizetype> | ||
222 | </sizepolicy> | ||
223 | </property> | ||
224 | <property stdset="1"> | ||
225 | <name>frameShape</name> | ||
226 | <enum>NoFrame</enum> | ||
227 | </property> | ||
228 | <property stdset="1"> | ||
229 | <name>frameShadow</name> | ||
230 | <enum>Raised</enum> | ||
231 | </property> | ||
232 | <property> | ||
233 | <name>layoutMargin</name> | ||
234 | </property> | ||
235 | <property> | ||
236 | <name>layoutSpacing</name> | ||
237 | </property> | ||
238 | <hbox> | ||
239 | <property stdset="1"> | ||
240 | <name>margin</name> | ||
241 | <number>0</number> | ||
242 | </property> | ||
243 | <property stdset="1"> | ||
244 | <name>spacing</name> | ||
245 | <number>0</number> | ||
246 | </property> | ||
247 | <widget> | ||
248 | <class>QToolButton</class> | ||
249 | <property stdset="1"> | ||
250 | <name>name</name> | ||
251 | <cstring>Add_TB</cstring> | ||
252 | </property> | ||
253 | <property stdset="1"> | ||
254 | <name>text</name> | ||
255 | <string>...</string> | ||
256 | </property> | ||
257 | </widget> | ||
258 | <spacer> | ||
259 | <property> | ||
260 | <name>name</name> | ||
261 | <cstring>Spacer2</cstring> | ||
262 | </property> | ||
263 | <property stdset="1"> | ||
264 | <name>orientation</name> | ||
265 | <enum>Horizontal</enum> | ||
266 | </property> | ||
267 | <property stdset="1"> | ||
268 | <name>sizeType</name> | ||
269 | <enum>Expanding</enum> | ||
270 | </property> | ||
271 | <property> | ||
272 | <name>sizeHint</name> | ||
273 | <size> | ||
274 | <width>20</width> | ||
275 | <height>20</height> | ||
276 | </size> | ||
277 | </property> | ||
278 | </spacer> | ||
279 | <widget> | ||
280 | <class>QToolButton</class> | ||
281 | <property stdset="1"> | ||
282 | <name>name</name> | ||
283 | <cstring>Remove_TB</cstring> | ||
284 | </property> | ||
285 | <property stdset="1"> | ||
286 | <name>text</name> | ||
287 | <string>...</string> | ||
288 | </property> | ||
289 | </widget> | ||
290 | </hbox> | ||
291 | </widget> | ||
292 | <widget row="3" column="0" > | ||
293 | <class>QLabel</class> | ||
294 | <property stdset="1"> | ||
295 | <name>name</name> | ||
296 | <cstring>TextLabel7</cstring> | ||
297 | </property> | ||
298 | <property stdset="1"> | ||
299 | <name>text</name> | ||
300 | <string>List</string> | ||
301 | </property> | ||
302 | <property stdset="1"> | ||
303 | <name>alignment</name> | ||
304 | <set>AlignTop|AlignLeft</set> | ||
305 | </property> | ||
306 | <property> | ||
307 | <name>vAlign</name> | ||
308 | </property> | ||
309 | </widget> | ||
310 | </grid> | ||
311 | </widget> | ||
312 | </hbox> | ||
313 | </widget> | ||
314 | </vbox> | ||
315 | </widget> | ||
316 | </vbox> | ||
317 | </widget> | ||
318 | <connections> | ||
319 | <connection> | ||
320 | <sender>DNSFixed_RB</sender> | ||
321 | <signal>toggled(bool)</signal> | ||
322 | <receiver>Frame21</receiver> | ||
323 | <slot>setEnabled(bool)</slot> | ||
324 | </connection> | ||
325 | <connection> | ||
326 | <sender>Add_TB</sender> | ||
327 | <signal>clicked()</signal> | ||
328 | <receiver>PPPDNSGUI</receiver> | ||
329 | <slot>SLOT_AddServer()</slot> | ||
330 | </connection> | ||
331 | <connection> | ||
332 | <sender>Remove_TB</sender> | ||
333 | <signal>clicked()</signal> | ||
334 | <receiver>PPPDNSGUI</receiver> | ||
335 | <slot>SLOT_RemoveServer()</slot> | ||
336 | </connection> | ||
337 | <slot access="public">SLOT_AddServer()</slot> | ||
338 | <slot access="public">SLOT_RemoveServer()</slot> | ||
339 | </connections> | ||
340 | </UI> | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp new file mode 100644 index 0000000..22f8e59 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.cpp | |||
@@ -0,0 +1,108 @@ | |||
1 | #include <qtoolbutton.h> | ||
2 | #include <qmessagebox.h> | ||
3 | #include <qlistbox.h> | ||
4 | #include <qlineedit.h> | ||
5 | #include <qradiobutton.h> | ||
6 | #include <resources.h> | ||
7 | #include <GUIUtils.h> | ||
8 | #include "PPPDNSedit.h" | ||
9 | |||
10 | PPPDNSEdit::PPPDNSEdit( QWidget * Parent ) : PPPDNSGUI( Parent ){ | ||
11 | |||
12 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | ||
13 | Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | ||
14 | } | ||
15 | |||
16 | QString PPPDNSEdit::acceptable( void ) { | ||
17 | if( DNSFixed_RB->isChecked() ) { | ||
18 | if( DomainName_LE->text().isEmpty() ) | ||
19 | tr("Domainname needed"); | ||
20 | if( Servers_LB->count() == 0 ) | ||
21 | tr("DNS Servers needed"); | ||
22 | } | ||
23 | return QString(); | ||
24 | } | ||
25 | |||
26 | bool PPPDNSEdit::commit( PPPData_t & D ) { | ||
27 | bool SM = 0; | ||
28 | |||
29 | CBM( D.DNS.ServerAssigned, DNSServerAssigned_RB, SM ); | ||
30 | TXTM( D.DNS.DomainName, DomainName_LE, SM ); | ||
31 | |||
32 | // new items in old ? | ||
33 | for ( unsigned i = 0; i < Servers_LB->count(); i++ ) { | ||
34 | QString S; | ||
35 | bool Found; | ||
36 | Found = 0; | ||
37 | S = Servers_LB->text(i); | ||
38 | for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) { | ||
39 | if( *(D.DNS.Servers[i]) == S ) { | ||
40 | // still in list | ||
41 | Found = 1; | ||
42 | break; | ||
43 | } | ||
44 | } | ||
45 | if( ! Found ) { | ||
46 | SM = 1; | ||
47 | D.DNS.Servers.resize( D.DNS.Servers.size()+1 ); | ||
48 | D.DNS.Servers[D.DNS.Servers.size()] = new QString( S ); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | // old in new ? | ||
53 | for ( unsigned j = 0; j < D.DNS.Servers.size(); j++ ) { | ||
54 | bool Found; | ||
55 | Found = 0; | ||
56 | for ( unsigned i = 0; i < Servers_LB->count(); i++ ) { | ||
57 | if( *(D.DNS.Servers[j]) == Servers_LB->text(i) ) { | ||
58 | // still in list | ||
59 | Found = 1; | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | if( ! Found ) { | ||
64 | // old obsolete | ||
65 | SM = 1; | ||
66 | delete D.DNS.Servers[j]; | ||
67 | for( unsigned i = j+1; i < D.DNS.Servers.size(); i ++ ) { | ||
68 | // compress array | ||
69 | D.DNS.Servers[i-1] = D.DNS.Servers[i]; | ||
70 | } | ||
71 | // shrink | ||
72 | D.DNS.Servers.resize( D.DNS.Servers.size()-1 ); | ||
73 | } | ||
74 | } | ||
75 | return SM; | ||
76 | } | ||
77 | |||
78 | void PPPDNSEdit::showData( PPPData_t & D) { | ||
79 | |||
80 | DNSServerAssigned_RB->setChecked( D.DNS.ServerAssigned ); | ||
81 | |||
82 | DomainName_LE->setText( D.DNS.DomainName ); | ||
83 | for( unsigned i = 0; i < D.DNS.Servers.size(); i ++ ) { | ||
84 | Servers_LB->insertItem( *(D.DNS.Servers[i]) ); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | void PPPDNSEdit::SLOT_AddServer( void ) { | ||
89 | if( ServerAddress_LE->text().isEmpty() ) | ||
90 | return; | ||
91 | |||
92 | Servers_LB->insertItem( ServerAddress_LE->text() ); | ||
93 | ServerAddress_LE->setText( "" ); | ||
94 | } | ||
95 | |||
96 | void PPPDNSEdit::SLOT_RemoveServer( void ) { | ||
97 | long i = Servers_LB->currentItem(); | ||
98 | if( i < 0 ) | ||
99 | return; | ||
100 | Servers_LB->removeItem( i ); | ||
101 | if( (unsigned) i >= Servers_LB->count() ) { | ||
102 | i --; | ||
103 | } | ||
104 | if( i >= 0 ) { | ||
105 | Servers_LB->setCurrentItem( i ); | ||
106 | } | ||
107 | |||
108 | } | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPDNSedit.h b/noncore/settings/networksettings2/ppp/PPPDNSedit.h new file mode 100644 index 0000000..43e0067 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPDNSedit.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #include "pppdata.h" | ||
2 | #include "PPPDNSGUI.h" | ||
3 | |||
4 | class PPPDNSEdit : public PPPDNSGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | PPPDNSEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( PPPData_t & Data ); | ||
11 | void showData( PPPData_t & Data ); | ||
12 | |||
13 | public slots : | ||
14 | |||
15 | void SLOT_AddServer( void ); | ||
16 | void SLOT_RemoveServer( void ); | ||
17 | |||
18 | private : | ||
19 | |||
20 | }; | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPGUI.ui b/noncore/settings/networksettings2/ppp/PPPGUI.ui new file mode 100644 index 0000000..777e4a9 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPGUI.ui | |||
@@ -0,0 +1,103 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PPPGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>PPPGUI</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>124</width> | ||
15 | <height>29</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>PPP</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>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QComboBox</class> | ||
39 | <item> | ||
40 | <property> | ||
41 | <name>text</name> | ||
42 | <string>Authentication</string> | ||
43 | </property> | ||
44 | </item> | ||
45 | <item> | ||
46 | <property> | ||
47 | <name>text</name> | ||
48 | <string>IP settings</string> | ||
49 | </property> | ||
50 | </item> | ||
51 | <item> | ||
52 | <property> | ||
53 | <name>text</name> | ||
54 | <string>DNS Settings</string> | ||
55 | </property> | ||
56 | </item> | ||
57 | <property stdset="1"> | ||
58 | <name>name</name> | ||
59 | <cstring>PPPOptions_CB</cstring> | ||
60 | </property> | ||
61 | </widget> | ||
62 | <widget> | ||
63 | <class>QWidgetStack</class> | ||
64 | <property stdset="1"> | ||
65 | <name>name</name> | ||
66 | <cstring>Options_WS</cstring> | ||
67 | </property> | ||
68 | </widget> | ||
69 | </vbox> | ||
70 | </widget> | ||
71 | <customwidgets> | ||
72 | <customwidget> | ||
73 | <class>QWidgetStack</class> | ||
74 | <header location="global">qwidgetstack.h</header> | ||
75 | <sizehint> | ||
76 | <width>-1</width> | ||
77 | <height>-1</height> | ||
78 | </sizehint> | ||
79 | <container>0</container> | ||
80 | <sizepolicy> | ||
81 | <hordata>7</hordata> | ||
82 | <verdata>7</verdata> | ||
83 | </sizepolicy> | ||
84 | <pixmap>image0</pixmap> | ||
85 | <slot access="public">raiseWidget( int )</slot> | ||
86 | </customwidget> | ||
87 | </customwidgets> | ||
88 | <images> | ||
89 | <image> | ||
90 | <name>image0</name> | ||
91 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
92 | </image> | ||
93 | </images> | ||
94 | <connections> | ||
95 | <connection> | ||
96 | <sender>PPPOptions_CB</sender> | ||
97 | <signal>activated(int)</signal> | ||
98 | <receiver>PPPGUI</receiver> | ||
99 | <slot>SLOT_SelectTopic( int )</slot> | ||
100 | </connection> | ||
101 | <slot access="public">SLOT_SelectTopic( int )</slot> | ||
102 | </connections> | ||
103 | </UI> | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPIPGUI.ui b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui new file mode 100644 index 0000000..f3d5019 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPIPGUI.ui | |||
@@ -0,0 +1,444 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PPPIPGUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>PPPIPGUI</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>133</width> | ||
15 | <height>235</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>PPPIP</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>3</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QButtonGroup</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>ButtonGroup4</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>frameShape</name> | ||
45 | <enum>Box</enum> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>title</name> | ||
49 | <string>IP</string> | ||
50 | </property> | ||
51 | <property> | ||
52 | <name>layoutMargin</name> | ||
53 | </property> | ||
54 | <property> | ||
55 | <name>layoutSpacing</name> | ||
56 | </property> | ||
57 | <vbox> | ||
58 | <property stdset="1"> | ||
59 | <name>margin</name> | ||
60 | <number>2</number> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>spacing</name> | ||
64 | <number>2</number> | ||
65 | </property> | ||
66 | <widget> | ||
67 | <class>QRadioButton</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>IPServerAssigned_RB</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>text</name> | ||
74 | <string>Server assigned</string> | ||
75 | </property> | ||
76 | <property stdset="1"> | ||
77 | <name>checked</name> | ||
78 | <bool>true</bool> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <widget> | ||
82 | <class>QRadioButton</class> | ||
83 | <property stdset="1"> | ||
84 | <name>name</name> | ||
85 | <cstring>IPFixed_RB</cstring> | ||
86 | </property> | ||
87 | <property stdset="1"> | ||
88 | <name>text</name> | ||
89 | <string>Fixed</string> | ||
90 | </property> | ||
91 | </widget> | ||
92 | <widget> | ||
93 | <class>QLayoutWidget</class> | ||
94 | <property stdset="1"> | ||
95 | <name>name</name> | ||
96 | <cstring>Layout11</cstring> | ||
97 | </property> | ||
98 | <hbox> | ||
99 | <property stdset="1"> | ||
100 | <name>margin</name> | ||
101 | <number>0</number> | ||
102 | </property> | ||
103 | <property stdset="1"> | ||
104 | <name>spacing</name> | ||
105 | <number>6</number> | ||
106 | </property> | ||
107 | <spacer> | ||
108 | <property> | ||
109 | <name>name</name> | ||
110 | <cstring>Spacer8</cstring> | ||
111 | </property> | ||
112 | <property stdset="1"> | ||
113 | <name>orientation</name> | ||
114 | <enum>Horizontal</enum> | ||
115 | </property> | ||
116 | <property stdset="1"> | ||
117 | <name>sizeType</name> | ||
118 | <enum>Fixed</enum> | ||
119 | </property> | ||
120 | <property> | ||
121 | <name>sizeHint</name> | ||
122 | <size> | ||
123 | <width>20</width> | ||
124 | <height>20</height> | ||
125 | </size> | ||
126 | </property> | ||
127 | <property> | ||
128 | <name>layoutMargin</name> | ||
129 | </property> | ||
130 | <property> | ||
131 | <name>layoutSpacing</name> | ||
132 | </property> | ||
133 | </spacer> | ||
134 | <widget> | ||
135 | <class>QFrame</class> | ||
136 | <property stdset="1"> | ||
137 | <name>name</name> | ||
138 | <cstring>Frame8</cstring> | ||
139 | </property> | ||
140 | <property stdset="1"> | ||
141 | <name>enabled</name> | ||
142 | <bool>false</bool> | ||
143 | </property> | ||
144 | <property stdset="1"> | ||
145 | <name>sizePolicy</name> | ||
146 | <sizepolicy> | ||
147 | <hsizetype>7</hsizetype> | ||
148 | <vsizetype>5</vsizetype> | ||
149 | </sizepolicy> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>frameShape</name> | ||
153 | <enum>NoFrame</enum> | ||
154 | </property> | ||
155 | <property stdset="1"> | ||
156 | <name>frameShadow</name> | ||
157 | <enum>Raised</enum> | ||
158 | </property> | ||
159 | <property> | ||
160 | <name>layoutMargin</name> | ||
161 | </property> | ||
162 | <property> | ||
163 | <name>layoutSpacing</name> | ||
164 | </property> | ||
165 | <grid> | ||
166 | <property stdset="1"> | ||
167 | <name>margin</name> | ||
168 | <number>2</number> | ||
169 | </property> | ||
170 | <property stdset="1"> | ||
171 | <name>spacing</name> | ||
172 | <number>2</number> | ||
173 | </property> | ||
174 | <widget row="0" column="1" > | ||
175 | <class>QLineEdit</class> | ||
176 | <property stdset="1"> | ||
177 | <name>name</name> | ||
178 | <cstring>IPAddress_LE</cstring> | ||
179 | </property> | ||
180 | </widget> | ||
181 | <widget row="1" column="0" > | ||
182 | <class>QLabel</class> | ||
183 | <property stdset="1"> | ||
184 | <name>name</name> | ||
185 | <cstring>TextLabel3</cstring> | ||
186 | </property> | ||
187 | <property stdset="1"> | ||
188 | <name>text</name> | ||
189 | <string>Subnetmask</string> | ||
190 | </property> | ||
191 | </widget> | ||
192 | <widget row="0" column="0" > | ||
193 | <class>QLabel</class> | ||
194 | <property stdset="1"> | ||
195 | <name>name</name> | ||
196 | <cstring>TextLabel2</cstring> | ||
197 | </property> | ||
198 | <property stdset="1"> | ||
199 | <name>text</name> | ||
200 | <string>Address</string> | ||
201 | </property> | ||
202 | </widget> | ||
203 | <widget row="1" column="1" > | ||
204 | <class>QLineEdit</class> | ||
205 | <property stdset="1"> | ||
206 | <name>name</name> | ||
207 | <cstring>IPSubMask_LE</cstring> | ||
208 | </property> | ||
209 | </widget> | ||
210 | </grid> | ||
211 | </widget> | ||
212 | </hbox> | ||
213 | </widget> | ||
214 | </vbox> | ||
215 | </widget> | ||
216 | <widget> | ||
217 | <class>QButtonGroup</class> | ||
218 | <property stdset="1"> | ||
219 | <name>name</name> | ||
220 | <cstring>ButtonGroup5</cstring> | ||
221 | </property> | ||
222 | <property stdset="1"> | ||
223 | <name>title</name> | ||
224 | <string>Gateway</string> | ||
225 | </property> | ||
226 | <property> | ||
227 | <name>layoutMargin</name> | ||
228 | </property> | ||
229 | <property> | ||
230 | <name>layoutSpacing</name> | ||
231 | </property> | ||
232 | <vbox> | ||
233 | <property stdset="1"> | ||
234 | <name>margin</name> | ||
235 | <number>2</number> | ||
236 | </property> | ||
237 | <property stdset="1"> | ||
238 | <name>spacing</name> | ||
239 | <number>2</number> | ||
240 | </property> | ||
241 | <widget> | ||
242 | <class>QRadioButton</class> | ||
243 | <property stdset="1"> | ||
244 | <name>name</name> | ||
245 | <cstring>GWServerAssigned_RB</cstring> | ||
246 | </property> | ||
247 | <property stdset="1"> | ||
248 | <name>text</name> | ||
249 | <string>Server assigned</string> | ||
250 | </property> | ||
251 | <property stdset="1"> | ||
252 | <name>checked</name> | ||
253 | <bool>true</bool> | ||
254 | </property> | ||
255 | <property> | ||
256 | <name>layoutMargin</name> | ||
257 | </property> | ||
258 | <property> | ||
259 | <name>layoutSpacing</name> | ||
260 | </property> | ||
261 | </widget> | ||
262 | <widget> | ||
263 | <class>QRadioButton</class> | ||
264 | <property stdset="1"> | ||
265 | <name>name</name> | ||
266 | <cstring>GWFixed_RB</cstring> | ||
267 | </property> | ||
268 | <property stdset="1"> | ||
269 | <name>text</name> | ||
270 | <string>Fixed</string> | ||
271 | </property> | ||
272 | </widget> | ||
273 | <widget> | ||
274 | <class>QLayoutWidget</class> | ||
275 | <property stdset="1"> | ||
276 | <name>name</name> | ||
277 | <cstring>Layout12</cstring> | ||
278 | </property> | ||
279 | <property> | ||
280 | <name>layoutMargin</name> | ||
281 | </property> | ||
282 | <property> | ||
283 | <name>layoutSpacing</name> | ||
284 | </property> | ||
285 | <hbox> | ||
286 | <property stdset="1"> | ||
287 | <name>margin</name> | ||
288 | <number>0</number> | ||
289 | </property> | ||
290 | <property stdset="1"> | ||
291 | <name>spacing</name> | ||
292 | <number>6</number> | ||
293 | </property> | ||
294 | <spacer> | ||
295 | <property> | ||
296 | <name>name</name> | ||
297 | <cstring>Spacer9</cstring> | ||
298 | </property> | ||
299 | <property stdset="1"> | ||
300 | <name>orientation</name> | ||
301 | <enum>Horizontal</enum> | ||
302 | </property> | ||
303 | <property stdset="1"> | ||
304 | <name>sizeType</name> | ||
305 | <enum>Fixed</enum> | ||
306 | </property> | ||
307 | <property> | ||
308 | <name>sizeHint</name> | ||
309 | <size> | ||
310 | <width>20</width> | ||
311 | <height>20</height> | ||
312 | </size> | ||
313 | </property> | ||
314 | </spacer> | ||
315 | <widget> | ||
316 | <class>QFrame</class> | ||
317 | <property stdset="1"> | ||
318 | <name>name</name> | ||
319 | <cstring>Frame9</cstring> | ||
320 | </property> | ||
321 | <property stdset="1"> | ||
322 | <name>enabled</name> | ||
323 | <bool>false</bool> | ||
324 | </property> | ||
325 | <property stdset="1"> | ||
326 | <name>sizePolicy</name> | ||
327 | <sizepolicy> | ||
328 | <hsizetype>7</hsizetype> | ||
329 | <vsizetype>5</vsizetype> | ||
330 | </sizepolicy> | ||
331 | </property> | ||
332 | <property stdset="1"> | ||
333 | <name>frameShape</name> | ||
334 | <enum>NoFrame</enum> | ||
335 | </property> | ||
336 | <property stdset="1"> | ||
337 | <name>frameShadow</name> | ||
338 | <enum>Raised</enum> | ||
339 | </property> | ||
340 | <property> | ||
341 | <name>layoutMargin</name> | ||
342 | </property> | ||
343 | <property> | ||
344 | <name>layoutSpacing</name> | ||
345 | </property> | ||
346 | <grid> | ||
347 | <property stdset="1"> | ||
348 | <name>margin</name> | ||
349 | <number>2</number> | ||
350 | </property> | ||
351 | <property stdset="1"> | ||
352 | <name>spacing</name> | ||
353 | <number>2</number> | ||
354 | </property> | ||
355 | <widget row="0" column="0" > | ||
356 | <class>QLabel</class> | ||
357 | <property stdset="1"> | ||
358 | <name>name</name> | ||
359 | <cstring>TextLabel4</cstring> | ||
360 | </property> | ||
361 | <property stdset="1"> | ||
362 | <name>text</name> | ||
363 | <string>Address</string> | ||
364 | </property> | ||
365 | </widget> | ||
366 | <widget row="0" column="1" > | ||
367 | <class>QLineEdit</class> | ||
368 | <property stdset="1"> | ||
369 | <name>name</name> | ||
370 | <cstring>GWAddress_LE</cstring> | ||
371 | </property> | ||
372 | </widget> | ||
373 | </grid> | ||
374 | </widget> | ||
375 | </hbox> | ||
376 | </widget> | ||
377 | <widget> | ||
378 | <class>QLayoutWidget</class> | ||
379 | <property stdset="1"> | ||
380 | <name>name</name> | ||
381 | <cstring>Layout3</cstring> | ||
382 | </property> | ||
383 | <hbox> | ||
384 | <property stdset="1"> | ||
385 | <name>margin</name> | ||
386 | <number>0</number> | ||
387 | </property> | ||
388 | <property stdset="1"> | ||
389 | <name>spacing</name> | ||
390 | <number>6</number> | ||
391 | </property> | ||
392 | <spacer> | ||
393 | <property> | ||
394 | <name>name</name> | ||
395 | <cstring>Spacer3</cstring> | ||
396 | </property> | ||
397 | <property stdset="1"> | ||
398 | <name>orientation</name> | ||
399 | <enum>Horizontal</enum> | ||
400 | </property> | ||
401 | <property stdset="1"> | ||
402 | <name>sizeType</name> | ||
403 | <enum>Expanding</enum> | ||
404 | </property> | ||
405 | <property> | ||
406 | <name>sizeHint</name> | ||
407 | <size> | ||
408 | <width>20</width> | ||
409 | <height>20</height> | ||
410 | </size> | ||
411 | </property> | ||
412 | </spacer> | ||
413 | <widget> | ||
414 | <class>QCheckBox</class> | ||
415 | <property stdset="1"> | ||
416 | <name>name</name> | ||
417 | <cstring>GWIsDefault_CB</cstring> | ||
418 | </property> | ||
419 | <property stdset="1"> | ||
420 | <name>text</name> | ||
421 | <string>Set as default</string> | ||
422 | </property> | ||
423 | </widget> | ||
424 | </hbox> | ||
425 | </widget> | ||
426 | </vbox> | ||
427 | </widget> | ||
428 | </vbox> | ||
429 | </widget> | ||
430 | <connections> | ||
431 | <connection> | ||
432 | <sender>GWFixed_RB</sender> | ||
433 | <signal>toggled(bool)</signal> | ||
434 | <receiver>Frame9</receiver> | ||
435 | <slot>setEnabled(bool)</slot> | ||
436 | </connection> | ||
437 | <connection> | ||
438 | <sender>IPFixed_RB</sender> | ||
439 | <signal>toggled(bool)</signal> | ||
440 | <receiver>Frame8</receiver> | ||
441 | <slot>setEnabled(bool)</slot> | ||
442 | </connection> | ||
443 | </connections> | ||
444 | </UI> | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.cpp b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp new file mode 100644 index 0000000..6965e5a --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPIPedit.cpp | |||
@@ -0,0 +1,57 @@ | |||
1 | #include <qmessagebox.h> | ||
2 | #include <qcheckbox.h> | ||
3 | #include <qradiobutton.h> | ||
4 | #include <qlineedit.h> | ||
5 | #include <GUIUtils.h> | ||
6 | #include "PPPIPedit.h" | ||
7 | |||
8 | PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){ | ||
9 | } | ||
10 | |||
11 | QString PPPIPEdit::acceptable( void ) { | ||
12 | if( IPFixed_RB->isChecked() ) { | ||
13 | if( IPAddress_LE->text().isEmpty() ) | ||
14 | return tr("IPAddress needed" ); | ||
15 | if( ! validIP( IPAddress_LE->text() ) ) | ||
16 | return tr("IPAddress not valid" ); | ||
17 | if( IPSubMask_LE->text().isEmpty() ) | ||
18 | return tr("Subnet mask needed" ); | ||
19 | if( ! validIP( IPSubMask_LE->text() ) ) | ||
20 | return tr("Subnet mask not valid" ); | ||
21 | } else if( GWFixed_RB->isChecked() ) { | ||
22 | if( GWAddress_LE->text().isEmpty() ) | ||
23 | return tr("Gateway address needed" ); | ||
24 | if( ! validIP( GWAddress_LE->text() ) ) | ||
25 | return tr("Gateway address not valid" ); | ||
26 | }; | ||
27 | |||
28 | return QString(); | ||
29 | } | ||
30 | |||
31 | bool PPPIPEdit::commit( PPPData_t & D ) { | ||
32 | |||
33 | bool SM = 0; | ||
34 | |||
35 | CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM ); | ||
36 | if( ! D.IP.IPAutomatic ) { | ||
37 | TXTM( D.IP.IPAddress, IPAddress_LE, SM ); | ||
38 | TXTM( D.IP.IPSubMask, IPSubMask_LE, SM ); | ||
39 | } | ||
40 | |||
41 | CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM ); | ||
42 | if( ! D.IP.GWAutomatic ) { | ||
43 | TXTM( D.IP.GWAddress, GWAddress_LE, SM ); | ||
44 | } | ||
45 | |||
46 | CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM ); | ||
47 | return SM; | ||
48 | } | ||
49 | |||
50 | void PPPIPEdit::showData( PPPData_t & D ) { | ||
51 | IPServerAssigned_RB->setChecked( D.IP.IPAutomatic ); | ||
52 | IPAddress_LE->setText( D.IP.IPAddress ); | ||
53 | IPSubMask_LE->setText( D.IP.IPSubMask ); | ||
54 | GWServerAssigned_RB->setChecked( D.IP.GWAutomatic ); | ||
55 | GWAddress_LE->setText( D.IP.GWAddress ); | ||
56 | GWIsDefault_CB->setChecked( D.IP.GWIsDefault ); | ||
57 | } | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPIPedit.h b/noncore/settings/networksettings2/ppp/PPPIPedit.h new file mode 100644 index 0000000..153ee68 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPIPedit.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #include "pppdata.h" | ||
2 | #include "PPPIPGUI.h" | ||
3 | |||
4 | class PPPIPEdit : public PPPIPGUI { | ||
5 | |||
6 | public : | ||
7 | |||
8 | PPPIPEdit( QWidget * parent ); | ||
9 | QString acceptable( void ); | ||
10 | bool commit( PPPData_t & Data ); | ||
11 | void showData( PPPData_t & Data ); | ||
12 | |||
13 | private : | ||
14 | |||
15 | }; | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.cpp b/noncore/settings/networksettings2/ppp/PPPedit.cpp new file mode 100644 index 0000000..eb4fdbf --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPedit.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | #include <qwidgetstack.h> | ||
2 | |||
3 | #include "PPPIPedit.h" | ||
4 | #include "PPPDNSedit.h" | ||
5 | #include "PPPAuthedit.h" | ||
6 | #include "PPPedit.h" | ||
7 | |||
8 | PPPEdit::PPPEdit( QWidget * Parent ) : PPPGUI( Parent ){ | ||
9 | |||
10 | Auth = new PPPAuthEdit( Options_WS ); | ||
11 | IP = new PPPIPEdit( Options_WS ); | ||
12 | DNS = new PPPDNSEdit( Options_WS ); | ||
13 | Options_WS->addWidget( Auth, 0 ); | ||
14 | Options_WS->addWidget( IP, 1 ); | ||
15 | Options_WS->addWidget( DNS, 2 ); | ||
16 | |||
17 | Options_WS->raiseWidget( 0 ); | ||
18 | } | ||
19 | |||
20 | QString PPPEdit::acceptable( void ) { | ||
21 | QString S; | ||
22 | S = Auth->acceptable(); | ||
23 | if( S.isEmpty() ) { | ||
24 | S = IP->acceptable(); | ||
25 | if( S.isEmpty() ) { | ||
26 | S = DNS->acceptable(); | ||
27 | } | ||
28 | } | ||
29 | return S; | ||
30 | } | ||
31 | |||
32 | bool PPPEdit::commit( PPPData_t & Data ) { | ||
33 | bool SM ; | ||
34 | SM = Auth->commit( Data ); | ||
35 | SM |= IP->commit( Data ); | ||
36 | SM |= DNS->commit( Data ); | ||
37 | return SM; | ||
38 | } | ||
39 | |||
40 | void PPPEdit::showData( PPPData_t & Data ) { | ||
41 | Auth->showData( Data ) ; | ||
42 | IP->showData( Data ); | ||
43 | DNS->showData( Data ); | ||
44 | } | ||
45 | |||
46 | void PPPEdit::SLOT_SelectTopic( int v ) { | ||
47 | Options_WS->raiseWidget( v ); | ||
48 | } | ||
diff --git a/noncore/settings/networksettings2/ppp/PPPedit.h b/noncore/settings/networksettings2/ppp/PPPedit.h new file mode 100644 index 0000000..57d38ee --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/PPPedit.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #include "pppdata.h" | ||
2 | #include "PPPGUI.h" | ||
3 | |||
4 | class PPPAuthEdit; | ||
5 | class PPPIPEdit; | ||
6 | class PPPDNSEdit; | ||
7 | |||
8 | class PPPEdit : public PPPGUI { | ||
9 | |||
10 | public : | ||
11 | |||
12 | PPPEdit( QWidget * parent ); | ||
13 | QString acceptable( void ); | ||
14 | bool commit( PPPData_t & Data ); | ||
15 | void showData( PPPData_t & Data ); | ||
16 | |||
17 | public slots : | ||
18 | |||
19 | void SLOT_SelectTopic( int ); | ||
20 | |||
21 | private : | ||
22 | |||
23 | PPPAuthEdit * Auth; | ||
24 | PPPDNSEdit * DNS; | ||
25 | PPPIPEdit * IP; | ||
26 | |||
27 | }; | ||
diff --git a/noncore/settings/networksettings2/ppp/config.in b/noncore/settings/networksettings2/ppp/config.in new file mode 100644 index 0000000..dc3abd0 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config NS2PPP | ||
2 | boolean "opie-networksettings2plugin-ppp (set up PPP)" | ||
3 | default "n" if NS2 | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE | ||
diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro new file mode 100644 index 0000000..f8712cd --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/ppp.pro | |||
@@ -0,0 +1,24 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | ||
4 | HEADERS = ppp_NN.h \ | ||
5 | ppp_NNI.h \ | ||
6 | PPPedit.h \ | ||
7 | PPPAuthedit.h \ | ||
8 | PPPDNSedit.h \ | ||
9 | PPPIPedit.h | ||
10 | SOURCES = ppp_NN.cpp \ | ||
11 | ppp_NNI.cpp \ | ||
12 | PPPedit.cpp \ | ||
13 | PPPDNSedit.cpp \ | ||
14 | PPPAuthedit.cpp \ | ||
15 | ppprun.cpp \ | ||
16 | PPPIPedit.cpp | ||
17 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
18 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | ||
19 | LIBS += -lqpe | ||
20 | INTERFACES= PPPGUI.ui PPPAuthGUI.ui PPPIPGUI.ui PPPDNSGUI.ui | ||
21 | TARGET = ppp | ||
22 | VERSION = 1.0.0 | ||
23 | |||
24 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp new file mode 100644 index 0000000..309c9a1 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -0,0 +1,62 @@ | |||
1 | #include "ppp_NN.h" | ||
2 | #include "ppp_NNI.h" | ||
3 | |||
4 | static const char * PPPNeeds[] = | ||
5 | { "line", | ||
6 | "modem", | ||
7 | 0 | ||
8 | }; | ||
9 | |||
10 | /** | ||
11 | * Constructor, find all of the possible interfaces | ||
12 | */ | ||
13 | PPPNetNode::PPPNetNode() : ANetNode() { | ||
14 | } | ||
15 | |||
16 | /** | ||
17 | * Delete any interfaces that we own. | ||
18 | */ | ||
19 | PPPNetNode::~PPPNetNode(){ | ||
20 | } | ||
21 | |||
22 | const QString PPPNetNode::nodeDescription(){ | ||
23 | return tr("\ | ||
24 | <p>Sets up IP using PPP.</p>\ | ||
25 | <p>Use this for dialup devices or serial setups</p>\ | ||
26 | " | ||
27 | ); | ||
28 | } | ||
29 | |||
30 | ANetNodeInstance * PPPNetNode::createInstance( void ) { | ||
31 | return new APPP( this ); | ||
32 | } | ||
33 | |||
34 | const char ** PPPNetNode::needs( void ) { | ||
35 | return PPPNeeds; | ||
36 | } | ||
37 | |||
38 | const char * PPPNetNode::provides( void ) { | ||
39 | return "connection"; | ||
40 | } | ||
41 | |||
42 | bool PPPNetNode::generateProperFilesFor( | ||
43 | ANetNodeInstance * ) { | ||
44 | return 1; | ||
45 | } | ||
46 | |||
47 | bool PPPNetNode::hasDataFor( const QString & ) { | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | bool PPPNetNode::generateDataForCommonFile( | ||
52 | SystemFile & , | ||
53 | long, | ||
54 | ANetNodeInstance * ) { | ||
55 | return 1; | ||
56 | } | ||
57 | |||
58 | extern "C" { | ||
59 | void create_plugin( QList<ANetNode> & PNN ) { | ||
60 | PNN.append( new PPPNetNode() ); | ||
61 | } | ||
62 | } | ||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h new file mode 100644 index 0000000..a933523 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef PPP_NETNODE_H | ||
2 | #define PPP_NETNODE_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class APPP; | ||
7 | |||
8 | class PPPNetNode : public ANetNode{ | ||
9 | |||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | |||
14 | PPPNetNode(); | ||
15 | virtual ~PPPNetNode(); | ||
16 | |||
17 | virtual const QString pixmapName() | ||
18 | { return "ppp"; } | ||
19 | |||
20 | virtual const QString nodeName() | ||
21 | { return tr("PPP Connection"); } | ||
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 | |||
35 | private: | ||
36 | |||
37 | }; | ||
38 | |||
39 | extern "C" | ||
40 | { | ||
41 | void create_plugin( QList<ANetNode> & PNN ); | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp new file mode 100644 index 0000000..d09ecf9 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp | |||
@@ -0,0 +1,115 @@ | |||
1 | #include "PPPedit.h" | ||
2 | #include "ppp_NNI.h" | ||
3 | #include "ppp_NN.h" | ||
4 | |||
5 | APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { | ||
6 | Data.DNS.ServerAssigned = 1; | ||
7 | Data.DNS.DomainName = ""; | ||
8 | |||
9 | Data.Auth.Mode = 0; | ||
10 | Data.Auth.Login.Expect = "ogin:"; | ||
11 | Data.Auth.Password.Expect = "assword:"; | ||
12 | Data.Auth.PCEMode = 0; | ||
13 | Data.Auth.Client = "*"; | ||
14 | Data.Auth.Server = "*"; | ||
15 | Data.Auth.Secret = ""; | ||
16 | |||
17 | Data.IP.IPAutomatic = 1; | ||
18 | Data.IP.IPAddress = ""; | ||
19 | Data.IP.IPSubMask = ""; | ||
20 | Data.IP.GWAutomatic = 1; | ||
21 | Data.IP.GWAddress = ""; | ||
22 | Data.IP.GWIsDefault = 1; | ||
23 | GUI = 0; | ||
24 | RT = 0; | ||
25 | |||
26 | } | ||
27 | |||
28 | void APPP::setSpecificAttribute( QString & A, QString & V ) { | ||
29 | if( A.startsWith( "dns" ) ) { | ||
30 | if( A == "dnsserverassigned" ) { | ||
31 | Data.DNS.ServerAssigned = (V == "yes"); | ||
32 | } else if( A == "dnsdomainname" ) { | ||
33 | Data.DNS.DomainName = V; | ||
34 | } else if( A == "dnsserver" ) { | ||
35 | Data.DNS.Servers.resize( Data.DNS.Servers.size()+1 ); | ||
36 | Data.DNS.Servers[Data.DNS.Servers.size()-1] = | ||
37 | new QString( V ); | ||
38 | } | ||
39 | } else if( A.startsWith( "auth" ) ) { | ||
40 | if( A == "authmode" ) { | ||
41 | Data.Auth.Mode = V.toShort(); | ||
42 | } else if( A == "authloginexpect" ) { | ||
43 | Data.Auth.Login.Expect = V; | ||
44 | } else if( A == "authloginsend" ) { | ||
45 | Data.Auth.Login.Send = V; | ||
46 | } else if( A == "authpasswordexpect" ) { | ||
47 | Data.Auth.Password.Expect = V; | ||
48 | } else if( A == "authpasswordsend" ) { | ||
49 | Data.Auth.Password.Send = V; | ||
50 | } else if( A == "authpcemode" ) { | ||
51 | Data.Auth.PCEMode = V.toShort(); | ||
52 | } else if( A == "authclient" ) { | ||
53 | Data.Auth.Client = V; | ||
54 | } else if( A == "authserver" ) { | ||
55 | Data.Auth.Server = V; | ||
56 | } else if( A == "authsecret" ) { | ||
57 | Data.Auth.Secret = V; | ||
58 | } | ||
59 | } else if( A.startsWith( "ip" ) ) { | ||
60 | if( A == "ipautomatic" ) { | ||
61 | Data.IP.IPAutomatic = (V == "yes"); | ||
62 | } else if( A == "gwautomatic" ) { | ||
63 | Data.IP.GWAutomatic = (V == "yes"); | ||
64 | } else if( A == "gwisdefault" ) { | ||
65 | Data.IP.GWIsDefault = (V == "yes"); | ||
66 | } else if( A == "ipaddress" ) { | ||
67 | Data.IP.IPAddress = V; | ||
68 | } else if( A == "ipsubmask" ) { | ||
69 | Data.IP.IPSubMask = V; | ||
70 | } else if( A == "gwaddress" ) { | ||
71 | Data.IP.GWAddress = V; | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | void APPP::saveSpecificAttribute( QTextStream & TS ) { | ||
77 | TS << "dnsserverassigned=" << | ||
78 | ( ( Data.DNS.ServerAssigned ) ? "yes" : "no" ) << endl; | ||
79 | TS << "dnsdomainname=" << Data.DNS.DomainName << endl; | ||
80 | for( unsigned int i = 0; i < Data.DNS.Servers.size(); i ++ ) { | ||
81 | TS << "dnsserver=" << *(Data.DNS.Servers[i]) << endl; | ||
82 | } | ||
83 | TS << "authmode=" << Data.Auth.Mode << endl; | ||
84 | TS << "authloginexpect=" << quote( Data.Auth.Login.Expect ) << endl; | ||
85 | TS << "authloginsend=" << quote( Data.Auth.Login.Send ) << endl; | ||
86 | TS << "authpasswordexpect=" << quote( Data.Auth.Password.Expect ) << endl; | ||
87 | TS << "authpasswordsend=" << quote( Data.Auth.Password.Send ) << endl; | ||
88 | TS << "authpcemode=" << Data.Auth.PCEMode << endl; | ||
89 | TS << "authclient=" << Data.Auth.Client << endl; | ||
90 | TS << "authserver=" << Data.Auth.Server << endl; | ||
91 | TS << "authsecret=" << quote( Data.Auth.Secret ) << endl; | ||
92 | TS << "ipautomatic=" << ( ( Data.IP.IPAutomatic ) ? "yes" : "no" ) << endl; | ||
93 | TS << "gwautomatic=" << ( ( Data.IP.GWAutomatic ) ? "yes" : "no" ) << endl; | ||
94 | TS << "gwisdefault=" << ( ( Data.IP.GWIsDefault ) ? "yes" : "no" ) << endl; | ||
95 | TS << "ipaddress=" << Data.IP.IPAddress << endl; | ||
96 | TS << "ipsubmask=" << Data.IP.IPSubMask << endl; | ||
97 | TS << "gwaddress=" << Data.IP.GWAddress << endl; | ||
98 | } | ||
99 | |||
100 | QWidget * APPP::edit( QWidget * parent ) { | ||
101 | GUI = new PPPEdit( parent ); | ||
102 | GUI->showData( Data ); | ||
103 | return GUI; | ||
104 | } | ||
105 | |||
106 | QString APPP::acceptable( void ) { | ||
107 | return ( GUI ) ? GUI->acceptable( ) : QString(); | ||
108 | } | ||
109 | |||
110 | void APPP::commit( void ) { | ||
111 | if( GUI && GUI->commit( Data ) ) { | ||
112 | setModified( 1 ); | ||
113 | } | ||
114 | } | ||
115 | |||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h new file mode 100644 index 0000000..08dca1d --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef PPP_H | ||
2 | #define PPP_H | ||
3 | |||
4 | #include <netnode.h> | ||
5 | #include "pppdata.h" | ||
6 | #include "ppprun.h" | ||
7 | |||
8 | class PPPNetNode; | ||
9 | class PPPEdit; | ||
10 | |||
11 | class APPP : public ANetNodeInstance { | ||
12 | |||
13 | public : | ||
14 | |||
15 | APPP( PPPNetNode * PNN ); | ||
16 | |||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | ||
22 | { if( RT == 0 ) | ||
23 | RT = new PPPRun( this, Data ); | ||
24 | return RT; | ||
25 | } | ||
26 | |||
27 | virtual void * data( void ) | ||
28 | { return (void *)&Data; } | ||
29 | |||
30 | protected : | ||
31 | |||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | ||
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | ||
34 | |||
35 | private : | ||
36 | |||
37 | PPPEdit * GUI; | ||
38 | PPPData Data; | ||
39 | PPPRun * RT; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/settings/networksettings2/ppp/pppdata.h b/noncore/settings/networksettings2/ppp/pppdata.h new file mode 100644 index 0000000..9e8543c --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/pppdata.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef PPP_DATA_H | ||
2 | #define PPP_DATA_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | #include <qarray.h> | ||
6 | |||
7 | typedef struct PPPData { | ||
8 | struct { | ||
9 | bool IPAutomatic; | ||
10 | QString IPAddress; | ||
11 | QString IPSubMask; | ||
12 | bool GWAutomatic; | ||
13 | QString GWAddress; | ||
14 | bool GWIsDefault; | ||
15 | } IP; | ||
16 | struct { | ||
17 | short Mode; // 0 login, 1 chap/pap, 2 Terminal | ||
18 | struct { | ||
19 | QString Expect; | ||
20 | QString Send; | ||
21 | } Login; | ||
22 | struct { | ||
23 | QString Expect; | ||
24 | QString Send; | ||
25 | } Password; | ||
26 | short PCEMode; // 0 pap, 1, chap 2, EAP | ||
27 | QString Server; | ||
28 | QString Client; | ||
29 | QString Secret; | ||
30 | } Auth; | ||
31 | struct { | ||
32 | bool ServerAssigned; | ||
33 | QString DomainName; | ||
34 | QArray<QString *> Servers; | ||
35 | } DNS; | ||
36 | } PPPData_t; | ||
37 | |||
38 | #endif | ||
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp new file mode 100644 index 0000000..8933f85 --- a/dev/null +++ b/noncore/settings/networksettings2/ppp/ppprun.cpp | |||
@@ -0,0 +1,77 @@ | |||
1 | #include <resources.h> | ||
2 | #include "ppprun.h" | ||
3 | |||
4 | void PPPRun::detectState( NodeCollection * NC ) { | ||
5 | if( isMyPPPDRunning( ) ) { | ||
6 | if( isMyPPPUp() ) { | ||
7 | NC->setCurrentState( IsUp ); | ||
8 | } else { | ||
9 | NC->setCurrentState( Available ); | ||
10 | } | ||
11 | } else { | ||
12 | NC->setCurrentState( Off ); // at least this | ||
13 | // but could also be unavailable | ||
14 | netNode()->nextNode()->runtime()->detectState( NC ); | ||
15 | } | ||
16 | } | ||
17 | |||
18 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { | ||
19 | switch( A ) { | ||
20 | case Activate : | ||
21 | NC->setCurrentState( Available ); | ||
22 | // no | ||
23 | break; | ||
24 | case Deactivate : | ||
25 | if( NC->currentState() == IsUp ) { | ||
26 | NC->state( Down ); | ||
27 | } | ||
28 | // cannot really disable | ||
29 | NC->setCurrentState( Available ); | ||
30 | break; | ||
31 | case Up : | ||
32 | if( NC->currentState() != IsUp ) { | ||
33 | // start my PPPD | ||
34 | NC->setCurrentState( IsUp ); | ||
35 | } | ||
36 | break; | ||
37 | case Down : | ||
38 | if( NC->currentState() == IsUp ) { | ||
39 | // stop my PPPD | ||
40 | NC->setCurrentState( Available ); | ||
41 | } | ||
42 | break; | ||
43 | default : // FT | ||
44 | break; | ||
45 | } | ||
46 | return 1; | ||
47 | } | ||
48 | |||
49 | bool PPPRun::isMyPPPDRunning( void ) { | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | bool PPPRun::isMyPPPUp( void ) { | ||
54 | System & S = NSResources->system(); | ||
55 | InterfaceInfo * best = 0, * Run; | ||
56 | QRegExp R( "ppp[0-9]" ); | ||
57 | |||
58 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
59 | It.current(); | ||
60 | ++It ) { | ||
61 | Run = It.current(); | ||
62 | if( R.match( Run->Name ) >= 0 && | ||
63 | Run->IsPointToPoint | ||
64 | ) { | ||
65 | // this is a LAN card | ||
66 | if( Run->assignedNode() == netNode() ) { | ||
67 | // assigned to us | ||
68 | return 1; | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | bool PPPRun::handlesInterface( const QString & S ) { | ||
76 | return Pat.match( S ) >= 0; | ||
77 | } | ||