Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/kpppwidget.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index e466358..e21bbc7 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp @@ -303,197 +303,197 @@ KPPPWidget::~KPPPWidget() // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { // if(e->type() == QEvent::User) { // switch(((SignalEvent*)e)->sigType()) { // case SIGINT: // qDebug( "Received a SIGINT" ); // interruptConnection(); // break; // case SIGCHLD: // sigChld(); // break; // case SIGUSR1: // sigPPPDDied(); // break; // } // return true; // } // if(o == connect_b) { // if(e->type() == QEvent::KeyPress) { // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { // beginConnect(); // return true; // } // } // } // return false; // } void KPPPWidget::enterPressedInID() { PW_Edit->setFocus(); } void KPPPWidget::enterPressedInPW() { connect_b->setFocus(); } // triggered by the session manager void KPPPWidget::saveMyself() { _pppdata->save(); } void KPPPWidget::shutDown() { interruptConnection(); saveMyself(); } void KPPPWidget::log_window_toggled(bool on) { _pppdata->set_show_log_window(on); } // void KPPPWidget::resetaccounts() { // connectto_c->clear(); // int count = _pppdata->count(); // // enable/disable controls // connectto_c->setEnabled(count > 0); // connect_b->setEnabled(count > 0); // log->setEnabled(count > 0); // ID_Edit->setEnabled(count > 0); // PW_Edit->setEnabled(count > 0); // //load the accounts // for(int i=0; i < count; i++) { // _pppdata->setAccountbyIndex(i); // connectto_c->insertItem(_pppdata->accname()); // } // //set the default account // if(!_pppdata->defaultAccount().isEmpty()) { // for(int i=0; i < count; i++) // if(_pppdata->defaultAccount() == connectto_c->text(i)) { // connectto_c->setCurrentItem(i); // _pppdata->setAccountbyIndex(i); // ID_Edit->setText(_pppdata->storedUsername()); // PW_Edit->setText(_pppdata->storedPassword()); // } // } // else // if(count > 0) { // _pppdata->setDefaultAccount(connectto_c->text(0)); // _pppdata->save(); // ID_Edit->setText(_pppdata->storedUsername()); // PW_Edit->setText(_pppdata->storedPassword()); // } -// connect(ID_Edit, SIGNAL(textChanged(const QString &)), -// this, SLOT(usernameChanged(const QString &))); +// connect(ID_Edit, SIGNAL(textChanged(const QString&)), +// this, SLOT(usernameChanged(const QString&))); -// connect(PW_Edit, SIGNAL(textChanged(const QString &)), -// this, SLOT(passwordChanged(const QString &))); +// connect(PW_Edit, SIGNAL(textChanged(const QString&)), +// this, SLOT(passwordChanged(const QString&))); // if (ID_Edit->text().isEmpty()) // ID_Edit->setFocus(); // else if (PW_Edit->text().isEmpty()) // PW_Edit->setFocus(); // } void KPPPWidget::interruptConnection() { // interrupt dial up // if (con->isVisible()) emit con->cancelbutton(); // disconnect if online if (_pppdata->pppdRunning()) emit disconnect(); } void KPPPWidget::sigPPPDDied() { qDebug( "Received a SIGUSR1" ); // if we are not connected pppdpid is -1 so have have to check for that // in the followin line to make sure that we don't raise a false alarm // such as would be the case when the log file viewer exits. if(_pppdata->pppdRunning() || _pppdata->pppdError()) { qDebug( "It was pppd that died" ); // when we killpppd() on Cancel in ConnectWidget // we set pppid to -1 so we won't // enter this block // just to be sure Modem::modem->removeSecret(AUTH_PAP); Modem::modem->removeSecret(AUTH_CHAP); _pppdata->setpppdRunning(false); qDebug( "Executing command on disconnect since pppd has died." ); QApplication::flushX(); execute_command(_pppdata->command_on_disconnect()); // stopAccounting(); con_win->stopClock(); // DockWidget::dock_widget->stop_stats(); // DockWidget::dock_widget->hide(); if(!_pppdata->pppdError()) _pppdata->setpppdError(E_PPPD_DIED); removedns(); Modem::modem->unlockdevice(); // con->pppdDied(); if(!_pppdata->automatic_redial()) { quit_b->setFocus(); show(); con_win->stopClock(); // stopAccounting(); con_win->hide(); con->hide(); _pppdata->setpppdRunning(false); // // not in a signal handler !!! KNotifyClient::beep(); QString msg; if (_pppdata->pppdError() == E_IF_TIMEOUT) msg = QObject::tr("Timeout expired while waiting for the PPP interface " "to come up!"); else { msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>"); Modem::modem->pppdExitStatus(); if (Modem::modem->lastStatus != 99) { // more recent pppds only msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " "codes or take a look at the kppp FAQ on " " <a href=http://devel-home.kde.org/~kppp/index.html>" "http://devel-home.kde.org/~kppp/index.html</a></p>"); } } // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) // // PPPL_ShowLog(); // } else { /* reconnect on disconnect */ if (false){ qDebug( "Trying to reconnect... " ); if(_pppdata->authMethod() == AUTH_PAP || _pppdata->authMethod() == AUTH_CHAP || _pppdata->authMethod() == AUTH_PAPCHAP) Modem::modem->setSecret(_pppdata->authMethod(), encodeWord(_pppdata->storedUsername()), encodeWord(_pppdata->password())); @@ -628,194 +628,194 @@ void KPPPWidget::disconnect() { con->setCaption(QObject::tr("Disconnecting...")); con->setMsg(QObject::tr("Executing command before disconnection.")); qApp->processEvents(); QApplication::flushX(); // pid_t id = execute_command(_pppdata->command_before_disconnect()); // int i, status; // do { // kapp->processEvents(); // i = waitpid(id, &status, WNOHANG); // usleep(500000); // } while (i == 0 && errno == 0); con->hide(); } qApp->processEvents(); // statdlg->stop_stats(); Modem::modem->killPPPDaemon(); QApplication::flushX(); execute_command(_pppdata->command_on_disconnect()); Modem::modem->removeSecret(AUTH_PAP); Modem::modem->removeSecret(AUTH_CHAP); removedns(); Modem::modem->unlockdevice(); con_win->stopClock(); // p_kppp->stopAccounting(); con_win->hide(); // DockWidget::dock_widget->stop_stats(); // DockWidget::dock_widget->hide(); // if(m_bQuitOnDisconnect) // kapp->exit(0); // else { this->quit_b->setFocus(); this->show(); // } } // void KPPPWidget::helpbutton() { // kapp->invokeHelp(); // } void KPPPWidget::quitbutton() { if(_pppdata->pppdRunning()) { int ok = QMessageBox::warning(this, QObject::tr("Exiting kPPP will close your PPP Session."), QObject::tr("Quit kPPP?")); if(ok == QMessageBox::Yes) { Modem::modem->killPPPDaemon(); QApplication::flushX(); execute_command(_pppdata->command_on_disconnect()); removedns(); Modem::modem->unlockdevice(); } } else { if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) _pppdata->setStoredPassword(""); } _pppdata->save(); qApp->quit(); } // void KPPPWidget::rulesetLoadError() { // QMessageBox::warning(this,"error", ruleset_load_errmsg); // } // void KPPPWidget::startAccounting() { // // volume accounting // stats->totalbytes = 0; // kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl; // // load the ruleset // if(!_pppdata->AcctEnabled()) // return; // QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); // // if(::access(d.data(), X_OK) != 0) // acct = new Accounting(this, stats); // // else // // acct = new ExecutableAccounting(this); // // connect to the accounting object -// connect(acct, SIGNAL(changed(QString, QString)), -// con_win, SLOT(slotAccounting(QString, QString))); +// connect(acct, SIGNAL(changed(QString,QString)), +// con_win, SLOT(slotAccounting(QString,QString))); // // if(!acct->loadRuleSet(_pppdata->accountingFile())) { // // QString s= QObject::tr("Can not load the accounting " // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); // // starting the messagebox with a timer will prevent us // // from blocking the calling function ConnectWidget::timerEvent // ruleset_load_errmsg = s; // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); // return; // } // //else // // acct->slotStart(); // } // void KPPPWidget::stopAccounting() { // // store volume accounting // // if(stats->totalbytes != 0) // // _pppdata->setTotalBytes(stats->totalbytes); // if(!_pppdata->AcctEnabled()) // return; // // if(acct != 0) { // // acct->slotStop(); // // delete acct; // // acct = 0; // // } // } // void KPPPWidget::showStats() { // if(statdlg) { // statdlg->show(); // statdlg->raise(); // } // } void KPPPWidget::usernameChanged(const QString &) { // store username for later use _pppdata->setStoredUsername(ID_Edit->text()); } void KPPPWidget::passwordChanged(const QString &) { // store the password if so requested if(_pppdata->storePassword()) _pppdata->setStoredPassword(PW_Edit->text()); else _pppdata->setStoredPassword(""); } void KPPPWidget::setPW_Edit(const QString &pw) { PW_Edit->setText(pw); } // void KPPPWidget::resetCosts(const QString &s) { // AccountingBase::resetCosts(s); // } // void KPPPWidget::resetVolume(const QString &s) { // AccountingBase::resetVolume(s); // } /** * pppd's getword() function knows about escape characters. * If we write the username and password to the secrets file * we'll therefore have to escape back slashes. */ QString KPPPWidget::encodeWord(const QString &s) { QString r = s; r.replace(QRegExp("\\"), "\\\\"); return r; } // void KPPPWidget::setQuitOnDisconnect (bool b) // { // m_bQuitOnDisconnect = b; // } void KPPPWidget::showNews() { #ifdef KPPP_SHOW_NEWS /* * Introduce the QuickHelp feature to new users of this version */ #define QUICKHELP_HINT "Hint_QuickHelp" if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { QDialog dlg(0, 0, true); dlg.setCaption(QObject::tr("Recent Changes in KPPP")); QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); QHBoxLayout *l1 = new QHBoxLayout(10); |