summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/kpppwidget.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp150
1 files changed, 75 insertions, 75 deletions
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index 2f9feda..8d70cd4 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -155,13 +155,13 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
155// tl->addLayout(l3); 155// tl->addLayout(l3);
156// tl->addSpacing(5); 156// tl->addSpacing(5);
157// l3->addSpacing(10); 157// l3->addSpacing(10);
158// log = new QCheckBox(i18n("Show lo&g window"), this); 158// log = new QCheckBox(i18n("Show lo&g window"), this);
159// connect(log, SIGNAL(toggled(bool)), 159// connect(log, SIGNAL(toggled(bool)),
160 // this, SLOT(log_window_toggled(bool))); 160 // this, SLOT(log_window_toggled(bool)));
161// log->setChecked(gpppdata.get_show_log_window()); 161// log->setChecked(PPPData::data()->get_show_log_window());
162// l3->addWidget(log); 162// l3->addWidget(log);
163 163
164// QWhatsThis::add(log, 164// QWhatsThis::add(log,
165 // i18n("<p>This controls whether a log window is shown.\n" 165 // i18n("<p>This controls whether a log window is shown.\n"
166 // "A log window shows the communication between\n" 166 // "A log window shows the communication between\n"
167 // "<i>kppp</i> and your modem. This will help you\n" 167 // "<i>kppp</i> and your modem. This will help you\n"
@@ -188,13 +188,13 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
188// connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); 188// connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton()));
189// if(setup_b->sizeHint().width() > minw) 189// if(setup_b->sizeHint().width() > minw)
190// minw = setup_b->sizeHint().width(); 190// minw = setup_b->sizeHint().width();
191 191
192 192
193 193
194// if(gpppdata.access() != KConfig::ReadWrite) 194// if(PPPData::data()->access() != KConfig::ReadWrite)
195// setup_b->setEnabled(false); 195// setup_b->setEnabled(false);
196 196
197// help_b = new QPushButton(i18n("&Help"), this); 197// help_b = new QPushButton(i18n("&Help"), this);
198// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); 198// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton()));
199 199
200// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); 200// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true);
@@ -288,13 +288,13 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl
288// if(!m_strCmdlAccount.isEmpty()) { 288// if(!m_strCmdlAccount.isEmpty()) {
289// m_bCmdlAccount = true; 289// m_bCmdlAccount = true;
290// kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; 290// kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl;
291// } 291// }
292 292
293// if(m_bCmdlAccount){ 293// if(m_bCmdlAccount){
294// bool result = gpppdata.setAccount(m_strCmdlAccount); 294// bool result = PPPData::data()->setAccount(m_strCmdlAccount);
295// if (!result){ 295// if (!result){
296// QString string; 296// QString string;
297// string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); 297// string = i18n("No such Account:\n%1").arg(m_strCmdlAccount);
298// KMessageBox::error(this, string); 298// KMessageBox::error(this, string);
299// m_bCmdlAccount = false; 299// m_bCmdlAccount = false;
300// this->show(); 300// this->show();
@@ -360,62 +360,62 @@ void KPPPWidget::enterPressedInID() {
360void KPPPWidget::enterPressedInPW() { 360void KPPPWidget::enterPressedInPW() {
361 connect_b->setFocus(); 361 connect_b->setFocus();
362} 362}
363 363
364// triggered by the session manager 364// triggered by the session manager
365void KPPPWidget::saveMyself() { 365void KPPPWidget::saveMyself() {
366 gpppdata.save(); 366 PPPData::data()->save();
367} 367}
368 368
369void KPPPWidget::shutDown() { 369void KPPPWidget::shutDown() {
370 interruptConnection(); 370 interruptConnection();
371 saveMyself(); 371 saveMyself();
372} 372}
373 373
374void KPPPWidget::log_window_toggled(bool on) { 374void KPPPWidget::log_window_toggled(bool on) {
375 gpppdata.set_show_log_window(on); 375 PPPData::data()->set_show_log_window(on);
376} 376}
377 377
378 378
379 379
380 380
381// void KPPPWidget::resetaccounts() { 381// void KPPPWidget::resetaccounts() {
382// connectto_c->clear(); 382// connectto_c->clear();
383 383
384// int count = gpppdata.count(); 384// int count = PPPData::data()->count();
385 385
386// // enable/disable controls 386// // enable/disable controls
387// connectto_c->setEnabled(count > 0); 387// connectto_c->setEnabled(count > 0);
388// connect_b->setEnabled(count > 0); 388// connect_b->setEnabled(count > 0);
389// log->setEnabled(count > 0); 389// log->setEnabled(count > 0);
390// ID_Edit->setEnabled(count > 0); 390// ID_Edit->setEnabled(count > 0);
391// PW_Edit->setEnabled(count > 0); 391// PW_Edit->setEnabled(count > 0);
392 392
393// //load the accounts 393// //load the accounts
394// for(int i=0; i < count; i++) { 394// for(int i=0; i < count; i++) {
395// gpppdata.setAccountbyIndex(i); 395// PPPData::data()->setAccountbyIndex(i);
396// connectto_c->insertItem(gpppdata.accname()); 396// connectto_c->insertItem(PPPData::data()->accname());
397// } 397// }
398 398
399// //set the default account 399// //set the default account
400// if(!gpppdata.defaultAccount().isEmpty()) { 400// if(!PPPData::data()->defaultAccount().isEmpty()) {
401// for(int i=0; i < count; i++) 401// for(int i=0; i < count; i++)
402// if(gpppdata.defaultAccount() == connectto_c->text(i)) { 402// if(PPPData::data()->defaultAccount() == connectto_c->text(i)) {
403 // connectto_c->setCurrentItem(i); 403 // connectto_c->setCurrentItem(i);
404 // gpppdata.setAccountbyIndex(i); 404 // PPPData::data()->setAccountbyIndex(i);
405 405
406 // ID_Edit->setText(gpppdata.storedUsername()); 406 // ID_Edit->setText(PPPData::data()->storedUsername());
407 // PW_Edit->setText(gpppdata.storedPassword()); 407 // PW_Edit->setText(PPPData::data()->storedPassword());
408// } 408// }
409// } 409// }
410// else 410// else
411// if(count > 0) { 411// if(count > 0) {
412// gpppdata.setDefaultAccount(connectto_c->text(0)); 412// PPPData::data()->setDefaultAccount(connectto_c->text(0));
413// gpppdata.save(); 413// PPPData::data()->save();
414 // ID_Edit->setText(gpppdata.storedUsername()); 414 // ID_Edit->setText(PPPData::data()->storedUsername());
415 // PW_Edit->setText(gpppdata.storedPassword()); 415 // PW_Edit->setText(PPPData::data()->storedPassword());
416// } 416// }
417 417
418// connect(ID_Edit, SIGNAL(textChanged(const QString &)), 418// connect(ID_Edit, SIGNAL(textChanged(const QString &)),
419 // this, SLOT(usernameChanged(const QString &))); 419 // this, SLOT(usernameChanged(const QString &)));
420 420
421// connect(PW_Edit, SIGNAL(textChanged(const QString &)), 421// connect(PW_Edit, SIGNAL(textChanged(const QString &)),
@@ -431,65 +431,65 @@ void KPPPWidget::log_window_toggled(bool on) {
431void KPPPWidget::interruptConnection() { 431void KPPPWidget::interruptConnection() {
432 // interrupt dial up 432 // interrupt dial up
433// if (con->isVisible()) 433// if (con->isVisible())
434// emit con->cancelbutton(); 434// emit con->cancelbutton();
435 435
436 // disconnect if online 436 // disconnect if online
437 if (gpppdata.pppdRunning()) 437 if (PPPData::data()->pppdRunning())
438 emit disconnect(); 438 emit disconnect();
439} 439}
440 440
441 441
442void KPPPWidget::sigPPPDDied() { 442void KPPPWidget::sigPPPDDied() {
443 qDebug( "Received a SIGUSR1" ); 443 qDebug( "Received a SIGUSR1" );
444 444
445 // if we are not connected pppdpid is -1 so have have to check for that 445 // if we are not connected pppdpid is -1 so have have to check for that
446 // in the followin line to make sure that we don't raise a false alarm 446 // in the followin line to make sure that we don't raise a false alarm
447 // such as would be the case when the log file viewer exits. 447 // such as would be the case when the log file viewer exits.
448 if(gpppdata.pppdRunning() || gpppdata.pppdError()) { 448 if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) {
449 qDebug( "It was pppd that died" ); 449 qDebug( "It was pppd that died" );
450 450
451 // when we killpppd() on Cancel in ConnectWidget 451 // when we killpppd() on Cancel in ConnectWidget
452 // we set pppid to -1 so we won't 452 // we set pppid to -1 so we won't
453 // enter this block 453 // enter this block
454 454
455 // just to be sure 455 // just to be sure
456 456
457 Modem::modem->removeSecret(AUTH_PAP); 457 Modem::modem->removeSecret(AUTH_PAP);
458 Modem::modem->removeSecret(AUTH_CHAP); 458 Modem::modem->removeSecret(AUTH_CHAP);
459 459
460 gpppdata.setpppdRunning(false); 460 PPPData::data()->setpppdRunning(false);
461 461
462 qDebug( "Executing command on disconnect since pppd has died." ); 462 qDebug( "Executing command on disconnect since pppd has died." );
463 QApplication::flushX(); 463 QApplication::flushX();
464 execute_command(gpppdata.command_on_disconnect()); 464 execute_command(PPPData::data()->command_on_disconnect());
465 465
466// stopAccounting(); 466// stopAccounting();
467 467
468// con_win->stopClock(); 468// con_win->stopClock();
469// DockWidget::dock_widget->stop_stats(); 469// DockWidget::dock_widget->stop_stats();
470// DockWidget::dock_widget->hide(); 470// DockWidget::dock_widget->hide();
471 471
472 if(!gpppdata.pppdError()) 472 if(!PPPData::data()->pppdError())
473 gpppdata.setpppdError(E_PPPD_DIED); 473 PPPData::data()->setpppdError(E_PPPD_DIED);
474 removedns(); 474 removedns();
475 Modem::modem->unlockdevice(); 475 Modem::modem->unlockdevice();
476 // con->pppdDied(); 476 // con->pppdDied();
477 477
478 if(!gpppdata.automatic_redial()) { 478 if(!PPPData::data()->automatic_redial()) {
479 quit_b->setFocus(); 479 quit_b->setFocus();
480 show(); 480 show();
481// con_win->stopClock(); 481// con_win->stopClock();
482 //stopAccounting(); 482 //stopAccounting();
483// con_win->hide(); 483// con_win->hide();
484// con->hide(); 484// con->hide();
485 485
486 gpppdata.setpppdRunning(false); 486 PPPData::data()->setpppdRunning(false);
487 // // not in a signal handler !!! KNotifyClient::beep(); 487 // // not in a signal handler !!! KNotifyClient::beep();
488 QString msg; 488 QString msg;
489 if (gpppdata.pppdError() == E_IF_TIMEOUT) 489 if (PPPData::data()->pppdError() == E_IF_TIMEOUT)
490 msg = i18n("Timeout expired while waiting for the PPP interface " 490 msg = i18n("Timeout expired while waiting for the PPP interface "
491 "to come up!"); 491 "to come up!");
492 else { 492 else {
493 msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); 493 msg = i18n("<p>The pppd daemon died unexpectedly!</p>");
494 Modem::modem->pppdExitStatus(); 494 Modem::modem->pppdExitStatus();
495 if (Modem::modem->lastStatus != 99) {// more recent pppds only 495 if (Modem::modem->lastStatus != 99) {// more recent pppds only
@@ -504,28 +504,28 @@ void KPPPWidget::sigPPPDDied() {
504 // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) 504 // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No)
505 // // PPPL_ShowLog(); 505 // // PPPL_ShowLog();
506// } else { /* reconnect on disconnect */ 506// } else { /* reconnect on disconnect */
507 if (false){ 507 if (false){
508 qDebug( "Trying to reconnect... " ); 508 qDebug( "Trying to reconnect... " );
509 509
510 if(gpppdata.authMethod() == AUTH_PAP || 510 if(PPPData::data()->authMethod() == AUTH_PAP ||
511 gpppdata.authMethod() == AUTH_CHAP || 511 PPPData::data()->authMethod() == AUTH_CHAP ||
512 gpppdata.authMethod() == AUTH_PAPCHAP) 512 PPPData::data()->authMethod() == AUTH_PAPCHAP)
513 Modem::modem->setSecret(gpppdata.authMethod(), 513 Modem::modem->setSecret(PPPData::data()->authMethod(),
514 encodeWord(gpppdata.storedUsername()), 514 encodeWord(PPPData::data()->storedUsername()),
515 encodeWord(gpppdata.password())); 515 encodeWord(PPPData::data()->password()));
516 516
517// con_win->hide(); 517// con_win->hide();
518 // con_win->stopClock(); 518 // con_win->stopClock();
519 //stopAccounting(); 519 //stopAccounting();
520 gpppdata.setpppdRunning(false); 520 PPPData::data()->setpppdRunning(false);
521 // not in a signal handler !!!KNotifyClient::beep(); 521 // not in a signal handler !!!KNotifyClient::beep();
522 emit cmdl_start(); 522 emit cmdl_start();
523 } 523 }
524 } 524 }
525 gpppdata.setpppdError(0); 525 PPPData::data()->setpppdError(0);
526 } 526 }
527} 527}
528 528
529// void KPPPWidget::sigChld() { 529// void KPPPWidget::sigChld() {
530// qDebug( "sigchld()" ); 530// qDebug( "sigchld()" );
531// // pid_t id = wait(0L); 531// // pid_t id = wait(0L);
@@ -540,29 +540,29 @@ void KPPPWidget::sigPPPDDied() {
540// exit(1); 540// exit(1);
541// // } 541// // }
542// } 542// }
543 543
544 544
545void KPPPWidget::newdefaultaccount(int i) { 545void KPPPWidget::newdefaultaccount(int i) {
546 gpppdata.setDefaultAccount(connectto_c->text(i)); 546 PPPData::data()->setDefaultAccount(connectto_c->text(i));
547 gpppdata.save(); 547 PPPData::data()->save();
548 ID_Edit->setText(gpppdata.storedUsername()); 548 ID_Edit->setText(PPPData::data()->storedUsername());
549 PW_Edit->setText(gpppdata.storedPassword()); 549 PW_Edit->setText(PPPData::data()->storedPassword());
550} 550}
551 551
552 552
553 553
554 554
555void KPPPWidget::beginConnect() { 555void KPPPWidget::beginConnect() {
556 // make sure to connect to the account that is selected in the combo box 556 // make sure to connect to the account that is selected in the combo box
557 // (exeption: an account given by a command line argument) 557 // (exeption: an account given by a command line argument)
558 // if(!m_bCmdlAccount) { 558 // if(!m_bCmdlAccount) {
559// gpppdata.setAccount(connectto_c->currentText()); 559// PPPData::data()->setAccount(connectto_c->currentText());
560// gpppdata.setPassword(PW_Edit->text()); 560// PPPData::data()->setPassword(PW_Edit->text());
561// } else { 561// } else {
562 gpppdata.setPassword(gpppdata.storedPassword()); 562 PPPData::data()->setPassword(PPPData::data()->storedPassword());
563// } 563// }
564 564
565 QFileInfo info(pppdPath()); 565 QFileInfo info(pppdPath());
566 566
567 if(!info.exists()){ 567 if(!info.exists()){
568 QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" 568 QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n"
@@ -574,71 +574,71 @@ void KPPPWidget::beginConnect() {
574 if(!info.isExecutable()){ 574 if(!info.isExecutable()){
575 575
576 QString string; 576 QString string;
577 string = i18n("kppp cannot execute:\n %1\n" 577 string = i18n("kppp cannot execute:\n %1\n"
578 "Please make sure that you have given kppp " 578 "Please make sure that you have given kppp "
579 "setuid permission and that " 579 "setuid permission and that "
580 "pppd is executable.").arg(gpppdata.pppdPath()); 580 "pppd is executable.").arg(PPPData::data()->pppdPath());
581 KMessageBox::error(this, string); 581 KMessageBox::error(this, string);
582 return; 582 return;
583 583
584 } 584 }
585#endif 585#endif
586 586
587 QFileInfo info2(gpppdata.modemDevice()); 587 QFileInfo info2(PPPData::data()->modemDevice());
588 588
589 if(!info2.exists()){ 589 if(!info2.exists()){
590 QString string; 590 QString string;
591 string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " 591 string = i18n("kppp can not find:\n %1\nPlease make sure you have setup "
592 "your modem device properly " 592 "your modem device properly "
593 "and/or adjust the location of the modem device on " 593 "and/or adjust the location of the modem device on "
594 "the modem tab of " 594 "the modem tab of "
595 "the setup dialog.").arg(gpppdata.modemDevice()); 595 "the setup dialog.").arg(PPPData::data()->modemDevice());
596 QMessageBox::warning(this, "error", string); 596 QMessageBox::warning(this, "error", string);
597 return; 597 return;
598 } 598 }
599 599
600 // if this is a PAP or CHAP account, ensure that username is 600 // if this is a PAP or CHAP account, ensure that username is
601 // supplied 601 // supplied
602 if(gpppdata.authMethod() == AUTH_PAP || 602 if(PPPData::data()->authMethod() == AUTH_PAP ||
603 gpppdata.authMethod() == AUTH_CHAP || 603 PPPData::data()->authMethod() == AUTH_CHAP ||
604 gpppdata.authMethod() == AUTH_PAPCHAP ) { 604 PPPData::data()->authMethod() == AUTH_PAPCHAP ) {
605 if(ID_Edit->text().isEmpty()) { 605 if(ID_Edit->text().isEmpty()) {
606 QMessageBox::warning(this,"error", 606 QMessageBox::warning(this,"error",
607 i18n( 607 i18n(
608 "You have selected the authentication " 608 "You have selected the authentication "
609 "method PAP or CHAP. This requires that you " 609 "method PAP or CHAP. This requires that you "
610 "supply a username and a password!")); 610 "supply a username and a password!"));
611 return; 611 return;
612 } else { 612 } else {
613 if(!Modem::modem->setSecret(gpppdata.authMethod(), 613 if(!Modem::modem->setSecret(PPPData::data()->authMethod(),
614 encodeWord(gpppdata.storedUsername()), 614 encodeWord(PPPData::data()->storedUsername()),
615 encodeWord(gpppdata.password()))) { 615 encodeWord(PPPData::data()->password()))) {
616 QString s; 616 QString s;
617 s = i18n("Cannot create PAP/CHAP authentication\n" 617 s = i18n("Cannot create PAP/CHAP authentication\n"
618 "file \"%1\"").arg(PAP_AUTH_FILE); 618 "file \"%1\"").arg(PAP_AUTH_FILE);
619 QMessageBox::warning(this, "error", s); 619 QMessageBox::warning(this, "error", s);
620 return; 620 return;
621 } 621 }
622 } 622 }
623 } 623 }
624 624
625 if (gpppdata.phonenumber().isEmpty()) { 625 if (PPPData::data()->phonenumber().isEmpty()) {
626 QString s = i18n("You must specify a telephone number!"); 626 QString s = i18n("You must specify a telephone number!");
627 QMessageBox::warning(this, "error", s); 627 QMessageBox::warning(this, "error", s);
628 return; 628 return;
629 } 629 }
630 630
631 this->hide(); 631 this->hide();
632 632
633 QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); 633 QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname());
634// con->setCaption(tit); 634// con->setCaption(tit);
635 635
636// con->show(); 636// con->show();
637 637
638 bool show_debug = gpppdata.get_show_log_window(); 638 bool show_debug = PPPData::data()->get_show_log_window();
639 // con->debug->setOn(show_debug);// toggle button 639 // con->debug->setOn(show_debug);// toggle button
640 debugwindow->clear(); 640 debugwindow->clear();
641 if (!show_debug) 641 if (!show_debug)
642 debugwindow->hide(); 642 debugwindow->hide();
643 else { 643 else {
644 debugwindow->show(); 644 debugwindow->show();
@@ -647,22 +647,22 @@ void KPPPWidget::beginConnect() {
647 647
648 emit begin_connect(); 648 emit begin_connect();
649} 649}
650 650
651 651
652void KPPPWidget::disconnect() { 652void KPPPWidget::disconnect() {
653 if (!gpppdata.command_before_disconnect().isEmpty()) { 653 if (!PPPData::data()->command_before_disconnect().isEmpty()) {
654// con_win->hide(); 654// con_win->hide();
655// con->show(); 655// con->show();
656// con->setCaption(i18n("Disconnecting...")); 656// con->setCaption(i18n("Disconnecting..."));
657// con->setMsg(i18n("Executing command before disconnection.")); 657// con->setMsg(i18n("Executing command before disconnection."));
658 658
659 qApp->processEvents(); 659 qApp->processEvents();
660 QApplication::flushX(); 660 QApplication::flushX();
661// pid_t id = 661// pid_t id =
662 execute_command(gpppdata.command_before_disconnect()); 662 execute_command(PPPData::data()->command_before_disconnect());
663// int i, status; 663// int i, status;
664 664
665// do { 665// do {
666// kapp->processEvents(); 666// kapp->processEvents();
667// i = waitpid(id, &status, WNOHANG); 667// i = waitpid(id, &status, WNOHANG);
668// usleep(500000); 668// usleep(500000);
@@ -674,13 +674,13 @@ void KPPPWidget::disconnect() {
674 qApp->processEvents(); 674 qApp->processEvents();
675 675
676// statdlg->stop_stats(); 676// statdlg->stop_stats();
677 Modem::modem->killPPPDaemon(); 677 Modem::modem->killPPPDaemon();
678 678
679 QApplication::flushX(); 679 QApplication::flushX();
680 execute_command(gpppdata.command_on_disconnect()); 680 execute_command(PPPData::data()->command_on_disconnect());
681 681
682 Modem::modem->removeSecret(AUTH_PAP); 682 Modem::modem->removeSecret(AUTH_PAP);
683 Modem::modem->removeSecret(AUTH_CHAP); 683 Modem::modem->removeSecret(AUTH_CHAP);
684 684
685 removedns(); 685 removedns();
686 Modem::modem->unlockdevice(); 686 Modem::modem->unlockdevice();
@@ -704,28 +704,28 @@ void KPPPWidget::disconnect() {
704// void KPPPWidget::helpbutton() { 704// void KPPPWidget::helpbutton() {
705// kapp->invokeHelp(); 705// kapp->invokeHelp();
706// } 706// }
707 707
708 708
709void KPPPWidget::quitbutton() { 709void KPPPWidget::quitbutton() {
710 if(gpppdata.pppdRunning()) { 710 if(PPPData::data()->pppdRunning()) {
711 int ok = QMessageBox::warning(this, 711 int ok = QMessageBox::warning(this,
712 i18n("Exiting kPPP will close your PPP Session."), 712 i18n("Exiting kPPP will close your PPP Session."),
713 i18n("Quit kPPP?")); 713 i18n("Quit kPPP?"));
714 if(ok == QMessageBox::Yes) { 714 if(ok == QMessageBox::Yes) {
715 Modem::modem->killPPPDaemon(); 715 Modem::modem->killPPPDaemon();
716 QApplication::flushX(); 716 QApplication::flushX();
717 execute_command(gpppdata.command_on_disconnect()); 717 execute_command(PPPData::data()->command_on_disconnect());
718 removedns(); 718 removedns();
719 Modem::modem->unlockdevice(); 719 Modem::modem->unlockdevice();
720 } 720 }
721 } else { 721 } else {
722 if (!gpppdata.accname().isEmpty() && !gpppdata.storePassword()) 722 if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword())
723 gpppdata.setStoredPassword(""); 723 PPPData::data()->setStoredPassword("");
724 } 724 }
725 gpppdata.save(); 725 PPPData::data()->save();
726 qApp->quit(); 726 qApp->quit();
727} 727}
728 728
729 729
730// void KPPPWidget::rulesetLoadError() { 730// void KPPPWidget::rulesetLoadError() {
731// QMessageBox::warning(this,"error", ruleset_load_errmsg); 731// QMessageBox::warning(this,"error", ruleset_load_errmsg);
@@ -733,31 +733,31 @@ void KPPPWidget::quitbutton() {
733 733
734 734
735// void KPPPWidget::startAccounting() { 735// void KPPPWidget::startAccounting() {
736// // volume accounting 736// // volume accounting
737// stats->totalbytes = 0; 737// stats->totalbytes = 0;
738 738
739// kdDebug() << "AcctEnabled: " << gpppdata.AcctEnabled() << endl; 739// kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl;
740 740
741// // load the ruleset 741// // load the ruleset
742// if(!gpppdata.AcctEnabled()) 742// if(!PPPData::data()->AcctEnabled())
743// return; 743// return;
744 744
745// QString d = AccountingBase::getAccountingFile(gpppdata.accountingFile()); 745// QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile());
746// // if(::access(d.data(), X_OK) != 0) 746// // if(::access(d.data(), X_OK) != 0)
747// acct = new Accounting(this, stats); 747// acct = new Accounting(this, stats);
748// // else 748// // else
749// // acct = new ExecutableAccounting(this); 749// // acct = new ExecutableAccounting(this);
750 750
751// // connect to the accounting object 751// // connect to the accounting object
752// connect(acct, SIGNAL(changed(QString, QString)), 752// connect(acct, SIGNAL(changed(QString, QString)),
753 // con_win, SLOT(slotAccounting(QString, QString))); 753 // con_win, SLOT(slotAccounting(QString, QString)));
754 754
755// // if(!acct->loadRuleSet(gpppdata.accountingFile())) { 755// // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) {
756// // QString s= i18n("Can not load the accounting " 756// // QString s= i18n("Can not load the accounting "
757 // // "ruleset \"%1\"!").arg(gpppdata.accountingFile()); 757 // // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile());
758 758
759// // starting the messagebox with a timer will prevent us 759// // starting the messagebox with a timer will prevent us
760// // from blocking the calling function ConnectWidget::timerEvent 760// // from blocking the calling function ConnectWidget::timerEvent
761// ruleset_load_errmsg = s; 761// ruleset_load_errmsg = s;
762// QTimer::singleShot(0, this, SLOT(rulesetLoadError())); 762// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
763// return; 763// return;
@@ -766,15 +766,15 @@ void KPPPWidget::quitbutton() {
766// // acct->slotStart(); 766// // acct->slotStart();
767// } 767// }
768 768
769// void KPPPWidget::stopAccounting() { 769// void KPPPWidget::stopAccounting() {
770// // store volume accounting 770// // store volume accounting
771// // if(stats->totalbytes != 0) 771// // if(stats->totalbytes != 0)
772// // gpppdata.setTotalBytes(stats->totalbytes); 772// // PPPData::data()->setTotalBytes(stats->totalbytes);
773 773
774// if(!gpppdata.AcctEnabled()) 774// if(!PPPData::data()->AcctEnabled())
775// return; 775// return;
776 776
777// // if(acct != 0) { 777// // if(acct != 0) {
778// // acct->slotStop(); 778// // acct->slotStop();
779// // delete acct; 779// // delete acct;
780// // acct = 0; 780// // acct = 0;
@@ -789,22 +789,22 @@ void KPPPWidget::quitbutton() {
789// } 789// }
790// } 790// }
791 791
792 792
793void KPPPWidget::usernameChanged(const QString &) { 793void KPPPWidget::usernameChanged(const QString &) {
794 // store username for later use 794 // store username for later use
795 gpppdata.setStoredUsername(ID_Edit->text()); 795 PPPData::data()->setStoredUsername(ID_Edit->text());
796} 796}
797 797
798 798
799void KPPPWidget::passwordChanged(const QString &) { 799void KPPPWidget::passwordChanged(const QString &) {
800 // store the password if so requested 800 // store the password if so requested
801 if(gpppdata.storePassword()) 801 if(PPPData::data()->storePassword())
802 gpppdata.setStoredPassword(PW_Edit->text()); 802 PPPData::data()->setStoredPassword(PW_Edit->text());
803 else 803 else
804 gpppdata.setStoredPassword(""); 804 PPPData::data()->setStoredPassword("");
805} 805}
806 806
807 807
808void KPPPWidget::setPW_Edit(const QString &pw) { 808void KPPPWidget::setPW_Edit(const QString &pw) {
809 PW_Edit->setText(pw); 809 PW_Edit->setText(pw);
810} 810}
@@ -838,13 +838,13 @@ QString KPPPWidget::encodeWord(const QString &s) {
838void KPPPWidget::showNews() { 838void KPPPWidget::showNews() {
839#ifdef KPPP_SHOW_NEWS 839#ifdef KPPP_SHOW_NEWS
840 /* 840 /*
841 * Introduce the QuickHelp feature to new users of this version 841 * Introduce the QuickHelp feature to new users of this version
842 */ 842 */
843 #define QUICKHELP_HINT "Hint_QuickHelp" 843 #define QUICKHELP_HINT "Hint_QuickHelp"
844 if(gpppdata.readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { 844 if(PPPData::data()->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
845 QDialog dlg(0, 0, true); 845 QDialog dlg(0, 0, true);
846 dlg.setCaption(i18n("Recent Changes in KPPP")); 846 dlg.setCaption(i18n("Recent Changes in KPPP"));
847 847
848 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); 848 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10);
849 QHBoxLayout *l1 = new QHBoxLayout(10); 849 QHBoxLayout *l1 = new QHBoxLayout(10);
850 QVBoxLayout *l2 = new QVBoxLayout(10); 850 QVBoxLayout *l2 = new QVBoxLayout(10);
@@ -890,14 +890,14 @@ void KPPPWidget::showNews() {
890 890
891 QWhatsThis::add(cb,tmp); 891 QWhatsThis::add(cb,tmp);
892 QWhatsThis::add(l, tmp); 892 QWhatsThis::add(l, tmp);
893 893
894 dlg.exec(); 894 dlg.exec();
895 if(cb->isChecked()) { 895 if(cb->isChecked()) {
896 gpppdata.writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); 896 PPPData::data()->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1);
897 gpppdata.save(); 897 PPPData::data()->save();
898 } 898 }
899 } 899 }
900#endif 900#endif
901} 901}
902 902
903 903