Diffstat (limited to 'noncore/settings/networksettings2/ppp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/ppp/PPPAuthGUI.ui | 158 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/PPPAuthedit.cpp | 42 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/PPPAuthedit.h | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NN.cpp | 31 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NN.h | 31 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NNI.cpp | 108 | ||||
-rw-r--r-- | noncore/settings/networksettings2/ppp/ppp_NNI.h | 21 |
7 files changed, 263 insertions, 130 deletions
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui index 826843a..0c5f4c8 100644 --- a/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui +++ b/noncore/settings/networksettings2/ppp/PPPAuthGUI.ui | |||
@@ -6,17 +6,17 @@ | |||
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>PPPAuthGUI</cstring> | 7 | <cstring>PPPAuthGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>249</width> | 14 | <width>245</width> |
15 | <height>209</height> | 15 | <height>209</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>PPPAuth</string> | 20 | <string>PPPAuth</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
@@ -52,21 +52,21 @@ | |||
52 | <name>layoutMargin</name> | 52 | <name>layoutMargin</name> |
53 | </property> | 53 | </property> |
54 | <property> | 54 | <property> |
55 | <name>layoutSpacing</name> | 55 | <name>layoutSpacing</name> |
56 | </property> | 56 | </property> |
57 | <vbox> | 57 | <vbox> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>margin</name> | 59 | <name>margin</name> |
60 | <number>0</number> | 60 | <number>3</number> |
61 | </property> | 61 | </property> |
62 | <property stdset="1"> | 62 | <property stdset="1"> |
63 | <name>spacing</name> | 63 | <name>spacing</name> |
64 | <number>0</number> | 64 | <number>2</number> |
65 | </property> | 65 | </property> |
66 | <widget> | 66 | <widget> |
67 | <class>QRadioButton</class> | 67 | <class>QRadioButton</class> |
68 | <property stdset="1"> | 68 | <property stdset="1"> |
69 | <name>name</name> | 69 | <name>name</name> |
70 | <cstring>Login_RB</cstring> | 70 | <cstring>Login_RB</cstring> |
71 | </property> | 71 | </property> |
72 | <property stdset="1"> | 72 | <property stdset="1"> |
@@ -186,25 +186,64 @@ | |||
186 | <cstring>PasswordSend_LE</cstring> | 186 | <cstring>PasswordSend_LE</cstring> |
187 | </property> | 187 | </property> |
188 | </widget> | 188 | </widget> |
189 | </grid> | 189 | </grid> |
190 | </widget> | 190 | </widget> |
191 | </hbox> | 191 | </hbox> |
192 | </widget> | 192 | </widget> |
193 | <widget> | 193 | <widget> |
194 | <class>QRadioButton</class> | 194 | <class>QLayoutWidget</class> |
195 | <property stdset="1"> | 195 | <property stdset="1"> |
196 | <name>name</name> | 196 | <name>name</name> |
197 | <cstring>PapChap_RB</cstring> | 197 | <cstring>Layout3</cstring> |
198 | </property> | ||
199 | <property stdset="1"> | ||
200 | <name>text</name> | ||
201 | <string>Pap/Chap/EAP</string> | ||
202 | </property> | 198 | </property> |
199 | <hbox> | ||
200 | <property stdset="1"> | ||
201 | <name>margin</name> | ||
202 | <number>0</number> | ||
203 | </property> | ||
204 | <property stdset="1"> | ||
205 | <name>spacing</name> | ||
206 | <number>6</number> | ||
207 | </property> | ||
208 | <widget> | ||
209 | <class>QRadioButton</class> | ||
210 | <property stdset="1"> | ||
211 | <name>name</name> | ||
212 | <cstring>Pap_RB</cstring> | ||
213 | </property> | ||
214 | <property stdset="1"> | ||
215 | <name>text</name> | ||
216 | <string>Pap</string> | ||
217 | </property> | ||
218 | </widget> | ||
219 | <widget> | ||
220 | <class>QRadioButton</class> | ||
221 | <property stdset="1"> | ||
222 | <name>name</name> | ||
223 | <cstring>Chap_RB</cstring> | ||
224 | </property> | ||
225 | <property stdset="1"> | ||
226 | <name>text</name> | ||
227 | <string>Chap</string> | ||
228 | </property> | ||
229 | </widget> | ||
230 | <widget> | ||
231 | <class>QRadioButton</class> | ||
232 | <property stdset="1"> | ||
233 | <name>name</name> | ||
234 | <cstring>EAP_RB</cstring> | ||
235 | </property> | ||
236 | <property stdset="1"> | ||
237 | <name>text</name> | ||
238 | <string>EAP</string> | ||
239 | </property> | ||
240 | </widget> | ||
241 | </hbox> | ||
203 | </widget> | 242 | </widget> |
204 | <widget> | 243 | <widget> |
205 | <class>QLayoutWidget</class> | 244 | <class>QLayoutWidget</class> |
206 | <property stdset="1"> | 245 | <property stdset="1"> |
207 | <name>name</name> | 246 | <name>name</name> |
208 | <cstring>Layout5</cstring> | 247 | <cstring>Layout5</cstring> |
209 | </property> | 248 | </property> |
210 | <hbox> | 249 | <hbox> |
@@ -270,137 +309,80 @@ | |||
270 | </property> | 309 | </property> |
271 | <grid> | 310 | <grid> |
272 | <property stdset="1"> | 311 | <property stdset="1"> |
273 | <name>margin</name> | 312 | <name>margin</name> |
274 | <number>2</number> | 313 | <number>2</number> |
275 | </property> | 314 | </property> |
276 | <property stdset="1"> | 315 | <property stdset="1"> |
277 | <name>spacing</name> | 316 | <name>spacing</name> |
278 | <number>1</number> | 317 | <number>2</number> |
279 | </property> | 318 | </property> |
280 | <widget row="2" column="0" > | 319 | <widget row="1" column="0" > |
281 | <class>QLabel</class> | 320 | <class>QLabel</class> |
282 | <property stdset="1"> | 321 | <property stdset="1"> |
283 | <name>name</name> | 322 | <name>name</name> |
284 | <cstring>TextLabel1_2</cstring> | 323 | <cstring>TextLabel1_2</cstring> |
285 | </property> | 324 | </property> |
286 | <property stdset="1"> | 325 | <property stdset="1"> |
287 | <name>text</name> | 326 | <name>text</name> |
288 | <string>Server</string> | 327 | <string>Server</string> |
289 | </property> | 328 | </property> |
290 | </widget> | 329 | </widget> |
291 | <widget row="3" column="0" > | 330 | <widget row="2" column="0" > |
292 | <class>QLabel</class> | 331 | <class>QLabel</class> |
293 | <property stdset="1"> | 332 | <property stdset="1"> |
294 | <name>name</name> | 333 | <name>name</name> |
295 | <cstring>TextLabel1_3</cstring> | 334 | <cstring>TextLabel1_3</cstring> |
296 | </property> | 335 | </property> |
297 | <property stdset="1"> | 336 | <property stdset="1"> |
298 | <name>text</name> | 337 | <name>text</name> |
299 | <string>Secret</string> | 338 | <string>Secret</string> |
300 | </property> | 339 | </property> |
301 | </widget> | 340 | </widget> |
302 | <widget row="0" column="1" > | 341 | <widget row="1" column="1" > |
303 | <class>QComboBox</class> | 342 | <class>QLineEdit</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"> | 343 | <property stdset="1"> |
330 | <name>name</name> | 344 | <name>name</name> |
331 | <cstring>TextLabel1</cstring> | 345 | <cstring>Server_LE</cstring> |
332 | </property> | 346 | </property> |
333 | <property stdset="1"> | 347 | <property stdset="1"> |
334 | <name>text</name> | 348 | <name>text</name> |
335 | <string>Client</string> | 349 | <string>*</string> |
336 | </property> | 350 | </property> |
337 | </widget> | 351 | </widget> |
338 | <widget row="0" column="0" > | 352 | <widget row="2" column="1" > |
339 | <class>QLabel</class> | 353 | <class>QLineEdit</class> |
340 | <property stdset="1"> | 354 | <property stdset="1"> |
341 | <name>name</name> | 355 | <name>name</name> |
342 | <cstring>TextLabel1_4</cstring> | 356 | <cstring>Secret_LE</cstring> |
343 | </property> | ||
344 | <property stdset="1"> | ||
345 | <name>text</name> | ||
346 | <string>Method</string> | ||
347 | </property> | 357 | </property> |
348 | </widget> | 358 | </widget> |
349 | <widget row="1" column="1" rowspan="1" colspan="2" > | 359 | <widget row="0" column="1" > |
350 | <class>QLineEdit</class> | 360 | <class>QLineEdit</class> |
351 | <property stdset="1"> | 361 | <property stdset="1"> |
352 | <name>name</name> | 362 | <name>name</name> |
353 | <cstring>Client_LE</cstring> | 363 | <cstring>Client_LE</cstring> |
354 | </property> | 364 | </property> |
355 | <property stdset="1"> | 365 | <property stdset="1"> |
356 | <name>text</name> | 366 | <name>text</name> |
357 | <string>*</string> | 367 | <string>*</string> |
358 | </property> | 368 | </property> |
359 | </widget> | 369 | </widget> |
360 | <widget row="2" column="1" rowspan="1" colspan="2" > | 370 | <widget row="0" column="0" > |
361 | <class>QLineEdit</class> | 371 | <class>QLabel</class> |
362 | <property stdset="1"> | 372 | <property stdset="1"> |
363 | <name>name</name> | 373 | <name>name</name> |
364 | <cstring>Server_LE</cstring> | 374 | <cstring>TextLabel1</cstring> |
365 | </property> | 375 | </property> |
366 | <property stdset="1"> | 376 | <property stdset="1"> |
367 | <name>text</name> | 377 | <name>text</name> |
368 | <string>*</string> | 378 | <string>Client</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> | 379 | </property> |
377 | </widget> | 380 | </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> | 381 | </grid> |
400 | </widget> | 382 | </widget> |
401 | </hbox> | 383 | </hbox> |
402 | </widget> | 384 | </widget> |
403 | <widget> | 385 | <widget> |
404 | <class>QRadioButton</class> | 386 | <class>QRadioButton</class> |
405 | <property stdset="1"> | 387 | <property stdset="1"> |
406 | <name>name</name> | 388 | <name>name</name> |
@@ -412,21 +394,33 @@ | |||
412 | </property> | 394 | </property> |
413 | </widget> | 395 | </widget> |
414 | </vbox> | 396 | </vbox> |
415 | </widget> | 397 | </widget> |
416 | </vbox> | 398 | </vbox> |
417 | </widget> | 399 | </widget> |
418 | <connections> | 400 | <connections> |
419 | <connection> | 401 | <connection> |
420 | <sender>PapChap_RB</sender> | 402 | <sender>Pap_RB</sender> |
421 | <signal>toggled(bool)</signal> | 403 | <signal>toggled(bool)</signal> |
422 | <receiver>GroupBox3</receiver> | 404 | <receiver>GroupBox3</receiver> |
423 | <slot>setEnabled(bool)</slot> | 405 | <slot>setEnabled(bool)</slot> |
424 | </connection> | 406 | </connection> |
425 | <connection> | 407 | <connection> |
426 | <sender>Login_RB</sender> | 408 | <sender>Login_RB</sender> |
427 | <signal>toggled(bool)</signal> | 409 | <signal>toggled(bool)</signal> |
428 | <receiver>GroupBox1</receiver> | 410 | <receiver>GroupBox1</receiver> |
429 | <slot>setEnabled(bool)</slot> | 411 | <slot>setEnabled(bool)</slot> |
430 | </connection> | 412 | </connection> |
413 | <connection> | ||
414 | <sender>Chap_RB</sender> | ||
415 | <signal>toggled(bool)</signal> | ||
416 | <receiver>GroupBox3</receiver> | ||
417 | <slot>setEnabled(bool)</slot> | ||
418 | </connection> | ||
419 | <connection> | ||
420 | <sender>EAP_RB</sender> | ||
421 | <signal>toggled(bool)</signal> | ||
422 | <receiver>GroupBox3</receiver> | ||
423 | <slot>setEnabled(bool)</slot> | ||
424 | </connection> | ||
431 | </connections> | 425 | </connections> |
432 | </UI> | 426 | </UI> |
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp index f305cc4..450d560 100644 --- a/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp +++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.cpp | |||
@@ -4,82 +4,102 @@ | |||
4 | #include <qradiobutton.h> | 4 | #include <qradiobutton.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <GUIUtils.h> | 6 | #include <GUIUtils.h> |
7 | #include "PPPAuthedit.h" | 7 | #include "PPPAuthedit.h" |
8 | 8 | ||
9 | PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){ | 9 | PPPAuthEdit::PPPAuthEdit( QWidget * Parent ) : PPPAuthGUI( Parent ){ |
10 | } | 10 | } |
11 | 11 | ||
12 | bool PPPAuthEdit::PAP_Checked( void ) { | ||
13 | return ( Pap_RB->isChecked() || | ||
14 | Chap_RB->isChecked() || | ||
15 | EAP_RB->isChecked() | ||
16 | ); | ||
17 | } | ||
18 | |||
12 | QString PPPAuthEdit::acceptable( void ) { | 19 | QString PPPAuthEdit::acceptable( void ) { |
13 | if( Login_RB->isChecked() ) { | 20 | if( Login_RB->isChecked() ) { |
14 | if( LoginSend_LE->text().isEmpty() ) | 21 | if( LoginSend_LE->text().isEmpty() ) |
15 | return tr("Login send missing"); | 22 | return tr("Login send missing"); |
16 | if( LoginExpect_LE->text().isEmpty() ) | 23 | if( LoginExpect_LE->text().isEmpty() ) |
17 | return tr("Login expect missing"); | 24 | return tr("Login expect missing"); |
18 | if( PasswordSend_LE->text().isEmpty() ) | 25 | if( PasswordSend_LE->text().isEmpty() ) |
19 | return tr("Password send missing"); | 26 | return tr("Password send missing"); |
20 | if( PasswordExpect_LE->text().isEmpty() ) | 27 | if( PasswordExpect_LE->text().isEmpty() ) |
21 | return tr("Password expect missing"); | 28 | return tr("Password expect missing"); |
22 | } else if( PapChap_RB->isChecked() ) { | 29 | } else if( PAP_Checked() ) { |
23 | if( Client_LE->text().isEmpty() ) | 30 | if( Client_LE->text().isEmpty() ) |
24 | return tr("Pap/Chap/EAP client id missing"); | 31 | return tr("Pap/Chap/EAP client id missing"); |
25 | if( Server_LE->text().isEmpty() ) | 32 | if( Server_LE->text().isEmpty() ) |
26 | return tr("Pap/Chap/EAP server id missing"); | 33 | return tr("Pap/Chap/EAP server id missing"); |
27 | if( Secret_LE->text().isEmpty() ) | 34 | if( Secret_LE->text().isEmpty() ) |
28 | return tr("Pap/Chap/EAP secret id missing"); | 35 | return tr("Pap/Chap/EAP secret id missing"); |
29 | } | 36 | } |
30 | return QString(); | 37 | return QString(); |
31 | } | 38 | } |
32 | 39 | ||
33 | bool PPPAuthEdit::commit( PPPData_t & D ) { | 40 | bool PPPAuthEdit::commit( PPPData_t & D ) { |
34 | bool SM = 0; | 41 | bool SM = 0; |
35 | 42 | ||
36 | if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || | 43 | if( ( D.Auth.Mode == 0 && ! Login_RB->isChecked() ) || |
37 | ( D.Auth.Mode == 1 && ! PapChap_RB->isChecked() ) || | 44 | ( D.Auth.Mode == 1 && ! PAP_Checked() ) || |
38 | ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { | 45 | ( D.Auth.Mode == 2 && ! Terminal_RB->isChecked() ) ) { |
39 | // mode modifed | 46 | // mode modifed |
40 | SM = 1; | 47 | SM = 1; |
41 | D.Auth.Mode = ( Login_RB->isChecked() ) ? | 48 | D.Auth.Mode = ( Login_RB->isChecked() ) ? |
42 | 0 : | 49 | 0 : |
43 | ( ( PapChap_RB->isChecked() ) ? | 50 | ( PAP_Checked() ) ? 1 : 2; |
44 | 1 : 2 ); | ||
45 | } | 51 | } |
46 | 52 | ||
47 | if( Login_RB->isChecked() ) { | 53 | if( Login_RB->isChecked() ) { |
48 | TXTM( D.Auth.Login.Expect, LoginExpect_LE, SM ); | 54 | TXTM( D.Auth.Login.Expect, LoginExpect_LE, SM ); |
49 | TXTM( D.Auth.Login.Send, LoginSend_LE, SM ); | 55 | TXTM( D.Auth.Login.Send, LoginSend_LE, SM ); |
50 | TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM ); | 56 | TXTM( D.Auth.Password.Expect, PasswordExpect_LE, SM ); |
51 | TXTM( D.Auth.Password.Send, PasswordSend_LE, SM ); | 57 | TXTM( D.Auth.Password.Send, PasswordSend_LE, SM ); |
52 | } else if( PapChap_RB->isChecked() ) { | 58 | } else if( PAP_Checked() ) { |
53 | TXTM( D.Auth.Client, Client_LE, SM ); | 59 | TXTM( D.Auth.Client, Client_LE, SM ); |
54 | TXTM( D.Auth.Server, Server_LE, SM ); | 60 | TXTM( D.Auth.Server, Server_LE, SM ); |
55 | TXTM( D.Auth.Secret, Secret_LE, SM ); | 61 | TXTM( D.Auth.Secret, Secret_LE, SM ); |
56 | CIM( D.Auth.PCEMode, AuthMethod_CB, SM ); | 62 | if( Pap_RB->isChecked() ) { |
63 | D.Auth.PCEMode = 0; | ||
64 | } else if( Chap_RB->isChecked() ) { | ||
65 | D.Auth.PCEMode = 1; | ||
66 | } else if( EAP_RB->isChecked() ) { | ||
67 | D.Auth.PCEMode = 2; | ||
68 | } | ||
57 | } | 69 | } |
58 | return SM; | 70 | return SM; |
59 | } | 71 | } |
60 | 72 | ||
61 | void PPPAuthEdit::showData( PPPData_t & D ) { | 73 | void PPPAuthEdit::showData( PPPData_t & D ) { |
62 | 74 | ||
63 | switch( D.Auth.Mode ) { | 75 | switch( D.Auth.Mode ) { |
64 | case 0 : | 76 | case 0 : |
65 | Login_RB->isChecked(); | 77 | Login_RB->setChecked( TRUE ); |
66 | break; | 78 | break; |
67 | case 1 : | 79 | case 1 : |
68 | PapChap_RB->isChecked(); | 80 | switch( D.Auth.PCEMode ) { |
81 | case 0 : | ||
82 | Pap_RB->setChecked( TRUE ); | ||
83 | break; | ||
84 | case 1 : | ||
85 | Chap_RB->setChecked( TRUE ); | ||
86 | break; | ||
87 | case 2 : | ||
88 | EAP_RB->setChecked( TRUE ); | ||
89 | break; | ||
90 | } | ||
69 | break; | 91 | break; |
70 | case 2 : | 92 | case 2 : |
71 | Terminal_RB->isChecked(); | 93 | Terminal_RB->setChecked( TRUE ); |
72 | break; | 94 | break; |
73 | } | 95 | } |
74 | 96 | ||
75 | LoginExpect_LE->setText( D.Auth.Login.Expect ); | 97 | LoginExpect_LE->setText( D.Auth.Login.Expect ); |
76 | PasswordExpect_LE->setText( D.Auth.Password.Expect ); | 98 | PasswordExpect_LE->setText( D.Auth.Password.Expect ); |
77 | LoginSend_LE->setText( D.Auth.Login.Send ); | 99 | LoginSend_LE->setText( D.Auth.Login.Send ); |
78 | PasswordSend_LE->setText( D.Auth.Password.Send ); | 100 | PasswordSend_LE->setText( D.Auth.Password.Send ); |
79 | 101 | ||
80 | Client_LE->setText( D.Auth.Client ); | 102 | Client_LE->setText( D.Auth.Client ); |
81 | Server_LE->setText( D.Auth.Server ); | 103 | Server_LE->setText( D.Auth.Server ); |
82 | Secret_LE->setText( D.Auth.Secret ); | 104 | Secret_LE->setText( D.Auth.Secret ); |
83 | |||
84 | AuthMethod_CB->setCurrentItem( D.Auth.PCEMode ); | ||
85 | } | 105 | } |
diff --git a/noncore/settings/networksettings2/ppp/PPPAuthedit.h b/noncore/settings/networksettings2/ppp/PPPAuthedit.h index cbd540e..2392569 100644 --- a/noncore/settings/networksettings2/ppp/PPPAuthedit.h +++ b/noncore/settings/networksettings2/ppp/PPPAuthedit.h | |||
@@ -4,12 +4,14 @@ | |||
4 | class PPPAuthEdit : public PPPAuthGUI { | 4 | class PPPAuthEdit : public PPPAuthGUI { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | PPPAuthEdit( QWidget * parent ); | 8 | PPPAuthEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 9 | QString acceptable( void ); |
10 | bool commit( PPPData_t & Data ); | 10 | bool commit( PPPData_t & Data ); |
11 | void showData( PPPData_t & Data ); | 11 | void showData( PPPData_t & Data ); |
12 | bool PAP_Checked( void ); | ||
13 | |||
12 | 14 | ||
13 | private : | 15 | private : |
14 | 16 | ||
15 | }; | 17 | }; |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index b7edf87..ff4465c 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -1,21 +1,36 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qtextstream.h> | ||
1 | #include "ppp_NN.h" | 3 | #include "ppp_NN.h" |
2 | #include "ppp_NNI.h" | 4 | #include "ppp_NNI.h" |
3 | 5 | ||
6 | QStringList * PPPNetNode::ProperFiles = 0; | ||
7 | |||
4 | static const char * PPPNeeds[] = | 8 | static const char * PPPNeeds[] = |
5 | { "line", | 9 | { "line", |
6 | "modem", | 10 | "modem", |
7 | 0 | 11 | 0 |
8 | }; | 12 | }; |
9 | 13 | ||
10 | /** | 14 | /** |
11 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
12 | */ | 16 | */ |
13 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { | 17 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { |
18 | |||
19 | // proper files : will leak | ||
20 | ProperFiles =new QStringList; | ||
21 | *ProperFiles << "peers"; | ||
22 | *ProperFiles << "chatscript"; | ||
23 | |||
24 | // system files | ||
25 | NSResources->addSystemFile( | ||
26 | "pap-secrets", "/tmp/pap-secrets", 0 ); | ||
27 | NSResources->addSystemFile( | ||
28 | "chap-secrets", "/tmp/chap-secrets", 0 ); | ||
14 | } | 29 | } |
15 | 30 | ||
16 | /** | 31 | /** |
17 | * Delete any interfaces that we own. | 32 | * Delete any interfaces that we own. |
18 | */ | 33 | */ |
19 | PPPNetNode::~PPPNetNode(){ | 34 | PPPNetNode::~PPPNetNode(){ |
20 | } | 35 | } |
21 | 36 | ||
@@ -34,25 +49,27 @@ ANetNodeInstance * PPPNetNode::createInstance( void ) { | |||
34 | const char ** PPPNetNode::needs( void ) { | 49 | const char ** PPPNetNode::needs( void ) { |
35 | return PPPNeeds; | 50 | return PPPNeeds; |
36 | } | 51 | } |
37 | 52 | ||
38 | const char * PPPNetNode::provides( void ) { | 53 | const char * PPPNetNode::provides( void ) { |
39 | return "connection"; | 54 | return "connection"; |
40 | } | 55 | } |
41 | 56 | ||
42 | bool PPPNetNode::generateProperFilesFor( | 57 | QStringList * PPPNetNode::properFiles( void ) { |
43 | ANetNodeInstance * ) { | 58 | return ProperFiles; |
44 | return 0; | 59 | |
45 | } | 60 | } |
46 | 61 | ||
47 | bool PPPNetNode::generateDeviceDataForCommonFile( | 62 | // need to generate : |
48 | SystemFile & , | 63 | // /etc/ppp/pap-secrets |
49 | long ) { | 64 | // /etc/ppp/pap-secrets |
50 | return 0; | 65 | bool PPPNetNode::hasDataForFile( const QString & S ) { |
66 | return S == "pap-secrets" || | ||
67 | S == "chap-secrets" ; | ||
51 | } | 68 | } |
52 | 69 | ||
53 | QString PPPNetNode::genNic( long NicNr ) { | 70 | QString PPPNetNode::genNic( long NicNr ) { |
54 | QString S; | 71 | QString S; |
55 | return S.sprintf( "ppp%ld", NicNr ); | 72 | return S.sprintf( "ppp%ld", NicNr ); |
56 | } | 73 | } |
57 | 74 | ||
58 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { | 75 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index b1483c4..249be5a 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -2,45 +2,42 @@ | |||
2 | #define PPP_NETNODE_H | 2 | #define PPP_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class APPP; | 6 | class APPP; |
7 | 7 | ||
8 | class PPPNetNode : public ANetNode{ | 8 | class PPPNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | PPPNetNode(); | 14 | PPPNetNode(); |
15 | virtual ~PPPNetNode(); | 15 | virtual ~PPPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual bool hasDataForFile( const QString & S ); |
21 | 21 | ||
22 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual const QString nodeDescription() ; |
23 | virtual ANetNodeInstance * createInstance( void ); | ||
24 | virtual const char ** needs( void ); | ||
25 | virtual const char * provides( void ); | ||
23 | 26 | ||
24 | virtual const char ** needs( void ); | 27 | virtual QString genNic( long NicNr ); |
25 | virtual const char * provides( void ); | 28 | virtual QStringList * properFiles( void ); |
26 | |||
27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | ||
28 | virtual bool hasDataFor( const QString & ) | ||
29 | { return 0; } | ||
30 | virtual bool generateDeviceDataForCommonFile( | ||
31 | SystemFile & SF, long DevNr ); | ||
32 | |||
33 | virtual QString genNic( long NicNr ); | ||
34 | 29 | ||
35 | private: | 30 | private: |
36 | 31 | ||
37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
38 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | |||
35 | static QStringList * ProperFiles; | ||
39 | }; | 36 | }; |
40 | 37 | ||
41 | extern "C" | 38 | extern "C" |
42 | { | 39 | { |
43 | void create_plugin( QList<ANetNode> & PNN ); | 40 | void create_plugin( QList<ANetNode> & PNN ); |
44 | }; | 41 | }; |
45 | 42 | ||
46 | #endif | 43 | #endif |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp index d0fd31c..ba639de 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp | |||
@@ -1,8 +1,10 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qfileinfo.h> | ||
1 | #include "PPPedit.h" | 3 | #include "PPPedit.h" |
2 | #include "ppp_NNI.h" | 4 | #include "ppp_NNI.h" |
3 | #include "ppp_NN.h" | 5 | #include "ppp_NN.h" |
4 | 6 | ||
5 | APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { | 7 | APPP::APPP( PPPNetNode * PNN ) : ANetNodeInstance( PNN ) { |
6 | Data.DNS.ServerAssigned = 1; | 8 | Data.DNS.ServerAssigned = 1; |
7 | Data.DNS.DomainName = ""; | 9 | Data.DNS.DomainName = ""; |
8 | 10 | ||
@@ -108,14 +110,112 @@ QString APPP::acceptable( void ) { | |||
108 | } | 110 | } |
109 | 111 | ||
110 | void APPP::commit( void ) { | 112 | void APPP::commit( void ) { |
111 | if( GUI && GUI->commit( Data ) ) { | 113 | if( GUI && GUI->commit( Data ) ) { |
112 | setModified( 1 ); | 114 | setModified( 1 ); |
113 | } | 115 | } |
114 | } | 116 | } |
115 | 117 | ||
116 | bool APPP::generateDataForCommonFile( | 118 | QFile * APPP::openFile( const QString & ID ) { |
117 | SystemFile & , | 119 | QFile * F = 0; |
118 | long) { | 120 | QString S; |
119 | return 1; | 121 | |
122 | if( ID == "peers" ) { | ||
123 | S = removeSpaces( QString("/tmp/") + connection()->name() ); | ||
124 | |||
125 | F = new QFile( S ); | ||
126 | |||
127 | if( ! F->open( IO_WriteOnly ) ) { | ||
128 | Log(("Cannot open file %s\n", S.latin1() )); | ||
129 | return 0; | ||
130 | } | ||
131 | } else if ( ID == "chatscripts" ) { | ||
132 | S = removeSpaces( QString("/tmp/") + connection()->name() + ".chat" ); | ||
133 | F = new QFile( S ); | ||
134 | |||
135 | if( ! F->open( IO_WriteOnly ) ) { | ||
136 | Log(("Cannot open file %s\n", S.latin1() )); | ||
137 | return 0; | ||
138 | } | ||
139 | } | ||
140 | if( F ) { | ||
141 | Log(("Generate proper file %s = %s\n", | ||
142 | ID.latin1(), F->name().latin1())); | ||
143 | } | ||
144 | return F; | ||
120 | } | 145 | } |
121 | 146 | ||
147 | short APPP::generateFile( const QString & ID, | ||
148 | const QString & Path, | ||
149 | QTextStream & TS, | ||
150 | long DevNr ) { | ||
151 | short rvl, rvd; | ||
152 | |||
153 | rvl = 1; | ||
154 | rvd = 1; | ||
155 | |||
156 | if( ID == "pap-secrets" ) { | ||
157 | Log(("Generate PPP for %s\n", ID.latin1() )); | ||
158 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) { | ||
159 | TS << "# secrets for " | ||
160 | << connection()->name().latin1() | ||
161 | << endl; | ||
162 | TS << Data.Auth.Client | ||
163 | << " " | ||
164 | << Data.Auth.Server | ||
165 | << " " | ||
166 | << Data.Auth.Secret | ||
167 | << endl; | ||
168 | rvl = 0; | ||
169 | rvd = connection()->getToplevel()->generateFileEmbedded( | ||
170 | ID, Path, TS, DevNr ); | ||
171 | } | ||
172 | } else if( ID == "chap-secrets" ) { | ||
173 | Log(("Generate PPP for %s\n", ID.latin1() )); | ||
174 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) { | ||
175 | // used for both EAP and Chap | ||
176 | TS << "# secrets for " | ||
177 | << connection()->name().latin1() | ||
178 | << endl; | ||
179 | TS << Data.Auth.Client | ||
180 | << " " | ||
181 | << Data.Auth.Server | ||
182 | << " " | ||
183 | << Data.Auth.Secret | ||
184 | << endl; | ||
185 | |||
186 | rvl = 0; | ||
187 | rvd = connection()->getToplevel()->generateFileEmbedded( | ||
188 | ID, Path, TS, DevNr ); | ||
189 | } | ||
190 | } else if ( ID == "peers" ) { | ||
191 | QFileInfo FI(Path); | ||
192 | Log(("Generate PPP for %s\n", ID.latin1() )); | ||
193 | |||
194 | TS << "connect \"/usr/sbin/chat -v -f /etc/ppp/" | ||
195 | << FI.baseName() | ||
196 | << ".chat\"" | ||
197 | << endl; | ||
198 | |||
199 | if( Data.IP.GWIsDefault ) { | ||
200 | TS << "defaultroute" | ||
201 | << endl; | ||
202 | } | ||
203 | |||
204 | TS << "linkname " | ||
205 | << removeSpaces( ID.latin1() ) | ||
206 | << endl; | ||
207 | |||
208 | // insert other data here | ||
209 | rvl = 0; | ||
210 | rvd = connection()->getToplevel()->generateFileEmbedded( | ||
211 | ID, Path, TS, DevNr ); | ||
212 | } else if ( ID == "chatscripts" ) { | ||
213 | Log(("Generate PPP for %s\n", ID.latin1() )); | ||
214 | rvl = 0; | ||
215 | rvd = connection()->getToplevel()->generateFileEmbedded( | ||
216 | ID, Path, TS, DevNr ); | ||
217 | } | ||
218 | |||
219 | return (rvd == 2 || rvl == 2 ) ? 2 : | ||
220 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | ||
221 | } | ||
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h index 989c2f0..0bf8fa9 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.h +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h | |||
@@ -2,41 +2,44 @@ | |||
2 | #define PPP_H | 2 | #define PPP_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "pppdata.h" | 5 | #include "pppdata.h" |
6 | #include "ppprun.h" | 6 | #include "ppprun.h" |
7 | 7 | ||
8 | class PPPNetNode; | 8 | class PPPNetNode; |
9 | class PPPEdit; | 9 | class PPPEdit; |
10 | class QTextStream; | ||
10 | 11 | ||
11 | class APPP : public ANetNodeInstance { | 12 | class APPP : public ANetNodeInstance { |
12 | 13 | ||
13 | public : | 14 | public : |
14 | 15 | ||
15 | APPP( PPPNetNode * PNN ); | 16 | APPP( PPPNetNode * PNN ); |
16 | 17 | ||
17 | QWidget * edit( QWidget * parent ); | ||
18 | QString acceptable( void ); | ||
19 | void commit( void ); | ||
20 | |||
21 | RuntimeInfo * runtime( void ) | 18 | RuntimeInfo * runtime( void ) |
22 | { if( RT == 0 ) | 19 | { if( RT == 0 ) { |
23 | RT = new PPPRun( this, Data ); | 20 | RT = new PPPRun( this, Data ); |
21 | } | ||
24 | return RT->runtimeInfo(); | 22 | return RT->runtimeInfo(); |
25 | } | 23 | } |
26 | 24 | ||
25 | QWidget * edit( QWidget * parent ); | ||
26 | QString acceptable( void ); | ||
27 | void commit( void ); | ||
28 | |||
27 | virtual void * data( void ) | 29 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 30 | { return (void *)&Data; } |
29 | 31 | ||
30 | virtual bool hasDataFor( const QString & ) | 32 | virtual QFile * openFile( const QString & ID ); |
31 | { return 0; } | 33 | short generateFile( const QString & ID, |
34 | const QString & Path, | ||
35 | QTextStream & TS, | ||
36 | long DevNr ); | ||
32 | 37 | ||
33 | virtual bool generateDataForCommonFile( | ||
34 | SystemFile & SF, long DevNr ); | ||
35 | protected : | 38 | protected : |
36 | 39 | ||
37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 40 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
38 | virtual void saveSpecificAttribute( QTextStream & TS ); | 41 | virtual void saveSpecificAttribute( QTextStream & TS ); |
39 | 42 | ||
40 | private : | 43 | private : |
41 | 44 | ||
42 | PPPEdit * GUI; | 45 | PPPEdit * GUI; |