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 | |||
@@ -42,14 +42,15 @@ | |||
42 | #include "edit.h" | 42 | #include "edit.h" |
43 | #include "pppdata.h" | 43 | #include "pppdata.h" |
44 | //#include "newwidget.h" | 44 | //#include "newwidget.h" |
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 | ||
53 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); | 54 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); |
54 | 55 | ||
55 | connect_label = new QLabel(i18n("Connection name:"), this); | 56 | connect_label = new QLabel(i18n("Connection name:"), this); |
@@ -151,16 +152,16 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
151 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); | 152 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); |
152 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); | 153 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); |
153 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); | 154 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); |
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()) { |
164 | if(n[idx] == ':') { | 165 | if(n[idx] == ':') { |
165 | if(tmp.length() > 0) | 166 | if(tmp.length() > 0) |
166 | numbers->insertItem(tmp); | 167 | numbers->insertItem(tmp); |
@@ -169,14 +170,14 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
169 | tmp += n[idx]; | 170 | tmp += n[idx]; |
170 | idx++; | 171 | idx++; |
171 | } | 172 | } |
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); |
180 | } | 181 | } |
181 | 182 | ||
182 | numbersChanged(); | 183 | numbersChanged(); |
@@ -184,27 +185,27 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
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++) { |
197 | if(i != 0) | 198 | if(i != 0) |
198 | number += ":"; | 199 | number += ":"; |
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 | } |
208 | 209 | ||
209 | 210 | ||
210 | void DialWidget::numbersChanged() { | 211 | void DialWidget::numbersChanged() { |
@@ -219,13 +220,13 @@ void DialWidget::numbersChanged() { | |||
219 | void DialWidget::selectionChanged(int) { | 220 | void DialWidget::selectionChanged(int) { |
220 | numbersChanged(); | 221 | numbersChanged(); |
221 | } | 222 | } |
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(); |
229 | } | 230 | } |
230 | } | 231 | } |
231 | 232 | ||
@@ -260,23 +261,23 @@ void DialWidget::downNumber() { | |||
260 | numbersChanged(); | 261 | numbersChanged(); |
261 | } | 262 | } |
262 | } | 263 | } |
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 | ||
270 | 271 | ||
271 | 272 | ||
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 | ||
280 | QLabel *l = new QLabel(\ | 281 | QLabel *l = new QLabel(\ |
281 | i18n("Here you can select commands to run at certain stages of the\n" | 282 | i18n("Here you can select commands to run at certain stages of the\n" |
282 | "connection. The commands are run with your real user id, so\n" | 283 | "connection. The commands are run with your real user id, so\n" |
@@ -357,37 +358,37 @@ i18n("Here you can select commands to run at certain stages of the\n" | |||
357 | 358 | ||
358 | tl->addStretch(1); | 359 | tl->addStretch(1); |
359 | tl->activate(); | 360 | tl->activate(); |
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 | ||
379 | 380 | ||
380 | 381 | ||
381 | ///////////////////////////////////////////////////////////////////////////// | 382 | ///////////////////////////////////////////////////////////////////////////// |
382 | // | 383 | // |
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()); |
391 | 392 | ||
392 | box = new QVGroupBox(i18n("Configuration"), this); | 393 | box = new QVGroupBox(i18n("Configuration"), this); |
393 | // box->setInsideSpacing( 1 );//KDialog::spacingHint()); | 394 | // box->setInsideSpacing( 1 );//KDialog::spacingHint()); |
@@ -446,13 +447,13 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
446 | ipLayout->addWidget(subnetmask_l, 1, 1); | 447 | ipLayout->addWidget(subnetmask_l, 1, 1); |
447 | 448 | ||
448 | QWhatsThis::add(sub_label,tmp); | 449 | QWhatsThis::add(sub_label,tmp); |
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 | ||
456 | QWhatsThis::add(autoname, | 457 | QWhatsThis::add(autoname, |
457 | i18n("<p>Whenever you connect, this reconfigures\n" | 458 | i18n("<p>Whenever you connect, this reconfigures\n" |
458 | "your hostname to match the IP address you\n" | 459 | "your hostname to match the IP address you\n" |
@@ -466,21 +467,21 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
466 | topLayout->addWidget(box); | 467 | topLayout->addWidget(box); |
467 | topLayout->addWidget(autoname); | 468 | topLayout->addWidget(autoname); |
468 | topLayout->addStretch(); | 469 | topLayout->addStretch(); |
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 | } |
484 | } | 485 | } |
485 | else { | 486 | else { |
486 | dynamicadd_rb->setChecked(true); | 487 | dynamicadd_rb->setChecked(true); |
@@ -507,19 +508,19 @@ void IPWidget::autoname_t(bool on) { | |||
507 | } | 508 | } |
508 | } | 509 | } |
509 | 510 | ||
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 | ||
523 | void IPWidget::hitIPSelect( int i ) { | 524 | void IPWidget::hitIPSelect( int i ) { |
524 | if(i == 0) { | 525 | if(i == 0) { |
525 | ipaddress_label->setEnabled(false); | 526 | ipaddress_label->setEnabled(false); |
@@ -534,14 +535,14 @@ void IPWidget::hitIPSelect( int i ) { | |||
534 | subnetmask_l->setEnabled(true); | 535 | subnetmask_l->setEnabled(true); |
535 | } | 536 | } |
536 | } | 537 | } |
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()); |
545 | 546 | ||
546 | dnsdomain_label = new QLabel(i18n("Domain name:"), this); | 547 | dnsdomain_label = new QLabel(i18n("Domain name:"), this); |
547 | tl->addWidget(dnsdomain_label, 0, 0); | 548 | tl->addWidget(dnsdomain_label, 0, 0); |
@@ -569,13 +570,13 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
569 | bg->hide(); | 570 | bg->hide(); |
570 | 571 | ||
571 | autodns = new QRadioButton(i18n("Automatic"), this); | 572 | autodns = new QRadioButton(i18n("Automatic"), this); |
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); |
579 | bg->insert(mandns, 1); | 580 | bg->insert(mandns, 1); |
580 | tl->addWidget(mandns, 2, 1); | 581 | tl->addWidget(mandns, 2, 1); |
581 | 582 | ||
@@ -642,13 +643,13 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
642 | QWhatsThis::add(servers_label,tmp); | 643 | QWhatsThis::add(servers_label,tmp); |
643 | QWhatsThis::add(dnsservers,tmp); | 644 | QWhatsThis::add(dnsservers,tmp); |
644 | 645 | ||
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" |
652 | "servers specified in <tt>/etc/resolv.conf</tt> are\n" | 653 | "servers specified in <tt>/etc/resolv.conf</tt> are\n" |
653 | "temporary disabled while the dialup connection\n" | 654 | "temporary disabled while the dialup connection\n" |
654 | "is established. After the connection is\n" | 655 | "is established. After the connection is\n" |
@@ -658,17 +659,17 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
658 | "option, but it may become useful under \n" | 659 | "option, but it may become useful under \n" |
659 | "some circumstances.")); | 660 | "some circumstances.")); |
660 | 661 | ||
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 | ||
672 | tl->activate(); | 673 | tl->activate(); |
673 | } | 674 | } |
674 | 675 | ||
@@ -692,26 +693,26 @@ void DNSWidget::DNS_Mode_Selected(int mode) { | |||
692 | dnsservers->clearSelection(); | 693 | dnsservers->clearSelection(); |
693 | dnsservers->setEnabled(on); | 694 | dnsservers->setEnabled(on); |
694 | dnsservers->triggerUpdate(false); | 695 | dnsservers->triggerUpdate(false); |
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 | ||
715 | void DNSWidget::adddns() { | 716 | void DNSWidget::adddns() { |
716 | if(dnsservers->count() < MAX_DNS_ENTRIES) { | 717 | if(dnsservers->count() < MAX_DNS_ENTRIES) { |
717 | dnsservers->insertItem(dnsipaddr->text()); | 718 | dnsservers->insertItem(dnsipaddr->text()); |
@@ -729,14 +730,14 @@ void DNSWidget::removedns() { | |||
729 | } | 730 | } |
730 | 731 | ||
731 | 732 | ||
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()); |
740 | 741 | ||
741 | box = new QVGroupBox(i18n("Configuration"), this); | 742 | box = new QVGroupBox(i18n("Configuration"), this); |
742 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); | 743 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); |
@@ -782,32 +783,32 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na | |||
782 | topLayout->addWidget(box); | 783 | topLayout->addWidget(box); |
783 | topLayout->addWidget(defaultroute); | 784 | topLayout->addWidget(defaultroute); |
784 | topLayout->addStretch(); | 785 | topLayout->addStretch(); |
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); |
800 | hitGatewaySelect(0); | 801 | hitGatewaySelect(0); |
801 | defaultroute->setChecked(true); | 802 | defaultroute->setChecked(true); |
802 | } | 803 | } |
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 | ||
811 | void GatewayWidget::hitGatewaySelect( int i ) { | 812 | void GatewayWidget::hitGatewaySelect( int i ) { |
812 | if(i == 0) { | 813 | if(i == 0) { |
813 | gatewayaddr->setText("0.0.0.0"); | 814 | gatewayaddr->setText("0.0.0.0"); |
@@ -820,14 +821,14 @@ void GatewayWidget::hitGatewaySelect( int i ) { | |||
820 | gate_label->setEnabled(true); | 821 | gate_label->setEnabled(true); |
821 | } | 822 | } |
822 | } | 823 | } |
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 ); |
831 | se = new ScriptEdit(this); | 832 | se = new ScriptEdit(this); |
832 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); | 833 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); |
833 | tl->addWidget(se); | 834 | tl->addWidget(se); |
@@ -864,14 +865,14 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name | |||
864 | l12->addWidget(stl, 1); | 865 | l12->addWidget(stl, 1); |
865 | l12->addWidget(sl, 3); | 866 | l12->addWidget(sl, 3); |
866 | l12->addWidget(slb, 0); | 867 | l12->addWidget(slb, 0); |
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 | ||
875 | for ( ; | 876 | for ( ; |
876 | itcom != comlist.end() && itarg != arglist.end(); | 877 | itcom != comlist.end() && itarg != arglist.end(); |
877 | ++itcom, ++itarg ) | 878 | ++itcom, ++itarg ) |
@@ -911,14 +912,14 @@ bool ScriptWidget::check() { | |||
911 | void ScriptWidget::save() { | 912 | void ScriptWidget::save() { |
912 | QStringList typelist, arglist; | 913 | QStringList typelist, arglist; |
913 | for(uint i=0; i < sl->count(); i++) { | 914 | for(uint i=0; i < sl->count(); i++) { |
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 | ||
922 | 923 | ||
923 | void ScriptWidget::adjustScrollBar() { | 924 | void ScriptWidget::adjustScrollBar() { |
924 | if((int)sl->count() <= sl->numItemsVisible()) | 925 | if((int)sl->count() <= sl->numItemsVisible()) |