00001 #include <qspinbox.h>
00002 #include <qlineedit.h>
00003 #include <qcheckbox.h>
00004 #include <qslider.h>
00005
00006 #include <qpe/config.h>
00007
00008 #include "linphoneconfig.h"
00009
00010
00011 LinPhoneConfig::LinPhoneConfig( QWidget* parent , const char* name , bool modal, WFlags fl ) : SettingsDialog( parent, name, modal, fl ) {
00012 loadConfig();
00013 }
00014
00015 LinPhoneConfig::~LinPhoneConfig() {
00016 }
00017
00018 void LinPhoneConfig::loadConfig() {
00019 Config cfg("opie-phone");
00020 cfg.setGroup( "net" );
00021 cfg.setGroup( "sip" );
00022 PortSpin->setValue( cfg.readNumEntry( "sip_port", 5060 ) );
00023 UserPartLine->setText( cfg.readEntry( "username", "" ) );
00024 HostPartLine->setText( cfg.readEntry( "hostname", "" ) );
00025 CheckBoxReg->setChecked( cfg.readBoolEntry( "use_registrar", 0 ) );
00026 ServerAddressLine->setText( cfg.readEntry( "registrar", "" ) );
00027
00028 PasswordLine->setText( cfg.readEntry( "reg_password", "" ) );
00029 RecordLine->setText( cfg.readEntry( "addr_of_rec", "" ) );
00030 CheckBoxProxy->setChecked( cfg.readBoolEntry( "as_proxy", 0 ) );
00031 cfg.setGroup( "rtp" );
00032 RTPPort->setText( cfg.readEntry( "audio_rtp_port", "" ) );
00033 SliderJitter->setValue( cfg.readNumEntry( "jitt_comp", 60 ) );
00034 cfg.setGroup( "audio" );
00035
00036 cfg.setGroup( "video" );
00037 cfg.setGroup( "codecs" );
00038 cfg.setGroup( "address_book" );
00039 }
00040
00041 void LinPhoneConfig::writeConfig() {
00042 Config cfg("opie-phone");
00043 cfg.setGroup( "net" );
00044 cfg.setGroup( "sip" );
00045 cfg.writeEntry( "sip_port", PortSpin->value() );
00046 cfg.writeEntry( "username", UserPartLine->text() );
00047 cfg.writeEntry( "hostname", HostPartLine->text() );
00048 cfg.writeEntry( "use_registrar", CheckBoxReg->isChecked() );
00049 cfg.writeEntry( "registrar", ServerAddressLine->text() );
00050 cfg.writeEntry( "reg_password", PasswordLine->text() );
00051 cfg.writeEntry( "addr_of_rec", RecordLine->text() );
00052 cfg.writeEntry( "as_proxy", CheckBoxProxy->isChecked() );
00053 cfg.setGroup( "rtp" );
00054 cfg.writeEntry( "audio_rtp_port", RTPPort->text() );
00055 cfg.writeEntry( "jitt_comp", SliderJitter->value() );
00056 cfg.setGroup( "audio" );
00057 cfg.setGroup( "video" );
00058 cfg.setGroup( "codecs" );
00059 cfg.setGroup( "address_book" );
00060 }
00061
00062 void LinPhoneConfig::accept() {
00063 writeConfig();
00064 QDialog::accept();
00065 }