summaryrefslogtreecommitdiff
path: root/noncore/settings
authortille <tille>2003-06-02 11:57:59 (UTC)
committer tille <tille>2003-06-02 11:57:59 (UTC)
commitec520ccd6a4696663269db36b7df74ffde13c70c (patch) (unidiff)
tree7c2c27160740eac2f24d8654b25266f8de55663d /noncore/settings
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') (more/less context) (show 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 @@
1- add possibility to input username and password ;)
1- impl. PPPData::copyaccount & PPPData::deleteAccount 2- 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
112 messg->setMinimumHeight(messg->sizeHint().height() + 5); 112 messg->setMinimumHeight(messg->sizeHint().height() + 5);
113 int messw = (messg->sizeHint().width() * 12) / 10; 113// int messw = (messg->sizeHint().width() * 12) / 10;
114 messw = QMAX(messw,280); 114// messw = QMAX(messw,280);
115 messg->setMinimumWidth(messw); 115// messg->setMinimumWidth(messw);
116 messg->setText(i18n("Looking for modem...")); 116 messg->setText(i18n("Offline"));
117 l0->addSpacing(10); 117 l0->addSpacing(10);
@@ -132,7 +132,7 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
132 132
133 int maxw = QMAX(cancel->sizeHint().width(), 133// int maxw = QMAX(cancel->sizeHint().width(),
134 debug->sizeHint().width()); 134 // debug->sizeHint().width());
135 maxw = QMAX(maxw,65); 135// maxw = QMAX(maxw,65);
136 debug->setFixedWidth(maxw); 136// debug->setFixedWidth(maxw);
137 cancel->setFixedWidth(maxw); 137// cancel->setFixedWidth(maxw);
138 l1->addWidget(debug); 138 l1->addWidget(debug);
@@ -140,3 +140,3 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
140 140
141 setFixedSize(sizeHint()); 141// setFixedSize(sizeHint());
142 142
@@ -991,7 +991,6 @@ void ConnectWidget::cancelbutton() {
991 991
992 this->hide(); 992
993 messg->setText("");
994// p_kppp->quit_b->setFocus(); 993// p_kppp->quit_b->setFocus();
995// p_kppp->show(); 994// p_kppp->show();
996 emit stopAccounting();// just to be sure 995 // emit stopAccounting();// just to be sure
997// p_kppp->con_win->stopClock(); 996// p_kppp->con_win->stopClock();
@@ -1006,4 +1005,3 @@ void ConnectWidget::cancelbutton() {
1006 1005
1007// if(p_kppp->quitOnDisconnect()) 1006 messg->setText(tr("offline"));
1008// qApp->exit(0);
1009} 1007}
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 @@
8 8
9#include "connect.h"
10#include "conwindow.h"
11
9#ifdef QWS 12#ifdef QWS
@@ -20,2 +23,7 @@ InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *na
20{ 23{
24 qDebug("InterfaceInformationPPP::InterfaceInformationPPP");
25 con = new ConnectWidget( (InterfacePPP*)i, this, "con" );
26 // InterfaceInformationLayout->addMultiCellWidget( con, 7, 7, 0, 1 );
27 InterfaceInformationLayout->addWidget( con, 7, 0 );
28 connect(i, SIGNAL(begin_connect()),con, SLOT(preinit()));
21} 29}
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 @@
4#include "interfaceinformationimp.h" 4#include "interfaceinformationimp.h"
5//#include "interface.h" 5
6 6
@@ -8,2 +8,4 @@ class QWidget;
8class Interface; 8class Interface;
9class ConnectWidget;
10class ConnectWindow;
9 11
@@ -18,2 +20,5 @@ public:
18 20
21 private:
22 ConnectWidget *con;
23 ConnectWindow *con_win;
19 24
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 @@
1
2#include <qmessagebox.h>
3#define i18n QObject::tr
4
5#include "auth.h"
1#include "interfaceppp.h" 6#include "interfaceppp.h"
@@ -6,4 +11,4 @@ InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
6 : Interface(parent, name, status), 11 : Interface(parent, name, status),
7 _modem(0), 12 _modemPtr(0),
8 _pppdata(0) 13 _dataPtr(0)
9{ 14{
@@ -14,8 +19,9 @@ PPPData* InterfacePPP::data()
14{ 19{
15 if (!_pppdata){ 20 if (!_dataPtr){
16 _pppdata = new PPPData(); 21 qDebug("creating new Data obj");
17 _pppdata->setModemDevice( getInterfaceName() ); 22 _dataPtr = new PPPData();
18 _pppdata->setAccount( getHardwareName() ); 23 _dataPtr->setModemDevice( getInterfaceName() );
24 _dataPtr->setAccount( getHardwareName() );
19 } 25 }
20 return _pppdata; 26 return _dataPtr;
21} 27}
@@ -24,6 +30,7 @@ Modem* InterfacePPP::modem()
24{ 30{
25 if (!_modem){ 31 if (!_modemPtr){
26 _modem = new Modem( data() ); 32 qDebug("creating new modem obj");
33 _modemPtr = new Modem( data() );
27 } 34 }
28 return _modem; 35 return _modemPtr;
29} 36}
@@ -33,2 +40,3 @@ bool InterfacePPP::refresh()
33 qDebug("InterfacePPP::refresh()"); 40 qDebug("InterfacePPP::refresh()");
41 QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-(");
34 return false; 42 return false;
@@ -39,3 +47,88 @@ void InterfacePPP::start()
39 qDebug("InterfacePPP::start"); 47 qDebug("InterfacePPP::start");
48 if (data()->storedPassword() != "" ){
49 data()->setPassword(data()->storedPassword());
50 }else{
51 //FIXME:
52 qDebug("using dummy password");
53 data()->setPassword( "dummy" );
54 }
55
56
57 QFileInfo info(pppdPath());
58
59 if(!info.exists()){
60 QMessageBox::warning(0, tr("Error"),
61 i18n("<qt>Cannot find the PPP daemon!<br>"
62 "Make sure that pppd is installed and "
63 "that you have entered the correct path.</qt>"));
64 return;
65 }
66//#if 0
67 if(!info.isExecutable()){
68
69 QString string;
70 string = i18n( "<qt>Cannot execute:<br> %1<br>"
71 "Please make sure that you have given "
72 "setuid permission and that "
73 "pppd is executable.<br>").arg(pppdPath());
74 QMessageBox::warning(0, tr("Error"), string);
75 return;
76
77 }
78//#endif
79
80 QFileInfo info2(data()->modemDevice());
81
82 if(!info2.exists()){
83 QString string;
84 string = i18n( "<qt>Cannot find:<br> %1<br>"
85 "Please make sure you have setup "
86 "your modem device properly "
87 "and/or adjust the location of the modem device on "
88 "the modem tab of "
89 "the setup dialog.</qt>").arg(data()->modemDevice());
90 QMessageBox::warning(0, tr("Error"), string);
91 return;
92 }
93
94 // if this is a PAP or CHAP account, ensure that username is
95 // supplied
96 if(data()->authMethod() == AUTH_PAP ||
97 data()->authMethod() == AUTH_CHAP ||
98 data()->authMethod() == AUTH_PAPCHAP ) {
99 if(false){ //ID_Edit->text().isEmpty()) {
100 QMessageBox::warning(0,tr("Error"),
101 i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>"));
102// FIXME: return;
103 } else {
104 if(!modem()->setSecret(data()->authMethod(),
105 PPPData::encodeWord(data()->storedUsername()),
106 PPPData::encodeWord(data()->password()))
107 ) {
108 QString s;
109 s = i18n("<qt>Cannot create PAP/CHAP authentication<br>"
110 "file \"%1\"</qt>").arg(PAP_AUTH_FILE);
111 QMessageBox::warning(0, tr("Error"), s);
112 return;
113 }
114 }
115 }
116
117 if (data()->phonenumber().isEmpty()) {
118 QString s = i18n("You must specify a telephone number!");
119 QMessageBox::warning(0, tr("Error"), s);
120 return;
121 }
122
123// this->hide();
124
125 QString tit = i18n("Connecting to: %1").arg(data()->accname());
126// con->setCaption(tit);
127
128// con->show();
129
130
131 emit begin_connect();
40 132
133 qDebug("InterfacePPP::start END");
41} 134}
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:
18 18
19signals:
20 void begin_connect();
21
19public slots: 22public slots:
@@ -24,4 +27,4 @@ public slots:
24 private: 27 private:
25 Modem *_modem; 28 Modem *_modemPtr;
26 PPPData *_pppdata; 29 PPPData *_dataPtr;
27}; 30};
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 @@
31 31
32#include "conwindow.h"
33#include "accounts.h" 32#include "accounts.h"
34#include "connect.h" 33#include "connect.h"
34#include "conwindow.h"
35 35
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,
132{ 132{
133// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); 133 qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
134 QString idx = SEP.arg(group).arg(key); 134 QString idx = SEP.arg(group).arg(key);
@@ -349,2 +349,3 @@ const QString PPPData::modemDevice() {
349bool PPPData::setModemDevice(const QString &n) { 349bool PPPData::setModemDevice(const QString &n) {
350 qDebug("Setting modem dev to >%s<", n.latin1());
350 bool ret = false; 351 bool ret = false;
@@ -356,2 +357,3 @@ bool PPPData::setModemDevice(const QString &n) {
356 } 357 }
358 qDebug(ret?"SUCCESS":"FAILURE");
357 return ret; 359 return ret;
@@ -714,2 +716,3 @@ int PPPData::count() const {
714bool PPPData::setAccount(const QString &aname) { 716bool PPPData::setAccount(const QString &aname) {
717 qDebug("setting account to >%s<", aname.latin1());
715 for(int i = 0; i <= highcount; i++) { 718 for(int i = 0; i <= highcount; i++) {
@@ -718,2 +721,3 @@ bool PPPData::setAccount(const QString &aname) {
718 caccount = i; 721 caccount = i;
722 qDebug("SUCCESS");
719 return true; 723 return true;
@@ -721,2 +725,3 @@ bool PPPData::setAccount(const QString &aname) {
721 } 725 }
726 qDebug("FAILURE");
722 return false; 727 return false;
@@ -912,2 +917,5 @@ void PPPData::setStoredUsername(const QString &b) {
912const QString PPPData::storedPassword() { 917const QString PPPData::storedPassword() {
918 qDebug("getting stored pw");
919 qDebug("g %s", cgroup.latin1() );
920 qDebug("k %s", STORED_PASSWORD_KEY);
913 return readConfig(cgroup, STORED_PASSWORD_KEY, ""); 921 return readConfig(cgroup, STORED_PASSWORD_KEY, "");
@@ -1276 +1284,12 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
1276} 1284}
1285
1286/**
1287 * pppd's getword() function knows about escape characters.
1288 * If we write the username and password to the secrets file
1289 * we'll therefore have to escape back slashes.
1290 */
1291QString PPPData::encodeWord(const QString &s) {
1292 QString r = s;
1293 r.replace(QRegExp("\\"), "\\\\");
1294 return r;
1295}
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:
411 411
412
413 static QString encodeWord(const QString &s);
414
412private: 415private: