author | tille <tille> | 2003-06-02 15:12:10 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-02 15:12:10 (UTC) |
commit | 2d9798f244078089a0305d26509e288bb4a4190e (patch) (unidiff) | |
tree | fd1932ca218382dc607ee21dd754693e30ef74e9 | |
parent | 6f49eaa7cf9589bf1f3f4277dc6dbd4d35cb0462 (diff) | |
download | opie-2d9798f244078089a0305d26509e288bb4a4190e.zip opie-2d9798f244078089a0305d26509e288bb4a4190e.tar.gz opie-2d9798f244078089a0305d26509e288bb4a4190e.tar.bz2 |
impl remove item
-rw-r--r-- | noncore/settings/networksettings/ppp/TODO | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 11 |
3 files changed, 9 insertions, 9 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO index 529d236..5635438 100644 --- a/noncore/settings/networksettings/ppp/TODO +++ b/noncore/settings/networksettings/ppp/TODO | |||
@@ -1,7 +1,7 @@ | |||
1 | - add possibility to input username and password ;) | 1 | - add possibility to input username and password ;) |
2 | - impl. PPPData::copyaccount & PPPData::deleteAccount | 2 | - impl. PPPData::copyaccount & PPPData::deleteAccount |
3 | - update modem attribute inputs when modem has changed | 3 | - update modem attribute inputs when modem has changed |
4 | - fix layout of edit account, i.e. get it shown maximised | 4 | - fix layout of edit account, i.e. get it shown maximised |
5 | - popup configure modem with the correct account prselected | 5 | - popup configure modem with the correct account prselected |
6 | not quite shure why it does not work... IMHO it should work | 6 | not quite shure why it does not work... IMHO it should work |
7 | - remove interfaces | 7 | |
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index 517dd8b..23db409 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp | |||
@@ -224,1072 +224,1075 @@ QString PPPData::password() const { | |||
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 | ||
230 | const QString PPPData::defaultAccount() { | 230 | const QString PPPData::defaultAccount() { |
231 | return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY); | 231 | return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY); |
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
235 | void PPPData::setDefaultAccount(const QString &n) { | 235 | void PPPData::setDefaultAccount(const QString &n) { |
236 | writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n); | 236 | writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n); |
237 | 237 | ||
238 | //now set the current account index to the default account | 238 | //now set the current account index to the default account |
239 | setAccount(defaultAccount()); | 239 | setAccount(defaultAccount()); |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | bool PPPData::get_show_clock_on_caption() { | 243 | bool PPPData::get_show_clock_on_caption() { |
244 | return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true); | 244 | return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | void PPPData::set_show_clock_on_caption(bool set) { | 248 | void PPPData::set_show_clock_on_caption(bool set) { |
249 | writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); | 249 | writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); |
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
253 | bool PPPData::get_xserver_exit_disconnect() { | 253 | 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 | qDebug("Setting modem dev to >%s<", n.latin1()); |
351 | bool ret = false; | 351 | bool ret = false; |
352 | for (int i = 0; devices[i]; i++) | 352 | for (int i = 0; devices[i]; i++) |
353 | if (devices[i] == n){ | 353 | if (devices[i] == n){ |
354 | modemDeviceGroup = i; | 354 | modemDeviceGroup = i; |
355 | writeConfig(modemGroup(), MODEMDEV_KEY, n); | 355 | writeConfig(modemGroup(), MODEMDEV_KEY, n); |
356 | ret = true; | 356 | ret = true; |
357 | } | 357 | } |
358 | qDebug(ret?"SUCCESS":"FAILURE"); | 358 | qDebug(ret?"SUCCESS":"FAILURE"); |
359 | return ret; | 359 | return ret; |
360 | } | 360 | } |
361 | 361 | ||
362 | 362 | ||
363 | const QString PPPData::flowcontrol() { | 363 | const QString PPPData::flowcontrol() { |
364 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); | 364 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); |
365 | } | 365 | } |
366 | 366 | ||
367 | 367 | ||
368 | void PPPData::setFlowcontrol(const QString &n) { | 368 | void PPPData::setFlowcontrol(const QString &n) { |
369 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); | 369 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); |
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | const QString PPPData::speed() { | 373 | const QString PPPData::speed() { |
374 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); | 374 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); |
375 | // 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= |
376 | // 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 |
377 | // pppd wouldn't receive the speed via the command line. | 377 | // pppd wouldn't receive the speed via the command line. |
378 | if(s.toUInt() == 0) | 378 | if(s.toUInt() == 0) |
379 | s = "57600"; | 379 | s = "57600"; |
380 | return s; | 380 | return s; |
381 | } | 381 | } |
382 | 382 | ||
383 | 383 | ||
384 | void PPPData::setSpeed(const QString &n) { | 384 | void PPPData::setSpeed(const QString &n) { |
385 | writeConfig(modemGroup(), SPEED_KEY, n); | 385 | writeConfig(modemGroup(), SPEED_KEY, n); |
386 | } | 386 | } |
387 | 387 | ||
388 | 388 | ||
389 | #if 0 | 389 | #if 0 |
390 | void PPPData::setUseCDLine(const int n) { | 390 | void PPPData::setUseCDLine(const int n) { |
391 | writeConfig(modemGroup(),USECDLINE_KEY,n); | 391 | writeConfig(modemGroup(),USECDLINE_KEY,n); |
392 | } | 392 | } |
393 | 393 | ||
394 | 394 | ||
395 | int PPPData::UseCDLine() { | 395 | int PPPData::UseCDLine() { |
396 | return readNumConfig(modemGroup(),USECDLINE_KEY,0); | 396 | return readNumConfig(modemGroup(),USECDLINE_KEY,0); |
397 | } | 397 | } |
398 | #endif | 398 | #endif |
399 | 399 | ||
400 | const QString PPPData::modemEscapeStr() { | 400 | const QString PPPData::modemEscapeStr() { |
401 | return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); | 401 | return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); |
402 | } | 402 | } |
403 | 403 | ||
404 | 404 | ||
405 | void PPPData::setModemEscapeStr(const QString &n) { | 405 | void PPPData::setModemEscapeStr(const QString &n) { |
406 | writeConfig(modemGroup(),ESCAPESTR_KEY,n); | 406 | writeConfig(modemGroup(),ESCAPESTR_KEY,n); |
407 | } | 407 | } |
408 | 408 | ||
409 | 409 | ||
410 | const QString PPPData::modemEscapeResp() { | 410 | const QString PPPData::modemEscapeResp() { |
411 | return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); | 411 | return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); |
412 | } | 412 | } |
413 | 413 | ||
414 | 414 | ||
415 | void PPPData::setModemEscapeResp(const QString &n) { | 415 | void PPPData::setModemEscapeResp(const QString &n) { |
416 | writeConfig(modemGroup(),ESCAPERESP_KEY,n); | 416 | writeConfig(modemGroup(),ESCAPERESP_KEY,n); |
417 | } | 417 | } |
418 | 418 | ||
419 | 419 | ||
420 | int PPPData::modemEscapeGuardTime() { | 420 | int PPPData::modemEscapeGuardTime() { |
421 | return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); | 421 | return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | void PPPData::setModemEscapeGuardTime(int n) { | 425 | void PPPData::setModemEscapeGuardTime(int n) { |
426 | writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); | 426 | writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); |
427 | } | 427 | } |
428 | 428 | ||
429 | 429 | ||
430 | bool PPPData::modemLockFile() { | 430 | bool PPPData::modemLockFile() { |
431 | return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); | 431 | return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); |
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
435 | void PPPData::setModemLockFile(bool set) { | 435 | void PPPData::setModemLockFile(bool set) { |
436 | writeConfig(modemGroup(), LOCKFILE_KEY, set); | 436 | writeConfig(modemGroup(), LOCKFILE_KEY, set); |
437 | } | 437 | } |
438 | 438 | ||
439 | 439 | ||
440 | int PPPData::modemTimeout() { | 440 | int PPPData::modemTimeout() { |
441 | return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); | 441 | return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); |
442 | } | 442 | } |
443 | 443 | ||
444 | 444 | ||
445 | void PPPData::setModemTimeout(int n) { | 445 | void PPPData::setModemTimeout(int n) { |
446 | writeConfig(modemGroup(), TIMEOUT_KEY, n); | 446 | writeConfig(modemGroup(), TIMEOUT_KEY, n); |
447 | } | 447 | } |
448 | 448 | ||
449 | 449 | ||
450 | int PPPData::modemToneDuration() { | 450 | int PPPData::modemToneDuration() { |
451 | return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); | 451 | return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); |
452 | } | 452 | } |
453 | 453 | ||
454 | 454 | ||
455 | void PPPData::setModemToneDuration(int n) { | 455 | void PPPData::setModemToneDuration(int n) { |
456 | writeConfig(modemGroup(), TONEDURATION_KEY, n); | 456 | writeConfig(modemGroup(), TONEDURATION_KEY, n); |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | int PPPData::busyWait() { | 460 | int PPPData::busyWait() { |
461 | return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); | 461 | return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); |
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | void PPPData::setbusyWait(int n) { | 465 | void PPPData::setbusyWait(int n) { |
466 | writeConfig(modemGroup(), BUSYWAIT_KEY, n); | 466 | writeConfig(modemGroup(), BUSYWAIT_KEY, n); |
467 | } | 467 | } |
468 | 468 | ||
469 | 469 | ||
470 | // | 470 | // |
471 | //Advanced "Modem" dialog | 471 | //Advanced "Modem" dialog |
472 | // | 472 | // |
473 | // defaults: InitString=ATZ, InitString1="" etc. | 473 | // defaults: InitString=ATZ, InitString1="" etc. |
474 | const QString PPPData::modemInitStr(int i) { | 474 | const QString PPPData::modemInitStr(int i) { |
475 | assert(i >= 0 && i < NumInitStrings); | 475 | assert(i >= 0 && i < NumInitStrings); |
476 | if(i == 0) | 476 | if(i == 0) |
477 | return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); | 477 | return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); |
478 | else | 478 | else |
479 | return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); | 479 | return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); |
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | void PPPData::setModemInitStr(int i, const QString &n) { | 483 | void PPPData::setModemInitStr(int i, const QString &n) { |
484 | assert(i >= 0 && i < NumInitStrings); | 484 | assert(i >= 0 && i < NumInitStrings); |
485 | QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); | 485 | QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); |
486 | writeConfig(modemGroup(), k, n); | 486 | writeConfig(modemGroup(), k, n); |
487 | } | 487 | } |
488 | 488 | ||
489 | 489 | ||
490 | const QString PPPData::modemInitResp() { | 490 | const QString PPPData::modemInitResp() { |
491 | return readConfig(modemGroup(), INITRESP_KEY, "OK"); | 491 | return readConfig(modemGroup(), INITRESP_KEY, "OK"); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | void PPPData::setModemInitResp(const QString &n) { | 495 | void PPPData::setModemInitResp(const QString &n) { |
496 | writeConfig(modemGroup(), INITRESP_KEY, n); | 496 | writeConfig(modemGroup(), INITRESP_KEY, n); |
497 | } | 497 | } |
498 | 498 | ||
499 | 499 | ||
500 | int PPPData::modemPreInitDelay() { | 500 | int PPPData::modemPreInitDelay() { |
501 | return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); | 501 | return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); |
502 | } | 502 | } |
503 | 503 | ||
504 | 504 | ||
505 | void PPPData::setModemPreInitDelay(int n) { | 505 | void PPPData::setModemPreInitDelay(int n) { |
506 | writeConfig(modemGroup(), PREINITDELAY_KEY, n); | 506 | writeConfig(modemGroup(), PREINITDELAY_KEY, n); |
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
510 | int PPPData::modemInitDelay() { | 510 | int PPPData::modemInitDelay() { |
511 | return readNumConfig(modemGroup(), INITDELAY_KEY, 50); | 511 | return readNumConfig(modemGroup(), INITDELAY_KEY, 50); |
512 | } | 512 | } |
513 | 513 | ||
514 | 514 | ||
515 | void PPPData::setModemInitDelay(int n) { | 515 | void PPPData::setModemInitDelay(int n) { |
516 | writeConfig(modemGroup(), INITDELAY_KEY, n); | 516 | writeConfig(modemGroup(), INITDELAY_KEY, n); |
517 | } | 517 | } |
518 | 518 | ||
519 | QString PPPData::modemNoDialToneDetectionStr() { | 519 | QString PPPData::modemNoDialToneDetectionStr() { |
520 | return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); | 520 | return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); |
521 | } | 521 | } |
522 | 522 | ||
523 | void PPPData::setModemNoDialToneDetectionStr(const QString &n) { | 523 | void PPPData::setModemNoDialToneDetectionStr(const QString &n) { |
524 | writeConfig(modemGroup(), NODTDETECT_KEY, n); | 524 | writeConfig(modemGroup(), NODTDETECT_KEY, n); |
525 | } | 525 | } |
526 | 526 | ||
527 | const QString PPPData::modemDialStr() { | 527 | const QString PPPData::modemDialStr() { |
528 | return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); | 528 | return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); |
529 | } | 529 | } |
530 | 530 | ||
531 | 531 | ||
532 | void PPPData::setModemDialStr(const QString &n) { | 532 | void PPPData::setModemDialStr(const QString &n) { |
533 | writeConfig(modemGroup(), DIALSTR_KEY, n); | 533 | writeConfig(modemGroup(), DIALSTR_KEY, n); |
534 | } | 534 | } |
535 | 535 | ||
536 | 536 | ||
537 | const QString PPPData::modemConnectResp() { | 537 | const QString PPPData::modemConnectResp() { |
538 | return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); | 538 | return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | void PPPData::setModemConnectResp(const QString &n) { | 542 | void PPPData::setModemConnectResp(const QString &n) { |
543 | writeConfig(modemGroup(), CONNECTRESP_KEY, n); | 543 | writeConfig(modemGroup(), CONNECTRESP_KEY, n); |
544 | } | 544 | } |
545 | 545 | ||
546 | 546 | ||
547 | const QString PPPData::modemBusyResp() { | 547 | const QString PPPData::modemBusyResp() { |
548 | return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY"); | 548 | return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY"); |
549 | } | 549 | } |
550 | 550 | ||
551 | 551 | ||
552 | void PPPData::setModemBusyResp(const QString &n) { | 552 | void PPPData::setModemBusyResp(const QString &n) { |
553 | writeConfig(modemGroup(), BUSYRESP_KEY, n); | 553 | writeConfig(modemGroup(), BUSYRESP_KEY, n); |
554 | } | 554 | } |
555 | 555 | ||
556 | 556 | ||
557 | const QString PPPData::modemNoCarrierResp() { | 557 | const QString PPPData::modemNoCarrierResp() { |
558 | return readConfig(modemGroup(), NOCARRIERRESP_KEY, "NO CARRIER"); | 558 | return readConfig(modemGroup(), NOCARRIERRESP_KEY, "NO CARRIER"); |
559 | } | 559 | } |
560 | 560 | ||
561 | 561 | ||
562 | void PPPData::setModemNoCarrierResp(const QString &n) { | 562 | void PPPData::setModemNoCarrierResp(const QString &n) { |
563 | writeConfig(modemGroup(), NOCARRIERRESP_KEY, n); | 563 | writeConfig(modemGroup(), NOCARRIERRESP_KEY, n); |
564 | } | 564 | } |
565 | 565 | ||
566 | 566 | ||
567 | const QString PPPData::modemNoDialtoneResp() { | 567 | const QString PPPData::modemNoDialtoneResp() { |
568 | return readConfig(modemGroup(), NODIALTONERESP_KEY, "NO DIALTONE"); | 568 | return readConfig(modemGroup(), NODIALTONERESP_KEY, "NO DIALTONE"); |
569 | } | 569 | } |
570 | 570 | ||
571 | 571 | ||
572 | void PPPData::setModemNoDialtoneResp(const QString &n) { | 572 | void PPPData::setModemNoDialtoneResp(const QString &n) { |
573 | writeConfig(modemGroup(), NODIALTONERESP_KEY, n); | 573 | writeConfig(modemGroup(), NODIALTONERESP_KEY, n); |
574 | } | 574 | } |
575 | 575 | ||
576 | 576 | ||
577 | const QString PPPData::modemHangupStr() { | 577 | const QString PPPData::modemHangupStr() { |
578 | return readConfig(modemGroup(), HANGUPSTR_KEY, "+++ATH"); | 578 | return readConfig(modemGroup(), HANGUPSTR_KEY, "+++ATH"); |
579 | } | 579 | } |
580 | 580 | ||
581 | void PPPData::setModemHangupStr(const QString &n) { | 581 | void PPPData::setModemHangupStr(const QString &n) { |
582 | writeConfig(modemGroup(), HANGUPSTR_KEY, n); | 582 | writeConfig(modemGroup(), HANGUPSTR_KEY, n); |
583 | } | 583 | } |
584 | 584 | ||
585 | 585 | ||
586 | const QString PPPData::modemHangupResp() { | 586 | const QString PPPData::modemHangupResp() { |
587 | return readConfig(modemGroup(), HANGUPRESP_KEY, "OK"); | 587 | return readConfig(modemGroup(), HANGUPRESP_KEY, "OK"); |
588 | } | 588 | } |
589 | 589 | ||
590 | void PPPData::setModemHangupResp(const QString &n) { | 590 | void PPPData::setModemHangupResp(const QString &n) { |
591 | writeConfig(modemGroup(), HANGUPRESP_KEY, n); | 591 | writeConfig(modemGroup(), HANGUPRESP_KEY, n); |
592 | } | 592 | } |
593 | 593 | ||
594 | 594 | ||
595 | const QString PPPData::modemAnswerStr() { | 595 | const QString PPPData::modemAnswerStr() { |
596 | return readConfig(modemGroup(), ANSWERSTR_KEY, "ATA"); | 596 | return readConfig(modemGroup(), ANSWERSTR_KEY, "ATA"); |
597 | } | 597 | } |
598 | 598 | ||
599 | 599 | ||
600 | QString PPPData::volumeOff() { | 600 | QString PPPData::volumeOff() { |
601 | return readConfig(modemGroup(), VOLUME_OFF, "M0L0"); | 601 | return readConfig(modemGroup(), VOLUME_OFF, "M0L0"); |
602 | } | 602 | } |
603 | 603 | ||
604 | 604 | ||
605 | void PPPData::setVolumeOff(const QString &s) { | 605 | void PPPData::setVolumeOff(const QString &s) { |
606 | writeConfig(modemGroup(), VOLUME_OFF, s); | 606 | writeConfig(modemGroup(), VOLUME_OFF, s); |
607 | } | 607 | } |
608 | 608 | ||
609 | 609 | ||
610 | QString PPPData::volumeMedium() { | 610 | QString PPPData::volumeMedium() { |
611 | return readConfig(modemGroup(), VOLUME_MEDIUM, "M1L1"); | 611 | return readConfig(modemGroup(), VOLUME_MEDIUM, "M1L1"); |
612 | } | 612 | } |
613 | 613 | ||
614 | 614 | ||
615 | void PPPData::setVolumeMedium(const QString &s) { | 615 | void PPPData::setVolumeMedium(const QString &s) { |
616 | writeConfig(modemGroup(), VOLUME_MEDIUM, s); | 616 | writeConfig(modemGroup(), VOLUME_MEDIUM, s); |
617 | } | 617 | } |
618 | 618 | ||
619 | 619 | ||
620 | QString PPPData::volumeHigh() { | 620 | QString PPPData::volumeHigh() { |
621 | QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3"); | 621 | QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3"); |
622 | if(tmp == "M1L4") | 622 | if(tmp == "M1L4") |
623 | tmp = "M1L3"; | 623 | tmp = "M1L3"; |
624 | return tmp; | 624 | return tmp; |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | void PPPData::setVolumeHigh(const QString &s) { | 628 | void PPPData::setVolumeHigh(const QString &s) { |
629 | writeConfig(modemGroup(), VOLUME_HIGH, s); | 629 | writeConfig(modemGroup(), VOLUME_HIGH, s); |
630 | } | 630 | } |
631 | 631 | ||
632 | 632 | ||
633 | QString PPPData::volumeInitString() { | 633 | QString PPPData::volumeInitString() { |
634 | QString s; | 634 | QString s; |
635 | 635 | ||
636 | switch(volume()) { | 636 | switch(volume()) { |
637 | case 0: | 637 | case 0: |
638 | s = volumeOff(); | 638 | s = volumeOff(); |
639 | break; | 639 | break; |
640 | case 1: | 640 | case 1: |
641 | s = volumeMedium(); | 641 | s = volumeMedium(); |
642 | break; | 642 | break; |
643 | case 2: | 643 | case 2: |
644 | s = volumeHigh(); | 644 | s = volumeHigh(); |
645 | break; | 645 | break; |
646 | default: | 646 | default: |
647 | s = volumeMedium(); | 647 | s = volumeMedium(); |
648 | } | 648 | } |
649 | 649 | ||
650 | return s; | 650 | return s; |
651 | } | 651 | } |
652 | 652 | ||
653 | 653 | ||
654 | int PPPData::volume() { | 654 | int PPPData::volume() { |
655 | return readNumConfig(modemGroup(), VOLUME_KEY, 1); | 655 | return readNumConfig(modemGroup(), VOLUME_KEY, 1); |
656 | } | 656 | } |
657 | 657 | ||
658 | 658 | ||
659 | void PPPData::setVolume(int i) { | 659 | void PPPData::setVolume(int i) { |
660 | writeConfig(modemGroup(), VOLUME_KEY, i); | 660 | writeConfig(modemGroup(), VOLUME_KEY, i); |
661 | } | 661 | } |
662 | 662 | ||
663 | int PPPData::waitForDialTone() { | 663 | int PPPData::waitForDialTone() { |
664 | return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); | 664 | return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); |
665 | } | 665 | } |
666 | 666 | ||
667 | void PPPData::setWaitForDialTone(int i) { | 667 | void PPPData::setWaitForDialTone(int i) { |
668 | writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); | 668 | writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); |
669 | } | 669 | } |
670 | 670 | ||
671 | void PPPData::setModemAnswerStr(const QString &n) { | 671 | void PPPData::setModemAnswerStr(const QString &n) { |
672 | writeConfig(modemGroup(), ANSWERSTR_KEY, n); | 672 | writeConfig(modemGroup(), ANSWERSTR_KEY, n); |
673 | } | 673 | } |
674 | 674 | ||
675 | 675 | ||
676 | const QString PPPData::modemRingResp() { | 676 | const QString PPPData::modemRingResp() { |
677 | return readConfig(modemGroup(), RINGRESP_KEY, "RING"); | 677 | return readConfig(modemGroup(), RINGRESP_KEY, "RING"); |
678 | } | 678 | } |
679 | 679 | ||
680 | 680 | ||
681 | void PPPData::setModemRingResp(const QString &n) { | 681 | void PPPData::setModemRingResp(const QString &n) { |
682 | writeConfig(modemGroup(), RINGRESP_KEY, n); | 682 | writeConfig(modemGroup(), RINGRESP_KEY, n); |
683 | } | 683 | } |
684 | 684 | ||
685 | 685 | ||
686 | const QString PPPData::modemAnswerResp() { | 686 | const QString PPPData::modemAnswerResp() { |
687 | return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); | 687 | return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); |
688 | } | 688 | } |
689 | 689 | ||
690 | 690 | ||
691 | void PPPData::setModemAnswerResp(const QString &n) { | 691 | void PPPData::setModemAnswerResp(const QString &n) { |
692 | writeConfig(modemGroup(), ANSWERRESP_KEY, n); | 692 | writeConfig(modemGroup(), ANSWERRESP_KEY, n); |
693 | } | 693 | } |
694 | 694 | ||
695 | 695 | ||
696 | const QString PPPData::enter() { | 696 | const QString PPPData::enter() { |
697 | return readConfig(modemGroup(), ENTER_KEY, "CR"); | 697 | return readConfig(modemGroup(), ENTER_KEY, "CR"); |
698 | } | 698 | } |
699 | 699 | ||
700 | 700 | ||
701 | void PPPData::setEnter(const QString &n) { | 701 | void PPPData::setEnter(const QString &n) { |
702 | writeConfig(modemGroup(), ENTER_KEY, n); | 702 | writeConfig(modemGroup(), ENTER_KEY, n); |
703 | } | 703 | } |
704 | 704 | ||
705 | 705 | ||
706 | // | 706 | // |
707 | // functions to set/return account information | 707 | // functions to set/return account information |
708 | // | 708 | // |
709 | 709 | ||
710 | //returns number of accounts | 710 | //returns number of accounts |
711 | int PPPData::count() const { | 711 | int PPPData::count() const { |
712 | return highcount + 1; | 712 | return highcount + 1; |
713 | } | 713 | } |
714 | 714 | ||
715 | 715 | ||
716 | bool PPPData::setAccount(const QString &aname) { | 716 | bool PPPData::setAccount(const QString &aname) { |
717 | qDebug("setting account to >%s<", aname.latin1()); | 717 | qDebug("setting account to >%s<", aname.latin1()); |
718 | for(int i = 0; i <= highcount; i++) { | 718 | for(int i = 0; i <= highcount; i++) { |
719 | setAccountbyIndex(i); | 719 | setAccountbyIndex(i); |
720 | if(accname() == aname) { | 720 | if(accname() == aname) { |
721 | caccount = i; | 721 | caccount = i; |
722 | qDebug("SUCCESS"); | 722 | qDebug("SUCCESS"); |
723 | return true; | 723 | return true; |
724 | } | 724 | } |
725 | } | 725 | } |
726 | qDebug("FAILURE"); | 726 | qDebug("FAILURE"); |
727 | return false; | 727 | return false; |
728 | } | 728 | } |
729 | 729 | ||
730 | 730 | ||
731 | bool PPPData::setAccountbyIndex(int i) { | 731 | bool PPPData::setAccountbyIndex(int i) { |
732 | if(i >= 0 && i <= highcount) { | 732 | if(i >= 0 && i <= highcount) { |
733 | caccount = i; | 733 | caccount = i; |
734 | cgroup.sprintf("%s%i", ACCOUNT_GRP, i); | 734 | cgroup.sprintf("%s%i", ACCOUNT_GRP, i); |
735 | return true; | 735 | return true; |
736 | } | 736 | } |
737 | return false; | 737 | return false; |
738 | } | 738 | } |
739 | 739 | ||
740 | 740 | ||
741 | bool PPPData::isUniqueAccname(const QString &n) { | 741 | bool PPPData::isUniqueAccname(const QString &n) { |
742 | int current = caccount; | 742 | int current = caccount; |
743 | for(int i=0; i <= highcount; i++) { | 743 | for(int i=0; i <= highcount; i++) { |
744 | setAccountbyIndex(i); | 744 | setAccountbyIndex(i); |
745 | if(accname() == n && i != current) { | 745 | if(accname() == n && i != current) { |
746 | setAccountbyIndex(current); | 746 | setAccountbyIndex(current); |
747 | return false; | 747 | return false; |
748 | } | 748 | } |
749 | } | 749 | } |
750 | setAccountbyIndex(current); | 750 | setAccountbyIndex(current); |
751 | return true; | 751 | return true; |
752 | } | 752 | } |
753 | 753 | ||
754 | 754 | ||
755 | bool PPPData::deleteAccount() { | 755 | bool PPPData::deleteAccount() { |
756 | //FIXME: | 756 | //FIXME: |
757 | // if(caccount < 0) | 757 | // if(caccount < 0) |
758 | return false; | 758 | return false; |
759 | 759 | ||
760 | // QMap <QString, QString> map; | 760 | // QMap <QString, QString> map; |
761 | // QMap <QString, QString>::Iterator it; | 761 | // QMap <QString, QString>::Iterator it; |
762 | 762 | ||
763 | // // set all entries of the current account to "" | 763 | // // set all entries of the current account to "" |
764 | // map = config->entryMap(cgroup); | 764 | // map = config->entryMap(cgroup); |
765 | // it = map.begin(); | 765 | // it = map.begin(); |
766 | // while (it != map.end()) { | 766 | // while (it != map.end()) { |
767 | // config->writeEntry(it.key(), ""); | 767 | // config->writeEntry(it.key(), ""); |
768 | // it++; | 768 | // it++; |
769 | // } | 769 | // } |
770 | 770 | ||
771 | // // shift the succeeding accounts | 771 | // // shift the succeeding accounts |
772 | // for(int i = caccount+1; i <= highcount; i++) { | 772 | // for(int i = caccount+1; i <= highcount; i++) { |
773 | // setAccountbyIndex(i); | 773 | // setAccountbyIndex(i); |
774 | // map = config->entryMap(cgroup); | 774 | // map = config->entryMap(cgroup); |
775 | // it = map.begin(); | 775 | // it = map.begin(); |
776 | // setAccountbyIndex(i-1); | 776 | // setAccountbyIndex(i-1); |
777 | // config->setGroup(cgroup); | 777 | // config->setGroup(cgroup); |
778 | // while (it != map.end()) { | 778 | // while (it != map.end()) { |
779 | // config->writeEntry(it.key(), *it); | 779 | // config->writeEntry(it.key(), *it); |
780 | // it++; | 780 | // it++; |
781 | // } | 781 | // } |
782 | // } | 782 | // } |
783 | 783 | ||
784 | // // make sure the top account is cleared | 784 | // // make sure the top account is cleared |
785 | // setAccountbyIndex(highcount); | 785 | // setAccountbyIndex(highcount); |
786 | // map = config->entryMap(cgroup); | 786 | // map = config->entryMap(cgroup); |
787 | // it = map.begin(); | 787 | // it = map.begin(); |
788 | // config->setGroup(cgroup); | 788 | // config->setGroup(cgroup); |
789 | // while (it.key() != QString::null) { | 789 | // while (it.key() != QString::null) { |
790 | // config->writeEntry(it.key(), ""); | 790 | // config->writeEntry(it.key(), ""); |
791 | // it++; | 791 | // it++; |
792 | // } | 792 | // } |
793 | 793 | ||
794 | // highcount--; | 794 | // highcount--; |
795 | // if(caccount > highcount) | 795 | // if(caccount > highcount) |
796 | // caccount = highcount; | 796 | // caccount = highcount; |
797 | 797 | ||
798 | // setAccountbyIndex(caccount); | 798 | // setAccountbyIndex(caccount); |
799 | 799 | ||
800 | // return true; | 800 | // return true; |
801 | } | 801 | } |
802 | 802 | ||
803 | 803 | ||
804 | bool PPPData::deleteAccount(const QString &aname) { | 804 | bool PPPData::deleteAccount(const QString &aname) { |
805 | if(!setAccount(aname)) | 805 | if(!setAccount(aname)) |
806 | return false; | 806 | return false; |
807 | 807 | ||
808 | deleteAccount(); | 808 | deleteAccount(); |
809 | 809 | ||
810 | return true; | 810 | return true; |
811 | } | 811 | } |
812 | 812 | ||
813 | 813 | ||
814 | int PPPData::newaccount() { | 814 | int PPPData::newaccount() { |
815 | 815 | ||
816 | qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); | 816 | qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); |
817 | // if(!config) open(); | 817 | // if(!config) open(); |
818 | if (highcount >= MAX_ACCOUNTS) return -1; | 818 | if (highcount >= MAX_ACCOUNTS) return -1; |
819 | 819 | ||
820 | highcount++; | 820 | highcount++; |
821 | setAccountbyIndex(highcount); | 821 | setAccountbyIndex(highcount); |
822 | 822 | ||
823 | setpppdArgumentDefaults(); | 823 | setpppdArgumentDefaults(); |
824 | qDebug("PPPData::newaccount -> %i",caccount); | 824 | qDebug("PPPData::newaccount -> %i",caccount); |
825 | return caccount; | 825 | return caccount; |
826 | } | 826 | } |
827 | 827 | ||
828 | int PPPData::copyaccount(int i) { | 828 | int PPPData::copyaccount(int i) { |
829 | // FIXME | 829 | // FIXME |
830 | // if(highcount >= MAX_ACCOUNTS) | 830 | // if(highcount >= MAX_ACCOUNTS) |
831 | return -1; | 831 | return -1; |
832 | 832 | ||
833 | // setAccountbyIndex(i); | 833 | // setAccountbyIndex(i); |
834 | 834 | ||
835 | // QMap <QString, QString> map = config->entryMap(cgroup); | 835 | // QMap <QString, QString> map = config->entryMap(cgroup); |
836 | // QMap <QString, QString>::ConstIterator it = map.begin(); | 836 | // QMap <QString, QString>::ConstIterator it = map.begin(); |
837 | 837 | ||
838 | // QString newname = i18n("%1_copy").arg(accname()); | 838 | // QString newname = i18n("%1_copy").arg(accname()); |
839 | 839 | ||
840 | // newaccount(); | 840 | // newaccount(); |
841 | 841 | ||
842 | // while (it != map.end()) { | 842 | // while (it != map.end()) { |
843 | // config->writeEntry(it.key(), *it); | 843 | // config->writeEntry(it.key(), *it); |
844 | // it++; | 844 | // it++; |
845 | // } | 845 | // } |
846 | 846 | ||
847 | // setAccname(newname); | 847 | // setAccname(newname); |
848 | 848 | ||
849 | // return caccount; | 849 | // return caccount; |
850 | } | 850 | } |
851 | 851 | ||
852 | 852 | ||
853 | const QString PPPData::accname() { | 853 | const QString PPPData::accname() { |
854 | return readConfig(cgroup, NAME_KEY); | 854 | return readConfig(cgroup, NAME_KEY); |
855 | } | 855 | } |
856 | 856 | ||
857 | void PPPData::setAccname(const QString &n) { | 857 | void PPPData::setAccname(const QString &n) { |
858 | if(!cgroup.isNull()) { | 858 | if(!cgroup.isNull()) { |
859 | // 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. |
860 | bool def = accname() == defaultAccount(); | 860 | bool def = accname() == defaultAccount(); |
861 | writeConfig(cgroup, NAME_KEY, n); | 861 | writeConfig(cgroup, NAME_KEY, n); |
862 | if (def) | 862 | if (def) |
863 | setDefaultAccount(n); | 863 | setDefaultAccount(n); |
864 | } | 864 | } |
865 | } | 865 | } |
866 | 866 | ||
867 | 867 | ||
868 | #define SEPARATOR_CHAR '&' | 868 | #define SEPARATOR_CHAR '&' |
869 | QStringList &PPPData::phonenumbers() { | 869 | QStringList &PPPData::phonenumbers() { |
870 | 870 | ||
871 | readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); | 871 | readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); |
872 | return phonelist; | 872 | return phonelist; |
873 | 873 | ||
874 | } | 874 | } |
875 | 875 | ||
876 | 876 | ||
877 | const QString PPPData::phonenumber() { | 877 | const QString PPPData::phonenumber() { |
878 | return readConfig(cgroup, PHONENUMBER_KEY); | 878 | return readConfig(cgroup, PHONENUMBER_KEY); |
879 | } | 879 | } |
880 | 880 | ||
881 | 881 | ||
882 | void PPPData::setPhonenumber(const QString &n) { | 882 | void PPPData::setPhonenumber(const QString &n) { |
883 | writeConfig(cgroup, PHONENUMBER_KEY, n); | 883 | writeConfig(cgroup, PHONENUMBER_KEY, n); |
884 | } | 884 | } |
885 | 885 | ||
886 | 886 | ||
887 | const QString PPPData::dialPrefix() { | 887 | const QString PPPData::dialPrefix() { |
888 | return readConfig(cgroup, DIAL_PREFIX_KEY, ""); | 888 | return readConfig(cgroup, DIAL_PREFIX_KEY, ""); |
889 | } | 889 | } |
890 | 890 | ||
891 | 891 | ||
892 | void PPPData::setDialPrefix(const QString &s) { | 892 | void PPPData::setDialPrefix(const QString &s) { |
893 | writeConfig(cgroup, DIAL_PREFIX_KEY, s); | 893 | writeConfig(cgroup, DIAL_PREFIX_KEY, s); |
894 | } | 894 | } |
895 | 895 | ||
896 | 896 | ||
897 | int PPPData::authMethod() { | 897 | int PPPData::authMethod() { |
898 | return readNumConfig(cgroup, AUTH_KEY, 0); | 898 | return readNumConfig(cgroup, AUTH_KEY, 0); |
899 | } | 899 | } |
900 | 900 | ||
901 | 901 | ||
902 | void PPPData::setAuthMethod(int value) { | 902 | void PPPData::setAuthMethod(int value) { |
903 | writeConfig(cgroup, AUTH_KEY, value); | 903 | writeConfig(cgroup, AUTH_KEY, value); |
904 | } | 904 | } |
905 | 905 | ||
906 | 906 | ||
907 | const QString PPPData::storedUsername() { | 907 | const QString PPPData::storedUsername() { |
908 | return readConfig(cgroup, STORED_USERNAME_KEY, ""); | 908 | return readConfig(cgroup, STORED_USERNAME_KEY, ""); |
909 | } | 909 | } |
910 | 910 | ||
911 | 911 | ||
912 | void PPPData::setStoredUsername(const QString &b) { | 912 | void PPPData::setStoredUsername(const QString &b) { |
913 | writeConfig(cgroup, STORED_USERNAME_KEY, b); | 913 | writeConfig(cgroup, STORED_USERNAME_KEY, b); |
914 | } | 914 | } |
915 | 915 | ||
916 | 916 | ||
917 | const QString PPPData::storedPassword() { | 917 | const QString PPPData::storedPassword() { |
918 | qDebug("getting stored pw"); | 918 | qDebug("getting stored pw"); |
919 | qDebug("g %s", cgroup.latin1() ); | 919 | qDebug("g %s", cgroup.latin1() ); |
920 | qDebug("k %s", STORED_PASSWORD_KEY); | 920 | qDebug("k %s", STORED_PASSWORD_KEY); |
921 | return readConfig(cgroup, STORED_PASSWORD_KEY, ""); | 921 | return readConfig(cgroup, STORED_PASSWORD_KEY, ""); |
922 | } | 922 | } |
923 | 923 | ||
924 | 924 | ||
925 | void PPPData::setStoredPassword(const QString &b) { | 925 | void PPPData::setStoredPassword(const QString &b) { |
926 | writeConfig(cgroup, STORED_PASSWORD_KEY, b); | 926 | writeConfig(cgroup, STORED_PASSWORD_KEY, b); |
927 | } | 927 | } |
928 | 928 | ||
929 | 929 | ||
930 | bool PPPData::storePassword() { | 930 | bool PPPData::storePassword() { |
931 | return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); | 931 | return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); |
932 | } | 932 | } |
933 | 933 | ||
934 | 934 | ||
935 | const QString PPPData::command_before_connect() { | 935 | const QString PPPData::command_before_connect() { |
936 | return readConfig(cgroup, BEFORE_CONNECT_KEY); | 936 | return readConfig(cgroup, BEFORE_CONNECT_KEY); |
937 | } | 937 | } |
938 | 938 | ||
939 | 939 | ||
940 | void PPPData::setCommand_before_connect(const QString &n) { | 940 | void PPPData::setCommand_before_connect(const QString &n) { |
941 | writeConfig(cgroup, BEFORE_CONNECT_KEY, n); | 941 | writeConfig(cgroup, BEFORE_CONNECT_KEY, n); |
942 | } | 942 | } |
943 | 943 | ||
944 | 944 | ||
945 | void PPPData::setStorePassword(bool b) { | 945 | void PPPData::setStorePassword(bool b) { |
946 | writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); | 946 | writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); |
947 | } | 947 | } |
948 | 948 | ||
949 | 949 | ||
950 | const QString PPPData::command_on_connect() { | 950 | const QString PPPData::command_on_connect() { |
951 | return readConfig(cgroup, COMMAND_KEY); | 951 | return readConfig(cgroup, COMMAND_KEY); |
952 | } | 952 | } |
953 | 953 | ||
954 | 954 | ||
955 | void PPPData::setCommand_on_connect(const QString &n) { | 955 | void PPPData::setCommand_on_connect(const QString &n) { |
956 | writeConfig(cgroup, COMMAND_KEY, n); | 956 | writeConfig(cgroup, COMMAND_KEY, n); |
957 | } | 957 | } |
958 | 958 | ||
959 | 959 | ||
960 | const QString PPPData::command_on_disconnect() { | 960 | const QString PPPData::command_on_disconnect() { |
961 | return readConfig(cgroup, DISCONNECT_COMMAND_KEY); | 961 | return readConfig(cgroup, DISCONNECT_COMMAND_KEY); |
962 | } | 962 | } |
963 | 963 | ||
964 | 964 | ||
965 | void PPPData::setCommand_on_disconnect(const QString &n) { | 965 | void PPPData::setCommand_on_disconnect(const QString &n) { |
966 | writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); | 966 | writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); |
967 | } | 967 | } |
968 | 968 | ||
969 | 969 | ||
970 | const QString PPPData::command_before_disconnect() { | 970 | const QString PPPData::command_before_disconnect() { |
971 | return readConfig(cgroup, BEFORE_DISCONNECT_KEY); | 971 | return readConfig(cgroup, BEFORE_DISCONNECT_KEY); |
972 | } | 972 | } |
973 | 973 | ||
974 | 974 | ||
975 | void PPPData::setCommand_before_disconnect(const QString &n) { | 975 | void PPPData::setCommand_before_disconnect(const QString &n) { |
976 | writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); | 976 | writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); |
977 | } | 977 | } |
978 | 978 | ||
979 | 979 | ||
980 | const QString PPPData::ipaddr() { | 980 | const QString PPPData::ipaddr() { |
981 | return readConfig(cgroup, IPADDR_KEY); | 981 | return readConfig(cgroup, IPADDR_KEY); |
982 | } | 982 | } |
983 | 983 | ||
984 | 984 | ||
985 | void PPPData::setIpaddr(const QString &n) { | 985 | void PPPData::setIpaddr(const QString &n) { |
986 | writeConfig(cgroup, IPADDR_KEY, n); | 986 | writeConfig(cgroup, IPADDR_KEY, n); |
987 | } | 987 | } |
988 | 988 | ||
989 | 989 | ||
990 | const QString PPPData::subnetmask() { | 990 | const QString PPPData::subnetmask() { |
991 | return readConfig(cgroup, SUBNETMASK_KEY); | 991 | return readConfig(cgroup, SUBNETMASK_KEY); |
992 | } | 992 | } |
993 | 993 | ||
994 | 994 | ||
995 | void PPPData::setSubnetmask(const QString &n) { | 995 | void PPPData::setSubnetmask(const QString &n) { |
996 | writeConfig(cgroup, SUBNETMASK_KEY, n); | 996 | writeConfig(cgroup, SUBNETMASK_KEY, n); |
997 | } | 997 | } |
998 | 998 | ||
999 | 999 | ||
1000 | bool PPPData::autoname() { | 1000 | bool PPPData::autoname() { |
1001 | return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); | 1001 | return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | 1004 | ||
1005 | void PPPData::setAutoname(bool set) { | 1005 | void PPPData::setAutoname(bool set) { |
1006 | writeConfig(cgroup, AUTONAME_KEY, (int) set); | 1006 | writeConfig(cgroup, AUTONAME_KEY, (int) set); |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | 1009 | ||
1010 | bool PPPData::AcctEnabled() { | 1010 | bool PPPData::AcctEnabled() { |
1011 | return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); | 1011 | return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | 1014 | ||
1015 | void PPPData::setAcctEnabled(bool set) { | 1015 | void PPPData::setAcctEnabled(bool set) { |
1016 | writeConfig(cgroup, ACCTENABLED_KEY, (int) set); | 1016 | writeConfig(cgroup, ACCTENABLED_KEY, (int) set); |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | 1019 | ||
1020 | // int PPPData::VolAcctEnabled() { | 1020 | // int PPPData::VolAcctEnabled() { |
1021 | // return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0); | 1021 | // return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0); |
1022 | // } | 1022 | // } |
1023 | 1023 | ||
1024 | 1024 | ||
1025 | // void PPPData::setVolAcctEnabled(int set) { | 1025 | // void PPPData::setVolAcctEnabled(int set) { |
1026 | // writeConfig(cgroup, VOLACCTENABLED_KEY, set); | 1026 | // writeConfig(cgroup, VOLACCTENABLED_KEY, set); |
1027 | // } | 1027 | // } |
1028 | 1028 | ||
1029 | 1029 | ||
1030 | const QString PPPData::gateway() { | 1030 | const QString PPPData::gateway() { |
1031 | return readConfig(cgroup, GATEWAY_KEY); | 1031 | return readConfig(cgroup, GATEWAY_KEY); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | 1034 | ||
1035 | void PPPData::setGateway(const QString &n ) { | 1035 | void PPPData::setGateway(const QString &n ) { |
1036 | writeConfig(cgroup, GATEWAY_KEY, n); | 1036 | writeConfig(cgroup, GATEWAY_KEY, n); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | 1039 | ||
1040 | bool PPPData::defaultroute() { | 1040 | bool PPPData::defaultroute() { |
1041 | // default route is by default 'on'. | 1041 | // default route is by default 'on'. |
1042 | return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true); | 1042 | return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | 1045 | ||
1046 | void PPPData::setDefaultroute(bool set) { | 1046 | void PPPData::setDefaultroute(bool set) { |
1047 | writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set); | 1047 | writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set); |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | 1050 | ||
1051 | bool PPPData::autoDNS() { | 1051 | bool PPPData::autoDNS() { |
1052 | bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); | 1052 | bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); |
1053 | return (set && pppdVersionMin(2, 3, 7)); | 1053 | return (set && pppdVersionMin(2, 3, 7)); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | 1056 | ||
1057 | void PPPData::setAutoDNS(bool set) { | 1057 | void PPPData::setAutoDNS(bool set) { |
1058 | writeConfig(cgroup, AUTODNS_KEY, (int) set); | 1058 | writeConfig(cgroup, AUTODNS_KEY, (int) set); |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | 1061 | ||
1062 | void PPPData::setExDNSDisabled(bool set) { | 1062 | void PPPData::setExDNSDisabled(bool set) { |
1063 | writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set); | 1063 | writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set); |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | 1066 | ||
1067 | bool PPPData::exDNSDisabled() { | 1067 | bool PPPData::exDNSDisabled() { |
1068 | return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0); | 1068 | return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0); |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | 1071 | ||
1072 | QStringList &PPPData::dns() { | 1072 | QStringList &PPPData::dns() { |
1073 | static QStringList dnslist; | 1073 | static QStringList dnslist; |
1074 | 1074 | ||
1075 | readListConfig(cgroup, DNS_KEY, dnslist); | 1075 | readListConfig(cgroup, DNS_KEY, dnslist); |
1076 | while(dnslist.count() > MAX_DNS_ENTRIES) | 1076 | while(dnslist.count() > MAX_DNS_ENTRIES) |
1077 | dnslist.remove(dnslist.last()); | 1077 | dnslist.remove(dnslist.last()); |
1078 | 1078 | ||
1079 | return dnslist; | 1079 | return dnslist; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | 1082 | ||
1083 | void PPPData::setDns(QStringList &list) { | 1083 | void PPPData::setDns(QStringList &list) { |
1084 | writeListConfig(cgroup, DNS_KEY, list); | 1084 | writeListConfig(cgroup, DNS_KEY, list); |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | 1087 | ||
1088 | const QString PPPData::domain() { | 1088 | const QString PPPData::domain() { |
1089 | return readConfig(cgroup, DOMAIN_KEY); | 1089 | return readConfig(cgroup, DOMAIN_KEY); |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | 1092 | ||
1093 | void PPPData::setDomain(const QString &n ) { | 1093 | void PPPData::setDomain(const QString &n ) { |
1094 | writeConfig(cgroup, DOMAIN_KEY, n); | 1094 | writeConfig(cgroup, DOMAIN_KEY, n); |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | 1097 | ||
1098 | QStringList &PPPData::scriptType() { | 1098 | QStringList &PPPData::scriptType() { |
1099 | static QStringList typelist; | 1099 | static QStringList typelist; |
1100 | 1100 | ||
1101 | readListConfig(cgroup, SCRIPTCOM_KEY, typelist); | 1101 | readListConfig(cgroup, SCRIPTCOM_KEY, typelist); |
1102 | while(typelist.count() > MAX_SCRIPT_ENTRIES) | 1102 | while(typelist.count() > MAX_SCRIPT_ENTRIES) |
1103 | typelist.remove(typelist.last()); | 1103 | typelist.remove(typelist.last()); |
1104 | 1104 | ||
1105 | return typelist; | 1105 | return typelist; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | 1108 | ||
1109 | void PPPData::setScriptType(QStringList &list) { | 1109 | void PPPData::setScriptType(QStringList &list) { |
1110 | writeListConfig(cgroup, SCRIPTCOM_KEY, list); | 1110 | writeListConfig(cgroup, SCRIPTCOM_KEY, list); |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | 1113 | ||
1114 | QStringList &PPPData::script() { | 1114 | QStringList &PPPData::script() { |
1115 | static QStringList scriptlist; | 1115 | static QStringList scriptlist; |
1116 | 1116 | ||
1117 | readListConfig(cgroup, SCRIPTARG_KEY, scriptlist); | 1117 | readListConfig(cgroup, SCRIPTARG_KEY, scriptlist); |
1118 | while(scriptlist.count() > MAX_SCRIPT_ENTRIES) | 1118 | while(scriptlist.count() > MAX_SCRIPT_ENTRIES) |
1119 | scriptlist.remove(scriptlist.last()); | 1119 | scriptlist.remove(scriptlist.last()); |
1120 | 1120 | ||
1121 | return scriptlist; | 1121 | return scriptlist; |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | 1124 | ||
1125 | void PPPData::setScript(QStringList &list) { | 1125 | void PPPData::setScript(QStringList &list) { |
1126 | writeListConfig(cgroup, SCRIPTARG_KEY, list); | 1126 | writeListConfig(cgroup, SCRIPTARG_KEY, list); |
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | 1129 | ||
1130 | // const QString PPPData::accountingFile() { | 1130 | // const QString PPPData::accountingFile() { |
1131 | // return readConfig(cgroup, ACCTFILE_KEY); | 1131 | // return readConfig(cgroup, ACCTFILE_KEY); |
1132 | // } | 1132 | // } |
1133 | 1133 | ||
1134 | 1134 | ||
1135 | // void PPPData::setAccountingFile(const QString &n) { | 1135 | // void PPPData::setAccountingFile(const QString &n) { |
1136 | // writeConfig(cgroup, ACCTFILE_KEY, n); | 1136 | // writeConfig(cgroup, ACCTFILE_KEY, n); |
1137 | // } | 1137 | // } |
1138 | 1138 | ||
1139 | 1139 | ||
1140 | // const QString PPPData::totalCosts() { | 1140 | // const QString PPPData::totalCosts() { |
1141 | // return readConfig(cgroup, TOTALCOSTS_KEY); | 1141 | // return readConfig(cgroup, TOTALCOSTS_KEY); |
1142 | // } | 1142 | // } |
1143 | 1143 | ||
1144 | 1144 | ||
1145 | // void PPPData::setTotalCosts(const QString &n) { | 1145 | // void PPPData::setTotalCosts(const QString &n) { |
1146 | // writeConfig(cgroup, TOTALCOSTS_KEY, n); | 1146 | // writeConfig(cgroup, TOTALCOSTS_KEY, n); |
1147 | // } | 1147 | // } |
1148 | 1148 | ||
1149 | 1149 | ||
1150 | // int PPPData::totalBytes() { | 1150 | // int PPPData::totalBytes() { |
1151 | // return readNumConfig(cgroup, TOTALBYTES_KEY, 0); | 1151 | // return readNumConfig(cgroup, TOTALBYTES_KEY, 0); |
1152 | // } | 1152 | // } |
1153 | 1153 | ||
1154 | // void PPPData::setTotalBytes(int n) { | 1154 | // void PPPData::setTotalBytes(int n) { |
1155 | // writeConfig(cgroup, TOTALBYTES_KEY, n); | 1155 | // writeConfig(cgroup, TOTALBYTES_KEY, n); |
1156 | // } | 1156 | // } |
1157 | 1157 | ||
1158 | 1158 | ||
1159 | QStringList &PPPData::pppdArgument() { | 1159 | QStringList &PPPData::pppdArgument() { |
1160 | static QStringList arglist; | 1160 | static QStringList arglist; |
1161 | 1161 | ||
1162 | while(arglist.count() > MAX_PPPD_ARGUMENTS) | 1162 | while(arglist.count() > MAX_PPPD_ARGUMENTS) |
1163 | arglist.remove(arglist.last()); | 1163 | arglist.remove(arglist.last()); |
1164 | readListConfig(cgroup, PPPDARG_KEY, arglist); | 1164 | readListConfig(cgroup, PPPDARG_KEY, arglist); |
1165 | 1165 | ||
1166 | return arglist; | 1166 | return arglist; |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | 1169 | ||
1170 | void PPPData::setpppdArgument(QStringList &args) { | 1170 | void PPPData::setpppdArgument(QStringList &args) { |
1171 | writeListConfig(cgroup, PPPDARG_KEY, args); | 1171 | writeListConfig(cgroup, PPPDARG_KEY, args); |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | 1174 | ||
1175 | void PPPData::setpppdArgumentDefaults() { | 1175 | void PPPData::setpppdArgumentDefaults() { |
1176 | QStringList arg; | 1176 | QStringList arg; |
1177 | setpppdArgument(arg); | 1177 | setpppdArgument(arg); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | 1180 | ||
1181 | // // graphing widget | 1181 | // // graphing widget |
1182 | // void PPPData::setGraphingOptions(bool enable, | 1182 | // void PPPData::setGraphingOptions(bool enable, |
1183 | // QColor bg, | 1183 | // QColor bg, |
1184 | // QColor text, | 1184 | // QColor text, |
1185 | // QColor in, | 1185 | // QColor in, |
1186 | // QColor out) | 1186 | // QColor out) |
1187 | // { | 1187 | // { |
1188 | // if(config) { | 1188 | // if(config) { |
1189 | // config->setGroup(GRAPH_GRP); | 1189 | // config->setGroup(GRAPH_GRP); |
1190 | // config->writeEntry(GENABLED, enable); | 1190 | // config->writeEntry(GENABLED, enable); |
1191 | // // config->writeEntry(GCOLOR_BG, bg); | 1191 | // // config->writeEntry(GCOLOR_BG, bg); |
1192 | // // config->writeEntry(GCOLOR_TEXT, text); | 1192 | // // config->writeEntry(GCOLOR_TEXT, text); |
1193 | // // config->writeEntry(GCOLOR_IN, in); | 1193 | // // config->writeEntry(GCOLOR_IN, in); |
1194 | // // config->writeEntry(GCOLOR_OUT, out); | 1194 | // // config->writeEntry(GCOLOR_OUT, out); |
1195 | // } | 1195 | // } |
1196 | // } | 1196 | // } |
1197 | 1197 | ||
1198 | // void PPPData::graphingOptions(bool &enable, | 1198 | // void PPPData::graphingOptions(bool &enable, |
1199 | // QColor &bg, | 1199 | // QColor &bg, |
1200 | // QColor &text, | 1200 | // QColor &text, |
1201 | // QColor &in, | 1201 | // QColor &in, |
1202 | // QColor &out) | 1202 | // QColor &out) |
1203 | // { | 1203 | // { |
1204 | // QColor c; | 1204 | // QColor c; |
1205 | 1205 | ||
1206 | // if(config) { | 1206 | // if(config) { |
1207 | // config->setGroup(GRAPH_GRP); | 1207 | // config->setGroup(GRAPH_GRP); |
1208 | // enable = config->readBoolEntry(GENABLED, true); | 1208 | // enable = config->readBoolEntry(GENABLED, true); |
1209 | // bg = Qt::white; | 1209 | // bg = Qt::white; |
1210 | // //bg = config->readColorEntry(GCOLOR_BG, &c); | 1210 | // //bg = config->readColorEntry(GCOLOR_BG, &c); |
1211 | // text = Qt::black; | 1211 | // text = Qt::black; |
1212 | // //text = config->readColorEntry(GCOLOR_TEXT, &c); | 1212 | // //text = config->readColorEntry(GCOLOR_TEXT, &c); |
1213 | // in = Qt::blue; | 1213 | // in = Qt::blue; |
1214 | // //in = config->readColorEntry(GCOLOR_IN, &c); | 1214 | // //in = config->readColorEntry(GCOLOR_IN, &c); |
1215 | // out = Qt::red; | 1215 | // out = Qt::red; |
1216 | // //out = config->readColorEntry(GCOLOR_OUT, &c); | 1216 | // //out = config->readColorEntry(GCOLOR_OUT, &c); |
1217 | // } | 1217 | // } |
1218 | // } | 1218 | // } |
1219 | 1219 | ||
1220 | 1220 | ||
1221 | // bool PPPData::graphingEnabled() { | 1221 | // bool PPPData::graphingEnabled() { |
1222 | // return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); | 1222 | // return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); |
1223 | // } | 1223 | // } |
1224 | 1224 | ||
1225 | 1225 | ||
1226 | 1226 | ||
1227 | // | 1227 | // |
1228 | //functions to change/set the child pppd process info | 1228 | //functions to change/set the child pppd process info |
1229 | // | 1229 | // |
1230 | bool PPPData::pppdRunning() const { | 1230 | bool PPPData::pppdRunning() const { |
1231 | return pppdisrunning; | 1231 | return pppdisrunning; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | void PPPData::setpppdRunning(bool set) { | 1234 | void PPPData::setpppdRunning(bool set) { |
1235 | pppdisrunning = set; | 1235 | pppdisrunning = set; |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | int PPPData::pppdError() const { | 1238 | int PPPData::pppdError() const { |
1239 | return pppderror; | 1239 | return pppderror; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | void PPPData::setpppdError(int err) { | 1242 | void PPPData::setpppdError(int err) { |
1243 | pppderror = err; | 1243 | pppderror = err; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | QString PPPData::modemGroup() | 1246 | QString PPPData::modemGroup() |
1247 | { | 1247 | { |
1248 | if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup); | 1248 | if (modemDeviceGroup<0){ |
1249 | qDebug("wrong modem %i\n using 0",modemDeviceGroup); | ||
1250 | modemDeviceGroup = 0; //FIXME! | ||
1251 | } | ||
1249 | return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup); | 1252 | return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup); |
1250 | } | 1253 | } |
1251 | 1254 | ||
1252 | 1255 | ||
1253 | QMap<QString,QString> PPPData::getConfiguredInterfaces() | 1256 | QMap<QString,QString> PPPData::getConfiguredInterfaces() |
1254 | { | 1257 | { |
1255 | QMap<QString,QString> ifaces; | 1258 | QMap<QString,QString> ifaces; |
1256 | Config config = PPPData::config(); | 1259 | Config config = PPPData::config(); |
1257 | config.setGroup(ACCLIST_GRP); | 1260 | config.setGroup(ACCLIST_GRP); |
1258 | int count = config.readNumEntry( ACCOUNTS_COUNT, -1 ); | 1261 | int count = config.readNumEntry( ACCOUNTS_COUNT, -1 ); |
1259 | QString accGrp, dev, acc; | 1262 | QString accGrp, dev, acc; |
1260 | for (int i = 0; i < count; i++){ | 1263 | for (int i = 0; i < count; i++){ |
1261 | accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); | 1264 | accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); |
1262 | config.setGroup(accGrp); | 1265 | config.setGroup(accGrp); |
1263 | dev = config.readEntry( ACOUNTS_DEV, "error" ); | 1266 | dev = config.readEntry( ACOUNTS_DEV, "error" ); |
1264 | acc = config.readEntry( ACOUNTS_ACC, "error" ); | 1267 | acc = config.readEntry( ACOUNTS_ACC, "error" ); |
1265 | ifaces.insert( dev, acc ); | 1268 | ifaces.insert( dev, acc ); |
1266 | } | 1269 | } |
1267 | 1270 | ||
1268 | return ifaces; | 1271 | return ifaces; |
1269 | } | 1272 | } |
1270 | 1273 | ||
1271 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) | 1274 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) |
1272 | { | 1275 | { |
1273 | QMap<QString,QString>::Iterator it; | 1276 | QMap<QString,QString>::Iterator it; |
1274 | int i = 0; | 1277 | int i = 0; |
1275 | Config cfg = config(); | 1278 | Config cfg = config(); |
1276 | for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){ | 1279 | for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){ |
1277 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i)); | 1280 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i)); |
1278 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); | 1281 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); |
1279 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); | 1282 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); |
1280 | } | 1283 | } |
1281 | cfg.setGroup( ACCLIST_GRP ); | 1284 | cfg.setGroup( ACCLIST_GRP ); |
1282 | cfg.writeEntry( ACCOUNTS_COUNT, i ); | 1285 | cfg.writeEntry( ACCOUNTS_COUNT, i ); |
1283 | 1286 | ||
1284 | } | 1287 | } |
1285 | 1288 | ||
1286 | /** | 1289 | /** |
1287 | * pppd's getword() function knows about escape characters. | 1290 | * pppd's getword() function knows about escape characters. |
1288 | * If we write the username and password to the secrets file | 1291 | * If we write the username and password to the secrets file |
1289 | * we'll therefore have to escape back slashes. | 1292 | * we'll therefore have to escape back slashes. |
1290 | */ | 1293 | */ |
1291 | QString PPPData::encodeWord(const QString &s) { | 1294 | QString PPPData::encodeWord(const QString &s) { |
1292 | QString r = s; | 1295 | QString r = s; |
1293 | r.replace(QRegExp("\\"), "\\\\"); | 1296 | r.replace(QRegExp("\\"), "\\\\"); |
1294 | return r; | 1297 | return r; |
1295 | } | 1298 | } |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index 95df068..8c401a9 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -1,142 +1,139 @@ | |||
1 | 1 | ||
2 | #include "pppconfig.h" | 2 | #include "pppconfig.h" |
3 | #include "pppmodule.h" | 3 | #include "pppmodule.h" |
4 | #include "pppdata.h" | 4 | #include "pppdata.h" |
5 | #include "interfaceinformationppp.h" | 5 | #include "interfaceinformationppp.h" |
6 | #include "interfaceppp.h" | 6 | #include "interfaceppp.h" |
7 | 7 | ||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | PPPModule::PPPModule() : Module() | 12 | PPPModule::PPPModule() : Module() |
13 | { | 13 | { |
14 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); | 14 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); |
15 | QMap<QString,QString>::Iterator it; | 15 | QMap<QString,QString>::Iterator it; |
16 | InterfacePPP *iface; | 16 | InterfacePPP *iface; |
17 | qDebug("getting interfaces"); | 17 | qDebug("getting interfaces"); |
18 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ | 18 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ |
19 | qDebug("ifaces %s", it.key().latin1()); | 19 | qDebug("ifaces %s", it.key().latin1()); |
20 | iface = new InterfacePPP( 0, it.key() ); | 20 | iface = new InterfacePPP( 0, it.key() ); |
21 | iface->setHardwareName( it.data() ); | 21 | iface->setHardwareName( it.data() ); |
22 | list.append( (Interface*)iface ); | 22 | list.append( (Interface*)iface ); |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Delete any interfaces that we own. | 27 | * Delete any interfaces that we own. |
28 | */ | 28 | */ |
29 | PPPModule::~PPPModule(){ | 29 | PPPModule::~PPPModule(){ |
30 | QMap<QString,QString> ifaces; | 30 | QMap<QString,QString> ifaces; |
31 | Interface *i; | 31 | Interface *i; |
32 | for ( i=list.first(); i != 0; i=list.next() ){ | 32 | for ( i=list.first(); i != 0; i=list.next() ){ |
33 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); | 33 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); |
34 | delete i; | 34 | delete i; |
35 | } | 35 | } |
36 | PPPData::setConfiguredInterfaces( ifaces ); | 36 | PPPData::setConfiguredInterfaces( ifaces ); |
37 | } | 37 | } |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Change the current profile | 40 | * Change the current profile |
41 | */ | 41 | */ |
42 | void PPPModule::setProfile(const QString &newProfile){ | 42 | void PPPModule::setProfile(const QString &newProfile){ |
43 | profile = newProfile; | 43 | profile = newProfile; |
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * get the icon name for this device. | 47 | * get the icon name for this device. |
48 | * @param Interface* can be used in determining the icon. | 48 | * @param Interface* can be used in determining the icon. |
49 | * @return QString the icon name (minus .png, .gif etc) | 49 | * @return QString the icon name (minus .png, .gif etc) |
50 | */ | 50 | */ |
51 | QString PPPModule::getPixmapName(Interface* ){ | 51 | QString PPPModule::getPixmapName(Interface* ){ |
52 | return "ppp"; | 52 | return "ppp"; |
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Check to see if the interface i is owned by this module. | 56 | * Check to see if the interface i is owned by this module. |
57 | * @param Interface* interface to check against | 57 | * @param Interface* interface to check against |
58 | * @return bool true if i is owned by this module, false otherwise. | 58 | * @return bool true if i is owned by this module, false otherwise. |
59 | */ | 59 | */ |
60 | bool PPPModule::isOwner(Interface *i){ | 60 | bool PPPModule::isOwner(Interface *i){ |
61 | return list.find( i ) != -1; | 61 | return list.find( i ) != -1; |
62 | } | 62 | } |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Create, and return the WLANConfigure Module | 65 | * Create, and return the WLANConfigure Module |
66 | * @return QWidget* pointer to this modules configure. | 66 | * @return QWidget* pointer to this modules configure. |
67 | */ | 67 | */ |
68 | QWidget *PPPModule::configure(Interface *i){ | 68 | QWidget *PPPModule::configure(Interface *i){ |
69 | qDebug("return ModemWidget"); | 69 | qDebug("return ModemWidget"); |
70 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, | 70 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, |
71 | 0, "PPPConfig", false, | 71 | 0, "PPPConfig", false, |
72 | Qt::WDestructiveClose ); | 72 | Qt::WDestructiveClose ); |
73 | return pppconfig; | 73 | return pppconfig; |
74 | } | 74 | } |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Create, and return the Information Module | 77 | * Create, and return the Information Module |
78 | * @return QWidget* pointer to this modules info. | 78 | * @return QWidget* pointer to this modules info. |
79 | */ | 79 | */ |
80 | QWidget *PPPModule::information(Interface *i){ | 80 | QWidget *PPPModule::information(Interface *i){ |
81 | // We don't have any advanced pppd information widget yet :-D | 81 | // We don't have any advanced pppd information widget yet :-D |
82 | // TODO ^ | 82 | // TODO ^ |
83 | qDebug("return PPPModule::information"); | 83 | qDebug("return PPPModule::information"); |
84 | // InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i); | 84 | // InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i); |
85 | InterfaceInformationPPP *information = new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); | 85 | InterfaceInformationPPP *information = new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); |
86 | return information; | 86 | return information; |
87 | } | 87 | } |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Get all active (up or down) interfaces | 90 | * Get all active (up or down) interfaces |
91 | * @return QList<Interface> A list of interfaces that exsist that havn't | 91 | * @return QList<Interface> A list of interfaces that exsist that havn't |
92 | * been called by isOwner() | 92 | * been called by isOwner() |
93 | */ | 93 | */ |
94 | QList<Interface> PPPModule::getInterfaces(){ | 94 | QList<Interface> PPPModule::getInterfaces(){ |
95 | // List all of the files in the peer directory | 95 | // List all of the files in the peer directory |
96 | qDebug("PPPModule::getInterfaces"); | 96 | qDebug("PPPModule::getInterfaces"); |
97 | return list; | 97 | return list; |
98 | } | 98 | } |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Attempt to add a new interface as defined by name | 101 | * Attempt to add a new interface as defined by name |
102 | * @param name the name of the type of interface that should be created given | 102 | * @param name the name of the type of interface that should be created given |
103 | * by possibleNewInterfaces(); | 103 | * by possibleNewInterfaces(); |
104 | * @return Interface* NULL if it was unable to be created. | 104 | * @return Interface* NULL if it was unable to be created. |
105 | */ | 105 | */ |
106 | Interface *PPPModule::addNewInterface(const QString &newInterface){ | 106 | Interface *PPPModule::addNewInterface(const QString &newInterface){ |
107 | 107 | ||
108 | qDebug("try to add iface %s",newInterface.latin1()); | ||
109 | |||
110 | InterfacePPP *ifaceppp; | 108 | InterfacePPP *ifaceppp; |
111 | Interface *iface; | 109 | Interface *iface; |
112 | ifaceppp = new InterfacePPP(); | 110 | ifaceppp = new InterfacePPP(); |
113 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); | 111 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); |
114 | imp.showMaximized(); | 112 | imp.showMaximized(); |
115 | if(imp.exec() == QDialog::Accepted ){ | 113 | if(imp.exec() == QDialog::Accepted ){ |
114 | iface = (InterfacePPP*) ifaceppp; | ||
116 | iface->setModuleOwner( this ); | 115 | iface->setModuleOwner( this ); |
117 | iface = ifaceppp; | ||
118 | list.append( iface ); | 116 | list.append( iface ); |
119 | return iface; | 117 | return iface; |
120 | }else { | 118 | }else { |
121 | delete iface; | 119 | delete ifaceppp; |
122 | iface = NULL; | 120 | iface = NULL; |
123 | } | 121 | } |
124 | return iface; | 122 | return iface; |
125 | } | 123 | } |
126 | 124 | ||
127 | /** | 125 | /** |
128 | * Attempts to remove the interface, doesn't delete i | 126 | * Attempts to remove the interface, doesn't delete i |
129 | * @return bool true if successfull, false otherwise. | 127 | * @return bool true if successfull, false otherwise. |
130 | */ | 128 | */ |
131 | bool PPPModule::remove(Interface*){ | 129 | bool PPPModule::remove(Interface *i){ |
132 | // Can't remove a hardware device, you can stop it though. | 130 | return list.remove(i); |
133 | return false; | ||
134 | } | 131 | } |
135 | 132 | ||
136 | void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) | 133 | void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) |
137 | { | 134 | { |
138 | newIfaces.insert(QObject::tr("PPP") , | 135 | newIfaces.insert(QObject::tr("PPP") , |
139 | QObject::tr("generic ppp device")); | 136 | QObject::tr("generic ppp device")); |
140 | } | 137 | } |
141 | 138 | ||
142 | 139 | ||