Diffstat (limited to 'noncore/settings/networksettings/ppp/connect.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 326 |
1 files changed, 161 insertions, 165 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index a3eda9d..2615b60 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -66,5 +66,5 @@ | |||
66 | #include "connect.h" | 66 | #include "connect.h" |
67 | //#include "docking.h" | 67 | //#include "docking.h" |
68 | //#include "main.h" | 68 | #include "interfaceppp.h" |
69 | #include "modem.h" | 69 | #include "modem.h" |
70 | #include "kpppconfig.h" | 70 | #include "kpppconfig.h" |
@@ -75,13 +75,10 @@ | |||
75 | #define execute_command system | 75 | #define execute_command system |
76 | 76 | ||
77 | extern KPPPWidget *p_kppp; | ||
78 | |||
79 | QString old_hostname; | 77 | QString old_hostname; |
80 | bool modified_hostname; | 78 | bool modified_hostname; |
81 | 79 | ||
82 | 80 | ||
83 | ConnectWidget::ConnectWidget(QWidget *parent, const char *name) | 81 | ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name) |
84 | : QWidget(parent, name), | 82 | : QWidget(parent, name), |
85 | // initialize some important variables | ||
86 | myreadbuffer(""), | 83 | myreadbuffer(""), |
87 | main_timer_ID(0), | 84 | main_timer_ID(0), |
@@ -97,7 +94,6 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name) | |||
97 | scanning(false), | 94 | scanning(false), |
98 | pausing(false), | 95 | pausing(false), |
99 | // termwindow(0), | 96 | dialnumber(0), |
100 | // stats(st), | 97 | _ifaceppp(ifp) |
101 | dialnumber(0) | ||
102 | { | 98 | { |
103 | modified_hostname = false; | 99 | modified_hostname = false; |
@@ -180,5 +176,5 @@ void ConnectWidget::preinit() { | |||
180 | 176 | ||
181 | void ConnectWidget::init() { | 177 | void ConnectWidget::init() { |
182 | PPPData::data()->setpppdError(0); | 178 | _ifaceppp->data()->setpppdError(0); |
183 | inittimer->stop(); | 179 | inittimer->stop(); |
184 | vmain = 0; | 180 | vmain = 0; |
@@ -195,12 +191,12 @@ void ConnectWidget::init() { | |||
195 | dialnumber = 0; | 191 | dialnumber = 0; |
196 | 192 | ||
197 | p_kppp->con_speed = ""; | 193 | // p_kppp->con_speed = ""; |
198 | 194 | ||
199 | // p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || PPPData::data()->quit_on_disconnect()); | 195 | // p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect()); |
200 | 196 | ||
201 | comlist = &PPPData::data()->scriptType(); | 197 | comlist = &_ifaceppp->data()->scriptType(); |
202 | arglist = &PPPData::data()->script(); | 198 | arglist = &_ifaceppp->data()->script(); |
203 | 199 | ||
204 | QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); | 200 | QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname()); |
205 | setCaption(tit); | 201 | setCaption(tit); |
206 | 202 | ||
@@ -208,5 +204,5 @@ void ConnectWidget::init() { | |||
208 | 204 | ||
209 | // run the "before-connect" command | 205 | // run the "before-connect" command |
210 | if (!PPPData::data()->command_before_connect().isEmpty()) { | 206 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { |
211 | messg->setText(i18n("Running pre-startup command...")); | 207 | messg->setText(i18n("Running pre-startup command...")); |
212 | emit debugMessage(i18n("Running pre-startup command...")); | 208 | emit debugMessage(i18n("Running pre-startup command...")); |
@@ -214,5 +210,5 @@ void ConnectWidget::init() { | |||
214 | qApp->processEvents(); | 210 | qApp->processEvents(); |
215 | QApplication::flushX(); | 211 | QApplication::flushX(); |
216 | pid_t id = execute_command(PPPData::data()->command_before_connect()); | 212 | pid_t id = execute_command(_ifaceppp->data()->command_before_connect()); |
217 | // int i, status; | 213 | // int i, status; |
218 | 214 | ||
@@ -224,5 +220,5 @@ void ConnectWidget::init() { | |||
224 | } | 220 | } |
225 | 221 | ||
226 | int lock = Modem::modem->lockdevice(); | 222 | int lock = _ifaceppp->modem()->lockdevice(); |
227 | 223 | ||
228 | if (lock == 1) { | 224 | if (lock == 1) { |
@@ -238,8 +234,8 @@ void ConnectWidget::init() { | |||
238 | } | 234 | } |
239 | 235 | ||
240 | if(Modem::modem->opentty()) { | 236 | if(_ifaceppp->modem()->opentty()) { |
241 | messg->setText(Modem::modem->modemMessage()); | 237 | messg->setText(_ifaceppp->modem()->modemMessage()); |
242 | qApp->processEvents(); | 238 | qApp->processEvents(); |
243 | if(Modem::modem->hangup()) { | 239 | if(_ifaceppp->modem()->hangup()) { |
244 | 240 | ||
245 | qApp->processEvents(); | 241 | qApp->processEvents(); |
@@ -247,9 +243,9 @@ void ConnectWidget::init() { | |||
247 | semaphore = false; | 243 | semaphore = false; |
248 | 244 | ||
249 | Modem::modem->stop(); | 245 | _ifaceppp->modem()->stop(); |
250 | Modem::modem->notify(this, SLOT(readChar(unsigned char))); | 246 | _ifaceppp->modem()->notify(this, SLOT(readChar(unsigned char))); |
251 | 247 | ||
252 | // if we are stuck anywhere we will time out | 248 | // if we are stuck anywhere we will time out |
253 | timeout_timer->start(PPPData::data()->modemTimeout()*1000); | 249 | timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000); |
254 | 250 | ||
255 | // this timer will run the script etc. | 251 | // this timer will run the script etc. |
@@ -261,7 +257,7 @@ void ConnectWidget::init() { | |||
261 | 257 | ||
262 | // initialization failed | 258 | // initialization failed |
263 | messg->setText(Modem::modem->modemMessage()); | 259 | messg->setText(_ifaceppp->modem()->modemMessage()); |
264 | vmain = 20; // wait until cancel is pressed | 260 | vmain = 20; // wait until cancel is pressed |
265 | Modem::modem->unlockdevice(); | 261 | _ifaceppp->modem()->unlockdevice(); |
266 | } | 262 | } |
267 | 263 | ||
@@ -285,16 +281,16 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
285 | } | 281 | } |
286 | 282 | ||
287 | QString initStr = PPPData::data()->modemInitStr(substate); | 283 | QString initStr = _ifaceppp->data()->modemInitStr(substate); |
288 | if (!initStr.isEmpty()) { | 284 | if (!initStr.isEmpty()) { |
289 | // send a carriage return and then wait a bit so that the modem will | 285 | // send a carriage return and then wait a bit so that the modem will |
290 | // let us issue commands. | 286 | // let us issue commands. |
291 | if(PPPData::data()->modemPreInitDelay() > 0) { | 287 | if(_ifaceppp->data()->modemPreInitDelay() > 0) { |
292 | usleep(PPPData::data()->modemPreInitDelay() * 5000); | 288 | usleep(_ifaceppp->data()->modemPreInitDelay() * 5000); |
293 | writeline(""); | 289 | writeline(""); |
294 | usleep(PPPData::data()->modemPreInitDelay() * 5000); | 290 | usleep(_ifaceppp->data()->modemPreInitDelay() * 5000); |
295 | } | 291 | } |
296 | setExpect(PPPData::data()->modemInitResp()); | 292 | setExpect(_ifaceppp->data()->modemInitResp()); |
297 | writeline(initStr); | 293 | writeline(initStr); |
298 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec | 294 | usleep(_ifaceppp->data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec |
299 | } | 295 | } |
300 | 296 | ||
@@ -307,5 +303,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
307 | * a "Modem Query" | 303 | * a "Modem Query" |
308 | */ | 304 | */ |
309 | if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration()) | 305 | if (MODEM_TONEDURATION != _ifaceppp->data()->modemToneDuration()) |
310 | vmain = 5; | 306 | vmain = 5; |
311 | else | 307 | else |
@@ -317,9 +313,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
317 | if (vmain == 5) { | 313 | if (vmain == 5) { |
318 | if(!expecting) { | 314 | if(!expecting) { |
319 | QString sToneDuration = "ATS11=" + QString::number(PPPData::data()->modemToneDuration()); | 315 | QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration()); |
320 | QString msg = i18n("Setting ") + sToneDuration; | 316 | QString msg = i18n("Setting ") + sToneDuration; |
321 | messg->setText(msg); | 317 | messg->setText(msg); |
322 | emit debugMessage(msg); | 318 | emit debugMessage(msg); |
323 | setExpect(PPPData::data()->modemInitResp()); | 319 | setExpect(_ifaceppp->data()->modemInitResp()); |
324 | writeline(sToneDuration); | 320 | writeline(sToneDuration); |
325 | } | 321 | } |
@@ -337,5 +333,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
337 | substate = -1; | 333 | substate = -1; |
338 | // skip setting the volume if command is empty | 334 | // skip setting the volume if command is empty |
339 | if(PPPData::data()->volumeInitString().isEmpty()) { | 335 | if(_ifaceppp->data()->volumeInitString().isEmpty()) { |
340 | vmain = 4; | 336 | vmain = 4; |
341 | return; | 337 | return; |
@@ -344,9 +340,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
344 | emit debugMessage(i18n("Setting speaker volume...")); | 340 | emit debugMessage(i18n("Setting speaker volume...")); |
345 | 341 | ||
346 | setExpect(PPPData::data()->modemInitResp()); | 342 | setExpect(_ifaceppp->data()->modemInitResp()); |
347 | QString vol("AT"); | 343 | QString vol("AT"); |
348 | vol += PPPData::data()->volumeInitString(); | 344 | vol += _ifaceppp->data()->volumeInitString(); |
349 | writeline(vol); | 345 | writeline(vol); |
350 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec | 346 | usleep(_ifaceppp->data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec |
351 | vmain = 4; | 347 | vmain = 4; |
352 | return; | 348 | return; |
@@ -356,10 +352,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
356 | if(vmain == 4) { | 352 | if(vmain == 4) { |
357 | if(!expecting) { | 353 | if(!expecting) { |
358 | if(!PPPData::data()->waitForDialTone()) { | 354 | if(!_ifaceppp->data()->waitForDialTone()) { |
359 | QString msg = i18n("Turning off dial tone waiting..."); | 355 | QString msg = i18n("Turning off dial tone waiting..."); |
360 | messg->setText(msg); | 356 | messg->setText(msg); |
361 | emit debugMessage(msg); | 357 | emit debugMessage(msg); |
362 | setExpect(PPPData::data()->modemInitResp()); | 358 | setExpect(_ifaceppp->data()->modemInitResp()); |
363 | writeline(PPPData::data()->modemNoDialToneDetectionStr()); | 359 | writeline(_ifaceppp->data()->modemNoDialToneDetectionStr()); |
364 | } | 360 | } |
365 | vmain = 1; | 361 | vmain = 1; |
@@ -373,8 +369,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
373 | 369 | ||
374 | timeout_timer->stop(); | 370 | timeout_timer->stop(); |
375 | timeout_timer->start(PPPData::data()->modemTimeout()*1000); | 371 | timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000); |
376 | 372 | ||
377 | QStringList &plist = PPPData::data()->phonenumbers(); | 373 | QStringList &plist = _ifaceppp->data()->phonenumbers(); |
378 | QString bmarg= PPPData::data()->dialPrefix(); | 374 | QString bmarg= _ifaceppp->data()->dialPrefix(); |
379 | bmarg += *plist.at(dialnumber); | 375 | bmarg += *plist.at(dialnumber); |
380 | QString bm = i18n("Dialing %1").arg(bmarg); | 376 | QString bm = i18n("Dialing %1").arg(bmarg); |
@@ -382,6 +378,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
382 | emit debugMessage(bm); | 378 | emit debugMessage(bm); |
383 | 379 | ||
384 | QString pn = PPPData::data()->modemDialStr(); | 380 | QString pn = _ifaceppp->data()->modemDialStr(); |
385 | pn += PPPData::data()->dialPrefix(); | 381 | pn += _ifaceppp->data()->dialPrefix(); |
386 | pn += *plist.at(dialnumber); | 382 | pn += *plist.at(dialnumber); |
387 | if(++dialnumber >= plist.count()) | 383 | if(++dialnumber >= plist.count()) |
@@ -389,5 +385,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
389 | writeline(pn); | 385 | writeline(pn); |
390 | 386 | ||
391 | setExpect(PPPData::data()->modemConnectResp()); | 387 | setExpect(_ifaceppp->data()->modemConnectResp()); |
392 | vmain = 100; | 388 | vmain = 100; |
393 | return; | 389 | return; |
@@ -399,5 +395,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
399 | if(vmain == 100) { | 395 | if(vmain == 100) { |
400 | if(!expecting) { | 396 | if(!expecting) { |
401 | myreadbuffer = PPPData::data()->modemConnectResp(); | 397 | myreadbuffer = _ifaceppp->data()->modemConnectResp(); |
402 | setExpect("\n"); | 398 | setExpect("\n"); |
403 | vmain = 101; | 399 | vmain = 101; |
@@ -405,14 +401,14 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
405 | } | 401 | } |
406 | 402 | ||
407 | if(readbuffer.contains(PPPData::data()->modemBusyResp())) { | 403 | if(readbuffer.contains(_ifaceppp->data()->modemBusyResp())) { |
408 | timeout_timer->stop(); | 404 | timeout_timer->stop(); |
409 | timeout_timer->start(PPPData::data()->modemTimeout()*1000); | 405 | timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000); |
410 | 406 | ||
411 | messg->setText(i18n("Line busy. Hanging up...")); | 407 | messg->setText(i18n("Line busy. Hanging up...")); |
412 | emit debugPutChar('\n'); | 408 | emit debugPutChar('\n'); |
413 | Modem::modem->hangup(); | 409 | _ifaceppp->modem()->hangup(); |
414 | 410 | ||
415 | if(PPPData::data()->busyWait() > 0) { | 411 | if(_ifaceppp->data()->busyWait() > 0) { |
416 | QString bm = i18n("Line busy. Waiting: %1 seconds").arg(PPPData::data()->busyWait()); | 412 | QString bm = i18n("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait()); |
417 | messg->setText(bm); | 413 | messg->setText(bm); |
418 | emit debugMessage(bm); | 414 | emit debugMessage(bm); |
@@ -420,9 +416,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
420 | pausing = true; | 416 | pausing = true; |
421 | 417 | ||
422 | pausetimer->start(PPPData::data()->busyWait()*1000, true); | 418 | pausetimer->start(_ifaceppp->data()->busyWait()*1000, true); |
423 | timeout_timer->stop(); | 419 | timeout_timer->stop(); |
424 | } | 420 | } |
425 | 421 | ||
426 | Modem::modem->setDataMode(false); | 422 | _ifaceppp->modem()->setDataMode(false); |
427 | vmain = 0; | 423 | vmain = 0; |
428 | substate = -1; | 424 | substate = -1; |
@@ -430,19 +426,19 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
430 | } | 426 | } |
431 | 427 | ||
432 | if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) { | 428 | if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) { |
433 | timeout_timer->stop(); | 429 | timeout_timer->stop(); |
434 | 430 | ||
435 | messg->setText(i18n("No Dialtone")); | 431 | messg->setText(i18n("No Dialtone")); |
436 | vmain = 20; | 432 | vmain = 20; |
437 | Modem::modem->unlockdevice(); | 433 | _ifaceppp->modem()->unlockdevice(); |
438 | return; | 434 | return; |
439 | } | 435 | } |
440 | 436 | ||
441 | if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) { | 437 | if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) { |
442 | timeout_timer->stop(); | 438 | timeout_timer->stop(); |
443 | 439 | ||
444 | messg->setText(i18n("No Carrier")); | 440 | messg->setText(i18n("No Carrier")); |
445 | vmain = 20; | 441 | vmain = 20; |
446 | Modem::modem->unlockdevice(); | 442 | _ifaceppp->modem()->unlockdevice(); |
447 | return; | 443 | return; |
448 | } | 444 | } |
@@ -452,5 +448,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
452 | if(vmain == 101) { | 448 | if(vmain == 101) { |
453 | if(!expecting) { | 449 | if(!expecting) { |
454 | Modem::modem->setDataMode(true); // modem will no longer respond to AT commands | 450 | _ifaceppp->modem()->setDataMode(true); // modem will no longer respond to AT commands |
455 | 451 | ||
456 | emit startAccounting(); | 452 | emit startAccounting(); |
@@ -458,5 +454,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
458 | 454 | ||
459 | vmain = 2; | 455 | vmain = 2; |
460 | scriptTimeout=PPPData::data()->modemTimeout()*1000; | 456 | scriptTimeout=_ifaceppp->data()->modemTimeout()*1000; |
461 | return; | 457 | return; |
462 | } | 458 | } |
@@ -495,8 +491,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
495 | 491 | ||
496 | if (scriptArgument.lower() == "password") { | 492 | if (scriptArgument.lower() == "password") { |
497 | PPPData::data()->setPassword(scanvar); | 493 | _ifaceppp->data()->setPassword(scanvar); |
498 | p_kppp->setPW_Edit(scanvar); | 494 | // p_kppp->setPW_Edit(scanvar); |
499 | if(PPPData::data()->storePassword()) | 495 | if(_ifaceppp->data()->storePassword()) |
500 | PPPData::data()->setStoredPassword(scanvar); | 496 | _ifaceppp->data()->setStoredPassword(scanvar); |
501 | firstrunPW = true; | 497 | firstrunPW = true; |
502 | } | 498 | } |
@@ -514,6 +510,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
514 | QRegExp re1("%USERNAME%"); | 510 | QRegExp re1("%USERNAME%"); |
515 | QRegExp re2("%PASSWORD%"); | 511 | QRegExp re2("%PASSWORD%"); |
516 | arg = arg.replace(re1, PPPData::data()->storedUsername()); | 512 | arg = arg.replace(re1, _ifaceppp->data()->storedUsername()); |
517 | arg = arg.replace(re2, PPPData::data()->storedPassword()); | 513 | arg = arg.replace(re2, _ifaceppp->data()->storedPassword()); |
518 | 514 | ||
519 | if (scriptCommand == "Send") | 515 | if (scriptCommand == "Send") |
@@ -579,6 +575,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
579 | emit debugMessage(i18n("Hangup")); | 575 | emit debugMessage(i18n("Hangup")); |
580 | 576 | ||
581 | writeline(PPPData::data()->modemHangupStr()); | 577 | writeline(_ifaceppp->data()->modemHangupStr()); |
582 | setExpect(PPPData::data()->modemHangupResp()); | 578 | setExpect(_ifaceppp->data()->modemHangupResp()); |
583 | 579 | ||
584 | scriptindex++; | 580 | scriptindex++; |
@@ -593,5 +589,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
593 | emit debugMessage(i18n("Answer")); | 589 | emit debugMessage(i18n("Answer")); |
594 | 590 | ||
595 | setExpect(PPPData::data()->modemRingResp()); | 591 | setExpect(_ifaceppp->data()->modemRingResp()); |
596 | vmain = 150; | 592 | vmain = 150; |
597 | return; | 593 | return; |
@@ -603,5 +599,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
603 | emit debugMessage(bm); | 599 | emit debugMessage(bm); |
604 | 600 | ||
605 | QString idstring = PPPData::data()->storedUsername(); | 601 | QString idstring = _ifaceppp->data()->storedUsername(); |
606 | 602 | ||
607 | if(!idstring.isEmpty() && firstrunID) { | 603 | if(!idstring.isEmpty() && firstrunID) { |
@@ -639,5 +635,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
639 | emit debugMessage(bm); | 635 | emit debugMessage(bm); |
640 | 636 | ||
641 | QString pwstring = PPPData::data()->password(); | 637 | QString pwstring = _ifaceppp->data()->password(); |
642 | 638 | ||
643 | if(!pwstring.isEmpty() && firstrunPW) { | 639 | if(!pwstring.isEmpty() && firstrunPW) { |
@@ -660,5 +656,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
660 | /* if prompt withdrawn ... then, */ | 656 | /* if prompt withdrawn ... then, */ |
661 | if(!(prompt->isVisible())) { | 657 | if(!(prompt->isVisible())) { |
662 | p_kppp->setPW_Edit(prompt->text()); | 658 | // p_kppp->setPW_Edit(prompt->text()); |
663 | writeline(prompt->text()); | 659 | writeline(prompt->text()); |
664 | prompt->setConsumed(); | 660 | prompt->setConsumed(); |
@@ -786,6 +782,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
786 | if(vmain == 150) { | 782 | if(vmain == 150) { |
787 | if(!expecting) { | 783 | if(!expecting) { |
788 | writeline(PPPData::data()->modemAnswerStr()); | 784 | writeline(_ifaceppp->data()->modemAnswerStr()); |
789 | setExpect(PPPData::data()->modemAnswerResp()); | 785 | setExpect(_ifaceppp->data()->modemAnswerResp()); |
790 | 786 | ||
791 | vmain = 2; | 787 | vmain = 2; |
@@ -813,7 +809,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
813 | 809 | ||
814 | // stop reading of data | 810 | // stop reading of data |
815 | Modem::modem->stop(); | 811 | _ifaceppp->modem()->stop(); |
816 | 812 | ||
817 | if(PPPData::data()->authMethod() == AUTH_TERMINAL) { | 813 | if(_ifaceppp->data()->authMethod() == AUTH_TERMINAL) { |
818 | // if (termwindow) { | 814 | // if (termwindow) { |
819 | // delete termwindow; | 815 | // delete termwindow; |
@@ -832,10 +828,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
832 | // Modem::readtty() from re-enabling the socket notifier. | 828 | // Modem::readtty() from re-enabling the socket notifier. |
833 | // The port is still held open by the helper process. | 829 | // The port is still held open by the helper process. |
834 | Modem::modem->closetty(); | 830 | _ifaceppp->modem()->closetty(); |
835 | 831 | ||
836 | killTimer( main_timer_ID ); | 832 | killTimer( main_timer_ID ); |
837 | 833 | ||
838 | if_timeout_timer->start(PPPData::data()->pppdTimeout()*1000); | 834 | if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); |
839 | qDebug( "started if timeout timer with %i", PPPData::data()->pppdTimeout()*1000); | 835 | qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000); |
840 | 836 | ||
841 | // find out PPP interface and notify the stats module | 837 | // find out PPP interface and notify the stats module |
@@ -850,6 +846,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
850 | 846 | ||
851 | if(result) { | 847 | if(result) { |
852 | if(!PPPData::data()->autoDNS()) | 848 | if(!_ifaceppp->data()->autoDNS()) |
853 | adddns(); | 849 | adddns( _ifaceppp ); |
854 | 850 | ||
855 | // O.K we are done here, let's change over to the if_waiting loop | 851 | // O.K we are done here, let's change over to the if_waiting loop |
@@ -864,12 +860,12 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
864 | this->hide(); | 860 | this->hide(); |
865 | messg->setText(""); | 861 | messg->setText(""); |
866 | p_kppp->quit_b->setFocus(); | 862 | //p_kppp->quit_b->setFocus(); |
867 | p_kppp->show(); | 863 | //p_kppp->show(); |
868 | qApp->processEvents(); | 864 | qApp->processEvents(); |
869 | Modem::modem->hangup(); | 865 | _ifaceppp->modem()->hangup(); |
870 | emit stopAccounting(); | 866 | emit stopAccounting(); |
871 | //p_kppp->con_win->stopClock(); | 867 | //p_kppp->con_win->stopClock(); |
872 | Modem::modem->closetty(); | 868 | _ifaceppp->modem()->closetty(); |
873 | Modem::modem->unlockdevice(); | 869 | _ifaceppp->modem()->unlockdevice(); |
874 | 870 | ||
875 | } | 871 | } |
@@ -891,5 +887,5 @@ void ConnectWidget::set_con_speed_string() { | |||
891 | // CONNECT 115200, so all we need to do is find the number after CONNECT | 887 | // CONNECT 115200, so all we need to do is find the number after CONNECT |
892 | // or whatever the modemConnectResp() is. | 888 | // or whatever the modemConnectResp() is. |
893 | p_kppp->con_speed = Modem::modem->parseModemSpeed(myreadbuffer); | 889 | // p_kppp->con_speed = _ifaceppp->modem()->parseModemSpeed(myreadbuffer); |
894 | } | 890 | } |
895 | 891 | ||
@@ -970,5 +966,5 @@ void ConnectWidget::pause() { | |||
970 | 966 | ||
971 | void ConnectWidget::cancelbutton() { | 967 | void ConnectWidget::cancelbutton() { |
972 | Modem::modem->stop(); | 968 | _ifaceppp->modem()->stop(); |
973 | killTimer(main_timer_ID); | 969 | killTimer(main_timer_ID); |
974 | timeout_timer->stop(); | 970 | timeout_timer->stop(); |
@@ -985,21 +981,21 @@ void ConnectWidget::cancelbutton() { | |||
985 | 981 | ||
986 | // just to be sure | 982 | // just to be sure |
987 | Modem::modem->removeSecret(AUTH_PAP); | 983 | _ifaceppp->modem()->removeSecret(AUTH_PAP); |
988 | Modem::modem->removeSecret(AUTH_CHAP); | 984 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); |
989 | removedns(); | 985 | removedns(_ifaceppp); |
990 | 986 | ||
991 | qApp->processEvents(); | 987 | qApp->processEvents(); |
992 | 988 | ||
993 | Modem::modem->killPPPDaemon(); | 989 | _ifaceppp->modem()->killPPPDaemon(); |
994 | Modem::modem->hangup(); | 990 | _ifaceppp->modem()->hangup(); |
995 | 991 | ||
996 | this->hide(); | 992 | this->hide(); |
997 | messg->setText(""); | 993 | messg->setText(""); |
998 | p_kppp->quit_b->setFocus(); | 994 | // p_kppp->quit_b->setFocus(); |
999 | p_kppp->show(); | 995 | // p_kppp->show(); |
1000 | emit stopAccounting();// just to be sure | 996 | emit stopAccounting();// just to be sure |
1001 | // p_kppp->con_win->stopClock(); | 997 | // p_kppp->con_win->stopClock(); |
1002 | Modem::modem->closetty(); | 998 | _ifaceppp->modem()->closetty(); |
1003 | Modem::modem->unlockdevice(); | 999 | _ifaceppp->modem()->unlockdevice(); |
1004 | 1000 | ||
1005 | //abort prompt window... | 1001 | //abort prompt window... |
@@ -1027,5 +1023,5 @@ void ConnectWidget::script_timed_out() { | |||
1027 | prompt->setConsumed(); | 1023 | prompt->setConsumed(); |
1028 | messg->setText(i18n("Script timed out!")); | 1024 | messg->setText(i18n("Script timed out!")); |
1029 | Modem::modem->hangup(); | 1025 | _ifaceppp->modem()->hangup(); |
1030 | emit stopAccounting(); | 1026 | emit stopAccounting(); |
1031 | // p_kppp->con_win->stopClock(); | 1027 | // p_kppp->con_win->stopClock(); |
@@ -1064,8 +1060,8 @@ void ConnectWidget::if_waiting_timed_out() { | |||
1064 | qDebug("if_waiting_timed_out()"); | 1060 | qDebug("if_waiting_timed_out()"); |
1065 | 1061 | ||
1066 | PPPData::data()->setpppdError(E_IF_TIMEOUT); | 1062 | _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); |
1067 | 1063 | ||
1068 | // let's kill the stuck pppd | 1064 | // let's kill the stuck pppd |
1069 | Modem::modem->killPPPDaemon(); | 1065 | _ifaceppp->modem()->killPPPDaemon(); |
1070 | 1066 | ||
1071 | emit stopAccounting(); | 1067 | emit stopAccounting(); |
@@ -1089,5 +1085,5 @@ void ConnectWidget::if_waiting_slot() { | |||
1089 | // if(!stats->ifIsUp()) { | 1085 | // if(!stats->ifIsUp()) { |
1090 | 1086 | ||
1091 | // if(PPPData::data()->pppdError() != 0) { | 1087 | // if(_ifaceppp->data()->pppdError() != 0) { |
1092 | // // we are here if pppd died immediately after starting it. | 1088 | // // we are here if pppd died immediately after starting it. |
1093 | // pppdDied(); | 1089 | // pppdDied(); |
@@ -1106,6 +1102,6 @@ void ConnectWidget::if_waiting_slot() { | |||
1106 | usleep(200000); | 1102 | usleep(200000); |
1107 | 1103 | ||
1108 | if(PPPData::data()->autoDNS()) | 1104 | if(_ifaceppp->data()->autoDNS()) |
1109 | addpeerdns(); | 1105 | addpeerdns( _ifaceppp ); |
1110 | 1106 | ||
1111 | // Close the debugging window. If we are connected, we | 1107 | // Close the debugging window. If we are connected, we |
@@ -1113,18 +1109,18 @@ void ConnectWidget::if_waiting_slot() { | |||
1113 | emit closeDebugWindow(); | 1109 | emit closeDebugWindow(); |
1114 | // p_kppp->statdlg->take_stats(); // start taking ppp statistics | 1110 | // p_kppp->statdlg->take_stats(); // start taking ppp statistics |
1115 | auto_hostname(); | 1111 | auto_hostname(_ifaceppp); |
1116 | 1112 | ||
1117 | if(!PPPData::data()->command_on_connect().isEmpty()) { | 1113 | if(!_ifaceppp->data()->command_on_connect().isEmpty()) { |
1118 | messg->setText(i18n("Running startup command...")); | 1114 | messg->setText(i18n("Running startup command...")); |
1119 | 1115 | ||
1120 | // make sure that we don't get any async errors | 1116 | // make sure that we don't get any async errors |
1121 | qApp->flushX(); | 1117 | qApp->flushX(); |
1122 | execute_command(PPPData::data()->command_on_connect()); | 1118 | execute_command(_ifaceppp->data()->command_on_connect()); |
1123 | messg->setText(i18n("Done")); | 1119 | messg->setText(i18n("Done")); |
1124 | } | 1120 | } |
1125 | 1121 | ||
1126 | // remove the authentication file | 1122 | // remove the authentication file |
1127 | Modem::modem->removeSecret(AUTH_PAP); | 1123 | _ifaceppp->modem()->removeSecret(AUTH_PAP); |
1128 | Modem::modem->removeSecret(AUTH_CHAP); | 1124 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); |
1129 | 1125 | ||
1130 | emit debugMessage(i18n("Done")); | 1126 | emit debugMessage(i18n("Done")); |
@@ -1142,18 +1138,18 @@ void ConnectWidget::if_waiting_slot() { | |||
1142 | // p_kppp->con_win->accounting(false); | 1138 | // p_kppp->con_win->accounting(false); |
1143 | 1139 | ||
1144 | if (PPPData::data()->get_dock_into_panel()) { | 1140 | // if (_ifaceppp->data()->get_dock_into_panel()) { |
1145 | // DockWidget::dock_widget->show(); | 1141 | // // DockWidget::dock_widget->show(); |
1146 | // DockWidget::dock_widget->take_stats(); | 1142 | // // DockWidget::dock_widget->take_stats(); |
1147 | // this->hide(); | 1143 | // // this->hide(); |
1148 | } | 1144 | // } |
1149 | else { | 1145 | // else { |
1150 | // p_kppp->con_win->show(); | 1146 | // // p_kppp->con_win->show(); |
1151 | 1147 | ||
1152 | if(PPPData::data()->get_iconify_on_connect()) { | 1148 | // if(_ifaceppp->data()->get_iconify_on_connect()) { |
1153 | // p_kppp->con_win->showMinimized(); | 1149 | // // p_kppp->con_win->showMinimized(); |
1154 | } | 1150 | // } |
1155 | } | 1151 | // } |
1156 | 1152 | ||
1157 | Modem::modem->closetty(); | 1153 | _ifaceppp->modem()->closetty(); |
1158 | } | 1154 | } |
1159 | 1155 | ||
@@ -1169,15 +1165,15 @@ bool ConnectWidget::execppp() { | |||
1169 | // which is the serial port we connected stdin/stdout to in opener.cpp. | 1165 | // which is the serial port we connected stdin/stdout to in opener.cpp. |
1170 | // command += " "; | 1166 | // command += " "; |
1171 | // command += PPPData::data()->modemDevice(); | 1167 | // command += _ifaceppp->data()->modemDevice(); |
1172 | 1168 | ||
1173 | command += " " + PPPData::data()->speed(); | 1169 | command += " " + _ifaceppp->data()->speed(); |
1174 | 1170 | ||
1175 | command += " -detach"; | 1171 | command += " -detach"; |
1176 | 1172 | ||
1177 | if(PPPData::data()->ipaddr() != "0.0.0.0" || | 1173 | if(_ifaceppp->data()->ipaddr() != "0.0.0.0" || |
1178 | PPPData::data()->gateway() != "0.0.0.0") { | 1174 | _ifaceppp->data()->gateway() != "0.0.0.0") { |
1179 | if(PPPData::data()->ipaddr() != "0.0.0.0") { | 1175 | if(_ifaceppp->data()->ipaddr() != "0.0.0.0") { |
1180 | command += " "; | 1176 | command += " "; |
1181 | command += PPPData::data()->ipaddr(); | 1177 | command += _ifaceppp->data()->ipaddr(); |
1182 | command += ":"; | 1178 | command += ":"; |
1183 | } | 1179 | } |
@@ -1187,13 +1183,13 @@ bool ConnectWidget::execppp() { | |||
1187 | } | 1183 | } |
1188 | 1184 | ||
1189 | if(PPPData::data()->gateway() != "0.0.0.0") | 1185 | if(_ifaceppp->data()->gateway() != "0.0.0.0") |
1190 | command += PPPData::data()->gateway(); | 1186 | command += _ifaceppp->data()->gateway(); |
1191 | } | 1187 | } |
1192 | 1188 | ||
1193 | if(PPPData::data()->subnetmask() != "0.0.0.0") | 1189 | if(_ifaceppp->data()->subnetmask() != "0.0.0.0") |
1194 | command += " netmask " + PPPData::data()->subnetmask(); | 1190 | command += " netmask " + _ifaceppp->data()->subnetmask(); |
1195 | 1191 | ||
1196 | if(PPPData::data()->flowcontrol() != "None") { | 1192 | if(_ifaceppp->data()->flowcontrol() != "None") { |
1197 | if(PPPData::data()->flowcontrol() == "CRTSCTS") | 1193 | if(_ifaceppp->data()->flowcontrol() == "CRTSCTS") |
1198 | command += " crtscts"; | 1194 | command += " crtscts"; |
1199 | else | 1195 | else |
@@ -1201,11 +1197,11 @@ bool ConnectWidget::execppp() { | |||
1201 | } | 1197 | } |
1202 | 1198 | ||
1203 | if(PPPData::data()->defaultroute()) | 1199 | if(_ifaceppp->data()->defaultroute()) |
1204 | command += " defaultroute"; | 1200 | command += " defaultroute"; |
1205 | 1201 | ||
1206 | if(PPPData::data()->autoDNS()) | 1202 | if(_ifaceppp->data()->autoDNS()) |
1207 | command += " usepeerdns"; | 1203 | command += " usepeerdns"; |
1208 | 1204 | ||
1209 | QStringList &arglist = PPPData::data()->pppdArgument(); | 1205 | QStringList &arglist = _ifaceppp->data()->pppdArgument(); |
1210 | for ( QStringList::Iterator it = arglist.begin(); | 1206 | for ( QStringList::Iterator it = arglist.begin(); |
1211 | it != arglist.end(); | 1207 | it != arglist.end(); |
@@ -1216,23 +1212,23 @@ bool ConnectWidget::execppp() { | |||
1216 | 1212 | ||
1217 | // PAP settings | 1213 | // PAP settings |
1218 | if(PPPData::data()->authMethod() == AUTH_PAP) { | 1214 | if(_ifaceppp->data()->authMethod() == AUTH_PAP) { |
1219 | command += " -chap user "; | 1215 | command += " -chap user "; |
1220 | command = command + "\"" + PPPData::data()->storedUsername() + "\""; | 1216 | command = command + "\"" + _ifaceppp->data()->storedUsername() + "\""; |
1221 | } | 1217 | } |
1222 | 1218 | ||
1223 | // CHAP settings | 1219 | // CHAP settings |
1224 | if(PPPData::data()->authMethod() == AUTH_CHAP) { | 1220 | if(_ifaceppp->data()->authMethod() == AUTH_CHAP) { |
1225 | command += " -pap user "; | 1221 | command += " -pap user "; |
1226 | command = command + "\"" + PPPData::data()->storedUsername() + "\""; | 1222 | command = command + "\"" + _ifaceppp->data()->storedUsername() + "\""; |
1227 | } | 1223 | } |
1228 | 1224 | ||
1229 | // PAP/CHAP settings | 1225 | // PAP/CHAP settings |
1230 | if(PPPData::data()->authMethod() == AUTH_PAPCHAP) { | 1226 | if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) { |
1231 | command += " user "; | 1227 | command += " user "; |
1232 | command = command + "\"" + PPPData::data()->storedUsername() + "\""; | 1228 | command = command + "\"" + _ifaceppp->data()->storedUsername() + "\""; |
1233 | } | 1229 | } |
1234 | 1230 | ||
1235 | // check for debug | 1231 | // check for debug |
1236 | if(PPPData::data()->getPPPDebug()) | 1232 | if(_ifaceppp->data()->getPPPDebug()) |
1237 | command += " debug"; | 1233 | command += " debug"; |
1238 | 1234 | ||
@@ -1248,5 +1244,5 @@ bool ConnectWidget::execppp() { | |||
1248 | qApp->flushX(); | 1244 | qApp->flushX(); |
1249 | 1245 | ||
1250 | return Modem::modem->execPPPDaemon(command); | 1246 | return _ifaceppp->modem()->execPPPDaemon(command); |
1251 | } | 1247 | } |
1252 | 1248 | ||
@@ -1263,9 +1259,9 @@ void ConnectWidget::setMsg(const QString &msg) { | |||
1263 | 1259 | ||
1264 | void ConnectWidget::writeline(const QString &s) { | 1260 | void ConnectWidget::writeline(const QString &s) { |
1265 | Modem::modem->writeLine(s.local8Bit()); | 1261 | _ifaceppp->modem()->writeLine(s.local8Bit()); |
1266 | } | 1262 | } |
1267 | 1263 | ||
1268 | // Set the hostname and domain from DNS Server | 1264 | // Set the hostname and domain from DNS Server |
1269 | void auto_hostname() { | 1265 | void auto_hostname(InterfacePPP *_ifaceppp) { |
1270 | struct in_addr local_ip; | 1266 | struct in_addr local_ip; |
1271 | struct hostent *hostname_entry; | 1267 | struct hostent *hostname_entry; |
@@ -1278,6 +1274,6 @@ void auto_hostname() { | |||
1278 | old_hostname=tmp_str; // copy to QString | 1274 | old_hostname=tmp_str; // copy to QString |
1279 | 1275 | ||
1280 | // if (!p_kppp->stats->local_ip_address.isEmpty() && PPPData::data()->autoname()) { | 1276 | // if (!p_kppp->stats->local_ip_address.isEmpty() && _ifaceppp->data()->autoname()) { |
1281 | if ( PPPData::data()->autoname()) { | 1277 | if ( _ifaceppp->data()->autoname()) { |
1282 | // local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii()); | 1278 | // local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii()); |
1283 | hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET); | 1279 | hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET); |
@@ -1287,5 +1283,5 @@ void auto_hostname() { | |||
1287 | dot=new_hostname.find('.'); | 1283 | dot=new_hostname.find('.'); |
1288 | new_hostname=new_hostname.remove(dot,new_hostname.length()-dot); | 1284 | new_hostname=new_hostname.remove(dot,new_hostname.length()-dot); |
1289 | Modem::modem->setHostname(new_hostname); | 1285 | _ifaceppp->modem()->setHostname(new_hostname); |
1290 | modified_hostname = TRUE; | 1286 | modified_hostname = TRUE; |
1291 | 1287 | ||
@@ -1293,5 +1289,5 @@ void auto_hostname() { | |||
1293 | new_hostname.remove(0,dot+1); | 1289 | new_hostname.remove(0,dot+1); |
1294 | 1290 | ||
1295 | add_domain(new_hostname); | 1291 | add_domain(new_hostname, _ifaceppp); |
1296 | } | 1292 | } |
1297 | } | 1293 | } |
@@ -1301,5 +1297,5 @@ void auto_hostname() { | |||
1301 | // Replace the DNS domain entry in the /etc/resolv.conf file and | 1297 | // Replace the DNS domain entry in the /etc/resolv.conf file and |
1302 | // disable the nameserver entries if option is enabled | 1298 | // disable the nameserver entries if option is enabled |
1303 | void add_domain(const QString &domain) { | 1299 | void add_domain(const QString &domain, InterfacePPP *_ifaceppp) { |
1304 | 1300 | ||
1305 | int fd; | 1301 | int fd; |
@@ -1310,5 +1306,5 @@ void add_domain(const QString &domain) { | |||
1310 | return; | 1306 | return; |
1311 | 1307 | ||
1312 | if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { | 1308 | if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) { |
1313 | 1309 | ||
1314 | int i=0; | 1310 | int i=0; |
@@ -1324,5 +1320,5 @@ void add_domain(const QString &domain) { | |||
1324 | if ((c != '\n') && (i < MAX_RESOLVCONF_LINES)) i++; | 1320 | if ((c != '\n') && (i < MAX_RESOLVCONF_LINES)) i++; |
1325 | 1321 | ||
1326 | if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) { | 1322 | if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_TRUNC)) >= 0) { |
1327 | QCString tmp = "domain " + domain.local8Bit() + | 1323 | QCString tmp = "domain " + domain.local8Bit() + |
1328 | " \t\t#kppp temp entry\n"; | 1324 | " \t\t#kppp temp entry\n"; |
@@ -1333,5 +1329,5 @@ void add_domain(const QString &domain) { | |||
1333 | ( resolv[j].contains("nameserver") | 1329 | ( resolv[j].contains("nameserver") |
1334 | && !resolv[j].contains("#kppp temp entry") | 1330 | && !resolv[j].contains("#kppp temp entry") |
1335 | && PPPData::data()->exDNSDisabled())) | 1331 | && _ifaceppp->data()->exDNSDisabled())) |
1336 | && !resolv[j].contains("#entry disabled by kppp")) { | 1332 | && !resolv[j].contains("#entry disabled by kppp")) { |
1337 | QCString tmp = "# " + resolv[j].local8Bit() + | 1333 | QCString tmp = "# " + resolv[j].local8Bit() + |
@@ -1351,10 +1347,10 @@ void add_domain(const QString &domain) { | |||
1351 | 1347 | ||
1352 | // adds the DNS entries in the /etc/resolv.conf file | 1348 | // adds the DNS entries in the /etc/resolv.conf file |
1353 | void adddns() | 1349 | void adddns( InterfacePPP *_ifaceppp) |
1354 | { | 1350 | { |
1355 | int fd; | 1351 | int fd; |
1356 | 1352 | ||
1357 | if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { | 1353 | if ((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_APPEND)) >= 0) { |
1358 | QStringList &dnslist = PPPData::data()->dns(); | 1354 | QStringList &dnslist = _ifaceppp->data()->dns(); |
1359 | for ( QStringList::Iterator it = dnslist.begin(); | 1355 | for ( QStringList::Iterator it = dnslist.begin(); |
1360 | it != dnslist.end(); | 1356 | it != dnslist.end(); |
@@ -1367,11 +1363,11 @@ void adddns() | |||
1367 | close(fd); | 1363 | close(fd); |
1368 | } | 1364 | } |
1369 | add_domain(PPPData::data()->domain()); | 1365 | add_domain(_ifaceppp->data()->domain(), _ifaceppp); |
1370 | } | 1366 | } |
1371 | 1367 | ||
1372 | void addpeerdns() { | 1368 | void addpeerdns(InterfacePPP *_ifaceppp) { |
1373 | int fd, fd2; | 1369 | int fd, fd2; |
1374 | 1370 | ||
1375 | if((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { | 1371 | if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_APPEND)) >= 0) { |
1376 | if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) { | 1372 | if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) { |
1377 | char c; | 1373 | char c; |
@@ -1388,9 +1384,9 @@ void addpeerdns() { | |||
1388 | close(fd); | 1384 | close(fd); |
1389 | } | 1385 | } |
1390 | add_domain(PPPData::data()->domain()); | 1386 | add_domain(_ifaceppp->data()->domain(), _ifaceppp); |
1391 | } | 1387 | } |
1392 | 1388 | ||
1393 | // remove the dns entries from the /etc/resolv.conf file | 1389 | // remove the dns entries from the /etc/resolv.conf file |
1394 | void removedns() { | 1390 | void removedns(InterfacePPP *_ifaceppp) { |
1395 | 1391 | ||
1396 | int fd; | 1392 | int fd; |
@@ -1398,5 +1394,5 @@ void removedns() { | |||
1398 | QString resolv[MAX_RESOLVCONF_LINES]; | 1394 | QString resolv[MAX_RESOLVCONF_LINES]; |
1399 | 1395 | ||
1400 | if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { | 1396 | if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) { |
1401 | 1397 | ||
1402 | int i=0; | 1398 | int i=0; |
@@ -1411,5 +1407,5 @@ void removedns() { | |||
1411 | close(fd); | 1407 | close(fd); |
1412 | 1408 | ||
1413 | if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) { | 1409 | if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_TRUNC)) >= 0) { |
1414 | for(int j=0; j < i; j++) { | 1410 | for(int j=0; j < i; j++) { |
1415 | if(resolv[j].contains("#kppp temp entry")) continue; | 1411 | if(resolv[j].contains("#kppp temp entry")) continue; |
@@ -1430,5 +1426,5 @@ void removedns() { | |||
1430 | 1426 | ||
1431 | if ( modified_hostname ) { | 1427 | if ( modified_hostname ) { |
1432 | Modem::modem->setHostname(old_hostname); | 1428 | _ifaceppp->modem()->setHostname(old_hostname); |
1433 | modified_hostname = FALSE; | 1429 | modified_hostname = FALSE; |
1434 | } | 1430 | } |