summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/interfaceppp.cpp
authortille <tille>2003-06-02 11:57:59 (UTC)
committer tille <tille>2003-06-02 11:57:59 (UTC)
commitec520ccd6a4696663269db36b7df74ffde13c70c (patch) (side-by-side diff)
tree7c2c27160740eac2f24d8654b25266f8de55663d /noncore/settings/networksettings/ppp/interfaceppp.cpp
parentc002c647b15ea04f5a755b5edba5db0b280b1cbf (diff)
downloadopie-ec520ccd6a4696663269db36b7df74ffde13c70c.zip
opie-ec520ccd6a4696663269db36b7df74ffde13c70c.tar.gz
opie-ec520ccd6a4696663269db36b7df74ffde13c70c.tar.bz2
basicly working now...
... but it's not yet tested... ... and you cannot input username and pw. you can write a loginscript.
Diffstat (limited to 'noncore/settings/networksettings/ppp/interfaceppp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp113
1 files changed, 103 insertions, 10 deletions
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
index d9ee3ff..dc24824 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -1,43 +1,136 @@
+
+#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),
- _modem(0),
- _pppdata(0)
+ _modemPtr(0),
+ _dataPtr(0)
{
qDebug("InterfacePPP::InterfacePPP(");
}
PPPData* InterfacePPP::data()
{
- if (!_pppdata){
- _pppdata = new PPPData();
- _pppdata->setModemDevice( getInterfaceName() );
- _pppdata->setAccount( getHardwareName() );
+ if (!_dataPtr){
+ qDebug("creating new Data obj");
+ _dataPtr = new PPPData();
+ _dataPtr->setModemDevice( getInterfaceName() );
+ _dataPtr->setAccount( getHardwareName() );
}
- return _pppdata;
+ return _dataPtr;
}
Modem* InterfacePPP::modem()
{
- if (!_modem){
- _modem = new Modem( data() );
+ if (!_modemPtr){
+ qDebug("creating new modem obj");
+ _modemPtr = new Modem( data() );
}
- return _modem;
+ 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()->storedPassword() != "" ){
+ data()->setPassword(data()->storedPassword());
+ }else{
+ //FIXME:
+ qDebug("using dummy password");
+ data()->setPassword( "dummy" );
+ }
+
+
+ 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){ //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!");
+ QMessageBox::warning(0, tr("Error"), s);
+ return;
+ }
+
+// this->hide();
+
+ QString tit = i18n("Connecting to: %1").arg(data()->accname());
+// con->setCaption(tit);
+
+// con->show();
+
+
+ emit begin_connect();
+ qDebug("InterfacePPP::start END");
}
void InterfacePPP::stop()