Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/kpppwidget.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index e21bbc7..fd09332 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp | |||
@@ -53,55 +53,55 @@ | |||
53 | 53 | ||
54 | //#include "main.h" | 54 | //#include "main.h" |
55 | #include "auth.h" | 55 | #include "auth.h" |
56 | #include "modem.h" | 56 | #include "modem.h" |
57 | //#include "ppplog.h" | 57 | //#include "ppplog.h" |
58 | //#include "opener.h" | 58 | //#include "opener.h" |
59 | //#include "requester.h" | 59 | //#include "requester.h" |
60 | //#include "pppstats.h" | 60 | //#include "pppstats.h" |
61 | #include "pppdata.h" | 61 | #include "pppdata.h" |
62 | #include "general.h" | 62 | #include "general.h" |
63 | #include "interface.h" | 63 | #include "interface.h" |
64 | 64 | ||
65 | #define execute_command system | 65 | #define execute_command system |
66 | 66 | ||
67 | KPPPWidget *p_kppp = 0; | 67 | KPPPWidget *p_kppp = 0; |
68 | 68 | ||
69 | KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) | 69 | KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) |
70 | : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) | 70 | : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) |
71 | { | 71 | { |
72 | // tabWindow = 0; | 72 | // tabWindow = 0; |
73 | p_kppp = this; | 73 | p_kppp = this; |
74 | // before doing anything else, run a few tests | 74 | // before doing anything else, run a few tests |
75 | if (!_pppdata->setModemDevice( i->getInterfaceName() )) | 75 | if (!_pppdata->setModemDevice( i->getInterfaceName() )) |
76 | _pppdata->setModemDevice("/dev/modem"); | 76 | _pppdata->setModemDevice("/dev/modem"); |
77 | qDebug("PPPConfigWidget::PPPConfigWidget"); | 77 | odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; |
78 | qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); | 78 | odebug << " interface->getHardwareName >" << i->getHardwareName().latin1() << "<" << oendl; |
79 | if (!_pppdata->setAccount( i->getHardwareName() )) | 79 | if (!_pppdata->setAccount( i->getHardwareName() )) |
80 | _pppdata->setAccount( 0 ); | 80 | _pppdata->setAccount( 0 ); |
81 | 81 | ||
82 | qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); | 82 | odebug << " _pppdata->accname >" << _pppdata->accname().latin1() << "<" << oendl; |
83 | qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); | 83 | odebug << " _pppdata->currentAccountID() >" << _pppdata->currentAccountID() << "<" << oendl; |
84 | 84 | ||
85 | int result = runTests(); | 85 | int result = runTests(); |
86 | if(result == TEST_CRITICAL) | 86 | if(result == TEST_CRITICAL) |
87 | exit(4); | 87 | exit(4); |
88 | 88 | ||
89 | // installEventFilter(this); | 89 | // installEventFilter(this); |
90 | 90 | ||
91 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); | 91 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); |
92 | 92 | ||
93 | QGridLayout *l1 = new QGridLayout(3, 4); | 93 | QGridLayout *l1 = new QGridLayout(3, 4); |
94 | tl->addLayout(l1); | 94 | tl->addLayout(l1); |
95 | l1->addColSpacing(0, 10); | 95 | l1->addColSpacing(0, 10); |
96 | l1->addColSpacing(3, 10); | 96 | l1->addColSpacing(3, 10); |
97 | l1->setColStretch(1, 3); | 97 | l1->setColStretch(1, 3); |
98 | l1->setColStretch(2, 4); | 98 | l1->setColStretch(2, 4); |
99 | 99 | ||
100 | label1 = new QLabel(QObject::tr("C&onnect to: "), this); | 100 | label1 = new QLabel(QObject::tr("C&onnect to: "), this); |
101 | l1->addWidget(label1, 0, 1); | 101 | l1->addWidget(label1, 0, 1); |
102 | 102 | ||
103 | connectto_c = new QComboBox(false, this); | 103 | connectto_c = new QComboBox(false, this); |
104 | label1->setBuddy(connectto_c); | 104 | label1->setBuddy(connectto_c); |
105 | 105 | ||
106 | connect(connectto_c, SIGNAL(activated(int)), | 106 | connect(connectto_c, SIGNAL(activated(int)), |
107 | SLOT(newdefaultaccount(int))); | 107 | SLOT(newdefaultaccount(int))); |
@@ -284,49 +284,49 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na | |||
284 | // } | 284 | // } |
285 | // } else | 285 | // } else |
286 | // expandbutton(); | 286 | // expandbutton(); |
287 | // show(); | 287 | // show(); |
288 | 288 | ||
289 | 289 | ||
290 | //#define KPPP_SHOW_NEWS | 290 | //#define KPPP_SHOW_NEWS |
291 | #ifdef KPPP_SHOW_NEWS | 291 | #ifdef KPPP_SHOW_NEWS |
292 | // keep user informed about recent changes | 292 | // keep user informed about recent changes |
293 | if(!m_bCmdlAccount) | 293 | if(!m_bCmdlAccount) |
294 | showNews(); | 294 | showNews(); |
295 | #endif | 295 | #endif |
296 | } | 296 | } |
297 | 297 | ||
298 | KPPPWidget::~KPPPWidget() | 298 | KPPPWidget::~KPPPWidget() |
299 | { | 299 | { |
300 | p_kppp = 0; | 300 | p_kppp = 0; |
301 | // delete stats; | 301 | // delete stats; |
302 | } | 302 | } |
303 | 303 | ||
304 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { | 304 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { |
305 | // if(e->type() == QEvent::User) { | 305 | // if(e->type() == QEvent::User) { |
306 | // switch(((SignalEvent*)e)->sigType()) { | 306 | // switch(((SignalEvent*)e)->sigType()) { |
307 | // case SIGINT: | 307 | // case SIGINT: |
308 | // qDebug( "Received a SIGINT" ); | 308 | // odebug << "Received a SIGINT" << oendl; |
309 | // interruptConnection(); | 309 | // interruptConnection(); |
310 | // break; | 310 | // break; |
311 | // case SIGCHLD: | 311 | // case SIGCHLD: |
312 | // sigChld(); | 312 | // sigChld(); |
313 | // break; | 313 | // break; |
314 | // case SIGUSR1: | 314 | // case SIGUSR1: |
315 | // sigPPPDDied(); | 315 | // sigPPPDDied(); |
316 | // break; | 316 | // break; |
317 | // } | 317 | // } |
318 | // return true; | 318 | // return true; |
319 | // } | 319 | // } |
320 | 320 | ||
321 | // if(o == connect_b) { | 321 | // if(o == connect_b) { |
322 | // if(e->type() == QEvent::KeyPress) { | 322 | // if(e->type() == QEvent::KeyPress) { |
323 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { | 323 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { |
324 | // beginConnect(); | 324 | // beginConnect(); |
325 | // return true; | 325 | // return true; |
326 | // } | 326 | // } |
327 | // } | 327 | // } |
328 | // } | 328 | // } |
329 | 329 | ||
330 | // return false; | 330 | // return false; |
331 | // } | 331 | // } |
332 | 332 | ||
@@ -402,137 +402,137 @@ void KPPPWidget::log_window_toggled(bool on) { | |||
402 | // connect(PW_Edit, SIGNAL(textChanged(const QString&)), | 402 | // connect(PW_Edit, SIGNAL(textChanged(const QString&)), |
403 | // this, SLOT(passwordChanged(const QString&))); | 403 | // this, SLOT(passwordChanged(const QString&))); |
404 | 404 | ||
405 | // if (ID_Edit->text().isEmpty()) | 405 | // if (ID_Edit->text().isEmpty()) |
406 | // ID_Edit->setFocus(); | 406 | // ID_Edit->setFocus(); |
407 | // else if (PW_Edit->text().isEmpty()) | 407 | // else if (PW_Edit->text().isEmpty()) |
408 | // PW_Edit->setFocus(); | 408 | // PW_Edit->setFocus(); |
409 | // } | 409 | // } |
410 | 410 | ||
411 | 411 | ||
412 | void KPPPWidget::interruptConnection() { | 412 | void KPPPWidget::interruptConnection() { |
413 | // interrupt dial up | 413 | // interrupt dial up |
414 | // | 414 | // |
415 | 415 | ||
416 | if (con->isVisible()) | 416 | if (con->isVisible()) |
417 | emit con->cancelbutton(); | 417 | emit con->cancelbutton(); |
418 | 418 | ||
419 | // disconnect if online | 419 | // disconnect if online |
420 | if (_pppdata->pppdRunning()) | 420 | if (_pppdata->pppdRunning()) |
421 | emit disconnect(); | 421 | emit disconnect(); |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | void KPPPWidget::sigPPPDDied() { | 425 | void KPPPWidget::sigPPPDDied() { |
426 | qDebug( "Received a SIGUSR1" ); | 426 | odebug << "Received a SIGUSR1" << oendl; |
427 | 427 | ||
428 | // if we are not connected pppdpid is -1 so have have to check for that | 428 | // if we are not connected pppdpid is -1 so have have to check for that |
429 | // in the followin line to make sure that we don't raise a false alarm | 429 | // in the followin line to make sure that we don't raise a false alarm |
430 | // such as would be the case when the log file viewer exits. | 430 | // such as would be the case when the log file viewer exits. |
431 | if(_pppdata->pppdRunning() || _pppdata->pppdError()) { | 431 | if(_pppdata->pppdRunning() || _pppdata->pppdError()) { |
432 | qDebug( "It was pppd that died" ); | 432 | odebug << "It was pppd that died" << oendl; |
433 | 433 | ||
434 | // when we killpppd() on Cancel in ConnectWidget | 434 | // when we killpppd() on Cancel in ConnectWidget |
435 | // we set pppid to -1 so we won't | 435 | // we set pppid to -1 so we won't |
436 | // enter this block | 436 | // enter this block |
437 | 437 | ||
438 | // just to be sure | 438 | // just to be sure |
439 | 439 | ||
440 | Modem::modem->removeSecret(AUTH_PAP); | 440 | Modem::modem->removeSecret(AUTH_PAP); |
441 | Modem::modem->removeSecret(AUTH_CHAP); | 441 | Modem::modem->removeSecret(AUTH_CHAP); |
442 | 442 | ||
443 | _pppdata->setpppdRunning(false); | 443 | _pppdata->setpppdRunning(false); |
444 | 444 | ||
445 | qDebug( "Executing command on disconnect since pppd has died." ); | 445 | odebug << "Executing command on disconnect since pppd has died." << oendl; |
446 | QApplication::flushX(); | 446 | QApplication::flushX(); |
447 | execute_command(_pppdata->command_on_disconnect()); | 447 | execute_command(_pppdata->command_on_disconnect()); |
448 | 448 | ||
449 | // stopAccounting(); | 449 | // stopAccounting(); |
450 | 450 | ||
451 | con_win->stopClock(); | 451 | con_win->stopClock(); |
452 | // DockWidget::dock_widget->stop_stats(); | 452 | // DockWidget::dock_widget->stop_stats(); |
453 | // DockWidget::dock_widget->hide(); | 453 | // DockWidget::dock_widget->hide(); |
454 | 454 | ||
455 | if(!_pppdata->pppdError()) | 455 | if(!_pppdata->pppdError()) |
456 | _pppdata->setpppdError(E_PPPD_DIED); | 456 | _pppdata->setpppdError(E_PPPD_DIED); |
457 | removedns(); | 457 | removedns(); |
458 | Modem::modem->unlockdevice(); | 458 | Modem::modem->unlockdevice(); |
459 | // | 459 | // |
460 | con->pppdDied(); | 460 | con->pppdDied(); |
461 | 461 | ||
462 | if(!_pppdata->automatic_redial()) { | 462 | if(!_pppdata->automatic_redial()) { |
463 | quit_b->setFocus(); | 463 | quit_b->setFocus(); |
464 | show(); | 464 | show(); |
465 | con_win->stopClock(); | 465 | con_win->stopClock(); |
466 | //stopAccounting(); | 466 | //stopAccounting(); |
467 | con_win->hide(); | 467 | con_win->hide(); |
468 | con->hide(); | 468 | con->hide(); |
469 | 469 | ||
470 | _pppdata->setpppdRunning(false); | 470 | _pppdata->setpppdRunning(false); |
471 | // // not in a signal handler !!! KNotifyClient::beep(); | 471 | // // not in a signal handler !!! KNotifyClient::beep(); |
472 | QString msg; | 472 | QString msg; |
473 | if (_pppdata->pppdError() == E_IF_TIMEOUT) | 473 | if (_pppdata->pppdError() == E_IF_TIMEOUT) |
474 | msg = QObject::tr("Timeout expired while waiting for the PPP interface " | 474 | msg = QObject::tr("Timeout expired while waiting for the PPP interface " |
475 | "to come up!"); | 475 | "to come up!"); |
476 | else { | 476 | else { |
477 | msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>"); | 477 | msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>"); |
478 | Modem::modem->pppdExitStatus(); | 478 | Modem::modem->pppdExitStatus(); |
479 | if (Modem::modem->lastStatus != 99) {// more recent pppds only | 479 | if (Modem::modem->lastStatus != 99) {// more recent pppds only |
480 | msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); | 480 | msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); |
481 | msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " | 481 | msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " |
482 | "codes or take a look at the kppp FAQ on " | 482 | "codes or take a look at the kppp FAQ on " |
483 | " <a href=http://devel-home.kde.org/~kppp/index.html>" | 483 | " <a href=http://devel-home.kde.org/~kppp/index.html>" |
484 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); | 484 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); |
485 | } | 485 | } |
486 | } | 486 | } |
487 | 487 | ||
488 | // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) | 488 | // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) |
489 | // // PPPL_ShowLog(); | 489 | // // PPPL_ShowLog(); |
490 | // } else { /* reconnect on disconnect */ | 490 | // } else { /* reconnect on disconnect */ |
491 | if (false){ | 491 | if (false){ |
492 | qDebug( "Trying to reconnect... " ); | 492 | odebug << "Trying to reconnect... " << oendl; |
493 | 493 | ||
494 | if(_pppdata->authMethod() == AUTH_PAP || | 494 | if(_pppdata->authMethod() == AUTH_PAP || |
495 | _pppdata->authMethod() == AUTH_CHAP || | 495 | _pppdata->authMethod() == AUTH_CHAP || |
496 | _pppdata->authMethod() == AUTH_PAPCHAP) | 496 | _pppdata->authMethod() == AUTH_PAPCHAP) |
497 | Modem::modem->setSecret(_pppdata->authMethod(), | 497 | Modem::modem->setSecret(_pppdata->authMethod(), |
498 | encodeWord(_pppdata->storedUsername()), | 498 | encodeWord(_pppdata->storedUsername()), |
499 | encodeWord(_pppdata->password())); | 499 | encodeWord(_pppdata->password())); |
500 | 500 | ||
501 | con_win->hide(); | 501 | con_win->hide(); |
502 | con_win->stopClock(); | 502 | con_win->stopClock(); |
503 | //stopAccounting(); | 503 | //stopAccounting(); |
504 | _pppdata->setpppdRunning(false); | 504 | _pppdata->setpppdRunning(false); |
505 | // not in a signal handler !!!KNotifyClient::beep(); | 505 | // not in a signal handler !!!KNotifyClient::beep(); |
506 | emit cmdl_start(); | 506 | emit cmdl_start(); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | _pppdata->setpppdError(0); | 509 | _pppdata->setpppdError(0); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | // void KPPPWidget::sigChld() { | 513 | // void KPPPWidget::sigChld() { |
514 | // qDebug( "sigchld()" ); | 514 | // odebug << "sigchld()" << oendl; |
515 | // // pid_t id = wait(0L); | 515 | // // pid_t id = wait(0L); |
516 | // // if(id == helperPid && helperPid != -1) { | 516 | // // if(id == helperPid && helperPid != -1) { |
517 | // // kdDebug(5002) << "It was the setuid child that died" << endl; | 517 | // // kdDebug(5002) << "It was the setuid child that died" << endl; |
518 | // // helperPid = -1; | 518 | // // helperPid = -1; |
519 | // QString msg = QObject::tr("kppp's helper process just died.\n" | 519 | // QString msg = QObject::tr("kppp's helper process just died.\n" |
520 | // "Since a further execution would be pointless, " | 520 | // "Since a further execution would be pointless, " |
521 | // "kppp will shut down now."); | 521 | // "kppp will shut down now."); |
522 | // QMessageBox::warning(0L,"error", msg); | 522 | // QMessageBox::warning(0L,"error", msg); |
523 | // //remove_pidfile(); | 523 | // //remove_pidfile(); |
524 | // exit(1); | 524 | // exit(1); |
525 | // // } | 525 | // // } |
526 | // } | 526 | // } |
527 | 527 | ||
528 | 528 | ||
529 | void KPPPWidget::newdefaultaccount(int i) { | 529 | void KPPPWidget::newdefaultaccount(int i) { |
530 | _pppdata->setDefaultAccount(connectto_c->text(i)); | 530 | _pppdata->setDefaultAccount(connectto_c->text(i)); |
531 | _pppdata->save(); | 531 | _pppdata->save(); |
532 | ID_Edit->setText(_pppdata->storedUsername()); | 532 | ID_Edit->setText(_pppdata->storedUsername()); |
533 | PW_Edit->setText(_pppdata->storedPassword()); | 533 | PW_Edit->setText(_pppdata->storedPassword()); |
534 | } | 534 | } |
535 | 535 | ||
536 | 536 | ||
537 | 537 | ||
538 | 538 | ||