summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/TODO1
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp28
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.cpp8
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.h7
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp113
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.h7
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.h2
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp21
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h3
9 files changed, 160 insertions, 30 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO
index 2410880..1136c2d 100644
--- a/noncore/settings/networksettings/ppp/TODO
+++ b/noncore/settings/networksettings/ppp/TODO
@@ -1 +1,2 @@
+- add possibility to input username and password ;)
- impl. PPPData::copyaccount & PPPData::deleteAccount
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index 2615b60..89d9930 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -112,6 +112,6 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
messg->setMinimumHeight(messg->sizeHint().height() + 5);
- int messw = (messg->sizeHint().width() * 12) / 10;
- messw = QMAX(messw,280);
- messg->setMinimumWidth(messw);
- messg->setText(i18n("Looking for modem..."));
+// int messw = (messg->sizeHint().width() * 12) / 10;
+// messw = QMAX(messw,280);
+// messg->setMinimumWidth(messw);
+ messg->setText(i18n("Offline"));
l0->addSpacing(10);
@@ -132,7 +132,7 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
- int maxw = QMAX(cancel->sizeHint().width(),
- debug->sizeHint().width());
- maxw = QMAX(maxw,65);
- debug->setFixedWidth(maxw);
- cancel->setFixedWidth(maxw);
+// int maxw = QMAX(cancel->sizeHint().width(),
+// debug->sizeHint().width());
+// maxw = QMAX(maxw,65);
+// debug->setFixedWidth(maxw);
+// cancel->setFixedWidth(maxw);
l1->addWidget(debug);
@@ -140,3 +140,3 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
- setFixedSize(sizeHint());
+// setFixedSize(sizeHint());
@@ -991,7 +991,6 @@ void ConnectWidget::cancelbutton() {
- this->hide();
- messg->setText("");
+
// p_kppp->quit_b->setFocus();
// p_kppp->show();
- emit stopAccounting(); // just to be sure
+// emit stopAccounting(); // just to be sure
// p_kppp->con_win->stopClock();
@@ -1006,4 +1005,3 @@ void ConnectWidget::cancelbutton() {
-// if(p_kppp->quitOnDisconnect())
-// qApp->exit(0);
+ messg->setText(tr("offline"));
}
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
index a58858c..3cf1167 100644
--- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
@@ -8,2 +8,5 @@
+#include "connect.h"
+#include "conwindow.h"
+
#ifdef QWS
@@ -20,2 +23,7 @@ InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *na
{
+ qDebug("InterfaceInformationPPP::InterfaceInformationPPP");
+ con = new ConnectWidget( (InterfacePPP*)i, this, "con" );
+ // InterfaceInformationLayout->addMultiCellWidget( con, 7, 7, 0, 1 );
+ InterfaceInformationLayout->addWidget( con, 7, 0 );
+ connect(i, SIGNAL(begin_connect()),con, SLOT(preinit()));
}
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.h b/noncore/settings/networksettings/ppp/interfaceinformationppp.h
index 8c6fc0b..68b58ea 100644
--- a/noncore/settings/networksettings/ppp/interfaceinformationppp.h
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.h
@@ -4,3 +4,3 @@
#include "interfaceinformationimp.h"
-//#include "interface.h"
+
@@ -8,2 +8,4 @@ class QWidget;
class Interface;
+class ConnectWidget;
+class ConnectWindow;
@@ -18,2 +20,5 @@ public:
+ private:
+ ConnectWidget *con;
+ ConnectWindow *con_win;
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 +1,6 @@
+
+#include <qmessagebox.h>
+#define i18n QObject::tr
+
+#include "auth.h"
#include "interfaceppp.h"
@@ -6,4 +11,4 @@ InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
: Interface(parent, name, status),
- _modem(0),
- _pppdata(0)
+ _modemPtr(0),
+ _dataPtr(0)
{
@@ -14,8 +19,9 @@ 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;
}
@@ -24,6 +30,7 @@ Modem* InterfacePPP::modem()
{
- if (!_modem){
- _modem = new Modem( data() );
+ if (!_modemPtr){
+ qDebug("creating new modem obj");
+ _modemPtr = new Modem( data() );
}
- return _modem;
+ return _modemPtr;
}
@@ -33,2 +40,3 @@ bool InterfacePPP::refresh()
qDebug("InterfacePPP::refresh()");
+ QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-(");
return false;
@@ -39,3 +47,88 @@ 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");
}
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.h b/noncore/settings/networksettings/ppp/interfaceppp.h
index b7477c9..06a4dbf 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.h
+++ b/noncore/settings/networksettings/ppp/interfaceppp.h
@@ -18,2 +18,5 @@ public:
+signals:
+ void begin_connect();
+
public slots:
@@ -24,4 +27,4 @@ public slots:
private:
- Modem *_modem;
- PPPData *_pppdata;
+ Modem *_modemPtr;
+ PPPData *_dataPtr;
};
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.h b/noncore/settings/networksettings/ppp/kpppwidget.h
index b958862..e0f5237 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.h
+++ b/noncore/settings/networksettings/ppp/kpppwidget.h
@@ -31,5 +31,5 @@
-#include "conwindow.h"
#include "accounts.h"
#include "connect.h"
+#include "conwindow.h"
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 59d68c9..7a6524f 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -132,3 +132,3 @@ QString PPPData::readConfig(const QString &group, const QString &key,
{
-// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
+ qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
QString idx = SEP.arg(group).arg(key);
@@ -349,2 +349,3 @@ const QString PPPData::modemDevice() {
bool PPPData::setModemDevice(const QString &n) {
+ qDebug("Setting modem dev to >%s<", n.latin1());
bool ret = false;
@@ -356,2 +357,3 @@ bool PPPData::setModemDevice(const QString &n) {
}
+ qDebug(ret?"SUCCESS":"FAILURE");
return ret;
@@ -714,2 +716,3 @@ int PPPData::count() const {
bool PPPData::setAccount(const QString &aname) {
+ qDebug("setting account to >%s<", aname.latin1());
for(int i = 0; i <= highcount; i++) {
@@ -718,2 +721,3 @@ bool PPPData::setAccount(const QString &aname) {
caccount = i;
+ qDebug("SUCCESS");
return true;
@@ -721,2 +725,3 @@ bool PPPData::setAccount(const QString &aname) {
}
+ qDebug("FAILURE");
return false;
@@ -912,2 +917,5 @@ void PPPData::setStoredUsername(const QString &b) {
const QString PPPData::storedPassword() {
+ qDebug("getting stored pw");
+ qDebug("g %s", cgroup.latin1() );
+ qDebug("k %s", STORED_PASSWORD_KEY);
return readConfig(cgroup, STORED_PASSWORD_KEY, "");
@@ -1276 +1284,12 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
}
+
+/**
+ * pppd's getword() function knows about escape characters.
+ * If we write the username and password to the secrets file
+ * we'll therefore have to escape back slashes.
+ */
+QString PPPData::encodeWord(const QString &s) {
+ QString r = s;
+ r.replace(QRegExp("\\"), "\\\\");
+ return r;
+}
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index af960c6..c9cd482 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -411,2 +411,5 @@ public:
+
+ static QString encodeWord(const QString &s);
+
private: