author | tille <tille> | 2003-05-30 15:06:17 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-30 15:06:17 (UTC) |
commit | 8699d02f6c152afed9490e7e7a4315044261e6e8 (patch) (unidiff) | |
tree | d2ee2ba401c7a9db0e33beaf0617a1456fe01d50 /noncore/settings/networksettings/ppp/edit.cpp | |
parent | d8cec07fe5e54a68afe4feca574f9f4d2433e0c1 (diff) | |
download | opie-8699d02f6c152afed9490e7e7a4315044261e6e8.zip opie-8699d02f6c152afed9490e7e7a4315044261e6e8.tar.gz opie-8699d02f6c152afed9490e7e7a4315044261e6e8.tar.bz2 |
modem and pppdata is now member of interfaceppp
Diffstat (limited to 'noncore/settings/networksettings/ppp/edit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 123 |
1 files changed, 62 insertions, 61 deletions
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index eee643d..8ae714e 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -45,8 +45,9 @@ | |||
45 | #include "iplined.h" | 45 | #include "iplined.h" |
46 | #include "auth.h" | 46 | #include "auth.h" |
47 | 47 | ||
48 | DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | 48 | DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount |
49 | : QWidget(parent, name) | 49 | , const char *name ) |
50 | : QWidget(parent, name), _pppdata(pd) | ||
50 | { | 51 | { |
51 | const int GRIDROWS = 6; | 52 | const int GRIDROWS = 6; |
52 | 53 | ||
@@ -154,10 +155,10 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
154 | 155 | ||
155 | // Set defaults if editing an existing connection | 156 | // Set defaults if editing an existing connection |
156 | if(!isnewaccount) { | 157 | if(!isnewaccount) { |
157 | connectname_l->setText(PPPData::data()->accname()); | 158 | connectname_l->setText(_pppdata->accname()); |
158 | 159 | ||
159 | // insert the phone numbers into the listbox | 160 | // insert the phone numbers into the listbox |
160 | QString n = PPPData::data()->phonenumber(); | 161 | QString n = _pppdata->phonenumber(); |
161 | QString tmp = ""; | 162 | QString tmp = ""; |
162 | uint idx = 0; | 163 | uint idx = 0; |
163 | while(idx != n.length()) { | 164 | while(idx != n.length()) { |
@@ -172,8 +173,8 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
172 | if(tmp.length() > 0) | 173 | if(tmp.length() > 0) |
173 | numbers->insertItem(tmp); | 174 | numbers->insertItem(tmp); |
174 | 175 | ||
175 | auth->setCurrentItem(PPPData::data()->authMethod()); | 176 | auth->setCurrentItem(_pppdata->authMethod()); |
176 | store_password->setChecked(PPPData::data()->storePassword()); | 177 | store_password->setChecked(_pppdata->storePassword()); |
177 | } else { | 178 | } else { |
178 | // select PAP/CHAP as default | 179 | // select PAP/CHAP as default |
179 | auth->setCurrentItem(AUTH_PAPCHAP); | 180 | auth->setCurrentItem(AUTH_PAPCHAP); |
@@ -187,10 +188,10 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
187 | bool DialWidget::save() { | 188 | bool DialWidget::save() { |
188 | //first check to make sure that the account name is unique! | 189 | //first check to make sure that the account name is unique! |
189 | if(connectname_l->text().isEmpty() || | 190 | if(connectname_l->text().isEmpty() || |
190 | !PPPData::data()->isUniqueAccname(connectname_l->text())) { | 191 | !_pppdata->isUniqueAccname(connectname_l->text())) { |
191 | return false; | 192 | return false; |
192 | } else { | 193 | } else { |
193 | PPPData::data()->setAccname(connectname_l->text()); | 194 | _pppdata->setAccname(connectname_l->text()); |
194 | 195 | ||
195 | QString number = ""; | 196 | QString number = ""; |
196 | for(uint i = 0; i < numbers->count(); i++) { | 197 | for(uint i = 0; i < numbers->count(); i++) { |
@@ -199,9 +200,9 @@ bool DialWidget::save() { | |||
199 | number += numbers->text(i); | 200 | number += numbers->text(i); |
200 | } | 201 | } |
201 | 202 | ||
202 | PPPData::data()->setPhonenumber(number); | 203 | _pppdata->setPhonenumber(number); |
203 | PPPData::data()->setAuthMethod(auth->currentItem()); | 204 | _pppdata->setAuthMethod(auth->currentItem()); |
204 | PPPData::data()->setStorePassword(store_password->isChecked()); | 205 | _pppdata->setStorePassword(store_password->isChecked()); |
205 | return true; | 206 | return true; |
206 | } | 207 | } |
207 | } | 208 | } |
@@ -222,7 +223,7 @@ void DialWidget::selectionChanged(int) { | |||
222 | 223 | ||
223 | 224 | ||
224 | void DialWidget::addNumber() { | 225 | void DialWidget::addNumber() { |
225 | PhoneNumberDialog dlg(this); | 226 | PhoneNumberDialog dlg(this); |
226 | if(dlg.exec()) { | 227 | if(dlg.exec()) { |
227 | numbers->insertItem(dlg.phoneNumber()); | 228 | numbers->insertItem(dlg.phoneNumber()); |
228 | numbersChanged(); | 229 | numbersChanged(); |
@@ -263,7 +264,7 @@ void DialWidget::downNumber() { | |||
263 | 264 | ||
264 | 265 | ||
265 | void DialWidget::pppdargsbutton() { | 266 | void DialWidget::pppdargsbutton() { |
266 | PPPdArguments pa(this); | 267 | PPPdArguments pa(_pppdata, this); |
267 | pa.exec(); | 268 | pa.exec(); |
268 | } | 269 | } |
269 | 270 | ||
@@ -272,8 +273,8 @@ void DialWidget::pppdargsbutton() { | |||
272 | ///////////////////////////////////////////////////////////////////////////// | 273 | ///////////////////////////////////////////////////////////////////////////// |
273 | // ExecWidget | 274 | // ExecWidget |
274 | ///////////////////////////////////////////////////////////////////////////// | 275 | ///////////////////////////////////////////////////////////////////////////// |
275 | ExecWidget::ExecWidget(QWidget *parent, bool isnewaccount, const char *name) : | 276 | ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) : |
276 | QWidget(parent, name) | 277 | QWidget(parent, name), _pppdata(pd) |
277 | { | 278 | { |
278 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 279 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
279 | 280 | ||
@@ -360,19 +361,19 @@ i18n("Here you can select commands to run at certain stages of the\n" | |||
360 | 361 | ||
361 | // Set defaults if editing an existing connection | 362 | // Set defaults if editing an existing connection |
362 | if(!isnewaccount) { | 363 | if(!isnewaccount) { |
363 | before_connect->setText(PPPData::data()->command_before_connect()); | 364 | before_connect->setText(_pppdata->command_before_connect()); |
364 | command->setText(PPPData::data()->command_on_connect()); | 365 | command->setText(_pppdata->command_on_connect()); |
365 | discommand->setText(PPPData::data()->command_on_disconnect()); | 366 | discommand->setText(_pppdata->command_on_disconnect()); |
366 | predisconnect->setText(PPPData::data()->command_before_disconnect()); | 367 | predisconnect->setText(_pppdata->command_before_disconnect()); |
367 | } | 368 | } |
368 | } | 369 | } |
369 | 370 | ||
370 | 371 | ||
371 | bool ExecWidget::save() { | 372 | bool ExecWidget::save() { |
372 | PPPData::data()->setCommand_before_connect(before_connect->text()); | 373 | _pppdata->setCommand_before_connect(before_connect->text()); |
373 | PPPData::data()->setCommand_on_connect(command->text()); | 374 | _pppdata->setCommand_on_connect(command->text()); |
374 | PPPData::data()->setCommand_before_disconnect(predisconnect->text()); | 375 | _pppdata->setCommand_before_disconnect(predisconnect->text()); |
375 | PPPData::data()->setCommand_on_disconnect(discommand->text()); | 376 | _pppdata->setCommand_on_disconnect(discommand->text()); |
376 | return true; | 377 | return true; |
377 | } | 378 | } |
378 | 379 | ||
@@ -383,8 +384,8 @@ bool ExecWidget::save() { | |||
383 | // IPWidget | 384 | // IPWidget |
384 | // | 385 | // |
385 | ///////////////////////////////////////////////////////////////////////////// | 386 | ///////////////////////////////////////////////////////////////////////////// |
386 | IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) | 387 | IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) |
387 | : QWidget(parent, name) | 388 | : QWidget(parent, name), _pppdata(pd) |
388 | { | 389 | { |
389 | QVBoxLayout *topLayout = new QVBoxLayout(this); | 390 | QVBoxLayout *topLayout = new QVBoxLayout(this); |
390 | topLayout->setSpacing( 3 );//KDialog::spacingHint()); | 391 | topLayout->setSpacing( 3 );//KDialog::spacingHint()); |
@@ -449,7 +450,7 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
449 | QWhatsThis::add(subnetmask_l,tmp); | 450 | QWhatsThis::add(subnetmask_l,tmp); |
450 | 451 | ||
451 | autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this); | 452 | autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this); |
452 | autoname->setChecked(PPPData::data()->autoname()); | 453 | autoname->setChecked(_pppdata->autoname()); |
453 | connect(autoname,SIGNAL(toggled(bool)), | 454 | connect(autoname,SIGNAL(toggled(bool)), |
454 | this,SLOT(autoname_t(bool))); | 455 | this,SLOT(autoname_t(bool))); |
455 | 456 | ||
@@ -469,15 +470,15 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
469 | 470 | ||
470 | //load info from gpppdata | 471 | //load info from gpppdata |
471 | if(!isnewaccount) { | 472 | if(!isnewaccount) { |
472 | if(PPPData::data()->ipaddr() == "0.0.0.0" && | 473 | if(_pppdata->ipaddr() == "0.0.0.0" && |
473 | PPPData::data()->subnetmask() == "0.0.0.0") { | 474 | _pppdata->subnetmask() == "0.0.0.0") { |
474 | dynamicadd_rb->setChecked(true); | 475 | dynamicadd_rb->setChecked(true); |
475 | hitIPSelect(0); | 476 | hitIPSelect(0); |
476 | autoname->setChecked(PPPData::data()->autoname()); | 477 | autoname->setChecked(_pppdata->autoname()); |
477 | } | 478 | } |
478 | else { | 479 | else { |
479 | ipaddress_l->setText(PPPData::data()->ipaddr()); | 480 | ipaddress_l->setText(_pppdata->ipaddr()); |
480 | subnetmask_l->setText(PPPData::data()->subnetmask()); | 481 | subnetmask_l->setText(_pppdata->subnetmask()); |
481 | staticadd_rb->setChecked(true); | 482 | staticadd_rb->setChecked(true); |
482 | autoname->setChecked(false); | 483 | autoname->setChecked(false); |
483 | } | 484 | } |
@@ -510,13 +511,13 @@ void IPWidget::autoname_t(bool on) { | |||
510 | 511 | ||
511 | void IPWidget::save() { | 512 | void IPWidget::save() { |
512 | if(dynamicadd_rb->isChecked()) { | 513 | if(dynamicadd_rb->isChecked()) { |
513 | PPPData::data()->setIpaddr("0.0.0.0"); | 514 | _pppdata->setIpaddr("0.0.0.0"); |
514 | PPPData::data()->setSubnetmask("0.0.0.0"); | 515 | _pppdata->setSubnetmask("0.0.0.0"); |
515 | } else { | 516 | } else { |
516 | PPPData::data()->setIpaddr(ipaddress_l->text()); | 517 | _pppdata->setIpaddr(ipaddress_l->text()); |
517 | PPPData::data()->setSubnetmask(subnetmask_l->text()); | 518 | _pppdata->setSubnetmask(subnetmask_l->text()); |
518 | } | 519 | } |
519 | PPPData::data()->setAutoname(autoname->isChecked()); | 520 | _pppdata->setAutoname(autoname->isChecked()); |
520 | } | 521 | } |
521 | 522 | ||
522 | 523 | ||
@@ -537,8 +538,8 @@ void IPWidget::hitIPSelect( int i ) { | |||
537 | 538 | ||
538 | 539 | ||
539 | 540 | ||
540 | DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | 541 | DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) |
541 | : QWidget(parent, name) | 542 | : QWidget(parent, name), _pppdata(pd) |
542 | { | 543 | { |
543 | // box = new QGroupBox(this); | 544 | // box = new QGroupBox(this); |
544 | QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );//, KDialog::spacingHint()); | 545 | QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );//, KDialog::spacingHint()); |
@@ -572,7 +573,7 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
572 | bg->insert(autodns, 0); | 573 | bg->insert(autodns, 0); |
573 | tl->addWidget(autodns, 1, 1); | 574 | tl->addWidget(autodns, 1, 1); |
574 | // no automatic DNS detection for pppd < 2.3.7 | 575 | // no automatic DNS detection for pppd < 2.3.7 |
575 | if(!PPPData::data()->pppdVersionMin(2, 3, 7)) | 576 | if(!_pppdata->pppdVersionMin(2, 3, 7)) |
576 | autodns->setEnabled(false); | 577 | autodns->setEnabled(false); |
577 | 578 | ||
578 | mandns = new QRadioButton(i18n("Manual"), this); | 579 | mandns = new QRadioButton(i18n("Manual"), this); |
@@ -645,7 +646,7 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
645 | exdnsdisabled_toggle = new QCheckBox(i18n( \ | 646 | exdnsdisabled_toggle = new QCheckBox(i18n( \ |
646 | "Disable existing DNS servers during connection"), | 647 | "Disable existing DNS servers during connection"), |
647 | this); | 648 | this); |
648 | exdnsdisabled_toggle->setChecked(PPPData::data()->exDNSDisabled()); | 649 | exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled()); |
649 | tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); | 650 | tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); |
650 | QWhatsThis::add(exdnsdisabled_toggle, | 651 | QWhatsThis::add(exdnsdisabled_toggle, |
651 | i18n("<p>When this option is selected, all DNS\n" | 652 | i18n("<p>When this option is selected, all DNS\n" |
@@ -661,11 +662,11 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
661 | 662 | ||
662 | // restore data if editing | 663 | // restore data if editing |
663 | if(!isnewaccount) { | 664 | if(!isnewaccount) { |
664 | dnsservers->insertStringList(PPPData::data()->dns()); | 665 | dnsservers->insertStringList(_pppdata->dns()); |
665 | dnsdomain->setText(PPPData::data()->domain()); | 666 | dnsdomain->setText(_pppdata->domain()); |
666 | } | 667 | } |
667 | 668 | ||
668 | int mode = PPPData::data()->autoDNS() ? 0 : 1; | 669 | int mode = _pppdata->autoDNS() ? 0 : 1; |
669 | bg->setButton(mode); | 670 | bg->setButton(mode); |
670 | DNS_Mode_Selected(mode); | 671 | DNS_Mode_Selected(mode); |
671 | 672 | ||
@@ -695,20 +696,20 @@ void DNSWidget::DNS_Mode_Selected(int mode) { | |||
695 | } | 696 | } |
696 | 697 | ||
697 | void DNSWidget::save() { | 698 | void DNSWidget::save() { |
698 | PPPData::data()->setAutoDNS(bg->id(bg->selected()) == 0); | 699 | _pppdata->setAutoDNS(bg->id(bg->selected()) == 0); |
699 | QStringList serverlist; | 700 | QStringList serverlist; |
700 | for(uint i=0; i < dnsservers->count(); i++) | 701 | for(uint i=0; i < dnsservers->count(); i++) |
701 | serverlist.append(dnsservers->text(i)); | 702 | serverlist.append(dnsservers->text(i)); |
702 | PPPData::data()->setDns(serverlist); | 703 | _pppdata->setDns(serverlist); |
703 | 704 | ||
704 | // strip leading dot | 705 | // strip leading dot |
705 | QString s(dnsdomain->text()); | 706 | QString s(dnsdomain->text()); |
706 | if(s.left(1) == ".") | 707 | if(s.left(1) == ".") |
707 | PPPData::data()->setDomain(s.mid(1)); | 708 | _pppdata->setDomain(s.mid(1)); |
708 | else | 709 | else |
709 | PPPData::data()->setDomain(dnsdomain->text()); | 710 | _pppdata->setDomain(dnsdomain->text()); |
710 | 711 | ||
711 | PPPData::data()->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); | 712 | _pppdata->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); |
712 | } | 713 | } |
713 | 714 | ||
714 | 715 | ||
@@ -732,8 +733,8 @@ void DNSWidget::removedns() { | |||
732 | // | 733 | // |
733 | // GatewayWidget | 734 | // GatewayWidget |
734 | // | 735 | // |
735 | GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) | 736 | GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) |
736 | : QWidget(parent, name) | 737 | : QWidget(parent, name), _pppdata(pd) |
737 | { | 738 | { |
738 | QVBoxLayout *topLayout = new QVBoxLayout(this); | 739 | QVBoxLayout *topLayout = new QVBoxLayout(this); |
739 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); | 740 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); |
@@ -785,15 +786,15 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na | |||
785 | 786 | ||
786 | //load info from gpppdata | 787 | //load info from gpppdata |
787 | if(!isnewaccount) { | 788 | if(!isnewaccount) { |
788 | if(PPPData::data()->gateway() == "0.0.0.0") { | 789 | if(_pppdata->gateway() == "0.0.0.0") { |
789 | defaultgateway->setChecked(true); | 790 | defaultgateway->setChecked(true); |
790 | hitGatewaySelect(0); | 791 | hitGatewaySelect(0); |
791 | } | 792 | } |
792 | else { | 793 | else { |
793 | gatewayaddr->setText(PPPData::data()->gateway()); | 794 | gatewayaddr->setText(_pppdata->gateway()); |
794 | staticgateway->setChecked(true); | 795 | staticgateway->setChecked(true); |
795 | } | 796 | } |
796 | defaultroute->setChecked(PPPData::data()->defaultroute()); | 797 | defaultroute->setChecked(_pppdata->defaultroute()); |
797 | } | 798 | } |
798 | else { | 799 | else { |
799 | defaultgateway->setChecked(true); | 800 | defaultgateway->setChecked(true); |
@@ -803,8 +804,8 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na | |||
803 | } | 804 | } |
804 | 805 | ||
805 | void GatewayWidget::save() { | 806 | void GatewayWidget::save() { |
806 | PPPData::data()->setGateway(gatewayaddr->text()); | 807 | _pppdata->setGateway(gatewayaddr->text()); |
807 | PPPData::data()->setDefaultroute(defaultroute->isChecked()); | 808 | _pppdata->setDefaultroute(defaultroute->isChecked()); |
808 | } | 809 | } |
809 | 810 | ||
810 | 811 | ||
@@ -823,8 +824,8 @@ void GatewayWidget::hitGatewaySelect( int i ) { | |||
823 | 824 | ||
824 | 825 | ||
825 | 826 | ||
826 | ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) | 827 | ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) |
827 | : QWidget(parent, name) | 828 | : QWidget(parent, name),_pppdata(pd) |
828 | { | 829 | { |
829 | 830 | ||
830 | QVBoxLayout *tl = new QVBoxLayout(this, 0 ); | 831 | QVBoxLayout *tl = new QVBoxLayout(this, 0 ); |
@@ -867,8 +868,8 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name | |||
867 | 868 | ||
868 | //load data from gpppdata | 869 | //load data from gpppdata |
869 | if(!isnewaccount) { | 870 | if(!isnewaccount) { |
870 | QStringList &comlist = PPPData::data()->scriptType(); | 871 | QStringList &comlist = _pppdata->scriptType(); |
871 | QStringList &arglist = PPPData::data()->script(); | 872 | QStringList &arglist = _pppdata->script(); |
872 | QStringList::Iterator itcom = comlist.begin(); | 873 | QStringList::Iterator itcom = comlist.begin(); |
873 | QStringList::Iterator itarg = arglist.begin(); | 874 | QStringList::Iterator itarg = arglist.begin(); |
874 | 875 | ||
@@ -914,8 +915,8 @@ void ScriptWidget::save() { | |||
914 | typelist.append(stl->text(i)); | 915 | typelist.append(stl->text(i)); |
915 | arglist.append(sl->text(i)); | 916 | arglist.append(sl->text(i)); |
916 | } | 917 | } |
917 | PPPData::data()->setScriptType(typelist); | 918 | _pppdata->setScriptType(typelist); |
918 | PPPData::data()->setScript(arglist); | 919 | _pppdata->setScript(arglist); |
919 | } | 920 | } |
920 | 921 | ||
921 | 922 | ||