summaryrefslogtreecommitdiff
authortille <tille>2003-06-06 13:38:57 (UTC)
committer tille <tille>2003-06-06 13:38:57 (UTC)
commit225486a1c3714b4b0c0e60286df13d8ede029768 (patch) (unidiff)
treea49c0faa1d439308ebb60181e1cd5afd5479d092
parentd3e9154252841f3adcfbd9868e263475fc698ebb (diff)
downloadopie-225486a1c3714b4b0c0e60286df13d8ede029768.zip
opie-225486a1c3714b4b0c0e60286df13d8ede029768.tar.gz
opie-225486a1c3714b4b0c0e60286df13d8ede029768.tar.bz2
more arm fixes..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 8f066ff..8f45e54 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -1,1302 +1,1302 @@
1/* 1/*
2 * kPPP: A pppd front end for the KDE project 2 * kPPP: A pppd front end for the KDE project
3 * 3 *
4 * $Id$ 4 * $Id$
5 * 5 *
6 * Copyright (C) 1997 Bernd Johannes Wuebben 6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu 7 * wuebben@math.cornell.edu
8 * 8 *
9 * based on EzPPP: 9 * based on EzPPP:
10 * Copyright (C) 1997 Jay Painter 10 * Copyright (C) 1997 Jay Painter
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#include "pppdata.h" 27#include "pppdata.h"
28#include "runtests.h" 28#include "runtests.h"
29#include "devices.h" 29#include "devices.h"
30//#include <klocale.h> 30//#include <klocale.h>
31#define i18n QObject::tr 31#define i18n QObject::tr
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qapplication.h> 34#include <qapplication.h>
35// #include <klocale.h> 35// #include <klocale.h>
36// #include <kconfig.h> 36// #include <kconfig.h>
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
44PPPData::PPPData() 44PPPData::PPPData()
45 : modemDeviceGroup(-1), 45 : modemDeviceGroup(-1),
46 passwd(""), 46 passwd(""),
47 highcount(-1), // start out with no entries 47 highcount(-1), // start out with no entries
48 caccount(-1), // set the current account index also 48 caccount(-1), // set the current account index also
49 suidprocessid(-1), // process ID of setuid child 49 suidprocessid(-1), // process ID of setuid child
50 pppdisrunning(false), 50 pppdisrunning(false),
51 pppderror(0) 51 pppderror(0)
52{ 52{
53 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; 53 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
54 54
55 if (highcount > MAX_ACCOUNTS) 55 if (highcount > MAX_ACCOUNTS)
56 highcount = MAX_ACCOUNTS; 56 highcount = MAX_ACCOUNTS;
57 57
58 if(highcount >= 0 && defaultAccount().isEmpty()) { 58 if(highcount >= 0 && defaultAccount().isEmpty()) {
59 setAccountbyIndex(0); 59 setAccountbyIndex(0);
60 setDefaultAccount(accname()); 60 setDefaultAccount(accname());
61 } else if(!setAccount(defaultAccount())) 61 } else if(!setAccount(defaultAccount()))
62 setDefaultAccount(accname()); 62 setDefaultAccount(accname());
63 63
64 // start out with internal debugging disabled 64 // start out with internal debugging disabled
65 // the user is still free to specify `debug' on his own 65 // the user is still free to specify `debug' on his own
66 setPPPDebug(false); 66 setPPPDebug(false);
67 67
68 ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); 68 ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch);
69 69
70} 70}
71 71
72Config PPPData::config() 72Config PPPData::config()
73{ 73{
74 return Config("NetworkSetupPPP"); 74 return Config("NetworkSetupPPP");
75} 75}
76 76
77// 77//
78// save configuration 78// save configuration
79// 79//
80void PPPData::save() 80void PPPData::save()
81{ 81{
82 qDebug("PPPData saving data"); 82 qDebug("PPPData saving data");
83 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); 83 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
84 QString key; 84 QString key;
85 QStringList keys; 85 QStringList keys;
86 Config cfg = config(); 86 Config cfg = config();
87 for( QMap<QString,QString>::Iterator it = stringEntries.begin(); 87 for( QMap<QString,QString>::Iterator it = stringEntries.begin();
88 it != stringEntries.end(); ++it ){ 88 it != stringEntries.end(); ++it ){
89 QString val = it.data(); 89 QString val = it.data();
90 key = it.key(); 90 key = it.key();
91// qDebug("saving %s -> %s", key.latin1(), val.latin1() ); 91// qDebug("saving %s -> %s", key.latin1(), val.latin1() );
92 keys = QStringList::split( "SEPARATOR", key ); 92 keys = QStringList::split( "SEPARATOR", key );
93 qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); 93 qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
94 cfg.setGroup(keys[0]); 94 cfg.setGroup(keys[0]);
95 cfg.writeEntry(keys[1], val); 95 cfg.writeEntry(keys[1], val);
96 } 96 }
97 for( QMap<QString,int>::Iterator it = intEntries.begin(); 97 for( QMap<QString,int>::Iterator it = intEntries.begin();
98 it != intEntries.end(); ++it ){ 98 it != intEntries.end(); ++it ){
99 int val = it.data(); 99 int val = it.data();
100 key = it.key(); 100 key = it.key();
101// qDebug("saving %s -> %i", key.latin1(), val ); 101// qDebug("saving %s -> %i", key.latin1(), val );
102 keys = QStringList::split( "SEPARATOR", key ); 102 keys = QStringList::split( "SEPARATOR", key );
103 qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); 103 qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val );
104 cfg.setGroup(keys[0]); 104 cfg.setGroup(keys[0]);
105 cfg.writeEntry(keys[1], val); 105 cfg.writeEntry(keys[1], val);
106 } 106 }
107 for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); 107 for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
108 it != listEntries.end(); ++it ){ 108 it != listEntries.end(); ++it ){
109 QStringList val = it.data(); 109 QStringList val = it.data();
110 key = it.key(); 110 key = it.key();
111 QChar sep = sepEntries[key]; 111 QChar sep = sepEntries[key];
112// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); 112// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() );
113 keys = QStringList::split( "SEPARATOR", key ); 113 keys = QStringList::split( "SEPARATOR", key );
114 qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() ); 114 qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() );
115 cfg.setGroup(keys[0]); 115 cfg.setGroup(keys[0]);
116 cfg.writeEntry(keys[1], val, sep); 116 cfg.writeEntry(keys[1], val, sep);
117 } 117 }
118} 118}
119 119
120 120
121// 121//
122// cancel changes 122// cancel changes
123// 123//
124void PPPData::cancel() { 124void PPPData::cancel() {
125 stringEntries.clear(); 125 stringEntries.clear();
126 intEntries.clear(); 126 intEntries.clear();
127 listEntries.clear(); 127 listEntries.clear();
128} 128}
129 129
130// functions to read/write date to configuration file 130// functions to read/write date to configuration file
131QString PPPData::readConfig(const QString &group, const QString &key, 131QString PPPData::readConfig(const QString &group, const QString &key,
132 const QString &defvalue = "") 132 const QString &defvalue = "")
133{ 133{
134// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); 134// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
135 QString idx = SEP.arg(group).arg(key); 135 QString idx = SEP.arg(group).arg(key);
136 if (stringEntries.find(idx) != stringEntries.end()) 136 if (stringEntries.find(idx) != stringEntries.end())
137 return stringEntries[idx]; 137 return stringEntries[idx];
138 Config cfg = config(); 138 Config cfg = config();
139 cfg.setGroup(group); 139 cfg.setGroup(group);
140 return cfg.readEntry(key, defvalue); 140 return cfg.readEntry(key, defvalue);
141} 141}
142 142
143 143
144int PPPData::readNumConfig(const QString &group, const QString &key, 144int PPPData::readNumConfig(const QString &group, const QString &key,
145 int defvalue) 145 int defvalue)
146{ 146{
147 QString idx = SEP.arg(group).arg(key); 147 QString idx = SEP.arg(group).arg(key);
148 if (intEntries.find(idx) != intEntries.end()) 148 if (intEntries.find(idx) != intEntries.end())
149 return intEntries[idx]; 149 return intEntries[idx];
150 Config cfg = config(); 150 Config cfg = config();
151 cfg.setGroup(group); 151 cfg.setGroup(group);
152 return cfg.readNumEntry(key, defvalue); 152 return cfg.readNumEntry(key, defvalue);
153 153
154// if (config) { 154// if (config) {
155// config->setGroup(group); 155// config->setGroup(group);
156// return config->readNumEntry(key, defvalue); 156// return config->readNumEntry(key, defvalue);
157// } else 157// } else
158// return defvalue; 158// return defvalue;
159 159
160} 160}
161 161
162 162
163bool PPPData::readListConfig(const QString &group, const QString &key, 163bool PPPData::readListConfig(const QString &group, const QString &key,
164 QStringList &list, char sep) { 164 QStringList &list, char sep) {
165 list.clear(); 165 list.clear();
166 QString idx = SEP.arg(group).arg(key); 166 QString idx = SEP.arg(group).arg(key);
167 if (listEntries.find(idx) != listEntries.end()){ 167 if (listEntries.find(idx) != listEntries.end()){
168 list = listEntries[idx]; 168 list = listEntries[idx];
169 return true; 169 return true;
170 } 170 }
171 Config cfg = config(); 171 Config cfg = config();
172 cfg.setGroup(group); 172 cfg.setGroup(group);
173 list = cfg.readListEntry(key, sep); 173 list = cfg.readListEntry(key, sep);
174 if (list.count() > 0) return true; 174 if (list.count() > 0) return true;
175 return false; 175 return false;
176 176
177// if (config) { 177// if (config) {
178// config->setGroup(group); 178// config->setGroup(group);
179// list = config->readListEntry(key, sep); 179// list = config->readListEntry(key, sep);
180// return true; 180// return true;
181// } else 181// } else
182// return false; 182// return false;
183} 183}
184 184
185 185
186void PPPData::writeConfig(const QString &group, const QString &key, 186void PPPData::writeConfig(const QString &group, const QString &key,
187 const QString &value) { 187 const QString &value) {
188 stringEntries.insert( SEP.arg(group).arg(key), value ); 188 stringEntries.insert( SEP.arg(group).arg(key), value );
189// if (config) { 189// if (config) {
190// config->setGroup(group); 190// config->setGroup(group);
191// config->writeEntry(key, value); 191// config->writeEntry(key, value);
192// } 192// }
193} 193}
194 194
195 195
196void PPPData::writeConfig(const QString &group, const QString &key, int value) 196void PPPData::writeConfig(const QString &group, const QString &key, int value)
197{ 197{
198 intEntries.insert( SEP.arg(group).arg(key), value ); 198 intEntries.insert( SEP.arg(group).arg(key), value );
199// if (config) { 199// if (config) {
200// config->setGroup(group); 200// config->setGroup(group);
201// config->writeEntry(key, value); 201// config->writeEntry(key, value);
202// } 202// }
203} 203}
204 204
205 205
206void PPPData::writeListConfig(const QString &group, const QString &key, 206void PPPData::writeListConfig(const QString &group, const QString &key,
207 QStringList &list, char sep) 207 QStringList &list, char sep)
208{ 208{
209 listEntries.insert( SEP.arg(group).arg(key), list ); 209 listEntries.insert( SEP.arg(group).arg(key), list );
210 sepEntries.insert( SEP.arg(group).arg(key), sep ); 210 sepEntries.insert( SEP.arg(group).arg(key), sep );
211// if (config) { 211// if (config) {
212// config->setGroup(group); 212// config->setGroup(group);
213// config->writeEntry(key, list, sep); 213// config->writeEntry(key, list, sep);
214// } 214// }
215} 215}
216 216
217 217
218// 218//
219// functions to set/return general information 219// functions to set/return general information
220// 220//
221QString PPPData::password(){ 221QString PPPData::password(){
222 if ( storePassword() ) return storedPassword(); 222 if ( storePassword() ) return storedPassword();
223 else return passwd; 223 else return passwd;
224} 224}
225 225
226 226
227void PPPData::setPassword(const QString &pw) { 227void PPPData::setPassword(const QString &pw) {
228 passwd = pw; 228 passwd = pw;
229} 229}
230 230
231 231
232const QString PPPData::defaultAccount() { 232const QString PPPData::defaultAccount() {
233 return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY); 233 return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY);
234} 234}
235 235
236 236
237void PPPData::setDefaultAccount(const QString &n) { 237void PPPData::setDefaultAccount(const QString &n) {
238 writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n); 238 writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n);
239 239
240 //now set the current account index to the default account 240 //now set the current account index to the default account
241 setAccount(defaultAccount()); 241 setAccount(defaultAccount());
242} 242}
243 243
244 244
245bool PPPData::get_show_clock_on_caption() { 245bool PPPData::get_show_clock_on_caption() {
246 return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true); 246 return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true);
247} 247}
248 248
249 249
250void PPPData::set_show_clock_on_caption(bool set) { 250void PPPData::set_show_clock_on_caption(bool set) {
251 writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); 251 writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set);
252} 252}
253 253
254 254
255bool PPPData::get_xserver_exit_disconnect() { 255bool PPPData::get_xserver_exit_disconnect() {
256 return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); 256 return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true);
257} 257}
258 258
259 259
260void PPPData::setPPPDebug(bool set) { 260void PPPData::setPPPDebug(bool set) {
261 writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); 261 writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set);
262} 262}
263 263
264 264
265bool PPPData::getPPPDebug() { 265bool PPPData::getPPPDebug() {
266 return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); 266 return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false);
267} 267}
268 268
269 269
270void PPPData::set_xserver_exit_disconnect(bool set) { 270void PPPData::set_xserver_exit_disconnect(bool set) {
271 writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); 271 writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set);
272} 272}
273 273
274 274
275bool PPPData::quit_on_disconnect() { 275bool PPPData::quit_on_disconnect() {
276 return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); 276 return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false);
277} 277}
278 278
279 279
280void PPPData::set_quit_on_disconnect(bool set) { 280void PPPData::set_quit_on_disconnect(bool set) {
281 writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); 281 writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set);
282} 282}
283 283
284 284
285bool PPPData::get_show_log_window() { 285bool PPPData::get_show_log_window() {
286 return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); 286 return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false);
287} 287}
288 288
289 289
290void PPPData::set_show_log_window(bool set) { 290void PPPData::set_show_log_window(bool set) {
291 writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); 291 writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set);
292} 292}
293 293
294 294
295bool PPPData::automatic_redial() { 295bool PPPData::automatic_redial() {
296 return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); 296 return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE);
297} 297}
298 298
299 299
300void PPPData::set_automatic_redial(bool set) { 300void PPPData::set_automatic_redial(bool set) {
301 writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); 301 writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set);
302} 302}
303 303
304 304
305// bool PPPData::get_iconify_on_connect() { 305// bool PPPData::get_iconify_on_connect() {
306// return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); 306// return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE);
307// } 307// }
308 308
309 309
310// void PPPData::set_iconify_on_connect(bool set) { 310// void PPPData::set_iconify_on_connect(bool set) {
311// writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); 311// writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set);
312// } 312// }
313 313
314 314
315// bool PPPData::get_dock_into_panel() { 315// bool PPPData::get_dock_into_panel() {
316// return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); 316// return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false);
317// } 317// }
318 318
319 319
320// void PPPData::set_dock_into_panel(bool set) { 320// void PPPData::set_dock_into_panel(bool set) {
321// writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); 321// writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set);
322// } 322// }
323 323
324 324
325QString PPPData::pppdVersion() { 325QString PPPData::pppdVersion() {
326 return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); 326 return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch);
327} 327}
328 328
329bool PPPData::pppdVersionMin(int ver, int mod, int patch) { 329bool PPPData::pppdVersionMin(int ver, int mod, int patch) {
330 // check if pppd version fulfills minimum requirement 330 // check if pppd version fulfills minimum requirement
331 return (pppdVer > ver 331 return (pppdVer > ver
332 || (pppdVer == ver && pppdMod > mod) 332 || (pppdVer == ver && pppdMod > mod)
333 || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); 333 || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch));
334} 334}
335 335
336int PPPData::pppdTimeout() { 336int PPPData::pppdTimeout() {
337 return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); 337 return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT);
338} 338}
339 339
340 340
341void PPPData::setpppdTimeout(int n) { 341void PPPData::setpppdTimeout(int n) {
342 writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); 342 writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n);
343} 343}
344 344
345 345
346const QString PPPData::modemDevice() { 346const QString PPPData::modemDevice() {
347 return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); 347 return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]);
348} 348}
349 349
350 350
351bool PPPData::setModemDevice(const QString &n) { 351bool PPPData::setModemDevice(const QString &n) {
352 qDebug("Setting modem dev to >%s<", n.latin1()); 352 qDebug("Setting modem dev to >%s<", n.latin1());
353 bool ret = false; 353 bool ret = false;
354 for (int i = 0; devices[i]; i++) 354 for (int i = 0; devices[i]; i++)
355 if (devices[i] == n){ 355 if (devices[i] == n){
356 modemDeviceGroup = i; 356 modemDeviceGroup = i;
357 writeConfig(modemGroup(), MODEMDEV_KEY, n); 357 writeConfig(modemGroup(), MODEMDEV_KEY, n);
358 ret = true; 358 ret = true;
359 } 359 }
360 qDebug(ret?"SUCCESS":"FAILURE"); 360 qDebug(ret?"SUCCESS":"FAILURE");
361 return ret; 361 return ret;
362} 362}
363 363
364 364
365const QString PPPData::flowcontrol() { 365const QString PPPData::flowcontrol() {
366 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); 366 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS");
367} 367}
368 368
369 369
370void PPPData::setFlowcontrol(const QString &n) { 370void PPPData::setFlowcontrol(const QString &n) {
371 writeConfig(modemGroup(), FLOWCONTROL_KEY, n); 371 writeConfig(modemGroup(), FLOWCONTROL_KEY, n);
372} 372}
373 373
374 374
375const QString PPPData::speed() { 375const QString PPPData::speed() {
376 QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); 376 QString s = readConfig(modemGroup(), SPEED_KEY, "57600");
377 // undo the damage of a bug in former versions. It left an empty Speed= 377 // undo the damage of a bug in former versions. It left an empty Speed=
378 // entry in kppprc. kppp did set the serial port to 57600 as default but 378 // entry in kppprc. kppp did set the serial port to 57600 as default but
379 // pppd wouldn't receive the speed via the command line. 379 // pppd wouldn't receive the speed via the command line.
380 if(s.toUInt() == 0) 380 if(s.toUInt() == 0)
381 s = "57600"; 381 s = "57600";
382 return s; 382 return s;
383} 383}
384 384
385 385
386void PPPData::setSpeed(const QString &n) { 386void PPPData::setSpeed(const QString &n) {
387 writeConfig(modemGroup(), SPEED_KEY, n); 387 writeConfig(modemGroup(), SPEED_KEY, n);
388} 388}
389 389
390 390
391#if 0 391#if 0
392void PPPData::setUseCDLine(const int n) { 392void PPPData::setUseCDLine(const int n) {
393 writeConfig(modemGroup(),USECDLINE_KEY,n); 393 writeConfig(modemGroup(),USECDLINE_KEY,n);
394} 394}
395 395
396 396
397int PPPData::UseCDLine() { 397int PPPData::UseCDLine() {
398 return readNumConfig(modemGroup(),USECDLINE_KEY,0); 398 return readNumConfig(modemGroup(),USECDLINE_KEY,0);
399} 399}
400#endif 400#endif
401 401
402const QString PPPData::modemEscapeStr() { 402const QString PPPData::modemEscapeStr() {
403 return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); 403 return readConfig(modemGroup(),ESCAPESTR_KEY,"+++");
404} 404}
405 405
406 406
407void PPPData::setModemEscapeStr(const QString &n) { 407void PPPData::setModemEscapeStr(const QString &n) {
408 writeConfig(modemGroup(),ESCAPESTR_KEY,n); 408 writeConfig(modemGroup(),ESCAPESTR_KEY,n);
409} 409}
410 410
411 411
412const QString PPPData::modemEscapeResp() { 412const QString PPPData::modemEscapeResp() {
413 return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); 413 return readConfig(modemGroup(),ESCAPERESP_KEY,"OK");
414} 414}
415 415
416 416
417void PPPData::setModemEscapeResp(const QString &n) { 417void PPPData::setModemEscapeResp(const QString &n) {
418 writeConfig(modemGroup(),ESCAPERESP_KEY,n); 418 writeConfig(modemGroup(),ESCAPERESP_KEY,n);
419} 419}
420 420
421 421
422int PPPData::modemEscapeGuardTime() { 422int PPPData::modemEscapeGuardTime() {
423 return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); 423 return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50);
424} 424}
425 425
426 426
427void PPPData::setModemEscapeGuardTime(int n) { 427void PPPData::setModemEscapeGuardTime(int n) {
428 writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); 428 writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n);
429} 429}
430 430
431 431
432bool PPPData::modemLockFile() { 432bool PPPData::modemLockFile() {
433 return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); 433 return readNumConfig(modemGroup(), LOCKFILE_KEY, 1);
434} 434}
435 435
436 436
437void PPPData::setModemLockFile(bool set) { 437void PPPData::setModemLockFile(bool set) {
438 writeConfig(modemGroup(), LOCKFILE_KEY, set); 438 writeConfig(modemGroup(), LOCKFILE_KEY, set);
439} 439}
440 440
441 441
442int PPPData::modemTimeout() { 442int PPPData::modemTimeout() {
443 return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); 443 return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT);
444} 444}
445 445
446 446
447void PPPData::setModemTimeout(int n) { 447void PPPData::setModemTimeout(int n) {
448 writeConfig(modemGroup(), TIMEOUT_KEY, n); 448 writeConfig(modemGroup(), TIMEOUT_KEY, n);
449} 449}
450 450
451 451
452int PPPData::modemToneDuration() { 452int PPPData::modemToneDuration() {
453 return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); 453 return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION);
454} 454}
455 455
456 456
457void PPPData::setModemToneDuration(int n) { 457void PPPData::setModemToneDuration(int n) {
458 writeConfig(modemGroup(), TONEDURATION_KEY, n); 458 writeConfig(modemGroup(), TONEDURATION_KEY, n);
459} 459}
460 460
461 461
462int PPPData::busyWait() { 462int PPPData::busyWait() {
463 return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); 463 return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT);
464} 464}
465 465
466 466
467void PPPData::setbusyWait(int n) { 467void PPPData::setbusyWait(int n) {
468 writeConfig(modemGroup(), BUSYWAIT_KEY, n); 468 writeConfig(modemGroup(), BUSYWAIT_KEY, n);
469} 469}
470 470
471 471
472// 472//
473//Advanced "Modem" dialog 473//Advanced "Modem" dialog
474// 474//
475// defaults: InitString=ATZ, InitString1="" etc. 475// defaults: InitString=ATZ, InitString1="" etc.
476const QString PPPData::modemInitStr(int i) { 476const QString PPPData::modemInitStr(int i) {
477 assert(i >= 0 && i < NumInitStrings); 477 assert(i >= 0 && i < NumInitStrings);
478 if(i == 0) 478 if(i == 0)
479 return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); 479 return readConfig(modemGroup(), INITSTR_KEY, "ATZ");
480 else 480 else
481 return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); 481 return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), "");
482} 482}
483 483
484 484
485void PPPData::setModemInitStr(int i, const QString &n) { 485void PPPData::setModemInitStr(int i, const QString &n) {
486 assert(i >= 0 && i < NumInitStrings); 486 assert(i >= 0 && i < NumInitStrings);
487 QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); 487 QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : QString(""));
488 writeConfig(modemGroup(), k, n); 488 writeConfig(modemGroup(), k, n);
489} 489}
490 490
491 491
492const QString PPPData::modemInitResp() { 492const QString PPPData::modemInitResp() {
493 return readConfig(modemGroup(), INITRESP_KEY, "OK"); 493 return readConfig(modemGroup(), INITRESP_KEY, "OK");
494} 494}
495 495
496 496
497void PPPData::setModemInitResp(const QString &n) { 497void PPPData::setModemInitResp(const QString &n) {
498 writeConfig(modemGroup(), INITRESP_KEY, n); 498 writeConfig(modemGroup(), INITRESP_KEY, n);
499} 499}
500 500
501 501
502int PPPData::modemPreInitDelay() { 502int PPPData::modemPreInitDelay() {
503 return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); 503 return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50);
504} 504}
505 505
506 506
507void PPPData::setModemPreInitDelay(int n) { 507void PPPData::setModemPreInitDelay(int n) {
508 writeConfig(modemGroup(), PREINITDELAY_KEY, n); 508 writeConfig(modemGroup(), PREINITDELAY_KEY, n);
509} 509}
510 510
511 511
512int PPPData::modemInitDelay() { 512int PPPData::modemInitDelay() {
513 return readNumConfig(modemGroup(), INITDELAY_KEY, 50); 513 return readNumConfig(modemGroup(), INITDELAY_KEY, 50);
514} 514}
515 515
516 516
517void PPPData::setModemInitDelay(int n) { 517void PPPData::setModemInitDelay(int n) {
518 writeConfig(modemGroup(), INITDELAY_KEY, n); 518 writeConfig(modemGroup(), INITDELAY_KEY, n);
519} 519}
520 520
521QString PPPData::modemNoDialToneDetectionStr() { 521QString PPPData::modemNoDialToneDetectionStr() {
522 return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); 522 return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3");
523} 523}
524 524
525void PPPData::setModemNoDialToneDetectionStr(const QString &n) { 525void PPPData::setModemNoDialToneDetectionStr(const QString &n) {
526 writeConfig(modemGroup(), NODTDETECT_KEY, n); 526 writeConfig(modemGroup(), NODTDETECT_KEY, n);
527} 527}
528 528
529const QString PPPData::modemDialStr() { 529const QString PPPData::modemDialStr() {
530 return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); 530 return readConfig(modemGroup(), DIALSTR_KEY, "ATDT");
531} 531}
532 532
533 533
534void PPPData::setModemDialStr(const QString &n) { 534void PPPData::setModemDialStr(const QString &n) {
535 writeConfig(modemGroup(), DIALSTR_KEY, n); 535 writeConfig(modemGroup(), DIALSTR_KEY, n);
536} 536}
537 537
538 538
539const QString PPPData::modemConnectResp() { 539const QString PPPData::modemConnectResp() {
540 return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); 540 return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT");
541} 541}
542 542
543 543
544void PPPData::setModemConnectResp(const QString &n) { 544void PPPData::setModemConnectResp(const QString &n) {
545 writeConfig(modemGroup(), CONNECTRESP_KEY, n); 545 writeConfig(modemGroup(), CONNECTRESP_KEY, n);
546} 546}
547 547
548 548
549const QString PPPData::modemBusyResp() { 549const QString PPPData::modemBusyResp() {
550 return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY"); 550 return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY");
551} 551}
552 552
553 553
554void PPPData::setModemBusyResp(const QString &n) { 554void PPPData::setModemBusyResp(const QString &n) {
555 writeConfig(modemGroup(), BUSYRESP_KEY, n); 555 writeConfig(modemGroup(), BUSYRESP_KEY, n);
556} 556}
557 557
558 558
559const QString PPPData::modemNoCarrierResp() { 559const QString PPPData::modemNoCarrierResp() {
560 return readConfig(modemGroup(), NOCARRIERRESP_KEY, "NO CARRIER"); 560 return readConfig(modemGroup(), NOCARRIERRESP_KEY, "NO CARRIER");
561} 561}
562 562
563 563
564void PPPData::setModemNoCarrierResp(const QString &n) { 564void PPPData::setModemNoCarrierResp(const QString &n) {
565 writeConfig(modemGroup(), NOCARRIERRESP_KEY, n); 565 writeConfig(modemGroup(), NOCARRIERRESP_KEY, n);
566} 566}
567 567
568 568
569const QString PPPData::modemNoDialtoneResp() { 569const QString PPPData::modemNoDialtoneResp() {
570 return readConfig(modemGroup(), NODIALTONERESP_KEY, "NO DIALTONE"); 570 return readConfig(modemGroup(), NODIALTONERESP_KEY, "NO DIALTONE");
571} 571}
572 572
573 573
574void PPPData::setModemNoDialtoneResp(const QString &n) { 574void PPPData::setModemNoDialtoneResp(const QString &n) {
575 writeConfig(modemGroup(), NODIALTONERESP_KEY, n); 575 writeConfig(modemGroup(), NODIALTONERESP_KEY, n);
576} 576}
577 577
578 578
579const QString PPPData::modemHangupStr() { 579const QString PPPData::modemHangupStr() {
580 return readConfig(modemGroup(), HANGUPSTR_KEY, "+++ATH"); 580 return readConfig(modemGroup(), HANGUPSTR_KEY, "+++ATH");
581} 581}
582 582
583void PPPData::setModemHangupStr(const QString &n) { 583void PPPData::setModemHangupStr(const QString &n) {
584 writeConfig(modemGroup(), HANGUPSTR_KEY, n); 584 writeConfig(modemGroup(), HANGUPSTR_KEY, n);
585} 585}
586 586
587 587
588const QString PPPData::modemHangupResp() { 588const QString PPPData::modemHangupResp() {
589 return readConfig(modemGroup(), HANGUPRESP_KEY, "OK"); 589 return readConfig(modemGroup(), HANGUPRESP_KEY, "OK");
590} 590}
591 591
592void PPPData::setModemHangupResp(const QString &n) { 592void PPPData::setModemHangupResp(const QString &n) {
593 writeConfig(modemGroup(), HANGUPRESP_KEY, n); 593 writeConfig(modemGroup(), HANGUPRESP_KEY, n);
594} 594}
595 595
596 596
597const QString PPPData::modemAnswerStr() { 597const QString PPPData::modemAnswerStr() {
598 return readConfig(modemGroup(), ANSWERSTR_KEY, "ATA"); 598 return readConfig(modemGroup(), ANSWERSTR_KEY, "ATA");
599} 599}
600 600
601 601
602QString PPPData::volumeOff() { 602QString PPPData::volumeOff() {
603 return readConfig(modemGroup(), VOLUME_OFF, "M0L0"); 603 return readConfig(modemGroup(), VOLUME_OFF, "M0L0");
604} 604}
605 605
606 606
607void PPPData::setVolumeOff(const QString &s) { 607void PPPData::setVolumeOff(const QString &s) {
608 writeConfig(modemGroup(), VOLUME_OFF, s); 608 writeConfig(modemGroup(), VOLUME_OFF, s);
609} 609}
610 610
611 611
612QString PPPData::volumeMedium() { 612QString PPPData::volumeMedium() {
613 return readConfig(modemGroup(), VOLUME_MEDIUM, "M1L1"); 613 return readConfig(modemGroup(), VOLUME_MEDIUM, "M1L1");
614} 614}
615 615
616 616
617void PPPData::setVolumeMedium(const QString &s) { 617void PPPData::setVolumeMedium(const QString &s) {
618 writeConfig(modemGroup(), VOLUME_MEDIUM, s); 618 writeConfig(modemGroup(), VOLUME_MEDIUM, s);
619} 619}
620 620
621 621
622QString PPPData::volumeHigh() { 622QString PPPData::volumeHigh() {
623 QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3"); 623 QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3");
624 if(tmp == "M1L4") 624 if(tmp == "M1L4")
625 tmp = "M1L3"; 625 tmp = "M1L3";
626 return tmp; 626 return tmp;
627} 627}
628 628
629 629
630void PPPData::setVolumeHigh(const QString &s) { 630void PPPData::setVolumeHigh(const QString &s) {
631 writeConfig(modemGroup(), VOLUME_HIGH, s); 631 writeConfig(modemGroup(), VOLUME_HIGH, s);
632} 632}
633 633
634 634
635QString PPPData::volumeInitString() { 635QString PPPData::volumeInitString() {
636 QString s; 636 QString s;
637 637
638 switch(volume()) { 638 switch(volume()) {
639 case 0: 639 case 0:
640 s = volumeOff(); 640 s = volumeOff();
641 break; 641 break;
642 case 1: 642 case 1:
643 s = volumeMedium(); 643 s = volumeMedium();
644 break; 644 break;
645 case 2: 645 case 2:
646 s = volumeHigh(); 646 s = volumeHigh();
647 break; 647 break;
648 default: 648 default:
649 s = volumeMedium(); 649 s = volumeMedium();
650 } 650 }
651 651
652 return s; 652 return s;
653} 653}
654 654
655 655
656int PPPData::volume() { 656int PPPData::volume() {
657 return readNumConfig(modemGroup(), VOLUME_KEY, 1); 657 return readNumConfig(modemGroup(), VOLUME_KEY, 1);
658} 658}
659 659
660 660
661void PPPData::setVolume(int i) { 661void PPPData::setVolume(int i) {
662 writeConfig(modemGroup(), VOLUME_KEY, i); 662 writeConfig(modemGroup(), VOLUME_KEY, i);
663} 663}
664 664
665int PPPData::waitForDialTone() { 665int PPPData::waitForDialTone() {
666 return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); 666 return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1);
667} 667}
668 668
669void PPPData::setWaitForDialTone(int i) { 669void PPPData::setWaitForDialTone(int i) {
670 writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); 670 writeConfig(modemGroup(), DIALTONEWAIT_KEY, i);
671} 671}
672 672
673void PPPData::setModemAnswerStr(const QString &n) { 673void PPPData::setModemAnswerStr(const QString &n) {
674 writeConfig(modemGroup(), ANSWERSTR_KEY, n); 674 writeConfig(modemGroup(), ANSWERSTR_KEY, n);
675} 675}
676 676
677 677
678const QString PPPData::modemRingResp() { 678const QString PPPData::modemRingResp() {
679 return readConfig(modemGroup(), RINGRESP_KEY, "RING"); 679 return readConfig(modemGroup(), RINGRESP_KEY, "RING");
680} 680}
681 681
682 682
683void PPPData::setModemRingResp(const QString &n) { 683void PPPData::setModemRingResp(const QString &n) {
684 writeConfig(modemGroup(), RINGRESP_KEY, n); 684 writeConfig(modemGroup(), RINGRESP_KEY, n);
685} 685}
686 686
687 687
688const QString PPPData::modemAnswerResp() { 688const QString PPPData::modemAnswerResp() {
689 return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); 689 return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT");
690} 690}
691 691
692 692
693void PPPData::setModemAnswerResp(const QString &n) { 693void PPPData::setModemAnswerResp(const QString &n) {
694 writeConfig(modemGroup(), ANSWERRESP_KEY, n); 694 writeConfig(modemGroup(), ANSWERRESP_KEY, n);
695} 695}
696 696
697 697
698const QString PPPData::enter() { 698const QString PPPData::enter() {
699 return readConfig(modemGroup(), ENTER_KEY, "CR"); 699 return readConfig(modemGroup(), ENTER_KEY, "CR");
700} 700}
701 701
702 702
703void PPPData::setEnter(const QString &n) { 703void PPPData::setEnter(const QString &n) {
704 writeConfig(modemGroup(), ENTER_KEY, n); 704 writeConfig(modemGroup(), ENTER_KEY, n);
705} 705}
706 706
707 707
708// 708//
709// functions to set/return account information 709// functions to set/return account information
710// 710//
711 711
712//returns number of accounts 712//returns number of accounts
713int PPPData::count() const { 713int PPPData::count() const {
714 return highcount + 1; 714 return highcount + 1;
715} 715}
716 716
717 717
718bool PPPData::setAccount(const QString &aname) { 718bool PPPData::setAccount(const QString &aname) {
719 qDebug("setting account to >%s<", aname.latin1()); 719 qDebug("setting account to >%s<", aname.latin1());
720 for(int i = 0; i <= highcount; i++) { 720 for(int i = 0; i <= highcount; i++) {
721 setAccountbyIndex(i); 721 setAccountbyIndex(i);
722 if(accname() == aname) { 722 if(accname() == aname) {
723 caccount = i; 723 caccount = i;
724 qDebug("SUCCESS"); 724 qDebug("SUCCESS");
725 return true; 725 return true;
726 } 726 }
727 } 727 }
728 qDebug("FAILURE"); 728 qDebug("FAILURE");
729 return false; 729 return false;
730} 730}
731 731
732 732
733bool PPPData::setAccountbyIndex(int i) { 733bool PPPData::setAccountbyIndex(int i) {
734 if(i >= 0 && i <= highcount) { 734 if(i >= 0 && i <= highcount) {
735 caccount = i; 735 caccount = i;
736 cgroup.sprintf("%s%i", ACCOUNT_GRP, i); 736 cgroup.sprintf("%s%i", ACCOUNT_GRP, i);
737 return true; 737 return true;
738 } 738 }
739 return false; 739 return false;
740} 740}
741 741
742 742
743bool PPPData::isUniqueAccname(const QString &n) { 743bool PPPData::isUniqueAccname(const QString &n) {
744 int current = caccount; 744 int current = caccount;
745 for(int i=0; i <= highcount; i++) { 745 for(int i=0; i <= highcount; i++) {
746 setAccountbyIndex(i); 746 setAccountbyIndex(i);
747 if(accname() == n && i != current) { 747 if(accname() == n && i != current) {
748 setAccountbyIndex(current); 748 setAccountbyIndex(current);
749 return false; 749 return false;
750 } 750 }
751 } 751 }
752 setAccountbyIndex(current); 752 setAccountbyIndex(current);
753 return true; 753 return true;
754} 754}
755 755
756 756
757bool PPPData::deleteAccount() { 757bool PPPData::deleteAccount() {
758 //FIXME: PPPData::deleteAccount 758 //FIXME: PPPData::deleteAccount
759// if(caccount < 0) 759// if(caccount < 0)
760 return false; 760 return false;
761 761
762// QMap <QString, QString> map; 762// QMap <QString, QString> map;
763// QMap <QString, QString>::Iterator it; 763// QMap <QString, QString>::Iterator it;
764 764
765// // set all entries of the current account to "" 765// // set all entries of the current account to ""
766// map = config->entryMap(cgroup); 766// map = config->entryMap(cgroup);
767// it = map.begin(); 767// it = map.begin();
768// while (it != map.end()) { 768// while (it != map.end()) {
769// config->writeEntry(it.key(), ""); 769// config->writeEntry(it.key(), "");
770// it++; 770// it++;
771// } 771// }
772 772
773// // shift the succeeding accounts 773// // shift the succeeding accounts
774// for(int i = caccount+1; i <= highcount; i++) { 774// for(int i = caccount+1; i <= highcount; i++) {
775// setAccountbyIndex(i); 775// setAccountbyIndex(i);
776// map = config->entryMap(cgroup); 776// map = config->entryMap(cgroup);
777// it = map.begin(); 777// it = map.begin();
778// setAccountbyIndex(i-1); 778// setAccountbyIndex(i-1);
779// config->setGroup(cgroup); 779// config->setGroup(cgroup);
780// while (it != map.end()) { 780// while (it != map.end()) {
781// config->writeEntry(it.key(), *it); 781// config->writeEntry(it.key(), *it);
782// it++; 782// it++;
783// } 783// }
784// } 784// }
785 785
786// // make sure the top account is cleared 786// // make sure the top account is cleared
787// setAccountbyIndex(highcount); 787// setAccountbyIndex(highcount);
788// map = config->entryMap(cgroup); 788// map = config->entryMap(cgroup);
789// it = map.begin(); 789// it = map.begin();
790// config->setGroup(cgroup); 790// config->setGroup(cgroup);
791// while (it.key() != QString::null) { 791// while (it.key() != QString::null) {
792// config->writeEntry(it.key(), ""); 792// config->writeEntry(it.key(), "");
793// it++; 793// it++;
794// } 794// }
795 795
796// highcount--; 796// highcount--;
797// if(caccount > highcount) 797// if(caccount > highcount)
798// caccount = highcount; 798// caccount = highcount;
799 799
800// setAccountbyIndex(caccount); 800// setAccountbyIndex(caccount);
801 801
802// return true; 802// return true;
803} 803}
804 804
805 805
806bool PPPData::deleteAccount(const QString &aname) { 806bool PPPData::deleteAccount(const QString &aname) {
807 if(!setAccount(aname)) 807 if(!setAccount(aname))
808 return false; 808 return false;
809 809
810 deleteAccount(); 810 deleteAccount();
811 811
812 return true; 812 return true;
813} 813}
814 814
815 815
816int PPPData::newaccount() { 816int PPPData::newaccount() {
817 817
818 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); 818 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS);
819// if(!config) open(); 819// if(!config) open();
820 if (highcount >= MAX_ACCOUNTS) return -1; 820 if (highcount >= MAX_ACCOUNTS) return -1;
821 821
822 highcount++; 822 highcount++;
823 setAccountbyIndex(highcount); 823 setAccountbyIndex(highcount);
824 824
825 setpppdArgumentDefaults(); 825 setpppdArgumentDefaults();
826 qDebug("PPPData::newaccount -> %i",caccount); 826 qDebug("PPPData::newaccount -> %i",caccount);
827 return caccount; 827 return caccount;
828} 828}
829 829
830int PPPData::copyaccount(int i) { 830int PPPData::copyaccount(int i) {
831// FIXME: PPPData::copyaccount 831// FIXME: PPPData::copyaccount
832// if(highcount >= MAX_ACCOUNTS) 832// if(highcount >= MAX_ACCOUNTS)
833 return -1; 833 return -1;
834 834
835// setAccountbyIndex(i); 835// setAccountbyIndex(i);
836 836
837// QMap <QString, QString> map = config->entryMap(cgroup); 837// QMap <QString, QString> map = config->entryMap(cgroup);
838// QMap <QString, QString>::ConstIterator it = map.begin(); 838// QMap <QString, QString>::ConstIterator it = map.begin();
839 839
840// QString newname = i18n("%1_copy").arg(accname()); 840// QString newname = i18n("%1_copy").arg(accname());
841 841
842// newaccount(); 842// newaccount();
843 843
844// while (it != map.end()) { 844// while (it != map.end()) {
845// config->writeEntry(it.key(), *it); 845// config->writeEntry(it.key(), *it);
846// it++; 846// it++;
847// } 847// }
848 848
849// setAccname(newname); 849// setAccname(newname);
850 850
851// return caccount; 851// return caccount;
852} 852}
853 853
854 854
855const QString PPPData::accname() { 855const QString PPPData::accname() {
856 return readConfig(cgroup, NAME_KEY); 856 return readConfig(cgroup, NAME_KEY);
857} 857}
858 858
859void PPPData::setAccname(const QString &n) { 859void PPPData::setAccname(const QString &n) {
860 if(!cgroup.isNull()) { 860 if(!cgroup.isNull()) {
861 // are we manipulating the default account's name ? then change it, too. 861 // are we manipulating the default account's name ? then change it, too.
862 bool def = accname() == defaultAccount(); 862 bool def = accname() == defaultAccount();
863 writeConfig(cgroup, NAME_KEY, n); 863 writeConfig(cgroup, NAME_KEY, n);
864 if (def) 864 if (def)
865 setDefaultAccount(n); 865 setDefaultAccount(n);
866 } 866 }
867} 867}
868 868
869 869
870#define SEPARATOR_CHAR '&' 870#define SEPARATOR_CHAR '&'
871QStringList &PPPData::phonenumbers() { 871QStringList &PPPData::phonenumbers() {
872 872
873 readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); 873 readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR);
874 return phonelist; 874 return phonelist;
875 875
876} 876}
877 877
878 878
879const QString PPPData::phonenumber() { 879const QString PPPData::phonenumber() {
880 return readConfig(cgroup, PHONENUMBER_KEY); 880 return readConfig(cgroup, PHONENUMBER_KEY);
881} 881}
882 882
883 883
884void PPPData::setPhonenumber(const QString &n) { 884void PPPData::setPhonenumber(const QString &n) {
885 writeConfig(cgroup, PHONENUMBER_KEY, n); 885 writeConfig(cgroup, PHONENUMBER_KEY, n);
886} 886}
887 887
888 888
889const QString PPPData::dialPrefix() { 889const QString PPPData::dialPrefix() {
890 return readConfig(cgroup, DIAL_PREFIX_KEY, ""); 890 return readConfig(cgroup, DIAL_PREFIX_KEY, "");
891} 891}
892 892
893 893
894void PPPData::setDialPrefix(const QString &s) { 894void PPPData::setDialPrefix(const QString &s) {
895 writeConfig(cgroup, DIAL_PREFIX_KEY, s); 895 writeConfig(cgroup, DIAL_PREFIX_KEY, s);
896} 896}
897 897
898 898
899int PPPData::authMethod() { 899int PPPData::authMethod() {
900 return readNumConfig(cgroup, AUTH_KEY, 0); 900 return readNumConfig(cgroup, AUTH_KEY, 0);
901} 901}
902 902
903 903
904void PPPData::setAuthMethod(int value) { 904void PPPData::setAuthMethod(int value) {
905 writeConfig(cgroup, AUTH_KEY, value); 905 writeConfig(cgroup, AUTH_KEY, value);
906} 906}
907 907
908 908
909const QString PPPData::storedUsername() { 909const QString PPPData::storedUsername() {
910 return readConfig(cgroup, STORED_USERNAME_KEY, ""); 910 return readConfig(cgroup, STORED_USERNAME_KEY, "");
911} 911}
912 912
913 913
914void PPPData::setStoredUsername(const QString &b) { 914void PPPData::setStoredUsername(const QString &b) {
915 writeConfig(cgroup, STORED_USERNAME_KEY, b); 915 writeConfig(cgroup, STORED_USERNAME_KEY, b);
916} 916}
917 917
918 918
919const QString PPPData::storedPassword() { 919const QString PPPData::storedPassword() {
920 qDebug("getting stored pw"); 920 qDebug("getting stored pw");
921 qDebug("g %s", cgroup.latin1() ); 921 qDebug("g %s", cgroup.latin1() );
922 qDebug("k %s", STORED_PASSWORD_KEY); 922 qDebug("k %s", STORED_PASSWORD_KEY);
923 return readConfig(cgroup, STORED_PASSWORD_KEY, ""); 923 return readConfig(cgroup, STORED_PASSWORD_KEY, "");
924} 924}
925 925
926 926
927void PPPData::setStoredPassword(const QString &b) { 927void PPPData::setStoredPassword(const QString &b) {
928 writeConfig(cgroup, STORED_PASSWORD_KEY, b); 928 writeConfig(cgroup, STORED_PASSWORD_KEY, b);
929} 929}
930 930
931 931
932bool PPPData::storePassword() { 932bool PPPData::storePassword() {
933 return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); 933 return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1);
934} 934}
935 935
936 936
937const QString PPPData::command_before_connect() { 937const QString PPPData::command_before_connect() {
938 return readConfig(cgroup, BEFORE_CONNECT_KEY); 938 return readConfig(cgroup, BEFORE_CONNECT_KEY);
939} 939}
940 940
941 941
942void PPPData::setCommand_before_connect(const QString &n) { 942void PPPData::setCommand_before_connect(const QString &n) {
943 writeConfig(cgroup, BEFORE_CONNECT_KEY, n); 943 writeConfig(cgroup, BEFORE_CONNECT_KEY, n);
944} 944}
945 945
946 946
947void PPPData::setStorePassword(bool b) { 947void PPPData::setStorePassword(bool b) {
948 writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); 948 writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b);
949} 949}
950 950
951 951
952const QString PPPData::command_on_connect() { 952const QString PPPData::command_on_connect() {
953 return readConfig(cgroup, COMMAND_KEY); 953 return readConfig(cgroup, COMMAND_KEY);
954} 954}
955 955
956 956
957void PPPData::setCommand_on_connect(const QString &n) { 957void PPPData::setCommand_on_connect(const QString &n) {
958 writeConfig(cgroup, COMMAND_KEY, n); 958 writeConfig(cgroup, COMMAND_KEY, n);
959} 959}
960 960
961 961
962const QString PPPData::command_on_disconnect() { 962const QString PPPData::command_on_disconnect() {
963 return readConfig(cgroup, DISCONNECT_COMMAND_KEY); 963 return readConfig(cgroup, DISCONNECT_COMMAND_KEY);
964} 964}
965 965
966 966
967void PPPData::setCommand_on_disconnect(const QString &n) { 967void PPPData::setCommand_on_disconnect(const QString &n) {
968 writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); 968 writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n);
969} 969}
970 970
971 971
972const QString PPPData::command_before_disconnect() { 972const QString PPPData::command_before_disconnect() {
973 return readConfig(cgroup, BEFORE_DISCONNECT_KEY); 973 return readConfig(cgroup, BEFORE_DISCONNECT_KEY);
974} 974}
975 975
976 976
977void PPPData::setCommand_before_disconnect(const QString &n) { 977void PPPData::setCommand_before_disconnect(const QString &n) {
978 writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); 978 writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n);
979} 979}
980 980
981 981
982const QString PPPData::ipaddr() { 982const QString PPPData::ipaddr() {
983 return readConfig(cgroup, IPADDR_KEY); 983 return readConfig(cgroup, IPADDR_KEY);
984} 984}
985 985
986 986
987void PPPData::setIpaddr(const QString &n) { 987void PPPData::setIpaddr(const QString &n) {
988 writeConfig(cgroup, IPADDR_KEY, n); 988 writeConfig(cgroup, IPADDR_KEY, n);
989} 989}
990 990
991 991
992const QString PPPData::subnetmask() { 992const QString PPPData::subnetmask() {
993 return readConfig(cgroup, SUBNETMASK_KEY); 993 return readConfig(cgroup, SUBNETMASK_KEY);
994} 994}
995 995
996 996
997void PPPData::setSubnetmask(const QString &n) { 997void PPPData::setSubnetmask(const QString &n) {
998 writeConfig(cgroup, SUBNETMASK_KEY, n); 998 writeConfig(cgroup, SUBNETMASK_KEY, n);
999} 999}
1000 1000
1001 1001
1002bool PPPData::autoname() { 1002bool PPPData::autoname() {
1003 return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); 1003 return (bool) readNumConfig(cgroup, AUTONAME_KEY, false);
1004} 1004}
1005 1005
1006 1006
1007void PPPData::setAutoname(bool set) { 1007void PPPData::setAutoname(bool set) {
1008 writeConfig(cgroup, AUTONAME_KEY, (int) set); 1008 writeConfig(cgroup, AUTONAME_KEY, (int) set);
1009} 1009}
1010 1010
1011 1011
1012bool PPPData::AcctEnabled() { 1012bool PPPData::AcctEnabled() {
1013 return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); 1013 return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false);
1014} 1014}
1015 1015
1016 1016
1017void PPPData::setAcctEnabled(bool set) { 1017void PPPData::setAcctEnabled(bool set) {
1018 writeConfig(cgroup, ACCTENABLED_KEY, (int) set); 1018 writeConfig(cgroup, ACCTENABLED_KEY, (int) set);
1019} 1019}
1020 1020
1021 1021
1022// int PPPData::VolAcctEnabled() { 1022// int PPPData::VolAcctEnabled() {
1023// return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0); 1023// return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0);
1024// } 1024// }
1025 1025
1026 1026
1027// void PPPData::setVolAcctEnabled(int set) { 1027// void PPPData::setVolAcctEnabled(int set) {
1028// writeConfig(cgroup, VOLACCTENABLED_KEY, set); 1028// writeConfig(cgroup, VOLACCTENABLED_KEY, set);
1029// } 1029// }
1030 1030
1031 1031
1032const QString PPPData::gateway() { 1032const QString PPPData::gateway() {
1033 return readConfig(cgroup, GATEWAY_KEY); 1033 return readConfig(cgroup, GATEWAY_KEY);
1034} 1034}
1035 1035
1036 1036
1037void PPPData::setGateway(const QString &n ) { 1037void PPPData::setGateway(const QString &n ) {
1038 writeConfig(cgroup, GATEWAY_KEY, n); 1038 writeConfig(cgroup, GATEWAY_KEY, n);
1039} 1039}
1040 1040
1041 1041
1042bool PPPData::defaultroute() { 1042bool PPPData::defaultroute() {
1043 // default route is by default 'on'. 1043 // default route is by default 'on'.
1044 return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true); 1044 return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true);
1045} 1045}
1046 1046
1047 1047
1048void PPPData::setDefaultroute(bool set) { 1048void PPPData::setDefaultroute(bool set) {
1049 writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set); 1049 writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set);
1050} 1050}
1051 1051
1052 1052
1053bool PPPData::autoDNS() { 1053bool PPPData::autoDNS() {
1054 bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); 1054 bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true);
1055 return (set && pppdVersionMin(2, 3, 7)); 1055 return (set && pppdVersionMin(2, 3, 7));
1056} 1056}
1057 1057
1058 1058
1059void PPPData::setAutoDNS(bool set) { 1059void PPPData::setAutoDNS(bool set) {
1060 writeConfig(cgroup, AUTODNS_KEY, (int) set); 1060 writeConfig(cgroup, AUTODNS_KEY, (int) set);
1061} 1061}
1062 1062
1063 1063
1064void PPPData::setExDNSDisabled(bool set) { 1064void PPPData::setExDNSDisabled(bool set) {
1065 writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set); 1065 writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set);
1066} 1066}
1067 1067
1068 1068
1069bool PPPData::exDNSDisabled() { 1069bool PPPData::exDNSDisabled() {
1070 return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0); 1070 return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0);
1071} 1071}
1072 1072
1073 1073
1074QStringList &PPPData::dns() { 1074QStringList &PPPData::dns() {
1075 static QStringList dnslist; 1075 static QStringList dnslist;
1076 1076
1077 readListConfig(cgroup, DNS_KEY, dnslist); 1077 readListConfig(cgroup, DNS_KEY, dnslist);
1078 while(dnslist.count() > MAX_DNS_ENTRIES) 1078 while(dnslist.count() > MAX_DNS_ENTRIES)
1079 dnslist.remove(dnslist.last()); 1079 dnslist.remove(dnslist.last());
1080 1080
1081 return dnslist; 1081 return dnslist;
1082} 1082}
1083 1083
1084 1084
1085void PPPData::setDns(QStringList &list) { 1085void PPPData::setDns(QStringList &list) {
1086 writeListConfig(cgroup, DNS_KEY, list); 1086 writeListConfig(cgroup, DNS_KEY, list);
1087} 1087}
1088 1088
1089 1089
1090const QString PPPData::domain() { 1090const QString PPPData::domain() {
1091 return readConfig(cgroup, DOMAIN_KEY); 1091 return readConfig(cgroup, DOMAIN_KEY);
1092} 1092}
1093 1093
1094 1094
1095void PPPData::setDomain(const QString &n ) { 1095void PPPData::setDomain(const QString &n ) {
1096 writeConfig(cgroup, DOMAIN_KEY, n); 1096 writeConfig(cgroup, DOMAIN_KEY, n);
1097} 1097}
1098 1098
1099 1099
1100QStringList &PPPData::scriptType() { 1100QStringList &PPPData::scriptType() {
1101 static QStringList typelist; 1101 static QStringList typelist;
1102 1102
1103 readListConfig(cgroup, SCRIPTCOM_KEY, typelist); 1103 readListConfig(cgroup, SCRIPTCOM_KEY, typelist);
1104 while(typelist.count() > MAX_SCRIPT_ENTRIES) 1104 while(typelist.count() > MAX_SCRIPT_ENTRIES)
1105 typelist.remove(typelist.last()); 1105 typelist.remove(typelist.last());
1106 1106
1107 return typelist; 1107 return typelist;
1108} 1108}
1109 1109
1110 1110
1111void PPPData::setScriptType(QStringList &list) { 1111void PPPData::setScriptType(QStringList &list) {
1112 writeListConfig(cgroup, SCRIPTCOM_KEY, list); 1112 writeListConfig(cgroup, SCRIPTCOM_KEY, list);
1113} 1113}
1114 1114
1115 1115
1116QStringList &PPPData::script() { 1116QStringList &PPPData::script() {
1117 static QStringList scriptlist; 1117 static QStringList scriptlist;
1118 1118
1119 readListConfig(cgroup, SCRIPTARG_KEY, scriptlist); 1119 readListConfig(cgroup, SCRIPTARG_KEY, scriptlist);
1120 while(scriptlist.count() > MAX_SCRIPT_ENTRIES) 1120 while(scriptlist.count() > MAX_SCRIPT_ENTRIES)
1121 scriptlist.remove(scriptlist.last()); 1121 scriptlist.remove(scriptlist.last());
1122 1122
1123 return scriptlist; 1123 return scriptlist;
1124} 1124}
1125 1125
1126 1126
1127void PPPData::setScript(QStringList &list) { 1127void PPPData::setScript(QStringList &list) {
1128 writeListConfig(cgroup, SCRIPTARG_KEY, list); 1128 writeListConfig(cgroup, SCRIPTARG_KEY, list);
1129} 1129}
1130 1130
1131 1131
1132// const QString PPPData::accountingFile() { 1132// const QString PPPData::accountingFile() {
1133// return readConfig(cgroup, ACCTFILE_KEY); 1133// return readConfig(cgroup, ACCTFILE_KEY);
1134// } 1134// }
1135 1135
1136 1136
1137// void PPPData::setAccountingFile(const QString &n) { 1137// void PPPData::setAccountingFile(const QString &n) {
1138// writeConfig(cgroup, ACCTFILE_KEY, n); 1138// writeConfig(cgroup, ACCTFILE_KEY, n);
1139// } 1139// }
1140 1140
1141 1141
1142// const QString PPPData::totalCosts() { 1142// const QString PPPData::totalCosts() {
1143// return readConfig(cgroup, TOTALCOSTS_KEY); 1143// return readConfig(cgroup, TOTALCOSTS_KEY);
1144// } 1144// }
1145 1145
1146 1146
1147// void PPPData::setTotalCosts(const QString &n) { 1147// void PPPData::setTotalCosts(const QString &n) {
1148// writeConfig(cgroup, TOTALCOSTS_KEY, n); 1148// writeConfig(cgroup, TOTALCOSTS_KEY, n);
1149// } 1149// }
1150 1150
1151 1151
1152// int PPPData::totalBytes() { 1152// int PPPData::totalBytes() {
1153// return readNumConfig(cgroup, TOTALBYTES_KEY, 0); 1153// return readNumConfig(cgroup, TOTALBYTES_KEY, 0);
1154// } 1154// }
1155 1155
1156// void PPPData::setTotalBytes(int n) { 1156// void PPPData::setTotalBytes(int n) {
1157// writeConfig(cgroup, TOTALBYTES_KEY, n); 1157// writeConfig(cgroup, TOTALBYTES_KEY, n);
1158// } 1158// }
1159 1159
1160 1160
1161QStringList &PPPData::pppdArgument() { 1161QStringList &PPPData::pppdArgument() {
1162 static QStringList arglist; 1162 static QStringList arglist;
1163 1163
1164 while(arglist.count() > MAX_PPPD_ARGUMENTS) 1164 while(arglist.count() > MAX_PPPD_ARGUMENTS)
1165 arglist.remove(arglist.last()); 1165 arglist.remove(arglist.last());
1166 readListConfig(cgroup, PPPDARG_KEY, arglist); 1166 readListConfig(cgroup, PPPDARG_KEY, arglist);
1167 1167
1168 return arglist; 1168 return arglist;
1169} 1169}
1170 1170
1171 1171
1172void PPPData::setpppdArgument(QStringList &args) { 1172void PPPData::setpppdArgument(QStringList &args) {
1173 writeListConfig(cgroup, PPPDARG_KEY, args); 1173 writeListConfig(cgroup, PPPDARG_KEY, args);
1174} 1174}
1175 1175
1176 1176
1177void PPPData::setpppdArgumentDefaults() { 1177void PPPData::setpppdArgumentDefaults() {
1178 QStringList arg; 1178 QStringList arg;
1179 setpppdArgument(arg); 1179 setpppdArgument(arg);
1180} 1180}
1181 1181
1182 1182
1183// // graphing widget 1183// // graphing widget
1184// void PPPData::setGraphingOptions(bool enable, 1184// void PPPData::setGraphingOptions(bool enable,
1185 // QColor bg, 1185 // QColor bg,
1186 // QColor text, 1186 // QColor text,
1187 // QColor in, 1187 // QColor in,
1188 // QColor out) 1188 // QColor out)
1189// { 1189// {
1190// if(config) { 1190// if(config) {
1191// config->setGroup(GRAPH_GRP); 1191// config->setGroup(GRAPH_GRP);
1192// config->writeEntry(GENABLED, enable); 1192// config->writeEntry(GENABLED, enable);
1193// // config->writeEntry(GCOLOR_BG, bg); 1193// // config->writeEntry(GCOLOR_BG, bg);
1194// // config->writeEntry(GCOLOR_TEXT, text); 1194// // config->writeEntry(GCOLOR_TEXT, text);
1195// // config->writeEntry(GCOLOR_IN, in); 1195// // config->writeEntry(GCOLOR_IN, in);
1196// // config->writeEntry(GCOLOR_OUT, out); 1196// // config->writeEntry(GCOLOR_OUT, out);
1197// } 1197// }
1198// } 1198// }
1199 1199
1200// void PPPData::graphingOptions(bool &enable, 1200// void PPPData::graphingOptions(bool &enable,
1201 // QColor &bg, 1201 // QColor &bg,
1202 // QColor &text, 1202 // QColor &text,
1203 // QColor &in, 1203 // QColor &in,
1204 // QColor &out) 1204 // QColor &out)
1205// { 1205// {
1206// QColor c; 1206// QColor c;
1207 1207
1208// if(config) { 1208// if(config) {
1209// config->setGroup(GRAPH_GRP); 1209// config->setGroup(GRAPH_GRP);
1210// enable = config->readBoolEntry(GENABLED, true); 1210// enable = config->readBoolEntry(GENABLED, true);
1211// bg = Qt::white; 1211// bg = Qt::white;
1212// //bg = config->readColorEntry(GCOLOR_BG, &c); 1212// //bg = config->readColorEntry(GCOLOR_BG, &c);
1213// text = Qt::black; 1213// text = Qt::black;
1214// //text = config->readColorEntry(GCOLOR_TEXT, &c); 1214// //text = config->readColorEntry(GCOLOR_TEXT, &c);
1215// in = Qt::blue; 1215// in = Qt::blue;
1216// //in = config->readColorEntry(GCOLOR_IN, &c); 1216// //in = config->readColorEntry(GCOLOR_IN, &c);
1217// out = Qt::red; 1217// out = Qt::red;
1218// //out = config->readColorEntry(GCOLOR_OUT, &c); 1218// //out = config->readColorEntry(GCOLOR_OUT, &c);
1219// } 1219// }
1220// } 1220// }
1221 1221
1222 1222
1223// bool PPPData::graphingEnabled() { 1223// bool PPPData::graphingEnabled() {
1224// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); 1224// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true);
1225// } 1225// }
1226 1226
1227 1227
1228 1228
1229// 1229//
1230//functions to change/set the child pppd process info 1230//functions to change/set the child pppd process info
1231// 1231//
1232bool PPPData::pppdRunning() const { 1232bool PPPData::pppdRunning() const {
1233 return pppdisrunning; 1233 return pppdisrunning;
1234} 1234}
1235 1235
1236void PPPData::setpppdRunning(bool set) { 1236void PPPData::setpppdRunning(bool set) {
1237 pppdisrunning = set; 1237 pppdisrunning = set;
1238} 1238}
1239 1239
1240int PPPData::pppdError() const { 1240int PPPData::pppdError() const {
1241 return pppderror; 1241 return pppderror;
1242} 1242}
1243 1243
1244void PPPData::setpppdError(int err) { 1244void PPPData::setpppdError(int err) {
1245 pppderror = err; 1245 pppderror = err;
1246} 1246}
1247 1247
1248QString PPPData::modemGroup() 1248QString PPPData::modemGroup()
1249{ 1249{
1250 if (modemDeviceGroup<0){ 1250 if (modemDeviceGroup<0){
1251 qDebug("wrong modem %i\n using 0",modemDeviceGroup); 1251 qDebug("wrong modem %i\n using 0",modemDeviceGroup);
1252 modemDeviceGroup = 0; //FIXME! 1252 modemDeviceGroup = 0; //FIXME!
1253 } 1253 }
1254 return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup); 1254 return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup);
1255} 1255}
1256 1256
1257 1257
1258QMap<QString,QString> PPPData::getConfiguredInterfaces() 1258QMap<QString,QString> PPPData::getConfiguredInterfaces()
1259{ 1259{
1260 QMap<QString,QString> ifaces; 1260 QMap<QString,QString> ifaces;
1261 Config config = PPPData::config(); 1261 Config config = PPPData::config();
1262 config.setGroup(ACCLIST_GRP); 1262 config.setGroup(ACCLIST_GRP);
1263 int count = config.readNumEntry( ACCOUNTS_COUNT, -1 ); 1263 int count = config.readNumEntry( ACCOUNTS_COUNT, -1 );
1264 QString accGrp, dev, acc; 1264 QString accGrp, dev, acc;
1265 for (int i = 0; i < count; i++){ 1265 for (int i = 0; i < count; i++){
1266 accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); 1266 accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
1267 config.setGroup(accGrp); 1267 config.setGroup(accGrp);
1268 dev = config.readEntry( ACOUNTS_DEV, "error" ); 1268 dev = config.readEntry( ACOUNTS_DEV, "error" );
1269 acc = config.readEntry( ACOUNTS_ACC, "error" ); 1269 acc = config.readEntry( ACOUNTS_ACC, "error" );
1270 ifaces.insert( dev, acc ); 1270 ifaces.insert( dev, acc );
1271 } 1271 }
1272 1272
1273 return ifaces; 1273 return ifaces;
1274} 1274}
1275 1275
1276void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) 1276void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
1277{ 1277{
1278 QMap<QString,QString>::Iterator it; 1278 QMap<QString,QString>::Iterator it;
1279 int i = 0; 1279 int i = 0;
1280 Config cfg = config(); 1280 Config cfg = config();
1281 for( it = ifaces.begin(); it != ifaces.end(); ++it ){ 1281 for( it = ifaces.begin(); it != ifaces.end(); ++it ){
1282 cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); 1282 cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++));
1283 cfg.writeEntry( ACOUNTS_DEV, it.key() ); 1283 cfg.writeEntry( ACOUNTS_DEV, it.key() );
1284 cfg.writeEntry( ACOUNTS_ACC, it.data() ); 1284 cfg.writeEntry( ACOUNTS_ACC, it.data() );
1285 qDebug("I %i",i); 1285 qDebug("I %i",i);
1286 } 1286 }
1287 cfg.setGroup( ACCLIST_GRP ); 1287 cfg.setGroup( ACCLIST_GRP );
1288 qDebug("saved %i account settings", i); 1288 qDebug("saved %i account settings", i);
1289 cfg.writeEntry( ACCOUNTS_COUNT, i ); 1289 cfg.writeEntry( ACCOUNTS_COUNT, i );
1290 1290
1291} 1291}
1292 1292
1293/** 1293/**
1294 * pppd's getword() function knows about escape characters. 1294 * pppd's getword() function knows about escape characters.
1295 * If we write the username and password to the secrets file 1295 * If we write the username and password to the secrets file
1296 * we'll therefore have to escape back slashes. 1296 * we'll therefore have to escape back slashes.
1297 */ 1297 */
1298QString PPPData::encodeWord(const QString &s) { 1298QString PPPData::encodeWord(const QString &s) {
1299 QString r = s; 1299 QString r = s;
1300 r.replace(QRegExp("\\"), "\\\\"); 1300 r.replace(QRegExp("\\"), "\\\\");
1301 return r; 1301 return r;
1302} 1302}