author | kergoth <kergoth> | 2003-08-09 17:14:54 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:14:54 (UTC) |
commit | a7e015198a8c5ad3b6e144a9032b059086253e00 (patch) (side-by-side diff) | |
tree | b712b6f11310d88744fe393a92b3160b741a7efe /noncore/settings/networksettings/ppp/interfaceppp.cpp | |
parent | beba0e73306815337bf04dee39502233595e9739 (diff) | |
download | opie-a7e015198a8c5ad3b6e144a9032b059086253e00.zip opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.gz opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.bz2 |
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/settings/networksettings/ppp/interfaceppp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/interfaceppp.cpp | 70 |
1 files changed, 51 insertions, 19 deletions
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp index 9ec30bc..f443f3c 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp @@ -1,9 +1,11 @@ #include <qmessagebox.h> -#define i18n QObject::tr +#include <qlayout.h> +#include <qlineedit.h> +#include <qlabel.h> #include "auth.h" #include "interfaceppp.h" #include "modem.h" #include "pppdata.h" @@ -12,65 +14,80 @@ InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) _modemPtr(0), _dataPtr(0) { qDebug("InterfacePPP::InterfacePPP("); } -PPPData* InterfacePPP::data() +PPPData* InterfacePPP::data()const { if (!_dataPtr){ qDebug("creating new Data obj"); _dataPtr = new PPPData(); - _dataPtr->setModemDevice( getInterfaceName() ); + _dataPtr->setDevice( getInterfaceName() ); _dataPtr->setAccount( getHardwareName() ); } return _dataPtr; } -Modem* InterfacePPP::modem() +Modem* InterfacePPP::modem()const { if (!_modemPtr){ qDebug("creating new modem obj"); _modemPtr = new Modem( data() ); } return _modemPtr; } bool InterfacePPP::refresh() { qDebug("InterfacePPP::refresh()"); - updateInterface(this); - QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-("); - return false; + QString old = getInterfaceName(); + setInterfaceName( modem()->pppDevice() ); + + (void)Interface::refresh(); + + setInterfaceName( old ); + emit updateInterface(this); + + return true; } void InterfacePPP::start() { qDebug("InterfacePPP::start"); -// 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! ;-)"); -// } + if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { + + QDialog mb( 0, "Dialog", true ); + mb.setCaption( tr( "No password" ) ); + QVBoxLayout layout( &mb ); + QLabel text ( &mb ); + text.setText( tr("Username defined but no password\n Please enter a password") ); + QLineEdit lineedit( &mb ); + lineedit.setEchoMode( QLineEdit::Password ); + layout.addWidget( &text ); + layout.addWidget( &lineedit ); + if ( mb.exec() == QDialog::Accepted ) { + data()->setPassword( lineedit.text() ); + } + } QFileInfo info(pppdPath()); if(!info.exists()){ QMessageBox::warning(0, tr("Error"), - i18n("<qt>Cannot find the PPP daemon!<br>" + QObject::tr("<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>" + string = QObject::tr( "<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; @@ -78,13 +95,13 @@ void InterfacePPP::start() //#endif QFileInfo info2(data()->modemDevice()); if(!info2.exists()){ QString string; - string = i18n( "<qt>Cannot find:<br> %1<br>" + string = QObject::tr( "<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); @@ -95,30 +112,30 @@ void InterfacePPP::start() // 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>")); + QObject::tr("<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>" + s = QObject::tr("<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!"); + QString s = QObject::tr("You must specify a telephone number!"); QMessageBox::warning(0, tr("Error"), s); return; } // SEGFAULTS: // setStatus( true ); @@ -129,14 +146,29 @@ void InterfacePPP::start() qDebug("InterfacePPP::start END"); } void InterfacePPP::stop() { qDebug("InterfacePPP::stop"); + // emit hangup_now(); + status = false; // not connected + setStatus( false ); + emit hangup_now(); + refresh(); } void InterfacePPP::save() { data()->save(); emit updateInterface((Interface*) this); } +QString InterfacePPP::pppDev()const { + return modem()->pppDevice(); +} +pid_t InterfacePPP::pppPID()const{ + return modem()->pppPID(); +} +void InterfacePPP::setPPPDpid( pid_t pid) { + setStatus( true ); + modem()->setPPPDPid( pid ); +} |