Diffstat (limited to 'noncore/settings/networksettings2/ppp/PPPAuthedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/ppp/PPPAuthedit.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
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 | } | ||