summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/connect.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/connect.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp162
1 files changed, 93 insertions, 69 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
@@ -32,7 +32,6 @@
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
@@ -99,7 +98,7 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
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);
@@ -108,15 +107,15 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
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);
@@ -125,12 +124,12 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
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
@@ -173,7 +172,7 @@ ConnectWidget::~ConnectWidget() {
173void ConnectWidget::preinit() { 172void 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
@@ -201,15 +200,15 @@ void ConnectWidget::init() {
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();
@@ -226,13 +225,13 @@ void ConnectWidget::init() {
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 }
@@ -279,8 +278,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -317,7 +316,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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());
@@ -340,8 +339,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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");
@@ -356,7 +355,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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());
@@ -377,7 +376,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -408,12 +407,12 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -432,7 +431,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -441,7 +440,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -479,7 +478,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -489,7 +488,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -507,7 +506,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -532,7 +531,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -546,7 +545,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -563,7 +562,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -575,8 +574,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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());
@@ -589,8 +588,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -598,7 +597,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -634,7 +633,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -671,7 +670,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -708,7 +707,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -733,7 +732,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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
@@ -741,10 +740,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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;
@@ -758,9 +757,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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);
@@ -848,7 +847,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
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) {
@@ -930,7 +929,7 @@ void ConnectWidget::checkBuffers() {
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
@@ -940,7 +939,7 @@ void ConnectWidget::checkBuffers() {
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) {
@@ -951,7 +950,7 @@ void ConnectWidget::checkBuffers() {
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;
@@ -984,7 +983,7 @@ void ConnectWidget::cancelbutton() {
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);
@@ -1010,7 +1009,10 @@ void ConnectWidget::cancelbutton() {
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
@@ -1026,7 +1028,7 @@ void ConnectWidget::script_timed_out() {
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();
@@ -1041,7 +1043,7 @@ void ConnectWidget::setScan(const QString &n) {
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
@@ -1050,7 +1052,7 @@ 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
@@ -1085,7 +1087,7 @@ void ConnectWidget::pppdDied()
1085} 1087}
1086 1088
1087void ConnectWidget::if_waiting_slot() { 1089void 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
@@ -1116,26 +1118,31 @@ void ConnectWidget::if_waiting_slot() {
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
@@ -1161,6 +1168,15 @@ void ConnectWidget::if_waiting_slot() {
1161 _ifaceppp->modem()->closetty(); 1168 _ifaceppp->modem()->closetty();
1162} 1169}
1163 1170
1171void 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
1165bool ConnectWidget::execppp() { 1181bool ConnectWidget::execppp() {
1166 QString command; 1182 QString command;
@@ -1210,38 +1226,44 @@ bool ConnectWidget::execppp() {
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) {
1244 QString tmpName = _ifaceppp->data()->storedUsername();
1245 if ( !tmpName.isEmpty() ) {
1235 command += " user "; 1246 command += " user ";
1236 command = command + "\"" + _ifaceppp->data()->storedUsername() + "\""; 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 ));
@@ -1249,6 +1271,8 @@ bool ConnectWidget::execppp() {
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);