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 | |||
@@ -67,3 +67,3 @@ | |||
67 | //#include "docking.h" | 67 | //#include "docking.h" |
68 | //#include "main.h" | 68 | #include "interfaceppp.h" |
69 | #include "modem.h" | 69 | #include "modem.h" |
@@ -76,4 +76,2 @@ | |||
76 | 76 | ||
77 | extern KPPPWidget *p_kppp; | ||
78 | |||
79 | QString old_hostname; | 77 | QString old_hostname; |
@@ -82,5 +80,4 @@ bool modified_hostname; | |||
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(""), |
@@ -98,5 +95,4 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name) | |||
98 | pausing(false), | 95 | pausing(false), |
99 | // termwindow(0), | 96 | dialnumber(0), |
100 | // stats(st), | 97 | _ifaceppp(ifp) |
101 | dialnumber(0) | ||
102 | { | 98 | { |
@@ -181,3 +177,3 @@ void ConnectWidget::preinit() { | |||
181 | void ConnectWidget::init() { | 177 | void ConnectWidget::init() { |
182 | PPPData::data()->setpppdError(0); | 178 | _ifaceppp->data()->setpppdError(0); |
183 | inittimer->stop(); | 179 | inittimer->stop(); |
@@ -196,10 +192,10 @@ void ConnectWidget::init() { | |||
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); |
@@ -209,3 +205,3 @@ void ConnectWidget::init() { | |||
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...")); |
@@ -215,3 +211,3 @@ void ConnectWidget::init() { | |||
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; |
@@ -225,3 +221,3 @@ void ConnectWidget::init() { | |||
225 | 221 | ||
226 | int lock = Modem::modem->lockdevice(); | 222 | int lock = _ifaceppp->modem()->lockdevice(); |
227 | 223 | ||
@@ -239,6 +235,6 @@ void ConnectWidget::init() { | |||
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 | ||
@@ -248,7 +244,7 @@ void ConnectWidget::init() { | |||
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 | ||
@@ -262,5 +258,5 @@ void ConnectWidget::init() { | |||
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 | } |
@@ -286,3 +282,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
286 | 282 | ||
287 | QString initStr = PPPData::data()->modemInitStr(substate); | 283 | QString initStr = _ifaceppp->data()->modemInitStr(substate); |
288 | if (!initStr.isEmpty()) { | 284 | if (!initStr.isEmpty()) { |
@@ -290,10 +286,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | } |
@@ -308,3 +304,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
308 | */ | 304 | */ |
309 | if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration()) | 305 | if (MODEM_TONEDURATION != _ifaceppp->data()->modemToneDuration()) |
310 | vmain = 5; | 306 | vmain = 5; |
@@ -318,3 +314,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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; |
@@ -322,3 +318,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
322 | emit debugMessage(msg); | 318 | emit debugMessage(msg); |
323 | setExpect(PPPData::data()->modemInitResp()); | 319 | setExpect(_ifaceppp->data()->modemInitResp()); |
324 | writeline(sToneDuration); | 320 | writeline(sToneDuration); |
@@ -338,3 +334,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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; |
@@ -345,7 +341,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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; |
@@ -357,3 +353,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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..."); |
@@ -361,4 +357,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | } |
@@ -374,6 +370,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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); |
@@ -383,4 +379,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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); |
@@ -390,3 +386,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
390 | 386 | ||
391 | setExpect(PPPData::data()->modemConnectResp()); | 387 | setExpect(_ifaceppp->data()->modemConnectResp()); |
392 | vmain = 100; | 388 | vmain = 100; |
@@ -400,3 +396,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
400 | if(!expecting) { | 396 | if(!expecting) { |
401 | myreadbuffer = PPPData::data()->modemConnectResp(); | 397 | myreadbuffer = _ifaceppp->data()->modemConnectResp(); |
402 | setExpect("\n"); | 398 | setExpect("\n"); |
@@ -406,5 +402,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | ||
@@ -412,6 +408,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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); |
@@ -421,3 +417,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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(); |
@@ -425,3 +421,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
425 | 421 | ||
426 | Modem::modem->setDataMode(false); | 422 | _ifaceppp->modem()->setDataMode(false); |
427 | vmain = 0; | 423 | vmain = 0; |
@@ -431,3 +427,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
431 | 427 | ||
432 | if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) { | 428 | if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) { |
433 | timeout_timer->stop(); | 429 | timeout_timer->stop(); |
@@ -436,3 +432,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
436 | vmain = 20; | 432 | vmain = 20; |
437 | Modem::modem->unlockdevice(); | 433 | _ifaceppp->modem()->unlockdevice(); |
438 | return; | 434 | return; |
@@ -440,3 +436,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
440 | 436 | ||
441 | if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) { | 437 | if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) { |
442 | timeout_timer->stop(); | 438 | timeout_timer->stop(); |
@@ -445,3 +441,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
445 | vmain = 20; | 441 | vmain = 20; |
446 | Modem::modem->unlockdevice(); | 442 | _ifaceppp->modem()->unlockdevice(); |
447 | return; | 443 | return; |
@@ -453,3 +449,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | ||
@@ -459,3 +455,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
459 | vmain = 2; | 455 | vmain = 2; |
460 | scriptTimeout=PPPData::data()->modemTimeout()*1000; | 456 | scriptTimeout=_ifaceppp->data()->modemTimeout()*1000; |
461 | return; | 457 | return; |
@@ -496,6 +492,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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; |
@@ -515,4 +511,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | ||
@@ -580,4 +576,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
580 | 576 | ||
581 | writeline(PPPData::data()->modemHangupStr()); | 577 | writeline(_ifaceppp->data()->modemHangupStr()); |
582 | setExpect(PPPData::data()->modemHangupResp()); | 578 | setExpect(_ifaceppp->data()->modemHangupResp()); |
583 | 579 | ||
@@ -594,3 +590,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
594 | 590 | ||
595 | setExpect(PPPData::data()->modemRingResp()); | 591 | setExpect(_ifaceppp->data()->modemRingResp()); |
596 | vmain = 150; | 592 | vmain = 150; |
@@ -604,3 +600,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
604 | 600 | ||
605 | QString idstring = PPPData::data()->storedUsername(); | 601 | QString idstring = _ifaceppp->data()->storedUsername(); |
606 | 602 | ||
@@ -640,3 +636,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
640 | 636 | ||
641 | QString pwstring = PPPData::data()->password(); | 637 | QString pwstring = _ifaceppp->data()->password(); |
642 | 638 | ||
@@ -661,3 +657,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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()); |
@@ -787,4 +783,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | ||
@@ -814,5 +810,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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) { |
@@ -833,3 +829,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | ||
@@ -837,4 +833,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | ||
@@ -851,4 +847,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
851 | if(result) { | 847 | if(result) { |
852 | if(!PPPData::data()->autoDNS()) | 848 | if(!_ifaceppp->data()->autoDNS()) |
853 | adddns(); | 849 | adddns( _ifaceppp ); |
854 | 850 | ||
@@ -865,10 +861,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
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 | ||
@@ -892,3 +888,3 @@ void ConnectWidget::set_con_speed_string() { | |||
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 | } |
@@ -971,3 +967,3 @@ void ConnectWidget::pause() { | |||
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); |
@@ -986,5 +982,5 @@ void ConnectWidget::cancelbutton() { | |||
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 | ||
@@ -992,4 +988,4 @@ void ConnectWidget::cancelbutton() { | |||
992 | 988 | ||
993 | Modem::modem->killPPPDaemon(); | 989 | _ifaceppp->modem()->killPPPDaemon(); |
994 | Modem::modem->hangup(); | 990 | _ifaceppp->modem()->hangup(); |
995 | 991 | ||
@@ -997,8 +993,8 @@ void ConnectWidget::cancelbutton() { | |||
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 | ||
@@ -1028,3 +1024,3 @@ void ConnectWidget::script_timed_out() { | |||
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(); |
@@ -1065,6 +1061,6 @@ void ConnectWidget::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 | ||
@@ -1090,3 +1086,3 @@ void ConnectWidget::if_waiting_slot() { | |||
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. |
@@ -1107,4 +1103,4 @@ void ConnectWidget::if_waiting_slot() { | |||
1107 | 1103 | ||
1108 | if(PPPData::data()->autoDNS()) | 1104 | if(_ifaceppp->data()->autoDNS()) |
1109 | addpeerdns(); | 1105 | addpeerdns( _ifaceppp ); |
1110 | 1106 | ||
@@ -1114,5 +1110,5 @@ void ConnectWidget::if_waiting_slot() { | |||
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...")); |
@@ -1121,3 +1117,3 @@ void ConnectWidget::if_waiting_slot() { | |||
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")); |
@@ -1126,4 +1122,4 @@ void ConnectWidget::if_waiting_slot() { | |||
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 | ||
@@ -1143,16 +1139,16 @@ void ConnectWidget::if_waiting_slot() { | |||
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 | } |
@@ -1170,5 +1166,5 @@ bool ConnectWidget::execppp() { | |||
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 | ||
@@ -1176,7 +1172,7 @@ bool ConnectWidget::execppp() { | |||
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 += ":"; |
@@ -1188,11 +1184,11 @@ bool ConnectWidget::execppp() { | |||
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"; |
@@ -1202,9 +1198,9 @@ bool ConnectWidget::execppp() { | |||
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(); |
@@ -1217,5 +1213,5 @@ bool ConnectWidget::execppp() { | |||
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 | } |
@@ -1223,5 +1219,5 @@ bool ConnectWidget::execppp() { | |||
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 | } |
@@ -1229,5 +1225,5 @@ bool ConnectWidget::execppp() { | |||
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 | } |
@@ -1235,3 +1231,3 @@ bool ConnectWidget::execppp() { | |||
1235 | // check for debug | 1231 | // check for debug |
1236 | if(PPPData::data()->getPPPDebug()) | 1232 | if(_ifaceppp->data()->getPPPDebug()) |
1237 | command += " debug"; | 1233 | command += " debug"; |
@@ -1249,3 +1245,3 @@ bool ConnectWidget::execppp() { | |||
1249 | 1245 | ||
1250 | return Modem::modem->execPPPDaemon(command); | 1246 | return _ifaceppp->modem()->execPPPDaemon(command); |
1251 | } | 1247 | } |
@@ -1264,3 +1260,3 @@ void ConnectWidget::setMsg(const QString &msg) { | |||
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 | } |
@@ -1268,3 +1264,3 @@ void ConnectWidget::writeline(const QString &s) { | |||
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; |
@@ -1279,4 +1275,4 @@ void auto_hostname() { | |||
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()); |
@@ -1288,3 +1284,3 @@ void auto_hostname() { | |||
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; |
@@ -1294,3 +1290,3 @@ void auto_hostname() { | |||
1294 | 1290 | ||
1295 | add_domain(new_hostname); | 1291 | add_domain(new_hostname, _ifaceppp); |
1296 | } | 1292 | } |
@@ -1302,3 +1298,3 @@ void auto_hostname() { | |||
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 | ||
@@ -1311,3 +1307,3 @@ void add_domain(const QString &domain) { | |||
1311 | 1307 | ||
1312 | if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { | 1308 | if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) { |
1313 | 1309 | ||
@@ -1325,3 +1321,3 @@ void add_domain(const QString &domain) { | |||
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() + |
@@ -1334,3 +1330,3 @@ void add_domain(const QString &domain) { | |||
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")) { |
@@ -1352,3 +1348,3 @@ void add_domain(const QString &domain) { | |||
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 | { |
@@ -1356,4 +1352,4 @@ void adddns() | |||
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(); |
@@ -1368,9 +1364,9 @@ void adddns() | |||
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) { |
@@ -1389,3 +1385,3 @@ void addpeerdns() { | |||
1389 | } | 1385 | } |
1390 | add_domain(PPPData::data()->domain()); | 1386 | add_domain(_ifaceppp->data()->domain(), _ifaceppp); |
1391 | } | 1387 | } |
@@ -1393,3 +1389,3 @@ void addpeerdns() { | |||
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 | ||
@@ -1399,3 +1395,3 @@ void removedns() { | |||
1399 | 1395 | ||
1400 | if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) { | 1396 | if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) { |
1401 | 1397 | ||
@@ -1412,3 +1408,3 @@ void removedns() { | |||
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++) { |
@@ -1431,3 +1427,3 @@ void removedns() { | |||
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; |