author | tille <tille> | 2003-05-24 16:12:02 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-24 16:12:02 (UTC) |
commit | cc1aa3e178dff65854913bd5667579fc33ce707d (patch) (unidiff) | |
tree | d37d7fd8fb3b9832c0825b015af862f2cc62f473 /noncore/settings/networksettings/ppp/connect.cpp | |
parent | 5667ded1d4583cfb79b2ddfd7aaae0e58ed6d552 (diff) | |
download | opie-cc1aa3e178dff65854913bd5667579fc33ce707d.zip opie-cc1aa3e178dff65854913bd5667579fc33ce707d.tar.gz opie-cc1aa3e178dff65854913bd5667579fc33ce707d.tar.bz2 |
saves config (still in the kppp way)
Diffstat (limited to 'noncore/settings/networksettings/ppp/connect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 180 |
1 files changed, 90 insertions, 90 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index b7e229e..a3eda9d 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -179,7 +179,7 @@ void ConnectWidget::preinit() { | |||
179 | 179 | ||
180 | 180 | ||
181 | void ConnectWidget::init() { | 181 | void ConnectWidget::init() { |
182 | gpppdata.setpppdError(0); | 182 | PPPData::data()->setpppdError(0); |
183 | inittimer->stop(); | 183 | inittimer->stop(); |
184 | vmain = 0; | 184 | vmain = 0; |
185 | substate = -1; | 185 | substate = -1; |
@@ -196,24 +196,24 @@ void ConnectWidget::init() { | |||
196 | 196 | ||
197 | p_kppp->con_speed = ""; | 197 | p_kppp->con_speed = ""; |
198 | 198 | ||
199 | // p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || gpppdata.quit_on_disconnect()); | 199 | // p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || PPPData::data()->quit_on_disconnect()); |
200 | 200 | ||
201 | comlist = &gpppdata.scriptType(); | 201 | comlist = &PPPData::data()->scriptType(); |
202 | arglist = &gpppdata.script(); | 202 | arglist = &PPPData::data()->script(); |
203 | 203 | ||
204 | QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); | 204 | QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); |
205 | setCaption(tit); | 205 | setCaption(tit); |
206 | 206 | ||
207 | qApp->processEvents(); | 207 | qApp->processEvents(); |
208 | 208 | ||
209 | // run the "before-connect" command | 209 | // run the "before-connect" command |
210 | if (!gpppdata.command_before_connect().isEmpty()) { | 210 | if (!PPPData::data()->command_before_connect().isEmpty()) { |
211 | messg->setText(i18n("Running pre-startup command...")); | 211 | messg->setText(i18n("Running pre-startup command...")); |
212 | emit debugMessage(i18n("Running pre-startup command...")); | 212 | emit debugMessage(i18n("Running pre-startup command...")); |
213 | 213 | ||
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | QApplication::flushX(); | 215 | QApplication::flushX(); |
216 | pid_t id = execute_command(gpppdata.command_before_connect()); | 216 | pid_t id = execute_command(PPPData::data()->command_before_connect()); |
217 | // int i, status; | 217 | // int i, status; |
218 | 218 | ||
219 | // do { | 219 | // do { |
@@ -250,7 +250,7 @@ void ConnectWidget::init() { | |||
250 | Modem::modem->notify(this, SLOT(readChar(unsigned char))); | 250 | Modem::modem->notify(this, SLOT(readChar(unsigned char))); |
251 | 251 | ||
252 | // if we are stuck anywhere we will time out | 252 | // if we are stuck anywhere we will time out |
253 | timeout_timer->start(gpppdata.modemTimeout()*1000); | 253 | timeout_timer->start(PPPData::data()->modemTimeout()*1000); |
254 | 254 | ||
255 | // this timer will run the script etc. | 255 | // this timer will run the script etc. |
256 | main_timer_ID = startTimer(10); | 256 | main_timer_ID = startTimer(10); |
@@ -284,18 +284,18 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
284 | substate = 0; | 284 | substate = 0; |
285 | } | 285 | } |
286 | 286 | ||
287 | QString initStr = gpppdata.modemInitStr(substate); | 287 | QString initStr = PPPData::data()->modemInitStr(substate); |
288 | if (!initStr.isEmpty()) { | 288 | if (!initStr.isEmpty()) { |
289 | // send a carriage return and then wait a bit so that the modem will | 289 | // send a carriage return and then wait a bit so that the modem will |
290 | // let us issue commands. | 290 | // let us issue commands. |
291 | if(gpppdata.modemPreInitDelay() > 0) { | 291 | if(PPPData::data()->modemPreInitDelay() > 0) { |
292 | usleep(gpppdata.modemPreInitDelay() * 5000); | 292 | usleep(PPPData::data()->modemPreInitDelay() * 5000); |
293 | writeline(""); | 293 | writeline(""); |
294 | usleep(gpppdata.modemPreInitDelay() * 5000); | 294 | usleep(PPPData::data()->modemPreInitDelay() * 5000); |
295 | } | 295 | } |
296 | setExpect(gpppdata.modemInitResp()); | 296 | setExpect(PPPData::data()->modemInitResp()); |
297 | writeline(initStr); | 297 | writeline(initStr); |
298 | usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec | 298 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec |
299 | } | 299 | } |
300 | 300 | ||
301 | substate++; | 301 | substate++; |
@@ -306,7 +306,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
306 | * Speed Dragon). Even better would be to detect this when doing | 306 | * Speed Dragon). Even better would be to detect this when doing |
307 | * a "Modem Query" | 307 | * a "Modem Query" |
308 | */ | 308 | */ |
309 | if (MODEM_TONEDURATION != gpppdata.modemToneDuration()) | 309 | if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration()) |
310 | vmain = 5; | 310 | vmain = 5; |
311 | else | 311 | else |
312 | vmain = 3; | 312 | vmain = 3; |
@@ -316,11 +316,11 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
316 | 316 | ||
317 | if (vmain == 5) { | 317 | if (vmain == 5) { |
318 | if(!expecting) { | 318 | if(!expecting) { |
319 | QString sToneDuration = "ATS11=" + QString::number(gpppdata.modemToneDuration()); | 319 | QString sToneDuration = "ATS11=" + QString::number(PPPData::data()->modemToneDuration()); |
320 | QString msg = i18n("Setting ") + sToneDuration; | 320 | QString msg = i18n("Setting ") + sToneDuration; |
321 | messg->setText(msg); | 321 | messg->setText(msg); |
322 | emit debugMessage(msg); | 322 | emit debugMessage(msg); |
323 | setExpect(gpppdata.modemInitResp()); | 323 | setExpect(PPPData::data()->modemInitResp()); |
324 | writeline(sToneDuration); | 324 | writeline(sToneDuration); |
325 | } | 325 | } |
326 | vmain = 3; | 326 | vmain = 3; |
@@ -336,18 +336,18 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
336 | } | 336 | } |
337 | substate = -1; | 337 | substate = -1; |
338 | // skip setting the volume if command is empty | 338 | // skip setting the volume if command is empty |
339 | if(gpppdata.volumeInitString().isEmpty()) { | 339 | if(PPPData::data()->volumeInitString().isEmpty()) { |
340 | vmain = 4; | 340 | vmain = 4; |
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | messg->setText(i18n("Setting speaker volume...")); | 343 | messg->setText(i18n("Setting speaker volume...")); |
344 | emit debugMessage(i18n("Setting speaker volume...")); | 344 | emit debugMessage(i18n("Setting speaker volume...")); |
345 | 345 | ||
346 | setExpect(gpppdata.modemInitResp()); | 346 | setExpect(PPPData::data()->modemInitResp()); |
347 | QString vol("AT"); | 347 | QString vol("AT"); |
348 | vol += gpppdata.volumeInitString(); | 348 | vol += PPPData::data()->volumeInitString(); |
349 | writeline(vol); | 349 | writeline(vol); |
350 | usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec | 350 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec |
351 | vmain = 4; | 351 | vmain = 4; |
352 | return; | 352 | return; |
353 | } | 353 | } |
@@ -355,12 +355,12 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
355 | 355 | ||
356 | if(vmain == 4) { | 356 | if(vmain == 4) { |
357 | if(!expecting) { | 357 | if(!expecting) { |
358 | if(!gpppdata.waitForDialTone()) { | 358 | if(!PPPData::data()->waitForDialTone()) { |
359 | QString msg = i18n("Turning off dial tone waiting..."); | 359 | QString msg = i18n("Turning off dial tone waiting..."); |
360 | messg->setText(msg); | 360 | messg->setText(msg); |
361 | emit debugMessage(msg); | 361 | emit debugMessage(msg); |
362 | setExpect(gpppdata.modemInitResp()); | 362 | setExpect(PPPData::data()->modemInitResp()); |
363 | writeline(gpppdata.modemNoDialToneDetectionStr()); | 363 | writeline(PPPData::data()->modemNoDialToneDetectionStr()); |
364 | } | 364 | } |
365 | vmain = 1; | 365 | vmain = 1; |
366 | return; | 366 | return; |
@@ -372,23 +372,23 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
372 | if(!expecting) { | 372 | if(!expecting) { |
373 | 373 | ||
374 | timeout_timer->stop(); | 374 | timeout_timer->stop(); |
375 | timeout_timer->start(gpppdata.modemTimeout()*1000); | 375 | timeout_timer->start(PPPData::data()->modemTimeout()*1000); |
376 | 376 | ||
377 | QStringList &plist = gpppdata.phonenumbers(); | 377 | QStringList &plist = PPPData::data()->phonenumbers(); |
378 | QString bmarg= gpppdata.dialPrefix(); | 378 | QString bmarg= PPPData::data()->dialPrefix(); |
379 | bmarg += *plist.at(dialnumber); | 379 | bmarg += *plist.at(dialnumber); |
380 | QString bm = i18n("Dialing %1").arg(bmarg); | 380 | QString bm = i18n("Dialing %1").arg(bmarg); |
381 | messg->setText(bm); | 381 | messg->setText(bm); |
382 | emit debugMessage(bm); | 382 | emit debugMessage(bm); |
383 | 383 | ||
384 | QString pn = gpppdata.modemDialStr(); | 384 | QString pn = PPPData::data()->modemDialStr(); |
385 | pn += gpppdata.dialPrefix(); | 385 | pn += PPPData::data()->dialPrefix(); |
386 | pn += *plist.at(dialnumber); | 386 | pn += *plist.at(dialnumber); |
387 | if(++dialnumber >= plist.count()) | 387 | if(++dialnumber >= plist.count()) |
388 | dialnumber = 0; | 388 | dialnumber = 0; |
389 | writeline(pn); | 389 | writeline(pn); |
390 | 390 | ||
391 | setExpect(gpppdata.modemConnectResp()); | 391 | setExpect(PPPData::data()->modemConnectResp()); |
392 | vmain = 100; | 392 | vmain = 100; |
393 | return; | 393 | return; |
394 | } | 394 | } |
@@ -398,28 +398,28 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
398 | // if NO CARRIER or NO DIALTONE | 398 | // if NO CARRIER or NO DIALTONE |
399 | if(vmain == 100) { | 399 | if(vmain == 100) { |
400 | if(!expecting) { | 400 | if(!expecting) { |
401 | myreadbuffer = gpppdata.modemConnectResp(); | 401 | myreadbuffer = PPPData::data()->modemConnectResp(); |
402 | setExpect("\n"); | 402 | setExpect("\n"); |
403 | vmain = 101; | 403 | vmain = 101; |
404 | return; | 404 | return; |
405 | } | 405 | } |
406 | 406 | ||
407 | if(readbuffer.contains(gpppdata.modemBusyResp())) { | 407 | if(readbuffer.contains(PPPData::data()->modemBusyResp())) { |
408 | timeout_timer->stop(); | 408 | timeout_timer->stop(); |
409 | timeout_timer->start(gpppdata.modemTimeout()*1000); | 409 | timeout_timer->start(PPPData::data()->modemTimeout()*1000); |
410 | 410 | ||
411 | messg->setText(i18n("Line busy. Hanging up...")); | 411 | messg->setText(i18n("Line busy. Hanging up...")); |
412 | emit debugPutChar('\n'); | 412 | emit debugPutChar('\n'); |
413 | Modem::modem->hangup(); | 413 | Modem::modem->hangup(); |
414 | 414 | ||
415 | if(gpppdata.busyWait() > 0) { | 415 | if(PPPData::data()->busyWait() > 0) { |
416 | QString bm = i18n("Line busy. Waiting: %1 seconds").arg(gpppdata.busyWait()); | 416 | QString bm = i18n("Line busy. Waiting: %1 seconds").arg(PPPData::data()->busyWait()); |
417 | messg->setText(bm); | 417 | messg->setText(bm); |
418 | emit debugMessage(bm); | 418 | emit debugMessage(bm); |
419 | 419 | ||
420 | pausing = true; | 420 | pausing = true; |
421 | 421 | ||
422 | pausetimer->start(gpppdata.busyWait()*1000, true); | 422 | pausetimer->start(PPPData::data()->busyWait()*1000, true); |
423 | timeout_timer->stop(); | 423 | timeout_timer->stop(); |
424 | } | 424 | } |
425 | 425 | ||
@@ -429,7 +429,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
429 | return; | 429 | return; |
430 | } | 430 | } |
431 | 431 | ||
432 | if(readbuffer.contains(gpppdata.modemNoDialtoneResp())) { | 432 | if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) { |
433 | timeout_timer->stop(); | 433 | timeout_timer->stop(); |
434 | 434 | ||
435 | messg->setText(i18n("No Dialtone")); | 435 | messg->setText(i18n("No Dialtone")); |
@@ -438,7 +438,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | 440 | ||
441 | if(readbuffer.contains(gpppdata.modemNoCarrierResp())) { | 441 | if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) { |
442 | timeout_timer->stop(); | 442 | timeout_timer->stop(); |
443 | 443 | ||
444 | messg->setText(i18n("No Carrier")); | 444 | messg->setText(i18n("No Carrier")); |
@@ -457,7 +457,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
457 | // p_kppp->con_win->startClock(); | 457 | // p_kppp->con_win->startClock(); |
458 | 458 | ||
459 | vmain = 2; | 459 | vmain = 2; |
460 | scriptTimeout=gpppdata.modemTimeout()*1000; | 460 | scriptTimeout=PPPData::data()->modemTimeout()*1000; |
461 | return; | 461 | return; |
462 | } | 462 | } |
463 | } | 463 | } |
@@ -494,10 +494,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
494 | emit debugMessage(bm); | 494 | emit debugMessage(bm); |
495 | 495 | ||
496 | if (scriptArgument.lower() == "password") { | 496 | if (scriptArgument.lower() == "password") { |
497 | gpppdata.setPassword(scanvar); | 497 | PPPData::data()->setPassword(scanvar); |
498 | p_kppp->setPW_Edit(scanvar); | 498 | p_kppp->setPW_Edit(scanvar); |
499 | if(gpppdata.storePassword()) | 499 | if(PPPData::data()->storePassword()) |
500 | gpppdata.setStoredPassword(scanvar); | 500 | PPPData::data()->setStoredPassword(scanvar); |
501 | firstrunPW = true; | 501 | firstrunPW = true; |
502 | } | 502 | } |
503 | 503 | ||
@@ -513,8 +513,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
513 | QString arg = scriptArgument; | 513 | QString arg = scriptArgument; |
514 | QRegExp re1("%USERNAME%"); | 514 | QRegExp re1("%USERNAME%"); |
515 | QRegExp re2("%PASSWORD%"); | 515 | QRegExp re2("%PASSWORD%"); |
516 | arg = arg.replace(re1, gpppdata.storedUsername()); | 516 | arg = arg.replace(re1, PPPData::data()->storedUsername()); |
517 | arg = arg.replace(re2, gpppdata.storedPassword()); | 517 | arg = arg.replace(re2, PPPData::data()->storedPassword()); |
518 | 518 | ||
519 | if (scriptCommand == "Send") | 519 | if (scriptCommand == "Send") |
520 | bm = bm.arg(scriptArgument); | 520 | bm = bm.arg(scriptArgument); |
@@ -578,8 +578,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
578 | messg->setText(i18n("Hangup")); | 578 | messg->setText(i18n("Hangup")); |
579 | emit debugMessage(i18n("Hangup")); | 579 | emit debugMessage(i18n("Hangup")); |
580 | 580 | ||
581 | writeline(gpppdata.modemHangupStr()); | 581 | writeline(PPPData::data()->modemHangupStr()); |
582 | setExpect(gpppdata.modemHangupResp()); | 582 | setExpect(PPPData::data()->modemHangupResp()); |
583 | 583 | ||
584 | scriptindex++; | 584 | scriptindex++; |
585 | return; | 585 | return; |
@@ -592,7 +592,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
592 | messg->setText(i18n("Answer")); | 592 | messg->setText(i18n("Answer")); |
593 | emit debugMessage(i18n("Answer")); | 593 | emit debugMessage(i18n("Answer")); |
594 | 594 | ||
595 | setExpect(gpppdata.modemRingResp()); | 595 | setExpect(PPPData::data()->modemRingResp()); |
596 | vmain = 150; | 596 | vmain = 150; |
597 | return; | 597 | return; |
598 | } | 598 | } |
@@ -602,7 +602,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
602 | messg->setText(bm); | 602 | messg->setText(bm); |
603 | emit debugMessage(bm); | 603 | emit debugMessage(bm); |
604 | 604 | ||
605 | QString idstring = gpppdata.storedUsername(); | 605 | QString idstring = PPPData::data()->storedUsername(); |
606 | 606 | ||
607 | if(!idstring.isEmpty() && firstrunID) { | 607 | if(!idstring.isEmpty() && firstrunID) { |
608 | // the user entered an Id on the main kppp dialog | 608 | // the user entered an Id on the main kppp dialog |
@@ -638,7 +638,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
638 | messg->setText(bm); | 638 | messg->setText(bm); |
639 | emit debugMessage(bm); | 639 | emit debugMessage(bm); |
640 | 640 | ||
641 | QString pwstring = gpppdata.password(); | 641 | QString pwstring = PPPData::data()->password(); |
642 | 642 | ||
643 | if(!pwstring.isEmpty() && firstrunPW) { | 643 | if(!pwstring.isEmpty() && firstrunPW) { |
644 | // the user entered a password on the main kppp dialog | 644 | // the user entered a password on the main kppp dialog |
@@ -785,8 +785,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
785 | 785 | ||
786 | if(vmain == 150) { | 786 | if(vmain == 150) { |
787 | if(!expecting) { | 787 | if(!expecting) { |
788 | writeline(gpppdata.modemAnswerStr()); | 788 | writeline(PPPData::data()->modemAnswerStr()); |
789 | setExpect(gpppdata.modemAnswerResp()); | 789 | setExpect(PPPData::data()->modemAnswerResp()); |
790 | 790 | ||
791 | vmain = 2; | 791 | vmain = 2; |
792 | scriptindex++; | 792 | scriptindex++; |
@@ -814,7 +814,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
814 | // stop reading of data | 814 | // stop reading of data |
815 | Modem::modem->stop(); | 815 | Modem::modem->stop(); |
816 | 816 | ||
817 | if(gpppdata.authMethod() == AUTH_TERMINAL) { | 817 | if(PPPData::data()->authMethod() == AUTH_TERMINAL) { |
818 | // if (termwindow) { | 818 | // if (termwindow) { |
819 | // delete termwindow; | 819 | // delete termwindow; |
820 | // termwindow = 0L; | 820 | // termwindow = 0L; |
@@ -835,8 +835,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
835 | 835 | ||
836 | killTimer( main_timer_ID ); | 836 | killTimer( main_timer_ID ); |
837 | 837 | ||
838 | if_timeout_timer->start(gpppdata.pppdTimeout()*1000); | 838 | if_timeout_timer->start(PPPData::data()->pppdTimeout()*1000); |
839 | qDebug( "started if timeout timer with %i", gpppdata.pppdTimeout()*1000); | 839 | qDebug( "started if timeout timer with %i", PPPData::data()->pppdTimeout()*1000); |
840 | 840 | ||
841 | // find out PPP interface and notify the stats module | 841 | // find out PPP interface and notify the stats module |
842 | // stats->setUnit(pppInterfaceNumber()); | 842 | // stats->setUnit(pppInterfaceNumber()); |
@@ -849,7 +849,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
849 | qDebug("execppp() returned with return-code %i", result ); | 849 | qDebug("execppp() returned with return-code %i", result ); |
850 | 850 | ||
851 | if(result) { | 851 | if(result) { |
852 | if(!gpppdata.autoDNS()) | 852 | if(!PPPData::data()->autoDNS()) |
853 | adddns(); | 853 | adddns(); |
854 | 854 | ||
855 | // O.K we are done here, let's change over to the if_waiting loop | 855 | // O.K we are done here, let's change over to the if_waiting loop |
@@ -1063,7 +1063,7 @@ void ConnectWidget::if_waiting_timed_out() { | |||
1063 | if_timeout_timer->stop(); | 1063 | if_timeout_timer->stop(); |
1064 | qDebug("if_waiting_timed_out()"); | 1064 | qDebug("if_waiting_timed_out()"); |
1065 | 1065 | ||
1066 | gpppdata.setpppdError(E_IF_TIMEOUT); | 1066 | PPPData::data()->setpppdError(E_IF_TIMEOUT); |
1067 | 1067 | ||
1068 | // let's kill the stuck pppd | 1068 | // let's kill the stuck pppd |
1069 | Modem::modem->killPPPDaemon(); | 1069 | Modem::modem->killPPPDaemon(); |
@@ -1088,7 +1088,7 @@ void ConnectWidget::if_waiting_slot() { | |||
1088 | 1088 | ||
1089 | // if(!stats->ifIsUp()) { | 1089 | // if(!stats->ifIsUp()) { |
1090 | 1090 | ||
1091 | // if(gpppdata.pppdError() != 0) { | 1091 | // if(PPPData::data()->pppdError() != 0) { |
1092 | // // we are here if pppd died immediately after starting it. | 1092 | // // we are here if pppd died immediately after starting it. |
1093 | // pppdDied(); | 1093 | // pppdDied(); |
1094 | // // error message handled in main.cpp: sigPPPDDied() | 1094 | // // error message handled in main.cpp: sigPPPDDied() |
@@ -1105,7 +1105,7 @@ void ConnectWidget::if_waiting_slot() { | |||
1105 | if_timer->stop(); | 1105 | if_timer->stop(); |
1106 | usleep(200000); | 1106 | usleep(200000); |
1107 | 1107 | ||
1108 | if(gpppdata.autoDNS()) | 1108 | if(PPPData::data()->autoDNS()) |
1109 | addpeerdns(); | 1109 | addpeerdns(); |
1110 | 1110 | ||
1111 | // Close the debugging window. If we are connected, we | 1111 | // Close the debugging window. If we are connected, we |
@@ -1114,12 +1114,12 @@ void ConnectWidget::if_waiting_slot() { | |||
1114 | // p_kppp->statdlg->take_stats(); // start taking ppp statistics | 1114 | // p_kppp->statdlg->take_stats(); // start taking ppp statistics |
1115 | auto_hostname(); | 1115 | auto_hostname(); |
1116 | 1116 | ||
1117 | if(!gpppdata.command_on_connect().isEmpty()) { | 1117 | if(!PPPData::data()->command_on_connect().isEmpty()) { |
1118 | messg->setText(i18n("Running startup command...")); | 1118 | messg->setText(i18n("Running startup command...")); |
1119 | 1119 | ||
1120 | // make sure that we don't get any async errors | 1120 | // make sure that we don't get any async errors |
1121 | qApp->flushX(); | 1121 | qApp->flushX(); |
1122 | execute_command(gpppdata.command_on_connect()); | 1122 | execute_command(PPPData::data()->command_on_connect()); |
1123 | messg->setText(i18n("Done")); | 1123 | messg->setText(i18n("Done")); |
1124 | } | 1124 | } |
1125 | 1125 | ||
@@ -1141,7 +1141,7 @@ void ConnectWidget::if_waiting_slot() { | |||
1141 | // else | 1141 | // else |
1142 | // p_kppp->con_win->accounting(false); | 1142 | // p_kppp->con_win->accounting(false); |
1143 | 1143 | ||
1144 | if (gpppdata.get_dock_into_panel()) { | 1144 | if (PPPData::data()->get_dock_into_panel()) { |
1145 | // DockWidget::dock_widget->show(); | 1145 | // DockWidget::dock_widget->show(); |
1146 | // DockWidget::dock_widget->take_stats(); | 1146 | // DockWidget::dock_widget->take_stats(); |
1147 | // this->hide(); | 1147 | // this->hide(); |
@@ -1149,7 +1149,7 @@ void ConnectWidget::if_waiting_slot() { | |||
1149 | else { | 1149 | else { |
1150 | // p_kppp->con_win->show(); | 1150 | // p_kppp->con_win->show(); |
1151 | 1151 | ||
1152 | if(gpppdata.get_iconify_on_connect()) { | 1152 | if(PPPData::data()->get_iconify_on_connect()) { |
1153 | // p_kppp->con_win->showMinimized(); | 1153 | // p_kppp->con_win->showMinimized(); |
1154 | } | 1154 | } |
1155 | } | 1155 | } |
@@ -1168,17 +1168,17 @@ bool ConnectWidget::execppp() { | |||
1168 | // we'll simply leave this argument away. pppd will then use the default tty | 1168 | // we'll simply leave this argument away. pppd will then use the default tty |
1169 | // which is the serial port we connected stdin/stdout to in opener.cpp. | 1169 | // which is the serial port we connected stdin/stdout to in opener.cpp. |
1170 | // command += " "; | 1170 | // command += " "; |
1171 | // command += gpppdata.modemDevice(); | 1171 | // command += PPPData::data()->modemDevice(); |
1172 | 1172 | ||
1173 | command += " " + gpppdata.speed(); | 1173 | command += " " + PPPData::data()->speed(); |
1174 | 1174 | ||
1175 | command += " -detach"; | 1175 | command += " -detach"; |
1176 | 1176 | ||
1177 | if(gpppdata.ipaddr() != "0.0.0.0" || | 1177 | if(PPPData::data()->ipaddr() != "0.0.0.0" || |
1178 | gpppdata.gateway() != "0.0.0.0") { | 1178 | PPPData::data()->gateway() != "0.0.0.0") { |
1179 | if(gpppdata.ipaddr() != "0.0.0.0") { | 1179 | if(PPPData::data()->ipaddr() != "0.0.0.0") { |
1180 | command += " "; | 1180 | command += " "; |
1181 | command += gpppdata.ipaddr(); | 1181 | command += PPPData::data()->ipaddr(); |
1182 | command += ":"; | 1182 | command += ":"; |
1183 | } | 1183 | } |
1184 | else { | 1184 | else { |
@@ -1186,27 +1186,27 @@ bool ConnectWidget::execppp() { | |||
1186 | command += ":"; | 1186 | command += ":"; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | if(gpppdata.gateway() != "0.0.0.0") | 1189 | if(PPPData::data()->gateway() != "0.0.0.0") |
1190 | command += gpppdata.gateway(); | 1190 | command += PPPData::data()->gateway(); |
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | if(gpppdata.subnetmask() != "0.0.0.0") | 1193 | if(PPPData::data()->subnetmask() != "0.0.0.0") |
1194 | command += " netmask " + gpppdata.subnetmask(); | 1194 | command += " netmask " + PPPData::data()->subnetmask(); |
1195 | 1195 | ||
1196 | if(gpppdata.flowcontrol() != "None") { | 1196 | if(PPPData::data()->flowcontrol() != "None") { |
1197 | if(gpppdata.flowcontrol() == "CRTSCTS") | 1197 | if(PPPData::data()->flowcontrol() == "CRTSCTS") |
1198 | command += " crtscts"; | 1198 | command += " crtscts"; |
1199 | else | 1199 | else |
1200 | command += " xonxoff"; | 1200 | command += " xonxoff"; |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | if(gpppdata.defaultroute()) | 1203 | if(PPPData::data()->defaultroute()) |
1204 | command += " defaultroute"; | 1204 | command += " defaultroute"; |
1205 | 1205 | ||
1206 | if(gpppdata.autoDNS()) | 1206 | if(PPPData::data()->autoDNS()) |
1207 | command += " usepeerdns"; | 1207 | command += " usepeerdns"; |
1208 | 1208 | ||
1209 | QStringList &arglist = gpppdata.pppdArgument(); | 1209 | QStringList &arglist = PPPData::data()->pppdArgument(); |
1210 | for ( QStringList::Iterator it = arglist.begin(); | 1210 | for ( QStringList::Iterator it = arglist.begin(); |
1211 | it != arglist.end(); | 1211 | it != arglist.end(); |
1212 | ++it ) | 1212 | ++it ) |
@@ -1215,25 +1215,25 @@ bool ConnectWidget::execppp() { | |||
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | // PAP settings | 1217 | // PAP settings |
1218 | if(gpppdata.authMethod() == AUTH_PAP) { | 1218 | if(PPPData::data()->authMethod() == AUTH_PAP) { |
1219 | command += " -chap user "; | 1219 | command += " -chap user "; |
1220 | command = command + "\"" + gpppdata.storedUsername() + "\""; | 1220 | command = command + "\"" + PPPData::data()->storedUsername() + "\""; |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | // CHAP settings | 1223 | // CHAP settings |
1224 | if(gpppdata.authMethod() == AUTH_CHAP) { | 1224 | if(PPPData::data()->authMethod() == AUTH_CHAP) { |
1225 | command += " -pap user "; | 1225 | command += " -pap user "; |
1226 | command = command + "\"" + gpppdata.storedUsername() + "\""; | 1226 | command = command + "\"" + PPPData::data()->storedUsername() + "\""; |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | // PAP/CHAP settings | 1229 | // PAP/CHAP settings |
1230 | if(gpppdata.authMethod() == AUTH_PAPCHAP) { | 1230 | if(PPPData::data()->authMethod() == AUTH_PAPCHAP) { |
1231 | command += " user "; | 1231 | command += " user "; |
1232 | command = command + "\"" + gpppdata.storedUsername() + "\""; | 1232 | command = command + "\"" + PPPData::data()->storedUsername() + "\""; |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | // check for debug | 1235 | // check for debug |
1236 | if(gpppdata.getPPPDebug()) | 1236 | if(PPPData::data()->getPPPDebug()) |
1237 | command += " debug"; | 1237 | command += " debug"; |
1238 | 1238 | ||
1239 | if (command.length() > MAX_CMDLEN) { | 1239 | if (command.length() > MAX_CMDLEN) { |
@@ -1277,8 +1277,8 @@ void auto_hostname() { | |||
1277 | tmp_str[sizeof(tmp_str)-1]=0; // panic | 1277 | tmp_str[sizeof(tmp_str)-1]=0; // panic |
1278 | old_hostname=tmp_str; // copy to QString | 1278 | old_hostname=tmp_str; // copy to QString |
1279 | 1279 | ||
1280 | // if (!p_kppp->stats->local_ip_address.isEmpty() && gpppdata.autoname()) { | 1280 | // if (!p_kppp->stats->local_ip_address.isEmpty() && PPPData::data()->autoname()) { |
1281 | if ( gpppdata.autoname()) { | 1281 | if ( PPPData::data()->autoname()) { |
1282 | // local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii()); | 1282 | // 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); | 1283 | hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET); |
1284 | 1284 | ||
@@ -1332,7 +1332,7 @@ void add_domain(const QString &domain) { | |||
1332 | if((resolv[j].contains("domain") || | 1332 | if((resolv[j].contains("domain") || |
1333 | ( resolv[j].contains("nameserver") | 1333 | ( resolv[j].contains("nameserver") |
1334 | && !resolv[j].contains("#kppp temp entry") | 1334 | && !resolv[j].contains("#kppp temp entry") |
1335 | && gpppdata.exDNSDisabled())) | 1335 | && PPPData::data()->exDNSDisabled())) |
1336 | && !resolv[j].contains("#entry disabled by kppp")) { | 1336 | && !resolv[j].contains("#entry disabled by kppp")) { |
1337 | QCString tmp = "# " + resolv[j].local8Bit() + | 1337 | QCString tmp = "# " + resolv[j].local8Bit() + |
1338 | " \t#entry disabled by kppp\n"; | 1338 | " \t#entry disabled by kppp\n"; |
@@ -1355,7 +1355,7 @@ void adddns() | |||
1355 | int fd; | 1355 | int fd; |
1356 | 1356 | ||
1357 | if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { | 1357 | if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { |
1358 | QStringList &dnslist = gpppdata.dns(); | 1358 | QStringList &dnslist = PPPData::data()->dns(); |
1359 | for ( QStringList::Iterator it = dnslist.begin(); | 1359 | for ( QStringList::Iterator it = dnslist.begin(); |
1360 | it != dnslist.end(); | 1360 | it != dnslist.end(); |
1361 | ++it ) | 1361 | ++it ) |
@@ -1366,7 +1366,7 @@ void adddns() | |||
1366 | } | 1366 | } |
1367 | close(fd); | 1367 | close(fd); |
1368 | } | 1368 | } |
1369 | add_domain(gpppdata.domain()); | 1369 | add_domain(PPPData::data()->domain()); |
1370 | } | 1370 | } |
1371 | 1371 | ||
1372 | void addpeerdns() { | 1372 | void addpeerdns() { |
@@ -1387,7 +1387,7 @@ void addpeerdns() { | |||
1387 | fprintf(stderr, "failed to read from /etc/ppp/resolv.conf\n"); | 1387 | fprintf(stderr, "failed to read from /etc/ppp/resolv.conf\n"); |
1388 | close(fd); | 1388 | close(fd); |
1389 | } | 1389 | } |
1390 | add_domain(gpppdata.domain()); | 1390 | add_domain(PPPData::data()->domain()); |
1391 | } | 1391 | } |
1392 | 1392 | ||
1393 | // remove the dns entries from the /etc/resolv.conf file | 1393 | // remove the dns entries from the /etc/resolv.conf file |