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 | |||
@@ -89,77 +89,77 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam | |||
89 | loopend(false), | 89 | loopend(false), |
90 | semaphore(false), | 90 | semaphore(false), |
91 | expecting(false), | 91 | expecting(false), |
92 | readbuffer(""), | 92 | readbuffer(""), |
93 | scanvar(""), | 93 | scanvar(""), |
94 | scanning(false), | 94 | scanning(false), |
95 | pausing(false), | 95 | pausing(false), |
96 | dialnumber(0), | 96 | dialnumber(0), |
97 | _ifaceppp(ifp) | 97 | _ifaceppp(ifp) |
98 | { | 98 | { |
99 | modified_hostname = false; | 99 | modified_hostname = false; |
100 | 100 | ||
101 | QVBoxLayout *tl = new QVBoxLayout(this, 8, 10); | 101 | QVBoxLayout *tl = new QVBoxLayout(this, 8, 10); |
102 | QString tit = i18n("Connecting to: "); | 102 | QString tit = i18n("Connecting to: "); |
103 | setCaption(tit); | 103 | setCaption(tit); |
104 | 104 | ||
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())); |
150 | 150 | ||
151 | inittimer = new QTimer(this); | 151 | inittimer = new QTimer(this); |
152 | connect(inittimer, SIGNAL(timeout()), SLOT(init())); | 152 | connect(inittimer, SIGNAL(timeout()), SLOT(init())); |
153 | 153 | ||
154 | if_timeout_timer = new QTimer(this); | 154 | if_timeout_timer = new QTimer(this); |
155 | connect(if_timeout_timer, SIGNAL(timeout()), SLOT(if_waiting_timed_out())); | 155 | connect(if_timeout_timer, SIGNAL(timeout()), SLOT(if_waiting_timed_out())); |
156 | 156 | ||
157 | connect(this,SIGNAL(if_waiting_signal()),this,SLOT(if_waiting_slot())); | 157 | connect(this,SIGNAL(if_waiting_signal()),this,SLOT(if_waiting_slot())); |
158 | 158 | ||
159 | prompt = new PWEntry( this, "pw" ); | 159 | prompt = new PWEntry( this, "pw" ); |
160 | if_timer = new QTimer(this); | 160 | if_timer = new QTimer(this); |
161 | connect(if_timer,SIGNAL(timeout()), SLOT(if_waiting_slot())); | 161 | connect(if_timer,SIGNAL(timeout()), SLOT(if_waiting_slot())); |
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | ConnectWidget::~ConnectWidget() { | 165 | ConnectWidget::~ConnectWidget() { |
@@ -968,65 +968,63 @@ void ConnectWidget::cancelbutton() { | |||
968 | _ifaceppp->modem()->stop(); | 968 | _ifaceppp->modem()->stop(); |
969 | killTimer(main_timer_ID); | 969 | killTimer(main_timer_ID); |
970 | timeout_timer->stop(); | 970 | timeout_timer->stop(); |
971 | if_timer->stop(); | 971 | if_timer->stop(); |
972 | if_timeout_timer->stop(); | 972 | if_timeout_timer->stop(); |
973 | 973 | ||
974 | // if (termwindow) { | 974 | // if (termwindow) { |
975 | // delete termwindow; | 975 | // delete termwindow; |
976 | // termwindow = 0L; | 976 | // termwindow = 0L; |
977 | // this->show(); | 977 | // this->show(); |
978 | // } | 978 | // } |
979 | 979 | ||
980 | messg->setText(i18n("One moment please...")); | 980 | messg->setText(i18n("One moment please...")); |
981 | 981 | ||
982 | // just to be sure | 982 | // just to be sure |
983 | _ifaceppp->modem()->removeSecret(AUTH_PAP); | 983 | _ifaceppp->modem()->removeSecret(AUTH_PAP); |
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(); |
1017 | return; | 1015 | return; |
1018 | } | 1016 | } |
1019 | 1017 | ||
1020 | if (prompt->isVisible()) | 1018 | if (prompt->isVisible()) |
1021 | prompt->hide(); | 1019 | prompt->hide(); |
1022 | 1020 | ||
1023 | prompt->setConsumed(); | 1021 | prompt->setConsumed(); |
1024 | messg->setText(i18n("Script timed out!")); | 1022 | messg->setText(i18n("Script timed out!")); |
1025 | _ifaceppp->modem()->hangup(); | 1023 | _ifaceppp->modem()->hangup(); |
1026 | emit stopAccounting(); | 1024 | emit stopAccounting(); |
1027 | // p_kppp->con_win->stopClock(); | 1025 | // p_kppp->con_win->stopClock(); |
1028 | 1026 | ||
1029 | vmain = 0; // let's try again. | 1027 | vmain = 0; // let's try again. |
1030 | substate = -1; | 1028 | substate = -1; |
1031 | } | 1029 | } |
1032 | 1030 | ||
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 | |||
@@ -1,30 +1,33 @@ | |||
1 | #ifndef INTERFACEPPP_H | 1 | #ifndef INTERFACEPPP_H |
2 | #define INTERFACEPPP_H | 2 | #define INTERFACEPPP_H |
3 | 3 | ||
4 | #include "interface.h" | 4 | #include "interface.h" |
5 | 5 | ||
6 | class PPPData; | 6 | class PPPData; |
7 | class Modem; | 7 | class Modem; |
8 | 8 | ||
9 | class InterfacePPP : public Interface | 9 | class InterfacePPP : public Interface |
10 | { | 10 | { |
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 | |||
@@ -8,51 +8,51 @@ | |||
8 | * wuebben@math.cornell.edu | 8 | * wuebben@math.cornell.edu |
9 | * | 9 | * |
10 | * Copyright (C) 1998-2002 Harri Porten <porten@kde.org> | 10 | * Copyright (C) 1998-2002 Harri Porten <porten@kde.org> |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU Library General Public | 13 | * modify it under the terms of the GNU Library General Public |
14 | * License as published by the Free Software Foundation; either | 14 | * License as published by the Free Software Foundation; either |
15 | * version 2 of the License, or (at your option) any later version. | 15 | * version 2 of the License, or (at your option) any later version. |
16 | * | 16 | * |
17 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 | * Library General Public License for more details. | 20 | * Library General Public License for more details. |
21 | * | 21 | * |
22 | * You should have received a copy of the GNU Library General Public | 22 | * You should have received a copy of the GNU Library General Public |
23 | * License along with this program; if not, write to the Free | 23 | * License along with this program; if not, write to the Free |
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: |
43 | 43 | ||
44 | KPPPWidget(PPPData*, Interface*, QWidget *parent=0, const char *name=0, bool modal = false, WFlags fl = 0 ); | 44 | KPPPWidget(PPPData*, Interface*, QWidget *parent=0, const char *name=0, bool modal = false, WFlags fl = 0 ); |
45 | ~KPPPWidget(); | 45 | ~KPPPWidget(); |
46 | 46 | ||
47 | void setPW_Edit(const QString &); | 47 | void setPW_Edit(const QString &); |
48 | 48 | ||
49 | 49 | ||
50 | private slots: | 50 | private slots: |
51 | void newdefaultaccount(int); | 51 | void newdefaultaccount(int); |
52 | void beginConnect(); | 52 | void beginConnect(); |
53 | void quitbutton(); | 53 | void quitbutton(); |
54 | void usernameChanged(const QString &); | 54 | void usernameChanged(const QString &); |
55 | void passwordChanged(const QString &); | 55 | void passwordChanged(const QString &); |
56 | void enterPressedInID(); | 56 | void enterPressedInID(); |
57 | void enterPressedInPW(); | 57 | void enterPressedInPW(); |
58 | void saveMyself(); | 58 | void saveMyself(); |
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 | |||
@@ -109,49 +109,49 @@ void PPPData::save() | |||
109 | key = it.key(); | 109 | key = it.key(); |
110 | QChar sep = sepEntries[key]; | 110 | QChar sep = sepEntries[key]; |
111 | // qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); | 111 | // qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); |
112 | keys = QStringList::split( "SEPARATOR", key ); | 112 | keys = QStringList::split( "SEPARATOR", key ); |
113 | qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() ); | 113 | qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() ); |
114 | cfg.setGroup(keys[0]); | 114 | cfg.setGroup(keys[0]); |
115 | cfg.writeEntry(keys[1], val, sep); | 115 | cfg.writeEntry(keys[1], val, sep); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | // | 120 | // |
121 | // cancel changes | 121 | // cancel changes |
122 | // | 122 | // |
123 | void PPPData::cancel() { | 123 | void PPPData::cancel() { |
124 | stringEntries.clear(); | 124 | stringEntries.clear(); |
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 | ||
142 | 142 | ||
143 | int PPPData::readNumConfig(const QString &group, const QString &key, | 143 | int PPPData::readNumConfig(const QString &group, const QString &key, |
144 | int defvalue) | 144 | int defvalue) |
145 | { | 145 | { |
146 | QString idx = SEP.arg(group).arg(key); | 146 | QString idx = SEP.arg(group).arg(key); |
147 | if (intEntries.find(idx) != intEntries.end()) | 147 | if (intEntries.find(idx) != intEntries.end()) |
148 | return intEntries[idx]; | 148 | return intEntries[idx]; |
149 | Config cfg = config(); | 149 | Config cfg = config(); |
150 | cfg.setGroup(group); | 150 | cfg.setGroup(group); |
151 | return cfg.readNumEntry(key, defvalue); | 151 | return cfg.readNumEntry(key, defvalue); |
152 | 152 | ||
153 | // if (config) { | 153 | // if (config) { |
154 | // config->setGroup(group); | 154 | // config->setGroup(group); |
155 | // return config->readNumEntry(key, defvalue); | 155 | // return config->readNumEntry(key, defvalue); |
156 | // } else | 156 | // } else |
157 | // return defvalue; | 157 | // return defvalue; |
@@ -326,55 +326,57 @@ QString PPPData::pppdVersion() { | |||
326 | 326 | ||
327 | bool PPPData::pppdVersionMin(int ver, int mod, int patch) { | 327 | bool PPPData::pppdVersionMin(int ver, int mod, int patch) { |
328 | // check if pppd version fulfills minimum requirement | 328 | // check if pppd version fulfills minimum requirement |
329 | return (pppdVer > ver | 329 | return (pppdVer > ver |
330 | || (pppdVer == ver && pppdMod > mod) | 330 | || (pppdVer == ver && pppdMod > mod) |
331 | || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); | 331 | || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); |
332 | } | 332 | } |
333 | 333 | ||
334 | int PPPData::pppdTimeout() { | 334 | int PPPData::pppdTimeout() { |
335 | return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); | 335 | return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); |
336 | } | 336 | } |
337 | 337 | ||
338 | 338 | ||
339 | void PPPData::setpppdTimeout(int n) { | 339 | void PPPData::setpppdTimeout(int n) { |
340 | writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); | 340 | writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); |
341 | } | 341 | } |
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 | ||
365 | 367 | ||
366 | void PPPData::setFlowcontrol(const QString &n) { | 368 | void PPPData::setFlowcontrol(const QString &n) { |
367 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); | 369 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); |
368 | } | 370 | } |
369 | 371 | ||
370 | 372 | ||
371 | const QString PPPData::speed() { | 373 | const QString PPPData::speed() { |
372 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); | 374 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); |
373 | // undo the damage of a bug in former versions. It left an empty Speed= | 375 | // undo the damage of a bug in former versions. It left an empty Speed= |
374 | // entry in kppprc. kppp did set the serial port to 57600 as default but | 376 | // entry in kppprc. kppp did set the serial port to 57600 as default but |
375 | // pppd wouldn't receive the speed via the command line. | 377 | // pppd wouldn't receive the speed via the command line. |
376 | if(s.toUInt() == 0) | 378 | if(s.toUInt() == 0) |
377 | s = "57600"; | 379 | s = "57600"; |
378 | return s; | 380 | return s; |
379 | } | 381 | } |
380 | 382 | ||
@@ -691,55 +693,58 @@ void PPPData::setModemAnswerResp(const QString &n) { | |||
691 | } | 693 | } |
692 | 694 | ||
693 | 695 | ||
694 | const QString PPPData::enter() { | 696 | const QString PPPData::enter() { |
695 | return readConfig(modemGroup(), ENTER_KEY, "CR"); | 697 | return readConfig(modemGroup(), ENTER_KEY, "CR"); |
696 | } | 698 | } |
697 | 699 | ||
698 | 700 | ||
699 | void PPPData::setEnter(const QString &n) { | 701 | void PPPData::setEnter(const QString &n) { |
700 | writeConfig(modemGroup(), ENTER_KEY, n); | 702 | writeConfig(modemGroup(), ENTER_KEY, n); |
701 | } | 703 | } |
702 | 704 | ||
703 | 705 | ||
704 | // | 706 | // |
705 | // functions to set/return account information | 707 | // functions to set/return account information |
706 | // | 708 | // |
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); |
730 | return true; | 735 | return true; |
731 | } | 736 | } |
732 | return false; | 737 | return false; |
733 | } | 738 | } |
734 | 739 | ||
735 | 740 | ||
736 | bool PPPData::isUniqueAccname(const QString &n) { | 741 | bool PPPData::isUniqueAccname(const QString &n) { |
737 | int current = caccount; | 742 | int current = caccount; |
738 | for(int i=0; i <= highcount; i++) { | 743 | for(int i=0; i <= highcount; i++) { |
739 | setAccountbyIndex(i); | 744 | setAccountbyIndex(i); |
740 | if(accname() == n && i != current) { | 745 | if(accname() == n && i != current) { |
741 | setAccountbyIndex(current); | 746 | setAccountbyIndex(current); |
742 | return false; | 747 | return false; |
743 | } | 748 | } |
744 | } | 749 | } |
745 | setAccountbyIndex(current); | 750 | setAccountbyIndex(current); |
@@ -889,48 +894,51 @@ void PPPData::setDialPrefix(const QString &s) { | |||
889 | } | 894 | } |
890 | 895 | ||
891 | 896 | ||
892 | int PPPData::authMethod() { | 897 | int PPPData::authMethod() { |
893 | return readNumConfig(cgroup, AUTH_KEY, 0); | 898 | return readNumConfig(cgroup, AUTH_KEY, 0); |
894 | } | 899 | } |
895 | 900 | ||
896 | 901 | ||
897 | void PPPData::setAuthMethod(int value) { | 902 | void PPPData::setAuthMethod(int value) { |
898 | writeConfig(cgroup, AUTH_KEY, value); | 903 | writeConfig(cgroup, AUTH_KEY, value); |
899 | } | 904 | } |
900 | 905 | ||
901 | 906 | ||
902 | const QString PPPData::storedUsername() { | 907 | const QString PPPData::storedUsername() { |
903 | return readConfig(cgroup, STORED_USERNAME_KEY, ""); | 908 | return readConfig(cgroup, STORED_USERNAME_KEY, ""); |
904 | } | 909 | } |
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 | ||
921 | 929 | ||
922 | bool PPPData::storePassword() { | 930 | bool PPPData::storePassword() { |
923 | return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); | 931 | return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); |
924 | } | 932 | } |
925 | 933 | ||
926 | 934 | ||
927 | const QString PPPData::command_before_connect() { | 935 | const QString PPPData::command_before_connect() { |
928 | return readConfig(cgroup, BEFORE_CONNECT_KEY); | 936 | return readConfig(cgroup, BEFORE_CONNECT_KEY); |
929 | } | 937 | } |
930 | 938 | ||
931 | 939 | ||
932 | void PPPData::setCommand_before_connect(const QString &n) { | 940 | void PPPData::setCommand_before_connect(const QString &n) { |
933 | writeConfig(cgroup, BEFORE_CONNECT_KEY, n); | 941 | writeConfig(cgroup, BEFORE_CONNECT_KEY, n); |
934 | } | 942 | } |
935 | 943 | ||
936 | 944 | ||
@@ -1253,24 +1261,35 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces() | |||
1253 | accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); | 1261 | accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); |
1254 | config.setGroup(accGrp); | 1262 | config.setGroup(accGrp); |
1255 | dev = config.readEntry( ACOUNTS_DEV, "error" ); | 1263 | dev = config.readEntry( ACOUNTS_DEV, "error" ); |
1256 | acc = config.readEntry( ACOUNTS_ACC, "error" ); | 1264 | acc = config.readEntry( ACOUNTS_ACC, "error" ); |
1257 | ifaces.insert( dev, acc ); | 1265 | ifaces.insert( dev, acc ); |
1258 | } | 1266 | } |
1259 | 1267 | ||
1260 | return ifaces; | 1268 | return ifaces; |
1261 | } | 1269 | } |
1262 | 1270 | ||
1263 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) | 1271 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) |
1264 | { | 1272 | { |
1265 | QMap<QString,QString>::Iterator it; | 1273 | QMap<QString,QString>::Iterator it; |
1266 | int i = 0; | 1274 | int i = 0; |
1267 | Config cfg = config(); | 1275 | Config cfg = config(); |
1268 | for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){ | 1276 | for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){ |
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 | |||
@@ -388,48 +388,51 @@ public: | |||
388 | 388 | ||
389 | QStringList &dns(); | 389 | QStringList &dns(); |
390 | void setDns(QStringList &); | 390 | void setDns(QStringList &); |
391 | 391 | ||
392 | const QString domain(); | 392 | const QString domain(); |
393 | void setDomain(const QString &); | 393 | void setDomain(const QString &); |
394 | 394 | ||
395 | QStringList &scriptType(); | 395 | QStringList &scriptType(); |
396 | void setScriptType(QStringList &); | 396 | void setScriptType(QStringList &); |
397 | 397 | ||
398 | QStringList &script(); | 398 | QStringList &script(); |
399 | void setScript(QStringList &); | 399 | void setScript(QStringList &); |
400 | 400 | ||
401 | QStringList &pppdArgument(); | 401 | QStringList &pppdArgument(); |
402 | void setpppdArgumentDefaults(); | 402 | void setpppdArgumentDefaults(); |
403 | void setpppdArgument(QStringList &); | 403 | void setpppdArgument(QStringList &); |
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 |
420 | QString cgroup; // name of current config group | 423 | QString cgroup; // name of current config group |
421 | pid_t suidprocessid; // process ID of setuid child | 424 | pid_t suidprocessid; // process ID of setuid child |
422 | bool pppdisrunning; // pppd process | 425 | bool pppdisrunning; // pppd process |
423 | // daemon | 426 | // daemon |
424 | int pppderror; // error encounterd running pppd | 427 | int pppderror; // error encounterd running pppd |
425 | int pppdVer, pppdMod, pppdPatch; // pppd version | 428 | int pppdVer, pppdMod, pppdPatch; // pppd version |
426 | 429 | ||
427 | QStringList phonelist; | 430 | QStringList phonelist; |
428 | QMap<QString,QString> stringEntries; | 431 | QMap<QString,QString> stringEntries; |
429 | QMap<QString,int> intEntries; | 432 | QMap<QString,int> intEntries; |
430 | QMap<QString,QStringList> listEntries; | 433 | QMap<QString,QStringList> listEntries; |
431 | QMap<QString,QChar> sepEntries; | 434 | QMap<QString,QChar> sepEntries; |
432 | 435 | ||
433 | }; | 436 | }; |
434 | 437 | ||
435 | #endif | 438 | #endif |