Diffstat (limited to 'noncore/settings/networksettings/ppp/connect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 166 |
1 files changed, 95 insertions, 71 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index 2400d7b..e3fab24 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -31,9 +31,8 @@ | |||
31 | 31 | ||
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <kdebug.h> | 33 | //#include <kdebug.h> |
34 | //#include <klocale.h> | 34 | //#include <klocale.h> |
35 | #define i18n QObject::tr | ||
36 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
37 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
38 | 37 | ||
39 | #include <unistd.h> | 38 | #include <unistd.h> |
@@ -98,40 +97,40 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam | |||
98 | { | 97 | { |
99 | modified_hostname = false; | 98 | modified_hostname = false; |
100 | 99 | ||
101 | QVBoxLayout *tl = new QVBoxLayout(this, 8, 10); | 100 | QVBoxLayout *tl = new QVBoxLayout(this, 8, 10); |
102 | QString tit = i18n("Connecting to: "); | 101 | QString tit = QObject::tr("Connecting to: "); |
103 | setCaption(tit); | 102 | setCaption(tit); |
104 | 103 | ||
105 | QHBoxLayout *l0 = new QHBoxLayout(10); | 104 | QHBoxLayout *l0 = new QHBoxLayout(10); |
106 | tl->addLayout(l0); | 105 | tl->addLayout(l0); |
107 | l0->addSpacing(10); | 106 | l0->addSpacing(10); |
108 | messg = new QLabel(this, "messg"); | 107 | messg = new QLabel(this, "messg"); |
109 | messg->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 108 | messg->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
110 | messg->setAlignment(AlignCenter); | 109 | messg->setAlignment(AlignCenter); |
111 | messg->setText(i18n("Unable to create modem lock file.")); | 110 | messg->setText(QObject::tr("Unable to create modem lock file.")); |
112 | messg->setMinimumHeight(messg->sizeHint().height() + 5); | 111 | messg->setMinimumHeight(messg->sizeHint().height() + 5); |
113 | // int messw = (messg->sizeHint().width() * 12) / 10; | 112 | // int messw = (messg->sizeHint().width() * 12) / 10; |
114 | // messw = QMAX(messw,280); | 113 | // messw = QMAX(messw,280); |
115 | // messg->setMinimumWidth(messw); | 114 | // messg->setMinimumWidth(messw); |
116 | if (_ifaceppp->getStatus()) | 115 | if (_ifaceppp->getStatus()) |
117 | messg->setText(i18n("Online")); | 116 | messg->setText(QObject::tr("Online")); |
118 | else | 117 | else |
119 | messg->setText(i18n("Offline")); | 118 | messg->setText(QObject::tr("Offline")); |
120 | l0->addSpacing(10); | 119 | l0->addSpacing(10); |
121 | l0->addWidget(messg); | 120 | l0->addWidget(messg); |
122 | l0->addSpacing(10); | 121 | l0->addSpacing(10); |
123 | 122 | ||
124 | QHBoxLayout *l1 = new QHBoxLayout(10); | 123 | QHBoxLayout *l1 = new QHBoxLayout(10); |
125 | tl->addLayout(l1); | 124 | tl->addLayout(l1); |
126 | l1->addStretch(1); | 125 | l1->addStretch(1); |
127 | 126 | ||
128 | debug = new QPushButton(i18n("Log"), this); | 127 | debug = new QPushButton(QObject::tr("Log"), this); |
129 | debug->setToggleButton(true); | 128 | debug->setToggleButton(true); |
130 | debug->setEnabled( false ); // FIXME: disable the log button | 129 | debug->setEnabled( false ); // FIXME: disable the log button |
131 | connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); | 130 | connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow())); |
132 | 131 | ||
133 | cancel = new QPushButton(i18n("Cancel"), this); | 132 | cancel = new QPushButton(QObject::tr("Cancel"), this); |
134 | cancel->setFocus(); | 133 | cancel->setFocus(); |
135 | connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton())); | 134 | connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton())); |
136 | 135 | ||
137 | // int maxw = QMAX(cancel->sizeHint().width(), | 136 | // int maxw = QMAX(cancel->sizeHint().width(), |
@@ -172,9 +171,9 @@ ConnectWidget::~ConnectWidget() { | |||
172 | 171 | ||
173 | void ConnectWidget::preinit() { | 172 | void ConnectWidget::preinit() { |
174 | // this is all just to keep the GUI nice and snappy .... | 173 | // this is all just to keep the GUI nice and snappy .... |
175 | // you have to see to believe ... | 174 | // you have to see to believe ... |
176 | messg->setText(i18n("Looking for modem...")); | 175 | messg->setText(QObject::tr("Looking for modem...")); |
177 | inittimer->start(100); | 176 | inittimer->start(100); |
178 | } | 177 | } |
179 | 178 | ||
180 | 179 | ||
@@ -200,17 +199,17 @@ void ConnectWidget::init() { | |||
200 | 199 | ||
201 | comlist = &_ifaceppp->data()->scriptType(); | 200 | comlist = &_ifaceppp->data()->scriptType(); |
202 | arglist = &_ifaceppp->data()->script(); | 201 | arglist = &_ifaceppp->data()->script(); |
203 | 202 | ||
204 | QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname()); | 203 | QString tit = QObject::tr("Connecting to: %1").arg(_ifaceppp->data()->accname()); |
205 | setCaption(tit); | 204 | setCaption(tit); |
206 | 205 | ||
207 | qApp->processEvents(); | 206 | qApp->processEvents(); |
208 | 207 | ||
209 | // run the "before-connect" command | 208 | // run the "before-connect" command |
210 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { | 209 | if (!_ifaceppp->data()->command_before_connect().isEmpty()) { |
211 | messg->setText(i18n("Running pre-startup command...")); | 210 | messg->setText(QObject::tr("Running pre-startup command...")); |
212 | emit debugMessage(i18n("Running pre-startup command...")); | 211 | emit debugMessage(QObject::tr("Running pre-startup command...")); |
213 | 212 | ||
214 | qApp->processEvents(); | 213 | qApp->processEvents(); |
215 | QApplication::flushX(); | 214 | QApplication::flushX(); |
216 | pid_t id = execute_command(_ifaceppp->data()->command_before_connect()); | 215 | pid_t id = execute_command(_ifaceppp->data()->command_before_connect()); |
@@ -225,15 +224,15 @@ void ConnectWidget::init() { | |||
225 | 224 | ||
226 | int lock = _ifaceppp->modem()->lockdevice(); | 225 | int lock = _ifaceppp->modem()->lockdevice(); |
227 | 226 | ||
228 | if (lock == 1) { | 227 | if (lock == 1) { |
229 | messg->setText(i18n("Modem device is locked.")); | 228 | messg->setText(QObject::tr("Modem device is locked.")); |
230 | vmain = 20; // wait until cancel is pressed | 229 | vmain = 20; // wait until cancel is pressed |
231 | return; | 230 | return; |
232 | } | 231 | } |
233 | 232 | ||
234 | if (lock == -1) { | 233 | if (lock == -1) { |
235 | messg->setText(i18n("Unable to create modem lock file.")); | 234 | messg->setText(QObject::tr("Unable to create modem lock file.")); |
236 | vmain = 20; // wait until cancel is pressed | 235 | vmain = 20; // wait until cancel is pressed |
237 | return; | 236 | return; |
238 | } | 237 | } |
239 | 238 | ||
@@ -278,10 +277,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
278 | 277 | ||
279 | assert(PPPData::NumInitStrings > 0); | 278 | assert(PPPData::NumInitStrings > 0); |
280 | // first init string ? | 279 | // first init string ? |
281 | if(substate == -1) { | 280 | if(substate == -1) { |
282 | messg->setText(i18n("Initializing modem...")); | 281 | messg->setText(QObject::tr("Initializing modem...")); |
283 | emit debugMessage(i18n("Initializing modem...")); | 282 | emit debugMessage(QObject::tr("Initializing modem...")); |
284 | substate = 0; | 283 | substate = 0; |
285 | } | 284 | } |
286 | 285 | ||
287 | QString initStr = _ifaceppp->data()->modemInitStr(substate); | 286 | QString initStr = _ifaceppp->data()->modemInitStr(substate); |
@@ -316,9 +315,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
316 | 315 | ||
317 | if (vmain == 5) { | 316 | if (vmain == 5) { |
318 | if(!expecting) { | 317 | if(!expecting) { |
319 | QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration()); | 318 | QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration()); |
320 | QString msg = i18n("Setting ") + sToneDuration; | 319 | QString msg = QObject::tr("Setting ") + sToneDuration; |
321 | messg->setText(msg); | 320 | messg->setText(msg); |
322 | emit debugMessage(msg); | 321 | emit debugMessage(msg); |
323 | setExpect(_ifaceppp->data()->modemInitResp()); | 322 | setExpect(_ifaceppp->data()->modemInitResp()); |
324 | writeline(sToneDuration); | 323 | writeline(sToneDuration); |
@@ -339,10 +338,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
339 | if(_ifaceppp->data()->volumeInitString().isEmpty()) { | 338 | if(_ifaceppp->data()->volumeInitString().isEmpty()) { |
340 | vmain = 4; | 339 | vmain = 4; |
341 | return; | 340 | return; |
342 | } | 341 | } |
343 | messg->setText(i18n("Setting speaker volume...")); | 342 | messg->setText(QObject::tr("Setting speaker volume...")); |
344 | emit debugMessage(i18n("Setting speaker volume...")); | 343 | emit debugMessage(QObject::tr("Setting speaker volume...")); |
345 | 344 | ||
346 | setExpect(_ifaceppp->data()->modemInitResp()); | 345 | setExpect(_ifaceppp->data()->modemInitResp()); |
347 | QString vol("AT"); | 346 | QString vol("AT"); |
348 | vol += _ifaceppp->data()->volumeInitString(); | 347 | vol += _ifaceppp->data()->volumeInitString(); |
@@ -355,9 +354,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
355 | 354 | ||
356 | if(vmain == 4) { | 355 | if(vmain == 4) { |
357 | if(!expecting) { | 356 | if(!expecting) { |
358 | if(!_ifaceppp->data()->waitForDialTone()) { | 357 | if(!_ifaceppp->data()->waitForDialTone()) { |
359 | QString msg = i18n("Turning off dial tone waiting..."); | 358 | QString msg = QObject::tr("Turning off dial tone waiting..."); |
360 | messg->setText(msg); | 359 | messg->setText(msg); |
361 | emit debugMessage(msg); | 360 | emit debugMessage(msg); |
362 | setExpect(_ifaceppp->data()->modemInitResp()); | 361 | setExpect(_ifaceppp->data()->modemInitResp()); |
363 | writeline(_ifaceppp->data()->modemNoDialToneDetectionStr()); | 362 | writeline(_ifaceppp->data()->modemNoDialToneDetectionStr()); |
@@ -376,9 +375,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
376 | 375 | ||
377 | QStringList &plist = _ifaceppp->data()->phonenumbers(); | 376 | QStringList &plist = _ifaceppp->data()->phonenumbers(); |
378 | QString bmarg= _ifaceppp->data()->dialPrefix(); | 377 | QString bmarg= _ifaceppp->data()->dialPrefix(); |
379 | bmarg += *plist.at(dialnumber); | 378 | bmarg += *plist.at(dialnumber); |
380 | QString bm = i18n("Dialing %1").arg(bmarg); | 379 | QString bm = QObject::tr("Dialing %1").arg(bmarg); |
381 | messg->setText(bm); | 380 | messg->setText(bm); |
382 | emit debugMessage(bm); | 381 | emit debugMessage(bm); |
383 | 382 | ||
384 | QString pn = _ifaceppp->data()->modemDialStr(); | 383 | QString pn = _ifaceppp->data()->modemDialStr(); |
@@ -407,14 +406,14 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
407 | if(readbuffer.contains(_ifaceppp->data()->modemBusyResp())) { | 406 | if(readbuffer.contains(_ifaceppp->data()->modemBusyResp())) { |
408 | timeout_timer->stop(); | 407 | timeout_timer->stop(); |
409 | timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000); | 408 | timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000); |
410 | 409 | ||
411 | messg->setText(i18n("Line busy. Hanging up...")); | 410 | messg->setText(QObject::tr("Line busy. Hanging up...")); |
412 | emit debugPutChar('\n'); | 411 | emit debugPutChar('\n'); |
413 | _ifaceppp->modem()->hangup(); | 412 | _ifaceppp->modem()->hangup(); |
414 | 413 | ||
415 | if(_ifaceppp->data()->busyWait() > 0) { | 414 | if(_ifaceppp->data()->busyWait() > 0) { |
416 | QString bm = i18n("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait()); | 415 | QString bm = QObject::tr("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait()); |
417 | messg->setText(bm); | 416 | messg->setText(bm); |
418 | emit debugMessage(bm); | 417 | emit debugMessage(bm); |
419 | 418 | ||
420 | pausing = true; | 419 | pausing = true; |
@@ -431,18 +430,18 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
431 | 430 | ||
432 | if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) { | 431 | if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) { |
433 | timeout_timer->stop(); | 432 | timeout_timer->stop(); |
434 | 433 | ||
435 | messg->setText(i18n("No Dialtone")); | 434 | messg->setText(QObject::tr("No Dialtone")); |
436 | vmain = 20; | 435 | vmain = 20; |
437 | _ifaceppp->modem()->unlockdevice(); | 436 | _ifaceppp->modem()->unlockdevice(); |
438 | return; | 437 | return; |
439 | } | 438 | } |
440 | 439 | ||
441 | if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) { | 440 | if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) { |
442 | timeout_timer->stop(); | 441 | timeout_timer->stop(); |
443 | 442 | ||
444 | messg->setText(i18n("No Carrier")); | 443 | messg->setText(QObject::tr("No Carrier")); |
445 | vmain = 20; | 444 | vmain = 20; |
446 | _ifaceppp->modem()->unlockdevice(); | 445 | _ifaceppp->modem()->unlockdevice(); |
447 | return; | 446 | return; |
448 | } | 447 | } |
@@ -478,9 +477,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
478 | return; | 477 | return; |
479 | } | 478 | } |
480 | 479 | ||
481 | if (scriptCommand == "Scan") { | 480 | if (scriptCommand == "Scan") { |
482 | QString bm = i18n("Scanning %1").arg(scriptArgument); | 481 | QString bm = QObject::tr("Scanning %1").arg(scriptArgument); |
483 | messg->setText(bm); | 482 | messg->setText(bm); |
484 | emit debugMessage(bm); | 483 | emit debugMessage(bm); |
485 | 484 | ||
486 | setScan(scriptArgument); | 485 | setScan(scriptArgument); |
@@ -488,9 +487,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
488 | return; | 487 | return; |
489 | } | 488 | } |
490 | 489 | ||
491 | if (scriptCommand == "Save") { | 490 | if (scriptCommand == "Save") { |
492 | QString bm = i18n("Saving %1").arg(scriptArgument); | 491 | QString bm = QObject::tr("Saving %1").arg(scriptArgument); |
493 | messg->setText(bm); | 492 | messg->setText(bm); |
494 | emit debugMessage(bm); | 493 | emit debugMessage(bm); |
495 | 494 | ||
496 | if (scriptArgument.lower() == "password") { | 495 | if (scriptArgument.lower() == "password") { |
@@ -506,9 +505,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
506 | } | 505 | } |
507 | 506 | ||
508 | 507 | ||
509 | if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") { | 508 | if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") { |
510 | QString bm = i18n("Sending %1"); | 509 | QString bm = QObject::tr("Sending %1"); |
511 | 510 | ||
512 | // replace %USERNAME% and %PASSWORD% | 511 | // replace %USERNAME% and %PASSWORD% |
513 | QString arg = scriptArgument; | 512 | QString arg = scriptArgument; |
514 | QRegExp re1("%USERNAME%"); | 513 | QRegExp re1("%USERNAME%"); |
@@ -531,9 +530,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
531 | return; | 530 | return; |
532 | } | 531 | } |
533 | 532 | ||
534 | if (scriptCommand == "Expect") { | 533 | if (scriptCommand == "Expect") { |
535 | QString bm = i18n("Expecting %1").arg(scriptArgument); | 534 | QString bm = QObject::tr("Expecting %1").arg(scriptArgument); |
536 | messg->setText(bm); | 535 | messg->setText(bm); |
537 | emit debugMessage(bm); | 536 | emit debugMessage(bm); |
538 | 537 | ||
539 | // The incrementing of the scriptindex MUST be before the | 538 | // The incrementing of the scriptindex MUST be before the |
@@ -545,9 +544,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
545 | } | 544 | } |
546 | 545 | ||
547 | 546 | ||
548 | if (scriptCommand == "Pause") { | 547 | if (scriptCommand == "Pause") { |
549 | QString bm = i18n("Pause %1 seconds").arg(scriptArgument); | 548 | QString bm = QObject::tr("Pause %1 seconds").arg(scriptArgument); |
550 | messg->setText(bm); | 549 | messg->setText(bm); |
551 | emit debugMessage(bm); | 550 | emit debugMessage(bm); |
552 | 551 | ||
553 | pausing = true; | 552 | pausing = true; |
@@ -562,9 +561,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
562 | if (scriptCommand == "Timeout") { | 561 | if (scriptCommand == "Timeout") { |
563 | 562 | ||
564 | timeout_timer->stop(); | 563 | timeout_timer->stop(); |
565 | 564 | ||
566 | QString bm = i18n("Timeout %1 seconds").arg(scriptArgument); | 565 | QString bm = QObject::tr("Timeout %1 seconds").arg(scriptArgument); |
567 | messg->setText(bm); | 566 | messg->setText(bm); |
568 | emit debugMessage(bm); | 567 | emit debugMessage(bm); |
569 | 568 | ||
570 | scriptTimeout=scriptArgument.toInt()*1000; | 569 | scriptTimeout=scriptArgument.toInt()*1000; |
@@ -574,10 +573,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
574 | return; | 573 | return; |
575 | } | 574 | } |
576 | 575 | ||
577 | if (scriptCommand == "Hangup") { | 576 | if (scriptCommand == "Hangup") { |
578 | messg->setText(i18n("Hangup")); | 577 | messg->setText(QObject::tr("Hangup")); |
579 | emit debugMessage(i18n("Hangup")); | 578 | emit debugMessage(QObject::tr("Hangup")); |
580 | 579 | ||
581 | writeline(_ifaceppp->data()->modemHangupStr()); | 580 | writeline(_ifaceppp->data()->modemHangupStr()); |
582 | setExpect(_ifaceppp->data()->modemHangupResp()); | 581 | setExpect(_ifaceppp->data()->modemHangupResp()); |
583 | 582 | ||
@@ -588,18 +587,18 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
588 | if (scriptCommand == "Answer") { | 587 | if (scriptCommand == "Answer") { |
589 | 588 | ||
590 | timeout_timer->stop(); | 589 | timeout_timer->stop(); |
591 | 590 | ||
592 | messg->setText(i18n("Answer")); | 591 | messg->setText(QObject::tr("Answer")); |
593 | emit debugMessage(i18n("Answer")); | 592 | emit debugMessage(QObject::tr("Answer")); |
594 | 593 | ||
595 | setExpect(_ifaceppp->data()->modemRingResp()); | 594 | setExpect(_ifaceppp->data()->modemRingResp()); |
596 | vmain = 150; | 595 | vmain = 150; |
597 | return; | 596 | return; |
598 | } | 597 | } |
599 | 598 | ||
600 | if (scriptCommand == "ID") { | 599 | if (scriptCommand == "ID") { |
601 | QString bm = i18n("ID %1").arg(scriptArgument); | 600 | QString bm = QObject::tr("ID %1").arg(scriptArgument); |
602 | messg->setText(bm); | 601 | messg->setText(bm); |
603 | emit debugMessage(bm); | 602 | emit debugMessage(bm); |
604 | 603 | ||
605 | QString idstring = _ifaceppp->data()->password(); | 604 | QString idstring = _ifaceppp->data()->password(); |
@@ -633,9 +632,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
633 | } | 632 | } |
634 | } | 633 | } |
635 | 634 | ||
636 | if (scriptCommand == "Password") { | 635 | if (scriptCommand == "Password") { |
637 | QString bm = i18n("Password %1").arg(scriptArgument); | 636 | QString bm = QObject::tr("Password %1").arg(scriptArgument); |
638 | messg->setText(bm); | 637 | messg->setText(bm); |
639 | emit debugMessage(bm); | 638 | emit debugMessage(bm); |
640 | 639 | ||
641 | QString pwstring = _ifaceppp->data()->password(); | 640 | QString pwstring = _ifaceppp->data()->password(); |
@@ -670,9 +669,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
670 | } | 669 | } |
671 | } | 670 | } |
672 | 671 | ||
673 | if (scriptCommand == "Prompt") { | 672 | if (scriptCommand == "Prompt") { |
674 | QString bm = i18n("Prompting %1"); | 673 | QString bm = QObject::tr("Prompting %1"); |
675 | 674 | ||
676 | // if the scriptindex (aka the prompt text) includes a ## marker | 675 | // if the scriptindex (aka the prompt text) includes a ## marker |
677 | // this marker should get substituted with the contents of our stored | 676 | // this marker should get substituted with the contents of our stored |
678 | // variable (from the subsequent scan). | 677 | // variable (from the subsequent scan). |
@@ -707,9 +706,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
707 | } | 706 | } |
708 | } | 707 | } |
709 | 708 | ||
710 | if (scriptCommand == "PWPrompt") { | 709 | if (scriptCommand == "PWPrompt") { |
711 | QString bm = i18n("PW Prompt %1").arg(scriptArgument); | 710 | QString bm = QObject::tr("PW Prompt %1").arg(scriptArgument); |
712 | messg->setText(bm); | 711 | messg->setText(bm); |
713 | emit debugMessage(bm); | 712 | emit debugMessage(bm); |
714 | 713 | ||
715 | /* if not around yet, then post window... */ | 714 | /* if not around yet, then post window... */ |
@@ -732,20 +731,20 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
732 | } | 731 | } |
733 | 732 | ||
734 | if (scriptCommand == "LoopStart") { | 733 | if (scriptCommand == "LoopStart") { |
735 | 734 | ||
736 | QString bm = i18n("Loop Start %1").arg(scriptArgument); | 735 | QString bm = QObject::tr("Loop Start %1").arg(scriptArgument); |
737 | 736 | ||
738 | // The incrementing of the scriptindex MUST be before the | 737 | // The incrementing of the scriptindex MUST be before the |
739 | // call to setExpect otherwise the expect will miss a string that is | 738 | // call to setExpect otherwise the expect will miss a string that is |
740 | // already in the buffer. | 739 | // already in the buffer. |
741 | scriptindex++; | 740 | scriptindex++; |
742 | 741 | ||
743 | if ( loopnest > (MAXLOOPNEST-2) ) { | 742 | if ( loopnest > (MAXLOOPNEST-2) ) { |
744 | bm += i18n("ERROR: Nested too deep, ignored."); | 743 | bm += QObject::tr("ERROR: Nested too deep, ignored."); |
745 | vmain=20; | 744 | vmain=20; |
746 | cancelbutton(); | 745 | cancelbutton(); |
747 | QMessageBox::critical(0, "error", i18n("Loops nested too deeply!")); | 746 | QMessageBox::critical(0, "error", QObject::tr("Loops nested too deeply!")); |
748 | } else { | 747 | } else { |
749 | setExpect(scriptArgument); | 748 | setExpect(scriptArgument); |
750 | loopstartindex[loopnest] = scriptindex; | 749 | loopstartindex[loopnest] = scriptindex; |
751 | loopstr[loopnest] = scriptArgument; | 750 | loopstr[loopnest] = scriptArgument; |
@@ -757,11 +756,11 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
757 | 756 | ||
758 | } | 757 | } |
759 | 758 | ||
760 | if (scriptCommand == "LoopEnd") { | 759 | if (scriptCommand == "LoopEnd") { |
761 | QString bm = i18n("Loop End %1").arg(scriptArgument); | 760 | QString bm = QObject::tr("Loop End %1").arg(scriptArgument); |
762 | if ( loopnest <= 0 ) { | 761 | if ( loopnest <= 0 ) { |
763 | bm = i18n("LoopEnd without matching Start! Line: %1").arg(bm); | 762 | bm = QObject::tr("LoopEnd without matching Start! Line: %1").arg(bm); |
764 | vmain=20; | 763 | vmain=20; |
765 | cancelbutton(); | 764 | cancelbutton(); |
766 | QMessageBox::critical(0, "error", bm); | 765 | QMessageBox::critical(0, "error", bm); |
767 | return; | 766 | return; |
@@ -847,9 +846,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { | |||
847 | qApp->flushX(); | 846 | qApp->flushX(); |
848 | semaphore = true; | 847 | semaphore = true; |
849 | result = execppp(); | 848 | result = execppp(); |
850 | 849 | ||
851 | emit debugMessage(i18n("Starting pppd...")); | 850 | emit debugMessage(QObject::tr("Starting pppd...")); |
852 | qDebug("execppp() returned with return-code %i", result ); | 851 | qDebug("execppp() returned with return-code %i", result ); |
853 | 852 | ||
854 | if(result) { | 853 | if(result) { |
855 | if(!_ifaceppp->data()->autoDNS()) | 854 | if(!_ifaceppp->data()->autoDNS()) |
@@ -929,9 +928,9 @@ void ConnectWidget::checkBuffers() { | |||
929 | scanvar = scanbuffer.mid( vstart, scanbuffer.length() - vstart); | 928 | scanvar = scanbuffer.mid( vstart, scanbuffer.length() - vstart); |
930 | scanvar = scanvar.stripWhiteSpace(); | 929 | scanvar = scanvar.stripWhiteSpace(); |
931 | 930 | ||
932 | // Show the Variabel content in the debug window | 931 | // Show the Variabel content in the debug window |
933 | QString sv = i18n("Scan Var: %1").arg(scanvar); | 932 | QString sv = QObject::tr("Scan Var: %1").arg(scanvar); |
934 | emit debugMessage(sv); | 933 | emit debugMessage(sv); |
935 | } | 934 | } |
936 | 935 | ||
937 | if(expecting) { | 936 | if(expecting) { |
@@ -939,9 +938,9 @@ void ConnectWidget::checkBuffers() { | |||
939 | expecting = false; | 938 | expecting = false; |
940 | // keep everything after the expected string | 939 | // keep everything after the expected string |
941 | readbuffer.remove(0, readbuffer.find(expectstr) + expectstr.length()); | 940 | readbuffer.remove(0, readbuffer.find(expectstr) + expectstr.length()); |
942 | 941 | ||
943 | QString ts = i18n("Found: %1").arg(expectstr); | 942 | QString ts = QObject::tr("Found: %1").arg(expectstr); |
944 | emit debugMessage(ts); | 943 | emit debugMessage(ts); |
945 | 944 | ||
946 | if (loopend) { | 945 | if (loopend) { |
947 | loopend=false; | 946 | loopend=false; |
@@ -950,9 +949,9 @@ void ConnectWidget::checkBuffers() { | |||
950 | 949 | ||
951 | if (loopend && readbuffer.contains(loopstr[loopnest])) { | 950 | if (loopend && readbuffer.contains(loopstr[loopnest])) { |
952 | expecting = false; | 951 | expecting = false; |
953 | readbuffer = ""; | 952 | readbuffer = ""; |
954 | QString ts = i18n("Looping: %1").arg(loopstr[loopnest]); | 953 | QString ts = QObject::tr("Looping: %1").arg(loopstr[loopnest]); |
955 | emit debugMessage(ts); | 954 | emit debugMessage(ts); |
956 | scriptindex = loopstartindex[loopnest]; | 955 | scriptindex = loopstartindex[loopnest]; |
957 | loopend = false; | 956 | loopend = false; |
958 | loopnest++; | 957 | loopnest++; |
@@ -983,9 +982,9 @@ void ConnectWidget::cancelbutton() { | |||
983 | // termwindow = 0L; | 982 | // termwindow = 0L; |
984 | // this->show(); | 983 | // this->show(); |
985 | // } | 984 | // } |
986 | 985 | ||
987 | messg->setText(i18n("One moment please...")); | 986 | messg->setText(QObject::tr("One moment please...")); |
988 | 987 | ||
989 | // just to be sure | 988 | // just to be sure |
990 | _ifaceppp->modem()->removeSecret(AUTH_PAP); | 989 | _ifaceppp->modem()->removeSecret(AUTH_PAP); |
991 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); | 990 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); |
@@ -1005,13 +1004,16 @@ void ConnectWidget::cancelbutton() { | |||
1005 | _ifaceppp->modem()->unlockdevice(); | 1004 | _ifaceppp->modem()->unlockdevice(); |
1006 | 1005 | ||
1007 | //abort prompt window... | 1006 | //abort prompt window... |
1008 | if (prompt->isVisible()) { | 1007 | if (prompt->isVisible()) { |
1009 | prompt->hide(); | 1008 | prompt->hide(); |
1010 | } | 1009 | } |
1011 | prompt->setConsumed(); | 1010 | prompt->setConsumed(); |
1012 | 1011 | ||
1013 | messg->setText(tr("offline")); | 1012 | _ifaceppp->setStatus( false ); |
1013 | _ifaceppp->refresh(); | ||
1014 | // messg->setText(tr("offline")); | ||
1015 | refresh(); | ||
1014 | } | 1016 | } |
1015 | 1017 | ||
1016 | 1018 | ||
1017 | void ConnectWidget::script_timed_out() { | 1019 | void ConnectWidget::script_timed_out() { |
@@ -1025,9 +1027,9 @@ void ConnectWidget::script_timed_out() { | |||
1025 | if (prompt->isVisible()) | 1027 | if (prompt->isVisible()) |
1026 | prompt->hide(); | 1028 | prompt->hide(); |
1027 | 1029 | ||
1028 | prompt->setConsumed(); | 1030 | prompt->setConsumed(); |
1029 | messg->setText(i18n("Script timed out!")); | 1031 | messg->setText(QObject::tr("Script timed out!")); |
1030 | _ifaceppp->modem()->hangup(); | 1032 | _ifaceppp->modem()->hangup(); |
1031 | emit stopAccounting(); | 1033 | emit stopAccounting(); |
1032 | // p_kppp->con_win->stopClock(); | 1034 | // p_kppp->con_win->stopClock(); |
1033 | 1035 | ||
@@ -1040,18 +1042,18 @@ void ConnectWidget::setScan(const QString &n) { | |||
1040 | scanning = true; | 1042 | scanning = true; |
1041 | scanstr = n; | 1043 | scanstr = n; |
1042 | scanbuffer = ""; | 1044 | scanbuffer = ""; |
1043 | 1045 | ||
1044 | QString ts = i18n("Scanning: %1").arg(n); | 1046 | QString ts = QObject::tr("Scanning: %1").arg(n); |
1045 | emit debugMessage(ts); | 1047 | emit debugMessage(ts); |
1046 | } | 1048 | } |
1047 | 1049 | ||
1048 | 1050 | ||
1049 | void ConnectWidget::setExpect(const QString &n) { | 1051 | void ConnectWidget::setExpect(const QString &n) { |
1050 | expecting = true; | 1052 | expecting = true; |
1051 | expectstr = n; | 1053 | expectstr = n; |
1052 | 1054 | ||
1053 | QString ts = i18n("Expecting: %1").arg(n); | 1055 | QString ts = QObject::tr("Expecting: %1").arg(n); |
1054 | ts.replace(QRegExp("\n"), "<LF>"); | 1056 | ts.replace(QRegExp("\n"), "<LF>"); |
1055 | emit debugMessage(ts); | 1057 | emit debugMessage(ts); |
1056 | 1058 | ||
1057 | // check if the expected string is in the read buffer already. | 1059 | // check if the expected string is in the read buffer already. |
@@ -1084,9 +1086,9 @@ void ConnectWidget::pppdDied() | |||
1084 | if_timeout_timer->stop(); | 1086 | if_timeout_timer->stop(); |
1085 | } | 1087 | } |
1086 | 1088 | ||
1087 | void ConnectWidget::if_waiting_slot() { | 1089 | void ConnectWidget::if_waiting_slot() { |
1088 | messg->setText(i18n("Logging on to network...")); | 1090 | messg->setText(QObject::tr("Logging on to network...")); |
1089 | 1091 | ||
1090 | // if(!stats->ifIsUp()) { | 1092 | // if(!stats->ifIsUp()) { |
1091 | 1093 | ||
1092 | // if(_ifaceppp->data()->pppdError() != 0) { | 1094 | // if(_ifaceppp->data()->pppdError() != 0) { |
@@ -1115,28 +1117,33 @@ void ConnectWidget::if_waiting_slot() { | |||
1115 | // p_kppp->statdlg->take_stats(); // start taking ppp statistics | 1117 | // p_kppp->statdlg->take_stats(); // start taking ppp statistics |
1116 | auto_hostname(_ifaceppp); | 1118 | auto_hostname(_ifaceppp); |
1117 | 1119 | ||
1118 | if(!_ifaceppp->data()->command_on_connect().isEmpty()) { | 1120 | if(!_ifaceppp->data()->command_on_connect().isEmpty()) { |
1119 | messg->setText(i18n("Running startup command...")); | 1121 | messg->setText(QObject::tr("Running startup command...")); |
1120 | 1122 | ||
1121 | // make sure that we don't get any async errors | 1123 | // make sure that we don't get any async errors |
1122 | qApp->flushX(); | 1124 | qApp->flushX(); |
1123 | execute_command(_ifaceppp->data()->command_on_connect()); | 1125 | execute_command(_ifaceppp->data()->command_on_connect()); |
1124 | messg->setText(i18n("Done")); | 1126 | messg->setText(QObject::tr("Done")); |
1125 | } | 1127 | } |
1126 | 1128 | ||
1127 | // remove the authentication file | 1129 | // remove the authentication file |
1128 | _ifaceppp->modem()->removeSecret(AUTH_PAP); | 1130 | _ifaceppp->modem()->removeSecret(AUTH_PAP); |
1129 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); | 1131 | _ifaceppp->modem()->removeSecret(AUTH_CHAP); |
1130 | 1132 | ||
1131 | emit debugMessage(i18n("Done")); | 1133 | emit debugMessage(QObject::tr("Done")); |
1132 | set_con_speed_string(); | 1134 | set_con_speed_string(); |
1133 | 1135 | ||
1134 | // p_kppp->con_win->setConnectionSpeed(p_kppp->con_speed); | 1136 | // p_kppp->con_win->setConnectionSpeed(p_kppp->con_speed); |
1135 | this->hide(); | 1137 | // this->hide(); |
1136 | messg->setText(""); | 1138 | // messg->setText(""); |
1137 | 1139 | ||
1138 | _ifaceppp->setStatus( true ); | 1140 | _ifaceppp->setStatus( true ); |
1141 | |||
1142 | m_refreshTimer = new QTimer( this ); | ||
1143 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
1144 | m_refreshTimer->start( 3000 ); | ||
1145 | //_ifaceppp->refresh(); | ||
1139 | // emit _ifaceppp->updateInterface(_ifaceppp); | 1146 | // emit _ifaceppp->updateInterface(_ifaceppp); |
1140 | 1147 | ||
1141 | // prepare the con_win so as to have the right size for | 1148 | // prepare the con_win so as to have the right size for |
1142 | // accounting / non-accounting mode | 1149 | // accounting / non-accounting mode |
@@ -1160,8 +1167,17 @@ void ConnectWidget::if_waiting_slot() { | |||
1160 | 1167 | ||
1161 | _ifaceppp->modem()->closetty(); | 1168 | _ifaceppp->modem()->closetty(); |
1162 | } | 1169 | } |
1163 | 1170 | ||
1171 | void ConnectWidget::refresh() { | ||
1172 | _ifaceppp->refresh(); | ||
1173 | if ( _ifaceppp->getStatus() ) { | ||
1174 | messg->setText(QObject::tr("Online")); | ||
1175 | } else { | ||
1176 | messg->setText(QObject::tr("Offline")); | ||
1177 | } | ||
1178 | } | ||
1179 | |||
1164 | 1180 | ||
1165 | bool ConnectWidget::execppp() { | 1181 | bool ConnectWidget::execppp() { |
1166 | QString command; | 1182 | QString command; |
1167 | 1183 | ||
@@ -1209,47 +1225,55 @@ bool ConnectWidget::execppp() { | |||
1209 | 1225 | ||
1210 | if(_ifaceppp->data()->autoDNS()) | 1226 | if(_ifaceppp->data()->autoDNS()) |
1211 | command += " usepeerdns"; | 1227 | command += " usepeerdns"; |
1212 | 1228 | ||
1213 | QStringList &arglist = _ifaceppp->data()->pppdArgument(); | ||
1214 | for ( QStringList::Iterator it = arglist.begin(); | ||
1215 | it != arglist.end(); | ||
1216 | ++it ) | ||
1217 | { | ||
1218 | command += " " + *it; | ||
1219 | } | ||
1220 | 1229 | ||
1221 | // PAP settings | 1230 | // PAP settings |
1222 | if(_ifaceppp->data()->authMethod() == AUTH_PAP) { | 1231 | if(_ifaceppp->data()->authMethod() == AUTH_PAP) { |
1223 | command += " -chap user "; | 1232 | command += " -chap user "; |
1224 | command = command + "\"" + _ifaceppp->data()->storedUsername() + "\""; | 1233 | command = command + _ifaceppp->data()->storedUsername(); |
1225 | } | 1234 | } |
1226 | 1235 | ||
1227 | // CHAP settings | 1236 | // CHAP settings |
1228 | if(_ifaceppp->data()->authMethod() == AUTH_CHAP) { | 1237 | if(_ifaceppp->data()->authMethod() == AUTH_CHAP) { |
1229 | command += " -pap user "; | 1238 | command += " -pap user "; |
1230 | command = command + "\"" + _ifaceppp->data()->storedUsername() + "\""; | 1239 | command = command + _ifaceppp->data()->storedUsername(); |
1231 | } | 1240 | } |
1232 | 1241 | ||
1233 | // PAP/CHAP settings | 1242 | // PAP/CHAP settings |
1234 | if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) { | 1243 | if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) { |
1235 | command += " user "; | 1244 | QString tmpName = _ifaceppp->data()->storedUsername(); |
1236 | command = command + "\"" + _ifaceppp->data()->storedUsername() + "\""; | 1245 | if ( !tmpName.isEmpty() ) { |
1246 | command += " user "; | ||
1247 | command = command + tmpName; | ||
1248 | } | ||
1237 | } | 1249 | } |
1238 | 1250 | ||
1239 | // check for debug | 1251 | // check for debug |
1240 | if(_ifaceppp->data()->getPPPDebug()) | 1252 | if(_ifaceppp->data()->getPPPDebug()) |
1241 | command += " debug"; | 1253 | command += " debug"; |
1242 | 1254 | ||
1255 | QStringList &arglist = _ifaceppp->data()->pppdArgument(); | ||
1256 | for ( QStringList::Iterator it = arglist.begin(); | ||
1257 | it != arglist.end(); | ||
1258 | ++it ) | ||
1259 | { | ||
1260 | command += " " + *it; | ||
1261 | } | ||
1262 | |||
1263 | command += " call opie-kppp logfd 11"; | ||
1264 | |||
1243 | if (command.length() > MAX_CMDLEN) { | 1265 | if (command.length() > MAX_CMDLEN) { |
1244 | QMessageBox::critical(this, "error", i18n( | 1266 | QMessageBox::critical(this, "error", QObject::tr( |
1245 | "pppd command + command-line arguments exceed " | 1267 | "pppd command + command-line arguments exceed " |
1246 | "2024 characters in length." | 1268 | "2024 characters in length." |
1247 | )); | 1269 | )); |
1248 | 1270 | ||
1249 | return false; // nonsensically long command which would bust my buffer buf. | 1271 | return false; // nonsensically long command which would bust my buffer buf. |
1250 | } | 1272 | } |
1251 | 1273 | ||
1274 | qWarning("Command IS: %s",command.latin1() ); | ||
1275 | |||
1252 | qApp->flushX(); | 1276 | qApp->flushX(); |
1253 | 1277 | ||
1254 | return _ifaceppp->modem()->execPPPDaemon(command); | 1278 | return _ifaceppp->modem()->execPPPDaemon(command); |
1255 | } | 1279 | } |