author | tille <tille> | 2003-06-02 11:57:59 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-02 11:57:59 (UTC) |
commit | ec520ccd6a4696663269db36b7df74ffde13c70c (patch) (unidiff) | |
tree | 7c2c27160740eac2f24d8654b25266f8de55663d | |
parent | c002c647b15ea04f5a755b5edba5db0b280b1cbf (diff) | |
download | opie-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.
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 | |||
@@ -17,221 +17,221 @@ | |||
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 | //#include <config.h> | 27 | //#include <config.h> |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qregexp.h> | 30 | #include <qregexp.h> |
31 | 31 | ||
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <kdebug.h> | 33 | //#include <kdebug.h> |
34 | //#include <klocale.h> | 34 | //#include <klocale.h> |
35 | #define i18n QObject::tr | 35 | #define i18n QObject::tr |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | 38 | ||
39 | #include <unistd.h> | 39 | #include <unistd.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <string.h> | 41 | #include <string.h> |
42 | #include <fcntl.h> | 42 | #include <fcntl.h> |
43 | #include <netdb.h> | 43 | #include <netdb.h> |
44 | #include <sys/types.h> | 44 | #include <sys/types.h> |
45 | #include <sys/socket.h> | 45 | #include <sys/socket.h> |
46 | #include <arpa/inet.h> | 46 | #include <arpa/inet.h> |
47 | #include <netinet/in.h> | 47 | #include <netinet/in.h> |
48 | #include <sys/ioctl.h> | 48 | #include <sys/ioctl.h> |
49 | #include <assert.h> | 49 | #include <assert.h> |
50 | 50 | ||
51 | #ifdef _XPG4_2 | 51 | #ifdef _XPG4_2 |
52 | #define __xnet_connectconnect | 52 | #define __xnet_connectconnect |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #include <errno.h> | 55 | #include <errno.h> |
56 | 56 | ||
57 | #ifdef HAVE_SYS_PARAM_H | 57 | #ifdef HAVE_SYS_PARAM_H |
58 | #include <sys/param.h> | 58 | #include <sys/param.h> |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #ifdef __linux__ | 61 | #ifdef __linux__ |
62 | #include "runtests.h" | 62 | #include "runtests.h" |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #include "auth.h" | 65 | #include "auth.h" |
66 | #include "connect.h" | 66 | #include "connect.h" |
67 | //#include "docking.h" | 67 | //#include "docking.h" |
68 | #include "interfaceppp.h" | 68 | #include "interfaceppp.h" |
69 | #include "modem.h" | 69 | #include "modem.h" |
70 | #include "kpppconfig.h" | 70 | #include "kpppconfig.h" |
71 | #include "pppdata.h" | 71 | #include "pppdata.h" |
72 | #include "kpppwidget.h" | 72 | #include "kpppwidget.h" |
73 | //#include "requester.h" | 73 | //#include "requester.h" |
74 | //#include "utils.h" | 74 | //#include "utils.h" |
75 | #define execute_command system | 75 | #define execute_command system |
76 | 76 | ||
77 | QString old_hostname; | 77 | QString old_hostname; |
78 | bool modified_hostname; | 78 | bool modified_hostname; |
79 | 79 | ||
80 | 80 | ||
81 | ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name) | 81 | ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name) |
82 | : QWidget(parent, name), | 82 | : QWidget(parent, name), |
83 | myreadbuffer(""), | 83 | myreadbuffer(""), |
84 | main_timer_ID(0), | 84 | main_timer_ID(0), |
85 | vmain(0), | 85 | vmain(0), |
86 | substate(-1), | 86 | substate(-1), |
87 | scriptindex(0), | 87 | scriptindex(0), |
88 | loopnest(0), | 88 | loopnest(0), |
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() { |
166 | } | 166 | } |
167 | 167 | ||
168 | 168 | ||
169 | void ConnectWidget::preinit() { | 169 | void ConnectWidget::preinit() { |
170 | // this is all just to keep the GUI nice and snappy .... | 170 | // this is all just to keep the GUI nice and snappy .... |
171 | // you have to see to believe ... | 171 | // you have to see to believe ... |
172 | messg->setText(i18n("Looking for modem...")); | 172 | messg->setText(i18n("Looking for modem...")); |
173 | inittimer->start(100); | 173 | inittimer->start(100); |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | void ConnectWidget::init() { | 177 | void ConnectWidget::init() { |
178 | _ifaceppp->data()->setpppdError(0); | 178 | _ifaceppp->data()->setpppdError(0); |
179 | inittimer->stop(); | 179 | inittimer->stop(); |
180 | vmain = 0; | 180 | vmain = 0; |
181 | substate = -1; | 181 | substate = -1; |
182 | expecting = false; | 182 | expecting = false; |
183 | pausing = false; | 183 | pausing = false; |
184 | scriptindex = 0; | 184 | scriptindex = 0; |
185 | myreadbuffer = ""; | 185 | myreadbuffer = ""; |
186 | scanning = false; | 186 | scanning = false; |
187 | scanvar = ""; | 187 | scanvar = ""; |
188 | firstrunID = true; | 188 | firstrunID = true; |
189 | firstrunPW = true; | 189 | firstrunPW = true; |
190 | // stats->totalbytes = 0; | 190 | // stats->totalbytes = 0; |
191 | dialnumber = 0; | 191 | dialnumber = 0; |
192 | 192 | ||
193 | // p_kppp->con_speed = ""; | 193 | // p_kppp->con_speed = ""; |
194 | 194 | ||
195 | // p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect()); | 195 | // p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect()); |
196 | 196 | ||
197 | comlist = &_ifaceppp->data()->scriptType(); | 197 | comlist = &_ifaceppp->data()->scriptType(); |
198 | arglist = &_ifaceppp->data()->script(); | 198 | arglist = &_ifaceppp->data()->script(); |
199 | 199 | ||
200 | QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname()); | 200 | QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname()); |
201 | setCaption(tit); | 201 | setCaption(tit); |
202 | 202 | ||
203 | qApp->processEvents(); | 203 | qApp->processEvents(); |
204 | 204 | ||
205 | // run the "before-connect" command | 205 | // run the "before-connect" command |
206 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { | 206 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { |
207 | messg->setText(i18n("Running pre-startup command...")); | 207 | messg->setText(i18n("Running pre-startup command...")); |
208 | emit debugMessage(i18n("Running pre-startup command...")); | 208 | emit debugMessage(i18n("Running pre-startup command...")); |
209 | 209 | ||
210 | qApp->processEvents(); | 210 | qApp->processEvents(); |
211 | QApplication::flushX(); | 211 | QApplication::flushX(); |
212 | pid_t id = execute_command(_ifaceppp->data()->command_before_connect()); | 212 | pid_t id = execute_command(_ifaceppp->data()->command_before_connect()); |
213 | // int i, status; | 213 | // int i, status; |
214 | 214 | ||
215 | // do { | 215 | // do { |
216 | // qApp->processEvents(); | 216 | // qApp->processEvents(); |
217 | // i = waitpid(id, &status, WNOHANG); | 217 | // i = waitpid(id, &status, WNOHANG); |
218 | // usleep(100000); | 218 | // usleep(100000); |
219 | // } while (i == 0 && errno == 0); | 219 | // } while (i == 0 && errno == 0); |
220 | } | 220 | } |
221 | 221 | ||
222 | int lock = _ifaceppp->modem()->lockdevice(); | 222 | int lock = _ifaceppp->modem()->lockdevice(); |
223 | 223 | ||
224 | if (lock == 1) { | 224 | if (lock == 1) { |
225 | messg->setText(i18n("Modem device is locked.")); | 225 | messg->setText(i18n("Modem device is locked.")); |
226 | vmain = 20; // wait until cancel is pressed | 226 | vmain = 20; // wait until cancel is pressed |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | 229 | ||
230 | if (lock == -1) { | 230 | if (lock == -1) { |
231 | messg->setText(i18n("Unable to create modem lock file.")); | 231 | messg->setText(i18n("Unable to create modem lock file.")); |
232 | vmain = 20; // wait until cancel is pressed | 232 | vmain = 20; // wait until cancel is pressed |
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | if(_ifaceppp->modem()->opentty()) { | 236 | if(_ifaceppp->modem()->opentty()) { |
237 | messg->setText(_ifaceppp->modem()->modemMessage()); | 237 | messg->setText(_ifaceppp->modem()->modemMessage()); |
@@ -896,209 +896,207 @@ void ConnectWidget::readChar(unsigned char c) { | |||
896 | return; | 896 | return; |
897 | 897 | ||
898 | readbuffer += c; | 898 | readbuffer += c; |
899 | myreadbuffer += c; | 899 | myreadbuffer += c; |
900 | 900 | ||
901 | // While in scanning mode store each char to the scan buffer | 901 | // While in scanning mode store each char to the scan buffer |
902 | // for use in the prompt command | 902 | // for use in the prompt command |
903 | if( scanning ) | 903 | if( scanning ) |
904 | scanbuffer += c; | 904 | scanbuffer += c; |
905 | 905 | ||
906 | // add to debug window | 906 | // add to debug window |
907 | emit debugPutChar(c); | 907 | emit debugPutChar(c); |
908 | 908 | ||
909 | checkBuffers(); | 909 | checkBuffers(); |
910 | } | 910 | } |
911 | 911 | ||
912 | 912 | ||
913 | void ConnectWidget::checkBuffers() { | 913 | void ConnectWidget::checkBuffers() { |
914 | // Let's check if we are finished with scanning: | 914 | // Let's check if we are finished with scanning: |
915 | // The scanstring have to be in the buffer and the latest character | 915 | // The scanstring have to be in the buffer and the latest character |
916 | // was a carriage return or an linefeed (depending on modem setup) | 916 | // was a carriage return or an linefeed (depending on modem setup) |
917 | if( scanning && scanbuffer.contains(scanstr) && | 917 | if( scanning && scanbuffer.contains(scanstr) && |
918 | ( scanbuffer.right(1) == "\n" || scanbuffer.right(1) == "\r") ) { | 918 | ( scanbuffer.right(1) == "\n" || scanbuffer.right(1) == "\r") ) { |
919 | scanning = false; | 919 | scanning = false; |
920 | 920 | ||
921 | int vstart = scanbuffer.find( scanstr ) + scanstr.length(); | 921 | int vstart = scanbuffer.find( scanstr ) + scanstr.length(); |
922 | scanvar = scanbuffer.mid( vstart, scanbuffer.length() - vstart); | 922 | scanvar = scanbuffer.mid( vstart, scanbuffer.length() - vstart); |
923 | scanvar = scanvar.stripWhiteSpace(); | 923 | scanvar = scanvar.stripWhiteSpace(); |
924 | 924 | ||
925 | // Show the Variabel content in the debug window | 925 | // Show the Variabel content in the debug window |
926 | QString sv = i18n("Scan Var: %1").arg(scanvar); | 926 | QString sv = i18n("Scan Var: %1").arg(scanvar); |
927 | emit debugMessage(sv); | 927 | emit debugMessage(sv); |
928 | } | 928 | } |
929 | 929 | ||
930 | if(expecting) { | 930 | if(expecting) { |
931 | if(readbuffer.contains(expectstr)) { | 931 | if(readbuffer.contains(expectstr)) { |
932 | expecting = false; | 932 | expecting = false; |
933 | // keep everything after the expected string | 933 | // keep everything after the expected string |
934 | readbuffer.remove(0, readbuffer.find(expectstr) + expectstr.length()); | 934 | readbuffer.remove(0, readbuffer.find(expectstr) + expectstr.length()); |
935 | 935 | ||
936 | QString ts = i18n("Found: %1").arg(expectstr); | 936 | QString ts = i18n("Found: %1").arg(expectstr); |
937 | emit debugMessage(ts); | 937 | emit debugMessage(ts); |
938 | 938 | ||
939 | if (loopend) { | 939 | if (loopend) { |
940 | loopend=false; | 940 | loopend=false; |
941 | } | 941 | } |
942 | } | 942 | } |
943 | 943 | ||
944 | if (loopend && readbuffer.contains(loopstr[loopnest])) { | 944 | if (loopend && readbuffer.contains(loopstr[loopnest])) { |
945 | expecting = false; | 945 | expecting = false; |
946 | readbuffer = ""; | 946 | readbuffer = ""; |
947 | QString ts = i18n("Looping: %1").arg(loopstr[loopnest]); | 947 | QString ts = i18n("Looping: %1").arg(loopstr[loopnest]); |
948 | emit debugMessage(ts); | 948 | emit debugMessage(ts); |
949 | scriptindex = loopstartindex[loopnest]; | 949 | scriptindex = loopstartindex[loopnest]; |
950 | loopend = false; | 950 | loopend = false; |
951 | loopnest++; | 951 | loopnest++; |
952 | } | 952 | } |
953 | // notify event loop if expected string was found | 953 | // notify event loop if expected string was found |
954 | if(!expecting) | 954 | if(!expecting) |
955 | timerEvent((QTimerEvent *) 0); | 955 | timerEvent((QTimerEvent *) 0); |
956 | } | 956 | } |
957 | } | 957 | } |
958 | 958 | ||
959 | 959 | ||
960 | 960 | ||
961 | void ConnectWidget::pause() { | 961 | void ConnectWidget::pause() { |
962 | pausing = false; | 962 | pausing = false; |
963 | pausetimer->stop(); | 963 | pausetimer->stop(); |
964 | } | 964 | } |
965 | 965 | ||
966 | 966 | ||
967 | void ConnectWidget::cancelbutton() { | 967 | 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 | ||
1033 | 1031 | ||
1034 | void ConnectWidget::setScan(const QString &n) { | 1032 | void ConnectWidget::setScan(const QString &n) { |
1035 | scanning = true; | 1033 | scanning = true; |
1036 | scanstr = n; | 1034 | scanstr = n; |
1037 | scanbuffer = ""; | 1035 | scanbuffer = ""; |
1038 | 1036 | ||
1039 | QString ts = i18n("Scanning: %1").arg(n); | 1037 | QString ts = i18n("Scanning: %1").arg(n); |
1040 | emit debugMessage(ts); | 1038 | emit debugMessage(ts); |
1041 | } | 1039 | } |
1042 | 1040 | ||
1043 | 1041 | ||
1044 | void ConnectWidget::setExpect(const QString &n) { | 1042 | void ConnectWidget::setExpect(const QString &n) { |
1045 | expecting = true; | 1043 | expecting = true; |
1046 | expectstr = n; | 1044 | expectstr = n; |
1047 | 1045 | ||
1048 | QString ts = i18n("Expecting: %1").arg(n); | 1046 | QString ts = i18n("Expecting: %1").arg(n); |
1049 | ts.replace(QRegExp("\n"), "<LF>"); | 1047 | ts.replace(QRegExp("\n"), "<LF>"); |
1050 | emit debugMessage(ts); | 1048 | emit debugMessage(ts); |
1051 | 1049 | ||
1052 | // check if the expected string is in the read buffer already. | 1050 | // check if the expected string is in the read buffer already. |
1053 | checkBuffers(); | 1051 | checkBuffers(); |
1054 | } | 1052 | } |
1055 | 1053 | ||
1056 | 1054 | ||
1057 | void ConnectWidget::if_waiting_timed_out() { | 1055 | void ConnectWidget::if_waiting_timed_out() { |
1058 | if_timer->stop(); | 1056 | if_timer->stop(); |
1059 | if_timeout_timer->stop(); | 1057 | if_timeout_timer->stop(); |
1060 | qDebug("if_waiting_timed_out()"); | 1058 | qDebug("if_waiting_timed_out()"); |
1061 | 1059 | ||
1062 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); | 1060 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); |
1063 | 1061 | ||
1064 | // let's kill the stuck pppd | 1062 | // let's kill the stuck pppd |
1065 | _ifaceppp->modem()->killPPPDaemon(); | 1063 | _ifaceppp->modem()->killPPPDaemon(); |
1066 | 1064 | ||
1067 | emit stopAccounting(); | 1065 | emit stopAccounting(); |
1068 | // p_kppp->con_win->stopClock(); | 1066 | // p_kppp->con_win->stopClock(); |
1069 | 1067 | ||
1070 | 1068 | ||
1071 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() | 1069 | // killing ppp will generate a SIGCHLD which will be caught in pppdie() |
1072 | // in main.cpp what happens next will depend on the boolean | 1070 | // in main.cpp what happens next will depend on the boolean |
1073 | // reconnect_on_disconnect which is set in ConnectWidget::init(); | 1071 | // reconnect_on_disconnect which is set in ConnectWidget::init(); |
1074 | } | 1072 | } |
1075 | 1073 | ||
1076 | void ConnectWidget::pppdDied() | 1074 | void ConnectWidget::pppdDied() |
1077 | { | 1075 | { |
1078 | if_timer->stop(); | 1076 | if_timer->stop(); |
1079 | if_timeout_timer->stop(); | 1077 | if_timeout_timer->stop(); |
1080 | } | 1078 | } |
1081 | 1079 | ||
1082 | void ConnectWidget::if_waiting_slot() { | 1080 | void ConnectWidget::if_waiting_slot() { |
1083 | messg->setText(i18n("Logging on to network...")); | 1081 | messg->setText(i18n("Logging on to network...")); |
1084 | 1082 | ||
1085 | // if(!stats->ifIsUp()) { | 1083 | // if(!stats->ifIsUp()) { |
1086 | 1084 | ||
1087 | // if(_ifaceppp->data()->pppdError() != 0) { | 1085 | // if(_ifaceppp->data()->pppdError() != 0) { |
1088 | // // we are here if pppd died immediately after starting it. | 1086 | // // we are here if pppd died immediately after starting it. |
1089 | // pppdDied(); | 1087 | // pppdDied(); |
1090 | // // error message handled in main.cpp: sigPPPDDied() | 1088 | // // error message handled in main.cpp: sigPPPDDied() |
1091 | // return; | 1089 | // return; |
1092 | // } | 1090 | // } |
1093 | 1091 | ||
1094 | // if_timer->start(100, TRUE); // single shot | 1092 | // if_timer->start(100, TRUE); // single shot |
1095 | // return; | 1093 | // return; |
1096 | // } | 1094 | // } |
1097 | 1095 | ||
1098 | // O.K the ppp interface is up and running | 1096 | // O.K the ppp interface is up and running |
1099 | // give it a few time to come up completly (0.2 seconds) | 1097 | // give it a few time to come up completly (0.2 seconds) |
1100 | if_timeout_timer->stop(); | 1098 | if_timeout_timer->stop(); |
1101 | if_timer->stop(); | 1099 | if_timer->stop(); |
1102 | usleep(200000); | 1100 | usleep(200000); |
1103 | 1101 | ||
1104 | if(_ifaceppp->data()->autoDNS()) | 1102 | if(_ifaceppp->data()->autoDNS()) |
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 | |||
@@ -1,115 +1,115 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * kPPP: A pppd front end for the KDE project | 3 | * kPPP: A pppd front end for the KDE project |
4 | * | 4 | * |
5 | * $Id$ | 5 | * $Id$ |
6 | * | 6 | * |
7 | * Copyright (C) 1997 Bernd Johannes Wuebben | 7 | * Copyright (C) 1997 Bernd Johannes Wuebben |
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(); |
59 | void shutDown(); | 59 | void shutDown(); |
60 | 60 | ||
61 | 61 | ||
62 | public slots: | 62 | public slots: |
63 | void disconnect(); | 63 | void disconnect(); |
64 | void log_window_toggled(bool on); | 64 | void log_window_toggled(bool on); |
65 | 65 | ||
66 | signals: | 66 | signals: |
67 | void begin_connect(); | 67 | void begin_connect(); |
68 | void cmdl_start(); | 68 | void cmdl_start(); |
69 | 69 | ||
70 | public: | 70 | public: |
71 | QCheckBox *log; | 71 | QCheckBox *log; |
72 | bool connected; | 72 | bool connected; |
73 | QString con_speed; | 73 | QString con_speed; |
74 | ConnectWidget *con; | 74 | ConnectWidget *con; |
75 | ConWindow *con_win; | 75 | ConWindow *con_win; |
76 | // PPPStatsDlg *statdlg; | 76 | // PPPStatsDlg *statdlg; |
77 | // AccountingBase *acct; | 77 | // AccountingBase *acct; |
78 | QPushButton *quit_b; | 78 | QPushButton *quit_b; |
79 | //PPPStats *stats; | 79 | //PPPStats *stats; |
80 | 80 | ||
81 | private: | 81 | private: |
82 | // void prepareSetupDialog(); | 82 | // void prepareSetupDialog(); |
83 | void interruptConnection(); | 83 | void interruptConnection(); |
84 | void sigChld(); | 84 | void sigChld(); |
85 | void sigPPPDDied(); | 85 | void sigPPPDDied(); |
86 | QString encodeWord(const QString &s); | 86 | QString encodeWord(const QString &s); |
87 | void showNews (); | 87 | void showNews (); |
88 | 88 | ||
89 | QString ruleset_load_errmsg; | 89 | QString ruleset_load_errmsg; |
90 | PPPData *_pppdata; | 90 | PPPData *_pppdata; |
91 | QPushButton *setup_b; | 91 | QPushButton *setup_b; |
92 | QFrame *fline; | 92 | QFrame *fline; |
93 | QFrame *fline1; | 93 | QFrame *fline1; |
94 | QPushButton *connect_b; | 94 | QPushButton *connect_b; |
95 | QComboBox *connectto_c; | 95 | QComboBox *connectto_c; |
96 | QLabel *ID_Label; | 96 | QLabel *ID_Label; |
97 | QLabel *PW_Label; | 97 | QLabel *PW_Label; |
98 | QLineEdit *ID_Edit; | 98 | QLineEdit *ID_Edit; |
99 | QLineEdit *PW_Edit; | 99 | QLineEdit *PW_Edit; |
100 | QLabel *label1; | 100 | QLabel *label1; |
101 | QLabel *label2; | 101 | QLabel *label2; |
102 | QLabel *label3; | 102 | QLabel *label3; |
103 | QLabel *label4; | 103 | QLabel *label4; |
104 | QLabel *label5; | 104 | QLabel *label5; |
105 | QLabel *label6; | 105 | QLabel *label6; |
106 | QLabel *radio_label; | 106 | QLabel *radio_label; |
107 | 107 | ||
108 | /* QString m_strCmdlAccount; */ | 108 | /* QString m_strCmdlAccount; */ |
109 | /* bool m_bQuitOnDisconnect; */ | 109 | /* bool m_bQuitOnDisconnect; */ |
110 | /* bool m_bCmdlAccount; */ | 110 | /* bool m_bCmdlAccount; */ |
111 | }; | 111 | }; |
112 | 112 | ||
113 | 113 | ||
114 | #endif | 114 | #endif |
115 | 115 | ||
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 | |||
@@ -37,193 +37,193 @@ | |||
37 | // #include <kmessagebox.h> | 37 | // #include <kmessagebox.h> |
38 | // #include <kapplication.h> | 38 | // #include <kapplication.h> |
39 | #include <assert.h> | 39 | #include <assert.h> |
40 | 40 | ||
41 | #define SEPARATOR -sseepp- | 41 | #define SEPARATOR -sseepp- |
42 | #define SEP QString("%1SEPARATOR%1") | 42 | #define SEP QString("%1SEPARATOR%1") |
43 | 43 | ||
44 | PPPData::PPPData() | 44 | PPPData::PPPData() |
45 | : modemDeviceGroup(-1), | 45 | : modemDeviceGroup(-1), |
46 | highcount(-1), // start out with no entries | 46 | highcount(-1), // start out with no entries |
47 | caccount(-1), // set the current account index also | 47 | caccount(-1), // set the current account index also |
48 | suidprocessid(-1), // process ID of setuid child | 48 | suidprocessid(-1), // process ID of setuid child |
49 | pppdisrunning(false), | 49 | pppdisrunning(false), |
50 | pppderror(0) | 50 | pppderror(0) |
51 | { | 51 | { |
52 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; | 52 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; |
53 | 53 | ||
54 | if (highcount > MAX_ACCOUNTS) | 54 | if (highcount > MAX_ACCOUNTS) |
55 | highcount = MAX_ACCOUNTS; | 55 | highcount = MAX_ACCOUNTS; |
56 | 56 | ||
57 | if(highcount >= 0 && defaultAccount().isEmpty()) { | 57 | if(highcount >= 0 && defaultAccount().isEmpty()) { |
58 | setAccountbyIndex(0); | 58 | setAccountbyIndex(0); |
59 | setDefaultAccount(accname()); | 59 | setDefaultAccount(accname()); |
60 | } else if(!setAccount(defaultAccount())) | 60 | } else if(!setAccount(defaultAccount())) |
61 | setDefaultAccount(accname()); | 61 | setDefaultAccount(accname()); |
62 | 62 | ||
63 | // start out with internal debugging disabled | 63 | // start out with internal debugging disabled |
64 | // the user is still free to specify `debug' on his own | 64 | // the user is still free to specify `debug' on his own |
65 | setPPPDebug(false); | 65 | setPPPDebug(false); |
66 | 66 | ||
67 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); | 67 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | Config PPPData::config() | 71 | Config PPPData::config() |
72 | { | 72 | { |
73 | return Config("NetworkSetupPPP"); | 73 | return Config("NetworkSetupPPP"); |
74 | } | 74 | } |
75 | 75 | ||
76 | // | 76 | // |
77 | // save configuration | 77 | // save configuration |
78 | // | 78 | // |
79 | void PPPData::save() | 79 | void PPPData::save() |
80 | { | 80 | { |
81 | qDebug("PPPData saving data"); | 81 | qDebug("PPPData saving data"); |
82 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); | 82 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); |
83 | QString key; | 83 | QString key; |
84 | QStringList keys; | 84 | QStringList keys; |
85 | Config cfg = config(); | 85 | Config cfg = config(); |
86 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | 86 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); |
87 | it != stringEntries.end(); ++it ){ | 87 | it != stringEntries.end(); ++it ){ |
88 | QString val = it.data(); | 88 | QString val = it.data(); |
89 | key = it.key(); | 89 | key = it.key(); |
90 | // qDebug("saving %s -> %s", key.latin1(), val.latin1() ); | 90 | // qDebug("saving %s -> %s", key.latin1(), val.latin1() ); |
91 | keys = QStringList::split( "SEPARATOR", key ); | 91 | keys = QStringList::split( "SEPARATOR", key ); |
92 | qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); | 92 | qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); |
93 | cfg.setGroup(keys[0]); | 93 | cfg.setGroup(keys[0]); |
94 | cfg.writeEntry(keys[1], val); | 94 | cfg.writeEntry(keys[1], val); |
95 | } | 95 | } |
96 | for( QMap<QString,int>::Iterator it = intEntries.begin(); | 96 | for( QMap<QString,int>::Iterator it = intEntries.begin(); |
97 | it != intEntries.end(); ++it ){ | 97 | it != intEntries.end(); ++it ){ |
98 | int val = it.data(); | 98 | int val = it.data(); |
99 | key = it.key(); | 99 | key = it.key(); |
100 | // qDebug("saving %s -> %i", key.latin1(), val ); | 100 | // qDebug("saving %s -> %i", key.latin1(), val ); |
101 | keys = QStringList::split( "SEPARATOR", key ); | 101 | keys = QStringList::split( "SEPARATOR", key ); |
102 | qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); | 102 | qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); |
103 | cfg.setGroup(keys[0]); | 103 | cfg.setGroup(keys[0]); |
104 | cfg.writeEntry(keys[1], val); | 104 | cfg.writeEntry(keys[1], val); |
105 | } | 105 | } |
106 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); | 106 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); |
107 | it != listEntries.end(); ++it ){ | 107 | it != listEntries.end(); ++it ){ |
108 | QStringList val = it.data(); | 108 | QStringList val = it.data(); |
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; |
158 | 158 | ||
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | bool PPPData::readListConfig(const QString &group, const QString &key, | 162 | bool PPPData::readListConfig(const QString &group, const QString &key, |
163 | QStringList &list, char sep) { | 163 | QStringList &list, char sep) { |
164 | list.clear(); | 164 | list.clear(); |
165 | QString idx = SEP.arg(group).arg(key); | 165 | QString idx = SEP.arg(group).arg(key); |
166 | if (listEntries.find(idx) != listEntries.end()){ | 166 | if (listEntries.find(idx) != listEntries.end()){ |
167 | list = listEntries[idx]; | 167 | list = listEntries[idx]; |
168 | return true; | 168 | return true; |
169 | } | 169 | } |
170 | Config cfg = config(); | 170 | Config cfg = config(); |
171 | cfg.setGroup(group); | 171 | cfg.setGroup(group); |
172 | list = cfg.readListEntry(key, sep); | 172 | list = cfg.readListEntry(key, sep); |
173 | if (list.count() > 0) return true; | 173 | if (list.count() > 0) return true; |
174 | return false; | 174 | return false; |
175 | 175 | ||
176 | // if (config) { | 176 | // if (config) { |
177 | // config->setGroup(group); | 177 | // config->setGroup(group); |
178 | // list = config->readListEntry(key, sep); | 178 | // list = config->readListEntry(key, sep); |
179 | // return true; | 179 | // return true; |
180 | // } else | 180 | // } else |
181 | // return false; | 181 | // return false; |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | void PPPData::writeConfig(const QString &group, const QString &key, | 185 | void PPPData::writeConfig(const QString &group, const QString &key, |
186 | const QString &value) { | 186 | const QString &value) { |
187 | stringEntries.insert( SEP.arg(group).arg(key), value ); | 187 | stringEntries.insert( SEP.arg(group).arg(key), value ); |
188 | // if (config) { | 188 | // if (config) { |
189 | // config->setGroup(group); | 189 | // config->setGroup(group); |
190 | // config->writeEntry(key, value); | 190 | // config->writeEntry(key, value); |
191 | // } | 191 | // } |
192 | } | 192 | } |
193 | 193 | ||
194 | 194 | ||
195 | void PPPData::writeConfig(const QString &group, const QString &key, int value) | 195 | void PPPData::writeConfig(const QString &group, const QString &key, int value) |
196 | { | 196 | { |
197 | intEntries.insert( SEP.arg(group).arg(key), value ); | 197 | intEntries.insert( SEP.arg(group).arg(key), value ); |
198 | // if (config) { | 198 | // if (config) { |
199 | // config->setGroup(group); | 199 | // config->setGroup(group); |
200 | // config->writeEntry(key, value); | 200 | // config->writeEntry(key, value); |
201 | // } | 201 | // } |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | void PPPData::writeListConfig(const QString &group, const QString &key, | 205 | void PPPData::writeListConfig(const QString &group, const QString &key, |
206 | QStringList &list, char sep) | 206 | QStringList &list, char sep) |
207 | { | 207 | { |
208 | listEntries.insert( SEP.arg(group).arg(key), list ); | 208 | listEntries.insert( SEP.arg(group).arg(key), list ); |
209 | sepEntries.insert( SEP.arg(group).arg(key), sep ); | 209 | sepEntries.insert( SEP.arg(group).arg(key), sep ); |
210 | // if (config) { | 210 | // if (config) { |
211 | // config->setGroup(group); | 211 | // config->setGroup(group); |
212 | // config->writeEntry(key, list, sep); | 212 | // config->writeEntry(key, list, sep); |
213 | // } | 213 | // } |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | // | 217 | // |
218 | // functions to set/return general information | 218 | // functions to set/return general information |
219 | // | 219 | // |
220 | QString PPPData::password() const { | 220 | QString PPPData::password() const { |
221 | return passwd; | 221 | return passwd; |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | void PPPData::setPassword(const QString &pw) { | 225 | void PPPData::setPassword(const QString &pw) { |
226 | passwd = pw; | 226 | passwd = pw; |
227 | } | 227 | } |
228 | 228 | ||
229 | 229 | ||
@@ -254,199 +254,201 @@ bool PPPData::get_xserver_exit_disconnect() { | |||
254 | return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); | 254 | return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); |
255 | } | 255 | } |
256 | 256 | ||
257 | 257 | ||
258 | void PPPData::setPPPDebug(bool set) { | 258 | void PPPData::setPPPDebug(bool set) { |
259 | writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); | 259 | writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); |
260 | } | 260 | } |
261 | 261 | ||
262 | 262 | ||
263 | bool PPPData::getPPPDebug() { | 263 | bool PPPData::getPPPDebug() { |
264 | return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); | 264 | return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); |
265 | } | 265 | } |
266 | 266 | ||
267 | 267 | ||
268 | void PPPData::set_xserver_exit_disconnect(bool set) { | 268 | void PPPData::set_xserver_exit_disconnect(bool set) { |
269 | writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); | 269 | writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | bool PPPData::quit_on_disconnect() { | 273 | bool PPPData::quit_on_disconnect() { |
274 | return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); | 274 | return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); |
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | void PPPData::set_quit_on_disconnect(bool set) { | 278 | void PPPData::set_quit_on_disconnect(bool set) { |
279 | writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); | 279 | writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | bool PPPData::get_show_log_window() { | 283 | bool PPPData::get_show_log_window() { |
284 | return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); | 284 | return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | void PPPData::set_show_log_window(bool set) { | 288 | void PPPData::set_show_log_window(bool set) { |
289 | writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); | 289 | writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
293 | bool PPPData::automatic_redial() { | 293 | bool PPPData::automatic_redial() { |
294 | return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); | 294 | return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); |
295 | } | 295 | } |
296 | 296 | ||
297 | 297 | ||
298 | void PPPData::set_automatic_redial(bool set) { | 298 | void PPPData::set_automatic_redial(bool set) { |
299 | writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); | 299 | writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | // bool PPPData::get_iconify_on_connect() { | 303 | // bool PPPData::get_iconify_on_connect() { |
304 | // return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); | 304 | // return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); |
305 | // } | 305 | // } |
306 | 306 | ||
307 | 307 | ||
308 | // void PPPData::set_iconify_on_connect(bool set) { | 308 | // void PPPData::set_iconify_on_connect(bool set) { |
309 | // writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); | 309 | // writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); |
310 | // } | 310 | // } |
311 | 311 | ||
312 | 312 | ||
313 | // bool PPPData::get_dock_into_panel() { | 313 | // bool PPPData::get_dock_into_panel() { |
314 | // return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); | 314 | // return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); |
315 | // } | 315 | // } |
316 | 316 | ||
317 | 317 | ||
318 | // void PPPData::set_dock_into_panel(bool set) { | 318 | // void PPPData::set_dock_into_panel(bool set) { |
319 | // writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); | 319 | // writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); |
320 | // } | 320 | // } |
321 | 321 | ||
322 | 322 | ||
323 | QString PPPData::pppdVersion() { | 323 | QString PPPData::pppdVersion() { |
324 | return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); | 324 | return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); |
325 | } | 325 | } |
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 | ||
381 | 383 | ||
382 | void PPPData::setSpeed(const QString &n) { | 384 | void PPPData::setSpeed(const QString &n) { |
383 | writeConfig(modemGroup(), SPEED_KEY, n); | 385 | writeConfig(modemGroup(), SPEED_KEY, n); |
384 | } | 386 | } |
385 | 387 | ||
386 | 388 | ||
387 | #if 0 | 389 | #if 0 |
388 | void PPPData::setUseCDLine(const int n) { | 390 | void PPPData::setUseCDLine(const int n) { |
389 | writeConfig(modemGroup(),USECDLINE_KEY,n); | 391 | writeConfig(modemGroup(),USECDLINE_KEY,n); |
390 | } | 392 | } |
391 | 393 | ||
392 | 394 | ||
393 | int PPPData::UseCDLine() { | 395 | int PPPData::UseCDLine() { |
394 | return readNumConfig(modemGroup(),USECDLINE_KEY,0); | 396 | return readNumConfig(modemGroup(),USECDLINE_KEY,0); |
395 | } | 397 | } |
396 | #endif | 398 | #endif |
397 | 399 | ||
398 | const QString PPPData::modemEscapeStr() { | 400 | const QString PPPData::modemEscapeStr() { |
399 | return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); | 401 | return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); |
400 | } | 402 | } |
401 | 403 | ||
402 | 404 | ||
403 | void PPPData::setModemEscapeStr(const QString &n) { | 405 | void PPPData::setModemEscapeStr(const QString &n) { |
404 | writeConfig(modemGroup(),ESCAPESTR_KEY,n); | 406 | writeConfig(modemGroup(),ESCAPESTR_KEY,n); |
405 | } | 407 | } |
406 | 408 | ||
407 | 409 | ||
408 | const QString PPPData::modemEscapeResp() { | 410 | const QString PPPData::modemEscapeResp() { |
409 | return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); | 411 | return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); |
410 | } | 412 | } |
411 | 413 | ||
412 | 414 | ||
413 | void PPPData::setModemEscapeResp(const QString &n) { | 415 | void PPPData::setModemEscapeResp(const QString &n) { |
414 | writeConfig(modemGroup(),ESCAPERESP_KEY,n); | 416 | writeConfig(modemGroup(),ESCAPERESP_KEY,n); |
415 | } | 417 | } |
416 | 418 | ||
417 | 419 | ||
418 | int PPPData::modemEscapeGuardTime() { | 420 | int PPPData::modemEscapeGuardTime() { |
419 | return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); | 421 | return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); |
420 | } | 422 | } |
421 | 423 | ||
422 | 424 | ||
423 | void PPPData::setModemEscapeGuardTime(int n) { | 425 | void PPPData::setModemEscapeGuardTime(int n) { |
424 | writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); | 426 | writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); |
425 | } | 427 | } |
426 | 428 | ||
427 | 429 | ||
428 | bool PPPData::modemLockFile() { | 430 | bool PPPData::modemLockFile() { |
429 | return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); | 431 | return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); |
430 | } | 432 | } |
431 | 433 | ||
432 | 434 | ||
433 | void PPPData::setModemLockFile(bool set) { | 435 | void PPPData::setModemLockFile(bool set) { |
434 | writeConfig(modemGroup(), LOCKFILE_KEY, set); | 436 | writeConfig(modemGroup(), LOCKFILE_KEY, set); |
435 | } | 437 | } |
436 | 438 | ||
437 | 439 | ||
438 | int PPPData::modemTimeout() { | 440 | int PPPData::modemTimeout() { |
439 | return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); | 441 | return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); |
440 | } | 442 | } |
441 | 443 | ||
442 | 444 | ||
443 | void PPPData::setModemTimeout(int n) { | 445 | void PPPData::setModemTimeout(int n) { |
444 | writeConfig(modemGroup(), TIMEOUT_KEY, n); | 446 | writeConfig(modemGroup(), TIMEOUT_KEY, n); |
445 | } | 447 | } |
446 | 448 | ||
447 | 449 | ||
448 | int PPPData::modemToneDuration() { | 450 | int PPPData::modemToneDuration() { |
449 | return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); | 451 | return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); |
450 | } | 452 | } |
451 | 453 | ||
452 | 454 | ||
@@ -619,390 +621,396 @@ QString PPPData::volumeHigh() { | |||
619 | QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3"); | 621 | QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3"); |
620 | if(tmp == "M1L4") | 622 | if(tmp == "M1L4") |
621 | tmp = "M1L3"; | 623 | tmp = "M1L3"; |
622 | return tmp; | 624 | return tmp; |
623 | } | 625 | } |
624 | 626 | ||
625 | 627 | ||
626 | void PPPData::setVolumeHigh(const QString &s) { | 628 | void PPPData::setVolumeHigh(const QString &s) { |
627 | writeConfig(modemGroup(), VOLUME_HIGH, s); | 629 | writeConfig(modemGroup(), VOLUME_HIGH, s); |
628 | } | 630 | } |
629 | 631 | ||
630 | 632 | ||
631 | QString PPPData::volumeInitString() { | 633 | QString PPPData::volumeInitString() { |
632 | QString s; | 634 | QString s; |
633 | 635 | ||
634 | switch(volume()) { | 636 | switch(volume()) { |
635 | case 0: | 637 | case 0: |
636 | s = volumeOff(); | 638 | s = volumeOff(); |
637 | break; | 639 | break; |
638 | case 1: | 640 | case 1: |
639 | s = volumeMedium(); | 641 | s = volumeMedium(); |
640 | break; | 642 | break; |
641 | case 2: | 643 | case 2: |
642 | s = volumeHigh(); | 644 | s = volumeHigh(); |
643 | break; | 645 | break; |
644 | default: | 646 | default: |
645 | s = volumeMedium(); | 647 | s = volumeMedium(); |
646 | } | 648 | } |
647 | 649 | ||
648 | return s; | 650 | return s; |
649 | } | 651 | } |
650 | 652 | ||
651 | 653 | ||
652 | int PPPData::volume() { | 654 | int PPPData::volume() { |
653 | return readNumConfig(modemGroup(), VOLUME_KEY, 1); | 655 | return readNumConfig(modemGroup(), VOLUME_KEY, 1); |
654 | } | 656 | } |
655 | 657 | ||
656 | 658 | ||
657 | void PPPData::setVolume(int i) { | 659 | void PPPData::setVolume(int i) { |
658 | writeConfig(modemGroup(), VOLUME_KEY, i); | 660 | writeConfig(modemGroup(), VOLUME_KEY, i); |
659 | } | 661 | } |
660 | 662 | ||
661 | int PPPData::waitForDialTone() { | 663 | int PPPData::waitForDialTone() { |
662 | return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); | 664 | return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); |
663 | } | 665 | } |
664 | 666 | ||
665 | void PPPData::setWaitForDialTone(int i) { | 667 | void PPPData::setWaitForDialTone(int i) { |
666 | writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); | 668 | writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); |
667 | } | 669 | } |
668 | 670 | ||
669 | void PPPData::setModemAnswerStr(const QString &n) { | 671 | void PPPData::setModemAnswerStr(const QString &n) { |
670 | writeConfig(modemGroup(), ANSWERSTR_KEY, n); | 672 | writeConfig(modemGroup(), ANSWERSTR_KEY, n); |
671 | } | 673 | } |
672 | 674 | ||
673 | 675 | ||
674 | const QString PPPData::modemRingResp() { | 676 | const QString PPPData::modemRingResp() { |
675 | return readConfig(modemGroup(), RINGRESP_KEY, "RING"); | 677 | return readConfig(modemGroup(), RINGRESP_KEY, "RING"); |
676 | } | 678 | } |
677 | 679 | ||
678 | 680 | ||
679 | void PPPData::setModemRingResp(const QString &n) { | 681 | void PPPData::setModemRingResp(const QString &n) { |
680 | writeConfig(modemGroup(), RINGRESP_KEY, n); | 682 | writeConfig(modemGroup(), RINGRESP_KEY, n); |
681 | } | 683 | } |
682 | 684 | ||
683 | 685 | ||
684 | const QString PPPData::modemAnswerResp() { | 686 | const QString PPPData::modemAnswerResp() { |
685 | return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); | 687 | return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); |
686 | } | 688 | } |
687 | 689 | ||
688 | 690 | ||
689 | void PPPData::setModemAnswerResp(const QString &n) { | 691 | void PPPData::setModemAnswerResp(const QString &n) { |
690 | writeConfig(modemGroup(), ANSWERRESP_KEY, n); | 692 | writeConfig(modemGroup(), ANSWERRESP_KEY, 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); |
746 | return true; | 751 | return true; |
747 | } | 752 | } |
748 | 753 | ||
749 | 754 | ||
750 | bool PPPData::deleteAccount() { | 755 | bool PPPData::deleteAccount() { |
751 | //FIXME: | 756 | //FIXME: |
752 | // if(caccount < 0) | 757 | // if(caccount < 0) |
753 | return false; | 758 | return false; |
754 | 759 | ||
755 | // QMap <QString, QString> map; | 760 | // QMap <QString, QString> map; |
756 | // QMap <QString, QString>::Iterator it; | 761 | // QMap <QString, QString>::Iterator it; |
757 | 762 | ||
758 | // // set all entries of the current account to "" | 763 | // // set all entries of the current account to "" |
759 | // map = config->entryMap(cgroup); | 764 | // map = config->entryMap(cgroup); |
760 | // it = map.begin(); | 765 | // it = map.begin(); |
761 | // while (it != map.end()) { | 766 | // while (it != map.end()) { |
762 | // config->writeEntry(it.key(), ""); | 767 | // config->writeEntry(it.key(), ""); |
763 | // it++; | 768 | // it++; |
764 | // } | 769 | // } |
765 | 770 | ||
766 | // // shift the succeeding accounts | 771 | // // shift the succeeding accounts |
767 | // for(int i = caccount+1; i <= highcount; i++) { | 772 | // for(int i = caccount+1; i <= highcount; i++) { |
768 | // setAccountbyIndex(i); | 773 | // setAccountbyIndex(i); |
769 | // map = config->entryMap(cgroup); | 774 | // map = config->entryMap(cgroup); |
770 | // it = map.begin(); | 775 | // it = map.begin(); |
771 | // setAccountbyIndex(i-1); | 776 | // setAccountbyIndex(i-1); |
772 | // config->setGroup(cgroup); | 777 | // config->setGroup(cgroup); |
773 | // while (it != map.end()) { | 778 | // while (it != map.end()) { |
774 | // config->writeEntry(it.key(), *it); | 779 | // config->writeEntry(it.key(), *it); |
775 | // it++; | 780 | // it++; |
776 | // } | 781 | // } |
777 | // } | 782 | // } |
778 | 783 | ||
779 | // // make sure the top account is cleared | 784 | // // make sure the top account is cleared |
780 | // setAccountbyIndex(highcount); | 785 | // setAccountbyIndex(highcount); |
781 | // map = config->entryMap(cgroup); | 786 | // map = config->entryMap(cgroup); |
782 | // it = map.begin(); | 787 | // it = map.begin(); |
783 | // config->setGroup(cgroup); | 788 | // config->setGroup(cgroup); |
784 | // while (it.key() != QString::null) { | 789 | // while (it.key() != QString::null) { |
785 | // config->writeEntry(it.key(), ""); | 790 | // config->writeEntry(it.key(), ""); |
786 | // it++; | 791 | // it++; |
787 | // } | 792 | // } |
788 | 793 | ||
789 | // highcount--; | 794 | // highcount--; |
790 | // if(caccount > highcount) | 795 | // if(caccount > highcount) |
791 | // caccount = highcount; | 796 | // caccount = highcount; |
792 | 797 | ||
793 | // setAccountbyIndex(caccount); | 798 | // setAccountbyIndex(caccount); |
794 | 799 | ||
795 | // return true; | 800 | // return true; |
796 | } | 801 | } |
797 | 802 | ||
798 | 803 | ||
799 | bool PPPData::deleteAccount(const QString &aname) { | 804 | bool PPPData::deleteAccount(const QString &aname) { |
800 | if(!setAccount(aname)) | 805 | if(!setAccount(aname)) |
801 | return false; | 806 | return false; |
802 | 807 | ||
803 | deleteAccount(); | 808 | deleteAccount(); |
804 | 809 | ||
805 | return true; | 810 | return true; |
806 | } | 811 | } |
807 | 812 | ||
808 | 813 | ||
809 | int PPPData::newaccount() { | 814 | int PPPData::newaccount() { |
810 | 815 | ||
811 | qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); | 816 | qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); |
812 | // if(!config) open(); | 817 | // if(!config) open(); |
813 | if (highcount >= MAX_ACCOUNTS) return -1; | 818 | if (highcount >= MAX_ACCOUNTS) return -1; |
814 | 819 | ||
815 | highcount++; | 820 | highcount++; |
816 | setAccountbyIndex(highcount); | 821 | setAccountbyIndex(highcount); |
817 | 822 | ||
818 | setpppdArgumentDefaults(); | 823 | setpppdArgumentDefaults(); |
819 | qDebug("PPPData::newaccount -> %i",caccount); | 824 | qDebug("PPPData::newaccount -> %i",caccount); |
820 | return caccount; | 825 | return caccount; |
821 | } | 826 | } |
822 | 827 | ||
823 | int PPPData::copyaccount(int i) { | 828 | int PPPData::copyaccount(int i) { |
824 | // FIXME | 829 | // FIXME |
825 | // if(highcount >= MAX_ACCOUNTS) | 830 | // if(highcount >= MAX_ACCOUNTS) |
826 | return -1; | 831 | return -1; |
827 | 832 | ||
828 | // setAccountbyIndex(i); | 833 | // setAccountbyIndex(i); |
829 | 834 | ||
830 | // QMap <QString, QString> map = config->entryMap(cgroup); | 835 | // QMap <QString, QString> map = config->entryMap(cgroup); |
831 | // QMap <QString, QString>::ConstIterator it = map.begin(); | 836 | // QMap <QString, QString>::ConstIterator it = map.begin(); |
832 | 837 | ||
833 | // QString newname = i18n("%1_copy").arg(accname()); | 838 | // QString newname = i18n("%1_copy").arg(accname()); |
834 | 839 | ||
835 | // newaccount(); | 840 | // newaccount(); |
836 | 841 | ||
837 | // while (it != map.end()) { | 842 | // while (it != map.end()) { |
838 | // config->writeEntry(it.key(), *it); | 843 | // config->writeEntry(it.key(), *it); |
839 | // it++; | 844 | // it++; |
840 | // } | 845 | // } |
841 | 846 | ||
842 | // setAccname(newname); | 847 | // setAccname(newname); |
843 | 848 | ||
844 | // return caccount; | 849 | // return caccount; |
845 | } | 850 | } |
846 | 851 | ||
847 | 852 | ||
848 | const QString PPPData::accname() { | 853 | const QString PPPData::accname() { |
849 | return readConfig(cgroup, NAME_KEY); | 854 | return readConfig(cgroup, NAME_KEY); |
850 | } | 855 | } |
851 | 856 | ||
852 | void PPPData::setAccname(const QString &n) { | 857 | void PPPData::setAccname(const QString &n) { |
853 | if(!cgroup.isNull()) { | 858 | if(!cgroup.isNull()) { |
854 | // are we manipulating the default account's name ? then change it, too. | 859 | // are we manipulating the default account's name ? then change it, too. |
855 | bool def = accname() == defaultAccount(); | 860 | bool def = accname() == defaultAccount(); |
856 | writeConfig(cgroup, NAME_KEY, n); | 861 | writeConfig(cgroup, NAME_KEY, n); |
857 | if (def) | 862 | if (def) |
858 | setDefaultAccount(n); | 863 | setDefaultAccount(n); |
859 | } | 864 | } |
860 | } | 865 | } |
861 | 866 | ||
862 | 867 | ||
863 | #define SEPARATOR_CHAR '&' | 868 | #define SEPARATOR_CHAR '&' |
864 | QStringList &PPPData::phonenumbers() { | 869 | QStringList &PPPData::phonenumbers() { |
865 | 870 | ||
866 | readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); | 871 | readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); |
867 | return phonelist; | 872 | return phonelist; |
868 | 873 | ||
869 | } | 874 | } |
870 | 875 | ||
871 | 876 | ||
872 | const QString PPPData::phonenumber() { | 877 | const QString PPPData::phonenumber() { |
873 | return readConfig(cgroup, PHONENUMBER_KEY); | 878 | return readConfig(cgroup, PHONENUMBER_KEY); |
874 | } | 879 | } |
875 | 880 | ||
876 | 881 | ||
877 | void PPPData::setPhonenumber(const QString &n) { | 882 | void PPPData::setPhonenumber(const QString &n) { |
878 | writeConfig(cgroup, PHONENUMBER_KEY, n); | 883 | writeConfig(cgroup, PHONENUMBER_KEY, n); |
879 | } | 884 | } |
880 | 885 | ||
881 | 886 | ||
882 | const QString PPPData::dialPrefix() { | 887 | const QString PPPData::dialPrefix() { |
883 | return readConfig(cgroup, DIAL_PREFIX_KEY, ""); | 888 | return readConfig(cgroup, DIAL_PREFIX_KEY, ""); |
884 | } | 889 | } |
885 | 890 | ||
886 | 891 | ||
887 | void PPPData::setDialPrefix(const QString &s) { | 892 | void PPPData::setDialPrefix(const QString &s) { |
888 | writeConfig(cgroup, DIAL_PREFIX_KEY, s); | 893 | writeConfig(cgroup, DIAL_PREFIX_KEY, 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 | ||
937 | void PPPData::setStorePassword(bool b) { | 945 | void PPPData::setStorePassword(bool b) { |
938 | writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); | 946 | writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); |
939 | } | 947 | } |
940 | 948 | ||
941 | 949 | ||
942 | const QString PPPData::command_on_connect() { | 950 | const QString PPPData::command_on_connect() { |
943 | return readConfig(cgroup, COMMAND_KEY); | 951 | return readConfig(cgroup, COMMAND_KEY); |
944 | } | 952 | } |
945 | 953 | ||
946 | 954 | ||
947 | void PPPData::setCommand_on_connect(const QString &n) { | 955 | void PPPData::setCommand_on_connect(const QString &n) { |
948 | writeConfig(cgroup, COMMAND_KEY, n); | 956 | writeConfig(cgroup, COMMAND_KEY, n); |
949 | } | 957 | } |
950 | 958 | ||
951 | 959 | ||
952 | const QString PPPData::command_on_disconnect() { | 960 | const QString PPPData::command_on_disconnect() { |
953 | return readConfig(cgroup, DISCONNECT_COMMAND_KEY); | 961 | return readConfig(cgroup, DISCONNECT_COMMAND_KEY); |
954 | } | 962 | } |
955 | 963 | ||
956 | 964 | ||
957 | void PPPData::setCommand_on_disconnect(const QString &n) { | 965 | void PPPData::setCommand_on_disconnect(const QString &n) { |
958 | writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); | 966 | writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); |
959 | } | 967 | } |
960 | 968 | ||
961 | 969 | ||
962 | const QString PPPData::command_before_disconnect() { | 970 | const QString PPPData::command_before_disconnect() { |
963 | return readConfig(cgroup, BEFORE_DISCONNECT_KEY); | 971 | return readConfig(cgroup, BEFORE_DISCONNECT_KEY); |
964 | } | 972 | } |
965 | 973 | ||
966 | 974 | ||
967 | void PPPData::setCommand_before_disconnect(const QString &n) { | 975 | void PPPData::setCommand_before_disconnect(const QString &n) { |
968 | writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); | 976 | writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); |
969 | } | 977 | } |
970 | 978 | ||
971 | 979 | ||
972 | const QString PPPData::ipaddr() { | 980 | const QString PPPData::ipaddr() { |
973 | return readConfig(cgroup, IPADDR_KEY); | 981 | return readConfig(cgroup, IPADDR_KEY); |
974 | } | 982 | } |
975 | 983 | ||
976 | 984 | ||
977 | void PPPData::setIpaddr(const QString &n) { | 985 | void PPPData::setIpaddr(const QString &n) { |
978 | writeConfig(cgroup, IPADDR_KEY, n); | 986 | writeConfig(cgroup, IPADDR_KEY, n); |
979 | } | 987 | } |
980 | 988 | ||
981 | 989 | ||
982 | const QString PPPData::subnetmask() { | 990 | const QString PPPData::subnetmask() { |
983 | return readConfig(cgroup, SUBNETMASK_KEY); | 991 | return readConfig(cgroup, SUBNETMASK_KEY); |
984 | } | 992 | } |
985 | 993 | ||
986 | 994 | ||
987 | void PPPData::setSubnetmask(const QString &n) { | 995 | void PPPData::setSubnetmask(const QString &n) { |
988 | writeConfig(cgroup, SUBNETMASK_KEY, n); | 996 | writeConfig(cgroup, SUBNETMASK_KEY, n); |
989 | } | 997 | } |
990 | 998 | ||
991 | 999 | ||
992 | bool PPPData::autoname() { | 1000 | bool PPPData::autoname() { |
993 | return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); | 1001 | return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); |
994 | } | 1002 | } |
995 | 1003 | ||
996 | 1004 | ||
997 | void PPPData::setAutoname(bool set) { | 1005 | void PPPData::setAutoname(bool set) { |
998 | writeConfig(cgroup, AUTONAME_KEY, (int) set); | 1006 | writeConfig(cgroup, AUTONAME_KEY, (int) set); |
999 | } | 1007 | } |
1000 | 1008 | ||
1001 | 1009 | ||
1002 | bool PPPData::AcctEnabled() { | 1010 | bool PPPData::AcctEnabled() { |
1003 | return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); | 1011 | return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); |
1004 | } | 1012 | } |
1005 | 1013 | ||
1006 | 1014 | ||
1007 | void PPPData::setAcctEnabled(bool set) { | 1015 | void PPPData::setAcctEnabled(bool set) { |
1008 | writeConfig(cgroup, ACCTENABLED_KEY, (int) set); | 1016 | writeConfig(cgroup, ACCTENABLED_KEY, (int) set); |
@@ -1181,96 +1189,107 @@ void PPPData::setpppdArgumentDefaults() { | |||
1181 | // config->setGroup(GRAPH_GRP); | 1189 | // config->setGroup(GRAPH_GRP); |
1182 | // config->writeEntry(GENABLED, enable); | 1190 | // config->writeEntry(GENABLED, enable); |
1183 | // // config->writeEntry(GCOLOR_BG, bg); | 1191 | // // config->writeEntry(GCOLOR_BG, bg); |
1184 | // // config->writeEntry(GCOLOR_TEXT, text); | 1192 | // // config->writeEntry(GCOLOR_TEXT, text); |
1185 | // // config->writeEntry(GCOLOR_IN, in); | 1193 | // // config->writeEntry(GCOLOR_IN, in); |
1186 | // // config->writeEntry(GCOLOR_OUT, out); | 1194 | // // config->writeEntry(GCOLOR_OUT, out); |
1187 | // } | 1195 | // } |
1188 | // } | 1196 | // } |
1189 | 1197 | ||
1190 | // void PPPData::graphingOptions(bool &enable, | 1198 | // void PPPData::graphingOptions(bool &enable, |
1191 | // QColor &bg, | 1199 | // QColor &bg, |
1192 | // QColor &text, | 1200 | // QColor &text, |
1193 | // QColor &in, | 1201 | // QColor &in, |
1194 | // QColor &out) | 1202 | // QColor &out) |
1195 | // { | 1203 | // { |
1196 | // QColor c; | 1204 | // QColor c; |
1197 | 1205 | ||
1198 | // if(config) { | 1206 | // if(config) { |
1199 | // config->setGroup(GRAPH_GRP); | 1207 | // config->setGroup(GRAPH_GRP); |
1200 | // enable = config->readBoolEntry(GENABLED, true); | 1208 | // enable = config->readBoolEntry(GENABLED, true); |
1201 | // bg = Qt::white; | 1209 | // bg = Qt::white; |
1202 | // //bg = config->readColorEntry(GCOLOR_BG, &c); | 1210 | // //bg = config->readColorEntry(GCOLOR_BG, &c); |
1203 | // text = Qt::black; | 1211 | // text = Qt::black; |
1204 | // //text = config->readColorEntry(GCOLOR_TEXT, &c); | 1212 | // //text = config->readColorEntry(GCOLOR_TEXT, &c); |
1205 | // in = Qt::blue; | 1213 | // in = Qt::blue; |
1206 | // //in = config->readColorEntry(GCOLOR_IN, &c); | 1214 | // //in = config->readColorEntry(GCOLOR_IN, &c); |
1207 | // out = Qt::red; | 1215 | // out = Qt::red; |
1208 | // //out = config->readColorEntry(GCOLOR_OUT, &c); | 1216 | // //out = config->readColorEntry(GCOLOR_OUT, &c); |
1209 | // } | 1217 | // } |
1210 | // } | 1218 | // } |
1211 | 1219 | ||
1212 | 1220 | ||
1213 | // bool PPPData::graphingEnabled() { | 1221 | // bool PPPData::graphingEnabled() { |
1214 | // return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); | 1222 | // return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); |
1215 | // } | 1223 | // } |
1216 | 1224 | ||
1217 | 1225 | ||
1218 | 1226 | ||
1219 | // | 1227 | // |
1220 | //functions to change/set the child pppd process info | 1228 | //functions to change/set the child pppd process info |
1221 | // | 1229 | // |
1222 | bool PPPData::pppdRunning() const { | 1230 | bool PPPData::pppdRunning() const { |
1223 | return pppdisrunning; | 1231 | return pppdisrunning; |
1224 | } | 1232 | } |
1225 | 1233 | ||
1226 | void PPPData::setpppdRunning(bool set) { | 1234 | void PPPData::setpppdRunning(bool set) { |
1227 | pppdisrunning = set; | 1235 | pppdisrunning = set; |
1228 | } | 1236 | } |
1229 | 1237 | ||
1230 | int PPPData::pppdError() const { | 1238 | int PPPData::pppdError() const { |
1231 | return pppderror; | 1239 | return pppderror; |
1232 | } | 1240 | } |
1233 | 1241 | ||
1234 | void PPPData::setpppdError(int err) { | 1242 | void PPPData::setpppdError(int err) { |
1235 | pppderror = err; | 1243 | pppderror = err; |
1236 | } | 1244 | } |
1237 | 1245 | ||
1238 | QString PPPData::modemGroup() | 1246 | QString PPPData::modemGroup() |
1239 | { | 1247 | { |
1240 | if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup); | 1248 | if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup); |
1241 | return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup); | 1249 | return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup); |
1242 | } | 1250 | } |
1243 | 1251 | ||
1244 | 1252 | ||
1245 | QMap<QString,QString> PPPData::getConfiguredInterfaces() | 1253 | QMap<QString,QString> PPPData::getConfiguredInterfaces() |
1246 | { | 1254 | { |
1247 | QMap<QString,QString> ifaces; | 1255 | QMap<QString,QString> ifaces; |
1248 | Config config = PPPData::config(); | 1256 | Config config = PPPData::config(); |
1249 | config.setGroup(ACCLIST_GRP); | 1257 | config.setGroup(ACCLIST_GRP); |
1250 | int count = config.readNumEntry( ACCOUNTS_COUNT, -1 ); | 1258 | int count = config.readNumEntry( ACCOUNTS_COUNT, -1 ); |
1251 | QString accGrp, dev, acc; | 1259 | QString accGrp, dev, acc; |
1252 | for (int i = 0; i < count; i++){ | 1260 | for (int i = 0; i < count; i++){ |
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 | |||
@@ -316,120 +316,123 @@ public: | |||
316 | bool setAccountbyIndex(int); | 316 | bool setAccountbyIndex(int); |
317 | 317 | ||
318 | bool isUniqueAccname(const QString &); | 318 | bool isUniqueAccname(const QString &); |
319 | 319 | ||
320 | bool deleteAccount(); | 320 | bool deleteAccount(); |
321 | bool deleteAccount(const QString &); | 321 | bool deleteAccount(const QString &); |
322 | int newaccount(); | 322 | int newaccount(); |
323 | int copyaccount(int i); | 323 | int copyaccount(int i); |
324 | 324 | ||
325 | const QString accname(); | 325 | const QString accname(); |
326 | void setAccname(const QString &); | 326 | void setAccname(const QString &); |
327 | 327 | ||
328 | QStringList &phonenumbers(); | 328 | QStringList &phonenumbers(); |
329 | const QString phonenumber(); | 329 | const QString phonenumber(); |
330 | void setPhonenumber(const QString &); | 330 | void setPhonenumber(const QString &); |
331 | 331 | ||
332 | const QString dialPrefix(); | 332 | const QString dialPrefix(); |
333 | void setDialPrefix(const QString &); | 333 | void setDialPrefix(const QString &); |
334 | 334 | ||
335 | int authMethod(); | 335 | int authMethod(); |
336 | void setAuthMethod(int); | 336 | void setAuthMethod(int); |
337 | 337 | ||
338 | const QString storedUsername(); | 338 | const QString storedUsername(); |
339 | void setStoredUsername(const QString &); | 339 | void setStoredUsername(const QString &); |
340 | 340 | ||
341 | const QString storedPassword(); | 341 | const QString storedPassword(); |
342 | void setStoredPassword(const QString &); | 342 | void setStoredPassword(const QString &); |
343 | 343 | ||
344 | bool storePassword(); | 344 | bool storePassword(); |
345 | void setStorePassword(bool); | 345 | void setStorePassword(bool); |
346 | 346 | ||
347 | const QString speed(); | 347 | const QString speed(); |
348 | void setSpeed(const QString &); | 348 | void setSpeed(const QString &); |
349 | 349 | ||
350 | const QString command_before_connect(); | 350 | const QString command_before_connect(); |
351 | void setCommand_before_connect(const QString &); | 351 | void setCommand_before_connect(const QString &); |
352 | 352 | ||
353 | const QString command_on_connect(); | 353 | const QString command_on_connect(); |
354 | void setCommand_on_connect(const QString &); | 354 | void setCommand_on_connect(const QString &); |
355 | 355 | ||
356 | const QString command_on_disconnect(); | 356 | const QString command_on_disconnect(); |
357 | void setCommand_on_disconnect(const QString &); | 357 | void setCommand_on_disconnect(const QString &); |
358 | 358 | ||
359 | const QString command_before_disconnect(); | 359 | const QString command_before_disconnect(); |
360 | void setCommand_before_disconnect(const QString &); | 360 | void setCommand_before_disconnect(const QString &); |
361 | 361 | ||
362 | const QString ipaddr(); | 362 | const QString ipaddr(); |
363 | void setIpaddr(const QString &); | 363 | void setIpaddr(const QString &); |
364 | 364 | ||
365 | const QString subnetmask(); | 365 | const QString subnetmask(); |
366 | void setSubnetmask(const QString &); | 366 | void setSubnetmask(const QString &); |
367 | 367 | ||
368 | bool AcctEnabled(); | 368 | bool AcctEnabled(); |
369 | void setAcctEnabled(bool set); | 369 | void setAcctEnabled(bool set); |
370 | 370 | ||
371 | // int VolAcctEnabled(); | 371 | // int VolAcctEnabled(); |
372 | // void setVolAcctEnabled(int set); | 372 | // void setVolAcctEnabled(int set); |
373 | 373 | ||
374 | bool autoDNS(); | 374 | bool autoDNS(); |
375 | void setAutoDNS(bool set); | 375 | void setAutoDNS(bool set); |
376 | 376 | ||
377 | bool exDNSDisabled(); | 377 | bool exDNSDisabled(); |
378 | void setExDNSDisabled(bool set); | 378 | void setExDNSDisabled(bool set); |
379 | 379 | ||
380 | bool autoname(); | 380 | bool autoname(); |
381 | void setAutoname(bool set); | 381 | void setAutoname(bool set); |
382 | 382 | ||
383 | const QString gateway(); | 383 | const QString gateway(); |
384 | void setGateway(const QString &); | 384 | void setGateway(const QString &); |
385 | 385 | ||
386 | bool defaultroute(); | 386 | bool defaultroute(); |
387 | void setDefaultroute(bool set); | 387 | void setDefaultroute(bool set); |
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 |