author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/settings/networksettings/ppp/kpppwidget.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
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 @@ -29,103 +29,103 @@ #include <qapplication.h> #include <qcombobox.h> #include <qdir.h> #include <qevent.h> #include <qdialog.h> #include <qlabel.h> #include <qpushbutton.h> #include <qregexp.h> #include <qtabwidget.h> #include <qdialog.h> #include <qwhatsthis.h> #include <qcheckbox.h> // #include <kaboutdata.h> // #include <kapplication.h> #include <qbuttongroup.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <stdlib.h> #include <errno.h> #include <signal.h> #include "runtests.h" //#include "main.h" #include "auth.h" #include "modem.h" //#include "ppplog.h" //#include "opener.h" //#include "requester.h" //#include "pppstats.h" #include "pppdata.h" #include "general.h" #include "interface.h" #define execute_command system KPPPWidget *p_kppp = 0; KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) { // tabWindow = 0; p_kppp = this; // before doing anything else, run a few tests if (!_pppdata->setModemDevice( i->getInterfaceName() )) _pppdata->setModemDevice("/dev/modem"); - qDebug("PPPConfigWidget::PPPConfigWidget"); - qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); + odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; + odebug << " interface->getHardwareName >" << i->getHardwareName().latin1() << "<" << oendl; if (!_pppdata->setAccount( i->getHardwareName() )) _pppdata->setAccount( 0 ); - qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); - qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); + odebug << " _pppdata->accname >" << _pppdata->accname().latin1() << "<" << oendl; + odebug << " _pppdata->currentAccountID() >" << _pppdata->currentAccountID() << "<" << oendl; int result = runTests(); if(result == TEST_CRITICAL) exit(4); // installEventFilter(this); QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QGridLayout *l1 = new QGridLayout(3, 4); tl->addLayout(l1); l1->addColSpacing(0, 10); l1->addColSpacing(3, 10); l1->setColStretch(1, 3); l1->setColStretch(2, 4); label1 = new QLabel(QObject::tr("C&onnect to: "), this); l1->addWidget(label1, 0, 1); connectto_c = new QComboBox(false, this); label1->setBuddy(connectto_c); connect(connectto_c, SIGNAL(activated(int)), SLOT(newdefaultaccount(int))); l1->addWidget(connectto_c, 0, 2); ID_Label = new QLabel(QObject::tr("&Login ID:"), this); l1->addWidget(ID_Label, 1, 1); // the entry line for usernames ID_Edit = new QLineEdit(this); ID_Label->setBuddy(ID_Edit); l1->addWidget(ID_Edit, 1, 2); connect(ID_Edit, SIGNAL(returnPressed()), this, SLOT(enterPressedInID())); QString tmp = QObject::tr("<p>Type in the username that you got from your\n" "ISP. This is especially important for PAP\n" "and CHAP. You may omit this when you use\n" "terminal-based or script-based authentication.\n" "\n" "<b>Important</b>: case is important here:\n" "<i>myusername</i> is not the same as <i>MyUserName</i>!"); QWhatsThis::add(ID_Label,tmp); QWhatsThis::add(ID_Edit,tmp); PW_Label = new QLabel(QObject::tr("&Password:"), this); l1->addWidget(PW_Label, 2, 1); @@ -260,97 +260,97 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na connect(qApp, SIGNAL(shutDown()), this, SLOT(shutDown())); // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); // m_strCmdlAccount = args->getOption("c"); // m_bQuitOnDisconnect = args->isSet("q"); // if(!m_strCmdlAccount.isEmpty()) { // m_bCmdlAccount = true; // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; // } // if(m_bCmdlAccount){ // bool result = _pppdata->setAccount(m_strCmdlAccount); // if (!result){ // QString string; // string = QObject::tr("No such Account:\n%1").arg(m_strCmdlAccount); // KMessageBox::error(this, string); // m_bCmdlAccount = false; // this->show(); // } else { // beginConnect(); // } // } else // expandbutton(); // show(); //#define KPPP_SHOW_NEWS #ifdef KPPP_SHOW_NEWS // keep user informed about recent changes if(!m_bCmdlAccount) showNews(); #endif } KPPPWidget::~KPPPWidget() { p_kppp = 0; // delete stats; } // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { // if(e->type() == QEvent::User) { // switch(((SignalEvent*)e)->sigType()) { // case SIGINT: -// qDebug( "Received a SIGINT" ); +// odebug << "Received a SIGINT" << oendl; // 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); @@ -378,185 +378,185 @@ void KPPPWidget::log_window_toggled(bool on) { // } // //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(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" ); + odebug << "Received a SIGUSR1" << oendl; // 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" ); + odebug << "It was pppd that died" << oendl; // 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." ); + odebug << "Executing command on disconnect since pppd has died." << oendl; 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... " ); + odebug << "Trying to reconnect... " << oendl; if(_pppdata->authMethod() == AUTH_PAP || _pppdata->authMethod() == AUTH_CHAP || _pppdata->authMethod() == AUTH_PAPCHAP) Modem::modem->setSecret(_pppdata->authMethod(), encodeWord(_pppdata->storedUsername()), encodeWord(_pppdata->password())); con_win->hide(); con_win->stopClock(); // stopAccounting(); _pppdata->setpppdRunning(false); // not in a signal handler !!! KNotifyClient::beep(); emit cmdl_start(); } } _pppdata->setpppdError(0); } } // void KPPPWidget::sigChld() { -// qDebug( "sigchld()" ); +// odebug << "sigchld()" << oendl; // // pid_t id = wait(0L); // // if(id == helperPid && helperPid != -1) { // // kdDebug(5002) << "It was the setuid child that died" << endl; // // helperPid = -1; // QString msg = QObject::tr("kppp's helper process just died.\n" // "Since a further execution would be pointless, " // "kppp will shut down now."); // QMessageBox::warning(0L,"error", msg); // //remove_pidfile(); // exit(1); // // } // } void KPPPWidget::newdefaultaccount(int i) { _pppdata->setDefaultAccount(connectto_c->text(i)); _pppdata->save(); ID_Edit->setText(_pppdata->storedUsername()); PW_Edit->setText(_pppdata->storedPassword()); } void KPPPWidget::beginConnect() { // make sure to connect to the account that is selected in the combo box // (exeption: an account given by a command line argument) // if(!m_bCmdlAccount) { // _pppdata->setAccount(connectto_c->currentText()); // _pppdata->setPassword(PW_Edit->text()); // } else { _pppdata->setPassword(_pppdata->storedPassword()); // } QFileInfo info(pppdPath()); if(!info.exists()){ QMessageBox::warning(this, "error", QObject::tr("Cannot find the PPP daemon!\n" "Make sure that pppd is installed and " "that you have entered the correct path.")); return; } #if 0 if(!info.isExecutable()){ QString string; string = QObject::tr("kppp cannot execute:\n %1\n" "Please make sure that you have given kppp " |