author | tille <tille> | 2003-06-03 14:51:12 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-03 14:51:12 (UTC) |
commit | 33cf1711b4d74036fa27dc971c25df236b8d0355 (patch) (side-by-side diff) | |
tree | 2a35ce380e40771089e22eed2d41dfc9577ff4cf | |
parent | 4e0c9efab5f3c73a1843e96983c9cd1894e44810 (diff) | |
download | opie-33cf1711b4d74036fa27dc971c25df236b8d0355.zip opie-33cf1711b4d74036fa27dc971c25df236b8d0355.tar.gz opie-33cf1711b4d74036fa27dc971c25df236b8d0355.tar.bz2 |
should popup for passwd now...
-rw-r--r-- | noncore/settings/networksettings/ppp/authwidget.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/interfaceppp.cpp | 11 |
3 files changed, 9 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp index 86bea98..fa2b164 100644 --- a/noncore/settings/networksettings/ppp/authwidget.cpp +++ b/noncore/settings/networksettings/ppp/authwidget.cpp @@ -105,91 +105,93 @@ AuthWidget::AuthWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch "gains access to this file!")); if (isNewAccount){ // select PAP/CHAP as default auth->setCurrentItem(AUTH_PAPCHAP); store_password->setChecked(true); }else{ auth->setCurrentItem(_pppdata->authMethod()); authChanged( auth->currentText() ); userName->setText( _pppdata->storedUsername() ); store_password->setChecked(_pppdata->storePassword()); if (store_password->isChecked()) passWord->setText( _pppdata->storedPassword() ); } } bool AuthWidget::check() { bool ret = true; if (scriptWidget){ if (!scriptWidget->check()){ QMessageBox::critical(this, tr("error"), tr("<qt>Login script has unbalanced loop Start/End<qt>")); ret = false; } } return ret; } void AuthWidget::save() { _pppdata->setAuthMethod(auth->currentItem()); if (scriptWidget) scriptWidget->save(); _pppdata->setStoredUsername( userName->text() ); _pppdata->setStorePassword(store_password->isChecked()); if (store_password->isChecked()) _pppdata->setStoredPassword( passWord->text() ); } void AuthWidget::authChanged( const QString &authStr ) { qDebug("AuthWidget::authChanged( %s )", authStr.latin1() ); if ( authStr.contains( tr("Script-based") ) ){ showUsernamePassword( false ); showScriptWindow( true ); } else if ( authStr.contains( tr("PAP") ) || authStr.contains( tr("CHAP") ) ){ showUsernamePassword( true ); showScriptWindow( false ); } else { qDebug("do not really know how to handle"); showUsernamePassword( false ); showScriptWindow( false ); } } void AuthWidget::showUsernamePassword( bool show ) { if (show){ user_l->show(); userName->show(); pw_l->show(); passWord->show(); store_password->show(); + hidePw->show(); }else{//!show user_l->hide(); userName->hide(); pw_l->hide(); passWord->hide(); store_password->hide(); + hidePw->hide(); } } void AuthWidget::showScriptWindow( bool show ) { if (show){ if (!scriptWidget){ scriptWidget = new ScriptWidget( _pppdata, this, isNewAccount, "scriptWid"); layout->addMultiCellWidget( scriptWidget, 1, 4, 0, 1 ); } scriptWidget->show(); }else{ // !show if (scriptWidget) scriptWidget->hide(); } } void AuthWidget::toggleEchoMode( bool t ) { passWord->setEchoMode( t ? QLineEdit::Normal : QLineEdit::Password ); } diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index a93f93d..798431b 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp @@ -538,129 +538,129 @@ void ConnectWidget::timerEvent(QTimerEvent *) { // already in the buffer. scriptindex++; setExpect(scriptArgument); return; } if (scriptCommand == "Pause") { QString bm = i18n("Pause %1 seconds").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); pausing = true; pausetimer->start(scriptArgument.toInt()*1000, true); timeout_timer->stop(); scriptindex++; return; } if (scriptCommand == "Timeout") { timeout_timer->stop(); QString bm = i18n("Timeout %1 seconds").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); scriptTimeout=scriptArgument.toInt()*1000; timeout_timer->start(scriptTimeout); scriptindex++; return; } if (scriptCommand == "Hangup") { messg->setText(i18n("Hangup")); emit debugMessage(i18n("Hangup")); writeline(_ifaceppp->data()->modemHangupStr()); setExpect(_ifaceppp->data()->modemHangupResp()); scriptindex++; return; } if (scriptCommand == "Answer") { timeout_timer->stop(); messg->setText(i18n("Answer")); emit debugMessage(i18n("Answer")); setExpect(_ifaceppp->data()->modemRingResp()); vmain = 150; return; } if (scriptCommand == "ID") { QString bm = i18n("ID %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); - QString idstring = _ifaceppp->data()->storedUsername(); + QString idstring = _ifaceppp->data()->password(); if(!idstring.isEmpty() && firstrunID) { // the user entered an Id on the main kppp dialog writeline(idstring); firstrunID = false; scriptindex++; } else { // the user didn't enter and Id on the main kppp dialog // let's query for an ID /* if not around yet, then post window... */ if (prompt->Consumed()) { if (!(prompt->isVisible())) { prompt->setPrompt(scriptArgument); prompt->setEchoModeNormal(); prompt->show(); } } else { /* if prompt withdrawn ... then, */ if(!(prompt->isVisible())) { writeline(prompt->text()); prompt->setConsumed(); scriptindex++; return; } /* replace timeout value */ } } } if (scriptCommand == "Password") { QString bm = i18n("Password %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); QString pwstring = _ifaceppp->data()->password(); if(!pwstring.isEmpty() && firstrunPW) { // the user entered a password on the main kppp dialog writeline(pwstring); firstrunPW = false; scriptindex++; } else { // the user didn't enter a password on the main kppp dialog // let's query for a password /* if not around yet, then post window... */ if (prompt->Consumed()) { if (!(prompt->isVisible())) { prompt->setPrompt(scriptArgument); prompt->setEchoModePassword(); prompt->show(); } } else { /* if prompt withdrawn ... then, */ if(!(prompt->isVisible())) { // p_kppp->setPW_Edit(prompt->text()); writeline(prompt->text()); prompt->setConsumed(); scriptindex++; return; } /* replace timeout value */ } diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp index 98bb4da..85ddbee 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp @@ -1,116 +1,117 @@ #include <qmessagebox.h> #define i18n QObject::tr #include "auth.h" #include "interfaceppp.h" #include "modem.h" #include "pppdata.h" InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) : Interface(parent, name, status), _modemPtr(0), _dataPtr(0) { qDebug("InterfacePPP::InterfacePPP("); } PPPData* InterfacePPP::data() { if (!_dataPtr){ qDebug("creating new Data obj"); _dataPtr = new PPPData(); _dataPtr->setModemDevice( getInterfaceName() ); _dataPtr->setAccount( getHardwareName() ); } return _dataPtr; } Modem* InterfacePPP::modem() { if (!_modemPtr){ qDebug("creating new modem obj"); _modemPtr = new Modem( data() ); } return _modemPtr; } bool InterfacePPP::refresh() { qDebug("InterfacePPP::refresh()"); QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-("); return false; } void InterfacePPP::start() { qDebug("InterfacePPP::start"); - if (data()->password().isEmpty() ){ -//FIXME: ask for password - qDebug("using dummy password"); - QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)"); - } +// should work... +// if (data()->password().isEmpty() ){ +// //FIXME: ask for password +// qDebug("using dummy password"); +// QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)"); +// } QFileInfo info(pppdPath()); if(!info.exists()){ QMessageBox::warning(0, tr("Error"), i18n("<qt>Cannot find the PPP daemon!<br>" "Make sure that pppd is installed and " "that you have entered the correct path.</qt>")); return; } //#if 0 if(!info.isExecutable()){ QString string; string = i18n( "<qt>Cannot execute:<br> %1<br>" "Please make sure that you have given " "setuid permission and that " "pppd is executable.<br>").arg(pppdPath()); QMessageBox::warning(0, tr("Error"), string); return; } //#endif QFileInfo info2(data()->modemDevice()); if(!info2.exists()){ QString string; string = i18n( "<qt>Cannot find:<br> %1<br>" "Please make sure you have setup " "your modem device properly " "and/or adjust the location of the modem device on " "the modem tab of " "the setup dialog.</qt>").arg(data()->modemDevice()); QMessageBox::warning(0, tr("Error"), string); return; } // if this is a PAP or CHAP account, ensure that username is // supplied if(data()->authMethod() == AUTH_PAP || data()->authMethod() == AUTH_CHAP || data()->authMethod() == AUTH_PAPCHAP ) { if(false){ //FIXME: ID_Edit->text().isEmpty()) { QMessageBox::warning(0,tr("Error"), i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>")); // FIXME: return; } else { if(!modem()->setSecret(data()->authMethod(), PPPData::encodeWord(data()->storedUsername()), PPPData::encodeWord(data()->password())) ) { QString s; s = i18n("<qt>Cannot create PAP/CHAP authentication<br>" "file \"%1\"</qt>").arg(PAP_AUTH_FILE); QMessageBox::warning(0, tr("Error"), s); return; } } } if (data()->phonenumber().isEmpty()) { QString s = i18n("You must specify a telephone number!"); |