summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/ppp/PPPIPedit.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/ppp/PPPIPedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/ppp/PPPIPedit.cpp57
1 files changed, 57 insertions, 0 deletions
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
8PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){
9}
10
11QString 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
31bool 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
50void 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}