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,6 +1,7 @@ | |||
1 | - add possibility to input username and password ;) | ||
1 | - impl. PPPData::copyaccount & PPPData::deleteAccount | 2 | - impl. PPPData::copyaccount & PPPData::deleteAccount |
2 | - update modem attribute inputs when modem has changed | 3 | - update modem attribute inputs when modem has changed |
3 | - fix layout of edit account | 4 | - fix layout of edit account |
4 | - save pppd arguments in edit account | 5 | - save pppd arguments in edit account |
5 | - popup configure modem with the correct account prselected | 6 | - popup configure modem with the correct account prselected |
6 | not quite shure why it does not work... IMHO it should work | 7 | not quite shure why it does not work... IMHO it should work |
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 | |||
@@ -105,45 +105,45 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam | |||
105 | QHBoxLayout *l0 = new QHBoxLayout(10); | 105 | QHBoxLayout *l0 = new QHBoxLayout(10); |
106 | tl->addLayout(l0); | 106 | tl->addLayout(l0); |
107 | l0->addSpacing(10); | 107 | l0->addSpacing(10); |
108 | messg = new QLabel(this, "messg"); | 108 | messg = new QLabel(this, "messg"); |
109 | messg->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 109 | messg->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
110 | messg->setAlignment(AlignCenter); | 110 | messg->setAlignment(AlignCenter); |
111 | messg->setText(i18n("Unable to create modem lock file.")); | 111 | messg->setText(i18n("Unable to create modem lock file.")); |
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); |
118 | l0->addWidget(messg); | 118 | l0->addWidget(messg); |
119 | l0->addSpacing(10); | 119 | l0->addSpacing(10); |
120 | 120 | ||
121 | QHBoxLayout *l1 = new QHBoxLayout(10); | 121 | QHBoxLayout *l1 = new QHBoxLayout(10); |
122 | tl->addLayout(l1); | 122 | tl->addLayout(l1); |
123 | l1->addStretch(1); | 123 | l1->addStretch(1); |
124 | 124 | ||
125 | debug = new QPushButton(i18n("Log"), this); | 125 | debug = new QPushButton(i18n("Log"), this); |
126 | debug->setToggleButton(true); | 126 | debug->setToggleButton(true); |
127 | connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); | 127 | connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); |
128 | 128 | ||
129 | cancel = new QPushButton(i18n("Cancel"), this); | 129 | cancel = new QPushButton(i18n("Cancel"), this); |
130 | cancel->setFocus(); | 130 | cancel->setFocus(); |
131 | connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton())); | 131 | connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton())); |
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); |
139 | l1->addWidget(cancel); | 139 | l1->addWidget(cancel); |
140 | 140 | ||
141 | setFixedSize(sizeHint()); | 141 | // setFixedSize(sizeHint()); |
142 | 142 | ||
143 | pausetimer = new QTimer(this); | 143 | pausetimer = new QTimer(this); |
144 | connect(pausetimer, SIGNAL(timeout()), SLOT(pause())); | 144 | connect(pausetimer, SIGNAL(timeout()), SLOT(pause())); |
145 | 145 | ||
146 | qApp->processEvents(); | 146 | qApp->processEvents(); |
147 | 147 | ||
148 | timeout_timer = new QTimer(this); | 148 | timeout_timer = new QTimer(this); |
149 | connect(timeout_timer, SIGNAL(timeout()), SLOT(script_timed_out())); | 149 | connect(timeout_timer, SIGNAL(timeout()), SLOT(script_timed_out())); |
@@ -984,33 +984,31 @@ void ConnectWidget::cancelbutton() { | |||
984 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); | 984 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); |
985 | removedns(_ifaceppp); | 985 | removedns(_ifaceppp); |
986 | 986 | ||
987 | qApp->processEvents(); | 987 | qApp->processEvents(); |
988 | 988 | ||
989 | _ifaceppp->modem()->killPPPDaemon(); | 989 | _ifaceppp->modem()->killPPPDaemon(); |
990 | _ifaceppp->modem()->hangup(); | 990 | _ifaceppp->modem()->hangup(); |
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(); |
998 | _ifaceppp->modem()->closetty(); | 997 | _ifaceppp->modem()->closetty(); |
999 | _ifaceppp->modem()->unlockdevice(); | 998 | _ifaceppp->modem()->unlockdevice(); |
1000 | 999 | ||
1001 | //abort prompt window... | 1000 | //abort prompt window... |
1002 | if (prompt->isVisible()) { | 1001 | if (prompt->isVisible()) { |
1003 | prompt->hide(); | 1002 | prompt->hide(); |
1004 | } | 1003 | } |
1005 | prompt->setConsumed(); | 1004 | prompt->setConsumed(); |
1006 | 1005 | ||
1007 | // if(p_kppp->quitOnDisconnect()) | 1006 | messg->setText(tr("offline")); |
1008 | // qApp->exit(0); | ||
1009 | } | 1007 | } |
1010 | 1008 | ||
1011 | 1009 | ||
1012 | void ConnectWidget::script_timed_out() { | 1010 | void ConnectWidget::script_timed_out() { |
1013 | if(vmain == 20) { // we are in the 'wait for the user to cancel' state | 1011 | if(vmain == 20) { // we are in the 'wait for the user to cancel' state |
1014 | timeout_timer->stop(); | 1012 | timeout_timer->stop(); |
1015 | emit stopAccounting(); | 1013 | emit stopAccounting(); |
1016 | // p_kppp->con_win->stopClock(); | 1014 | // p_kppp->con_win->stopClock(); |
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 | |||
@@ -1,24 +1,32 @@ | |||
1 | #include "interfaceinformationppp.h" | 1 | #include "interfaceinformationppp.h" |
2 | 2 | ||
3 | 3 | ||
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | //#include <qgroupbox.h> | 6 | //#include <qgroupbox.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | 8 | ||
9 | #include "connect.h" | ||
10 | #include "conwindow.h" | ||
11 | |||
9 | #ifdef QWS | 12 | #ifdef QWS |
10 | #else | 13 | #else |
11 | #define showMaximized show | 14 | #define showMaximized show |
12 | #endif | 15 | #endif |
13 | 16 | ||
14 | /** | 17 | /** |
15 | * Constructor for the InterfaceInformationImp class. This class pretty much | 18 | * Constructor for the InterfaceInformationImp class. This class pretty much |
16 | * just display's information about the interface that is passed to it. | 19 | * just display's information about the interface that is passed to it. |
17 | */ | 20 | */ |
18 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) | 21 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) |
19 | :InterfaceInformationImp(parent, name, i, f) | 22 | :InterfaceInformationImp(parent, name, i, f) |
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 | } |
22 | 30 | ||
23 | 31 | ||
24 | 32 | ||
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 | |||
@@ -1,25 +1,30 @@ | |||
1 | #ifndef INTERFACEINFORMATIONPPP_H | 1 | #ifndef INTERFACEINFORMATIONPPP_H |
2 | #define INTERFACEINFORMATIONPPP_H | 2 | #define INTERFACEINFORMATIONPPP_H |
3 | 3 | ||
4 | #include "interfaceinformationimp.h" | 4 | #include "interfaceinformationimp.h" |
5 | //#include "interface.h" | 5 | |
6 | 6 | ||
7 | class QWidget; | 7 | class QWidget; |
8 | class Interface; | 8 | class Interface; |
9 | class ConnectWidget; | ||
10 | class ConnectWindow; | ||
9 | 11 | ||
10 | class InterfaceInformationPPP : public InterfaceInformationImp { | 12 | class InterfaceInformationPPP : public InterfaceInformationImp { |
11 | 13 | ||
12 | Q_OBJECT | 14 | Q_OBJECT |
13 | 15 | ||
14 | public: | 16 | public: |
15 | 17 | ||
16 | InterfaceInformationPPP(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0); | 18 | InterfaceInformationPPP(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0); |
17 | ~InterfaceInformationPPP(){}; | 19 | ~InterfaceInformationPPP(){}; |
18 | 20 | ||
21 | private: | ||
22 | ConnectWidget *con; | ||
23 | ConnectWindow *con_win; | ||
19 | 24 | ||
20 | }; | 25 | }; |
21 | 26 | ||
22 | #endif | 27 | #endif |
23 | 28 | ||
24 | // addserviceimp.h | 29 | // addserviceimp.h |
25 | 30 | ||
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,48 +1,141 @@ | |||
1 | |||
2 | #include <qmessagebox.h> | ||
3 | #define i18n QObject::tr | ||
4 | |||
5 | #include "auth.h" | ||
1 | #include "interfaceppp.h" | 6 | #include "interfaceppp.h" |
2 | #include "modem.h" | 7 | #include "modem.h" |
3 | #include "pppdata.h" | 8 | #include "pppdata.h" |
4 | 9 | ||
5 | InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) | 10 | 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 | { |
10 | qDebug("InterfacePPP::InterfacePPP("); | 15 | qDebug("InterfacePPP::InterfacePPP("); |
11 | } | 16 | } |
12 | 17 | ||
13 | PPPData* InterfacePPP::data() | 18 | 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 | } |
22 | 28 | ||
23 | Modem* InterfacePPP::modem() | 29 | 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 | } |
30 | 37 | ||
31 | bool InterfacePPP::refresh() | 38 | bool InterfacePPP::refresh() |
32 | { | 39 | { |
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; |
35 | } | 43 | } |
36 | 44 | ||
37 | void InterfacePPP::start() | 45 | void InterfacePPP::start() |
38 | { | 46 | { |
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 | } |
42 | 135 | ||
43 | void InterfacePPP::stop() | 136 | void InterfacePPP::stop() |
44 | { | 137 | { |
45 | qDebug("InterfacePPP::stop"); | 138 | qDebug("InterfacePPP::stop"); |
46 | 139 | ||
47 | } | 140 | } |
48 | 141 | ||
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 | |||
@@ -11,20 +11,23 @@ class InterfacePPP : public Interface | |||
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | InterfacePPP(QObject *parent=0, const char *name="PPP", bool status=false); | 14 | InterfacePPP(QObject *parent=0, const char *name="PPP", bool status=false); |
15 | 15 | ||
16 | PPPData* data(); | 16 | PPPData* data(); |
17 | Modem* modem(); | 17 | Modem* modem(); |
18 | 18 | ||
19 | signals: | ||
20 | void begin_connect(); | ||
21 | |||
19 | public slots: | 22 | public slots: |
20 | virtual bool refresh(); | 23 | virtual bool refresh(); |
21 | virtual void start(); | 24 | virtual void start(); |
22 | virtual void stop(); | 25 | virtual void stop(); |
23 | 26 | ||
24 | private: | 27 | private: |
25 | Modem *_modem; | 28 | Modem *_modemPtr; |
26 | PPPData *_pppdata; | 29 | PPPData *_dataPtr; |
27 | }; | 30 | }; |
28 | 31 | ||
29 | 32 | ||
30 | #endif | 33 | #endif |
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 | |||
@@ -24,19 +24,19 @@ | |||
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef __KPPPWIDGET_H__ | 27 | #ifndef __KPPPWIDGET_H__ |
28 | #define __KPPPWIDGET_H__ | 28 | #define __KPPPWIDGET_H__ |
29 | 29 | ||
30 | #include <qstring.h> | 30 | #include <qstring.h> |
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 | ||
36 | class QPushButton; | 36 | class QPushButton; |
37 | class Interface; | 37 | class Interface; |
38 | class PPPData; | 38 | class PPPData; |
39 | 39 | ||
40 | class KPPPWidget : public QDialog { | 40 | class KPPPWidget : public QDialog { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
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 | |||
@@ -125,17 +125,17 @@ void PPPData::cancel() { | |||
125 | intEntries.clear(); | 125 | intEntries.clear(); |
126 | listEntries.clear(); | 126 | listEntries.clear(); |
127 | } | 127 | } |
128 | 128 | ||
129 | // functions to read/write date to configuration file | 129 | // functions to read/write date to configuration file |
130 | QString PPPData::readConfig(const QString &group, const QString &key, | 130 | QString PPPData::readConfig(const QString &group, const QString &key, |
131 | const QString &defvalue = "") | 131 | const QString &defvalue = "") |
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); |
135 | if (stringEntries.find(idx) != stringEntries.end()) | 135 | if (stringEntries.find(idx) != stringEntries.end()) |
136 | return stringEntries[idx]; | 136 | return stringEntries[idx]; |
137 | Config cfg = config(); | 137 | Config cfg = config(); |
138 | cfg.setGroup(group); | 138 | cfg.setGroup(group); |
139 | return cfg.readEntry(key, defvalue); | 139 | return cfg.readEntry(key, defvalue); |
140 | } | 140 | } |
141 | 141 | ||
@@ -342,23 +342,25 @@ void PPPData::setpppdTimeout(int n) { | |||
342 | 342 | ||
343 | 343 | ||
344 | const QString PPPData::modemDevice() { | 344 | const QString PPPData::modemDevice() { |
345 | return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); | 345 | return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | bool PPPData::setModemDevice(const QString &n) { | 349 | bool PPPData::setModemDevice(const QString &n) { |
350 | qDebug("Setting modem dev to >%s<", n.latin1()); | ||
350 | bool ret = false; | 351 | bool ret = false; |
351 | for (int i = 0; devices[i]; i++) | 352 | for (int i = 0; devices[i]; i++) |
352 | if (devices[i] == n){ | 353 | if (devices[i] == n){ |
353 | modemDeviceGroup = i; | 354 | modemDeviceGroup = i; |
354 | writeConfig(modemGroup(), MODEMDEV_KEY, n); | 355 | writeConfig(modemGroup(), MODEMDEV_KEY, n); |
355 | ret = true; | 356 | ret = true; |
356 | } | 357 | } |
358 | qDebug(ret?"SUCCESS":"FAILURE"); | ||
357 | return ret; | 359 | return ret; |
358 | } | 360 | } |
359 | 361 | ||
360 | 362 | ||
361 | const QString PPPData::flowcontrol() { | 363 | const QString PPPData::flowcontrol() { |
362 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); | 364 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); |
363 | } | 365 | } |
364 | 366 | ||
@@ -707,23 +709,26 @@ void PPPData::setEnter(const QString &n) { | |||
707 | 709 | ||
708 | //returns number of accounts | 710 | //returns number of accounts |
709 | int PPPData::count() const { | 711 | int PPPData::count() const { |
710 | return highcount + 1; | 712 | return highcount + 1; |
711 | } | 713 | } |
712 | 714 | ||
713 | 715 | ||
714 | bool PPPData::setAccount(const QString &aname) { | 716 | bool 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++) { |
716 | setAccountbyIndex(i); | 719 | setAccountbyIndex(i); |
717 | if(accname() == aname) { | 720 | if(accname() == aname) { |
718 | caccount = i; | 721 | caccount = i; |
722 | qDebug("SUCCESS"); | ||
719 | return true; | 723 | return true; |
720 | } | 724 | } |
721 | } | 725 | } |
726 | qDebug("FAILURE"); | ||
722 | return false; | 727 | return false; |
723 | } | 728 | } |
724 | 729 | ||
725 | 730 | ||
726 | bool PPPData::setAccountbyIndex(int i) { | 731 | bool PPPData::setAccountbyIndex(int i) { |
727 | if(i >= 0 && i <= highcount) { | 732 | if(i >= 0 && i <= highcount) { |
728 | caccount = i; | 733 | caccount = i; |
729 | cgroup.sprintf("%s%i", ACCOUNT_GRP, i); | 734 | cgroup.sprintf("%s%i", ACCOUNT_GRP, i); |
@@ -905,16 +910,19 @@ const QString PPPData::storedUsername() { | |||
905 | 910 | ||
906 | 911 | ||
907 | void PPPData::setStoredUsername(const QString &b) { | 912 | void PPPData::setStoredUsername(const QString &b) { |
908 | writeConfig(cgroup, STORED_USERNAME_KEY, b); | 913 | writeConfig(cgroup, STORED_USERNAME_KEY, b); |
909 | } | 914 | } |
910 | 915 | ||
911 | 916 | ||
912 | const QString PPPData::storedPassword() { | 917 | const 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, ""); |
914 | } | 922 | } |
915 | 923 | ||
916 | 924 | ||
917 | void PPPData::setStoredPassword(const QString &b) { | 925 | void PPPData::setStoredPassword(const QString &b) { |
918 | writeConfig(cgroup, STORED_PASSWORD_KEY, b); | 926 | writeConfig(cgroup, STORED_PASSWORD_KEY, b); |
919 | } | 927 | } |
920 | 928 | ||
@@ -1269,8 +1277,19 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) | |||
1269 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i)); | 1277 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i)); |
1270 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); | 1278 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); |
1271 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); | 1279 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); |
1272 | } | 1280 | } |
1273 | cfg.setGroup( ACCLIST_GRP ); | 1281 | cfg.setGroup( ACCLIST_GRP ); |
1274 | cfg.writeEntry( ACCOUNTS_COUNT, i ); | 1282 | cfg.writeEntry( ACCOUNTS_COUNT, i ); |
1275 | 1283 | ||
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 | */ | ||
1291 | QString 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 | |||
@@ -404,16 +404,19 @@ public: | |||
404 | 404 | ||
405 | //functions to change/set the child pppd process info | 405 | //functions to change/set the child pppd process info |
406 | bool pppdRunning() const; | 406 | bool pppdRunning() const; |
407 | void setpppdRunning(bool set); | 407 | void setpppdRunning(bool set); |
408 | 408 | ||
409 | int pppdError() const; | 409 | int pppdError() const; |
410 | void setpppdError(int err); | 410 | void setpppdError(int err); |
411 | 411 | ||
412 | |||
413 | static QString encodeWord(const QString &s); | ||
414 | |||
412 | private: | 415 | private: |
413 | 416 | ||
414 | //static PPPData *_data; | 417 | //static PPPData *_data; |
415 | int modemDeviceGroup; | 418 | int modemDeviceGroup; |
416 | QString passwd; | 419 | QString passwd; |
417 | // static Config* config; // configuration object | 420 | // static Config* config; // configuration object |
418 | int highcount; // index of highest account | 421 | int highcount; // index of highest account |
419 | int caccount; // index of the current account | 422 | int caccount; // index of the current account |