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 @@ -2,3 +2,5 @@ #include <qmessagebox.h> -#define i18n QObject::tr +#include <qlayout.h> +#include <qlineedit.h> +#include <qlabel.h> @@ -17,3 +19,3 @@ InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) -PPPData* InterfacePPP::data() +PPPData* InterfacePPP::data()const { @@ -22,3 +24,3 @@ PPPData* InterfacePPP::data() _dataPtr = new PPPData(); - _dataPtr->setModemDevice( getInterfaceName() ); + _dataPtr->setDevice( getInterfaceName() ); _dataPtr->setAccount( getHardwareName() ); @@ -28,3 +30,3 @@ PPPData* InterfacePPP::data() -Modem* InterfacePPP::modem() +Modem* InterfacePPP::modem()const { @@ -40,5 +42,11 @@ 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; } @@ -48,9 +56,18 @@ 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() ); + } + } @@ -60,3 +77,3 @@ void InterfacePPP::start() 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 " @@ -69,3 +86,3 @@ void InterfacePPP::start() 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 " @@ -83,3 +100,3 @@ void InterfacePPP::start() 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 " @@ -100,3 +117,3 @@ void InterfacePPP::start() 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; @@ -108,3 +125,3 @@ void InterfacePPP::start() 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); @@ -117,3 +134,3 @@ void InterfacePPP::start() 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); @@ -134,2 +151,7 @@ void InterfacePPP::stop() qDebug("InterfacePPP::stop"); + // emit hangup_now(); + status = false; // not connected + setStatus( false ); + emit hangup_now(); + refresh(); @@ -142 +164,11 @@ void InterfacePPP::save() } +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 ); +} |