00001 #include <qmessagebox.h>
00002 #include <qcheckbox.h>
00003 #include <qradiobutton.h>
00004 #include <qlineedit.h>
00005 #include <GUIUtils.h>
00006 #include "PPPIPedit.h"
00007
00008 PPPIPEdit::PPPIPEdit( QWidget * Parent ) : PPPIPGUI( Parent ){
00009 }
00010
00011 QString PPPIPEdit::acceptable( void ) {
00012 if( GWFixed_RB->isChecked() ) {
00013 if( GWAddress_LE->text().isEmpty() )
00014 return tr("Gateway address needed" );
00015 if( ! validIP( GWAddress_LE->text() ) )
00016 return tr("Gateway address not valid" );
00017 };
00018
00019 return QString();
00020 }
00021
00022 bool PPPIPEdit::commit( PPPData & D ) {
00023
00024 bool SM = 0;
00025
00026 CBM( D.IP.LocalOverrule, ServerOverrulesLocal_CB, SM );
00027 CBM( D.IP.RemoteOverrule, ServerOverrulesRemote_CB, SM );
00028
00029 TXTM( D.IP.LocalAddress, LocalAddress_LE, SM );
00030 TXTM( D.IP.RemoteAddress, RemoteAddress_LE, SM );
00031
00032 CBM( D.IP.GWAutomatic, GWServerAssigned_RB, SM );
00033
00034 if( ! D.IP.GWAutomatic ) {
00035 TXTM( D.IP.GWAddress, GWAddress_LE, SM );
00036 }
00037
00038 CBM( D.IP.GWIsDefault, GWIsDefault_CB, SM );
00039 CBM( D.IP.GWIfNotSet, GWIfNotSet_CB, SM );
00040
00041 return SM;
00042 }
00043
00044 void PPPIPEdit::showData( PPPData & D ) {
00045 ServerOverrulesLocal_CB->setChecked( D.IP.LocalOverrule );
00046 ServerOverrulesRemote_CB->setChecked( D.IP.RemoteOverrule );
00047 LocalAddress_LE->setText( D.IP.LocalAddress );
00048 RemoteAddress_LE->setText( D.IP.RemoteAddress );
00049
00050 GWServerAssigned_RB->setChecked( D.IP.GWAutomatic );
00051 GWAddress_LE->setText( D.IP.GWAddress );
00052 GWIsDefault_CB->setChecked( D.IP.GWIsDefault );
00053 GWIfNotSet_CB->setChecked( D.IP.GWIfNotSet );
00054 }