From 5334b639c9f97793bcae4f50f7b47c7a2ada4e2f Mon Sep 17 00:00:00 2001 From: wimpie Date: Fri, 02 Apr 2004 18:29:49 +0000 Subject: First import of NS2 app --- (limited to 'noncore/settings/networksettings2/ppp/PPPIPedit.cpp') 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 @@ +#include +#include +#include +#include +#include +#include "PPPIPedit.h" + +PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){ +} + +QString PPPIPEdit::acceptable( void ) { + if( IPFixed_RB->isChecked() ) { + if( IPAddress_LE->text().isEmpty() ) + return tr("IPAddress needed" ); + if( ! validIP( IPAddress_LE->text() ) ) + return tr("IPAddress not valid" ); + if( IPSubMask_LE->text().isEmpty() ) + return tr("Subnet mask needed" ); + if( ! validIP( IPSubMask_LE->text() ) ) + return tr("Subnet mask not valid" ); + } else if( GWFixed_RB->isChecked() ) { + if( GWAddress_LE->text().isEmpty() ) + return tr("Gateway address needed" ); + if( ! validIP( GWAddress_LE->text() ) ) + return tr("Gateway address not valid" ); + }; + + return QString(); +} + +bool PPPIPEdit::commit( PPPData_t & D ) { + + bool SM = 0; + + CBM( D.IP.IPAutomatic, IPServerAssigned_RB, SM ); + if( ! D.IP.IPAutomatic ) { + TXTM( D.IP.IPAddress, IPAddress_LE, SM ); + TXTM( D.IP.IPSubMask, IPSubMask_LE, SM ); + } + + CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM ); + if( ! D.IP.GWAutomatic ) { + TXTM( D.IP.GWAddress, GWAddress_LE, SM ); + } + + CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM ); + return SM; +} + +void PPPIPEdit::showData( PPPData_t & D ) { + IPServerAssigned_RB->setChecked( D.IP.IPAutomatic ); + IPAddress_LE->setText( D.IP.IPAddress ); + IPSubMask_LE->setText( D.IP.IPSubMask ); + GWServerAssigned_RB->setChecked( D.IP.GWAutomatic ); + GWAddress_LE->setText( D.IP.GWAddress ); + GWIsDefault_CB->setChecked( D.IP.GWIsDefault ); +} -- cgit v0.9.0.2