summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/authwidget.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp2
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp11
3 files changed, 9 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp
index 86bea98..fa2b164 100644
--- a/noncore/settings/networksettings/ppp/authwidget.cpp
+++ b/noncore/settings/networksettings/ppp/authwidget.cpp
@@ -41,155 +41,157 @@ AuthWidget::AuthWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch
41 layout = new QGridLayout(this); 41 layout = new QGridLayout(this);
42 42
43 auth_l = new QLabel(tr("Authentication: "), this); 43 auth_l = new QLabel(tr("Authentication: "), this);
44 layout->addWidget(auth_l, 0, 0); 44 layout->addWidget(auth_l, 0, 0);
45 45
46 auth = new QComboBox(this); 46 auth = new QComboBox(this);
47 auth->insertItem(tr("Script-based")); 47 auth->insertItem(tr("Script-based"));
48 auth->insertItem(tr("PAP")); 48 auth->insertItem(tr("PAP"));
49 auth->insertItem(tr("Terminal-based")); 49 auth->insertItem(tr("Terminal-based"));
50 auth->insertItem(tr("CHAP")); 50 auth->insertItem(tr("CHAP"));
51 auth->insertItem(tr("PAP/CHAP")); 51 auth->insertItem(tr("PAP/CHAP"));
52 layout->addWidget(auth, 0, 1); 52 layout->addWidget(auth, 0, 1);
53 53
54 connect( auth, SIGNAL(activated(const QString&)), 54 connect( auth, SIGNAL(activated(const QString&)),
55 SLOT(authChanged(const QString&))); 55 SLOT(authChanged(const QString&)));
56 56
57 QString tmp = tr("<p>Specifies the method used to identify yourself to\n" 57 QString tmp = tr("<p>Specifies the method used to identify yourself to\n"
58 "the PPP server. Most universities still use\n" 58 "the PPP server. Most universities still use\n"
59 "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" 59 "<b>Terminal</b>- or <b>Script</b>-based authentication,\n"
60 "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" 60 "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n"
61 "unsure, contact your ISP.\n" 61 "unsure, contact your ISP.\n"
62 "\n" 62 "\n"
63 "If you can choose between PAP and CHAP,\n" 63 "If you can choose between PAP and CHAP,\n"
64 "choose CHAP, because it's much safer. If you don't know\n" 64 "choose CHAP, because it's much safer. If you don't know\n"
65 "whether PAP or CHAP is right, choose PAP/CHAP."); 65 "whether PAP or CHAP is right, choose PAP/CHAP.");
66 66
67 QWhatsThis::add(auth_l,tmp); 67 QWhatsThis::add(auth_l,tmp);
68 QWhatsThis::add(auth,tmp); 68 QWhatsThis::add(auth,tmp);
69 69
70 user_l = new QLabel( tr("Username: "), this); 70 user_l = new QLabel( tr("Username: "), this);
71 layout->addWidget( user_l, 1, 0 ); 71 layout->addWidget( user_l, 1, 0 );
72 userName = new QLineEdit( this, "usernameEdit" ); 72 userName = new QLineEdit( this, "usernameEdit" );
73 layout->addWidget( userName, 1, 1 ); 73 layout->addWidget( userName, 1, 1 );
74 tmp = tr("Enter your username here..."); 74 tmp = tr("Enter your username here...");
75 QWhatsThis::add( user_l, tmp ); 75 QWhatsThis::add( user_l, tmp );
76 QWhatsThis::add( userName, tmp ); 76 QWhatsThis::add( userName, tmp );
77 77
78 pw_l = new QLabel( tr("Password: "), this); 78 pw_l = new QLabel( tr("Password: "), this);
79 layout->addWidget( pw_l, 2, 0 ); 79 layout->addWidget( pw_l, 2, 0 );
80 passWord = new QLineEdit( this, "pw" ); 80 passWord = new QLineEdit( this, "pw" );
81 passWord->setAutoMask( true ); 81 passWord->setAutoMask( true );
82 passWord->setEchoMode( QLineEdit::Password ); 82 passWord->setEchoMode( QLineEdit::Password );
83 layout->addWidget( passWord, 2, 1 ); 83 layout->addWidget( passWord, 2, 1 );
84 hidePw = new QToolButton( this ); 84 hidePw = new QToolButton( this );
85 hidePw->setPixmap( QPixmap( ( const char** ) image0_data ) ); 85 hidePw->setPixmap( QPixmap( ( const char** ) image0_data ) );
86 hidePw->setToggleButton( true ); 86 hidePw->setToggleButton( true );
87 layout->addWidget( hidePw, 2, 2 ); 87 layout->addWidget( hidePw, 2, 2 );
88 88
89 connect(hidePw, SIGNAL(toggled(bool)), SLOT(toggleEchoMode(bool))); 89 connect(hidePw, SIGNAL(toggled(bool)), SLOT(toggleEchoMode(bool)));
90 90
91 tmp = tr("Enter your password here"); 91 tmp = tr("Enter your password here");
92 QWhatsThis::add( pw_l, tmp ); 92 QWhatsThis::add( pw_l, tmp );
93 QWhatsThis::add( passWord, tmp ); 93 QWhatsThis::add( passWord, tmp );
94 94
95 store_password = new QCheckBox(tr("Store password"), this); 95 store_password = new QCheckBox(tr("Store password"), this);
96 layout->addMultiCellWidget(store_password, 3, 3, 0, 1, AlignRight); 96 layout->addMultiCellWidget(store_password, 3, 3, 0, 1, AlignRight);
97 QWhatsThis::add(store_password, 97 QWhatsThis::add(store_password,
98 tr("<p>When this is turned on, your ISP password\n" 98 tr("<p>When this is turned on, your ISP password\n"
99 "will be saved in <i>kppp</i>'s config file, so\n" 99 "will be saved in <i>kppp</i>'s config file, so\n"
100 "you do not need to type it in every time.\n" 100 "you do not need to type it in every time.\n"
101 "\n" 101 "\n"
102 "<b><font color=\"red\">Warning:</font> your password will be stored as\n" 102 "<b><font color=\"red\">Warning:</font> your password will be stored as\n"
103 "plain text in the config file, which is\n" 103 "plain text in the config file, which is\n"
104 "readable only to you. Make sure nobody\n" 104 "readable only to you. Make sure nobody\n"
105 "gains access to this file!")); 105 "gains access to this file!"));
106 106
107 if (isNewAccount){ 107 if (isNewAccount){
108 // select PAP/CHAP as default 108 // select PAP/CHAP as default
109 auth->setCurrentItem(AUTH_PAPCHAP); 109 auth->setCurrentItem(AUTH_PAPCHAP);
110 store_password->setChecked(true); 110 store_password->setChecked(true);
111 }else{ 111 }else{
112 auth->setCurrentItem(_pppdata->authMethod()); 112 auth->setCurrentItem(_pppdata->authMethod());
113 authChanged( auth->currentText() ); 113 authChanged( auth->currentText() );
114 userName->setText( _pppdata->storedUsername() ); 114 userName->setText( _pppdata->storedUsername() );
115 store_password->setChecked(_pppdata->storePassword()); 115 store_password->setChecked(_pppdata->storePassword());
116 if (store_password->isChecked()) 116 if (store_password->isChecked())
117 passWord->setText( _pppdata->storedPassword() ); 117 passWord->setText( _pppdata->storedPassword() );
118 } 118 }
119} 119}
120 120
121bool AuthWidget::check() 121bool AuthWidget::check()
122{ 122{
123 bool ret = true; 123 bool ret = true;
124 if (scriptWidget){ 124 if (scriptWidget){
125 if (!scriptWidget->check()){ 125 if (!scriptWidget->check()){
126 QMessageBox::critical(this, tr("error"), tr("<qt>Login script has unbalanced loop Start/End<qt>")); 126 QMessageBox::critical(this, tr("error"), tr("<qt>Login script has unbalanced loop Start/End<qt>"));
127 ret = false; 127 ret = false;
128 } 128 }
129 } 129 }
130 return ret; 130 return ret;
131} 131}
132 132
133void AuthWidget::save() 133void AuthWidget::save()
134{ 134{
135 _pppdata->setAuthMethod(auth->currentItem()); 135 _pppdata->setAuthMethod(auth->currentItem());
136 if (scriptWidget) scriptWidget->save(); 136 if (scriptWidget) scriptWidget->save();
137 _pppdata->setStoredUsername( userName->text() ); 137 _pppdata->setStoredUsername( userName->text() );
138 _pppdata->setStorePassword(store_password->isChecked()); 138 _pppdata->setStorePassword(store_password->isChecked());
139 if (store_password->isChecked()) 139 if (store_password->isChecked())
140 _pppdata->setStoredPassword( passWord->text() ); 140 _pppdata->setStoredPassword( passWord->text() );
141} 141}
142 142
143void AuthWidget::authChanged( const QString &authStr ) 143void AuthWidget::authChanged( const QString &authStr )
144{ 144{
145 qDebug("AuthWidget::authChanged( %s )", authStr.latin1() ); 145 qDebug("AuthWidget::authChanged( %s )", authStr.latin1() );
146 if ( authStr.contains( tr("Script-based") ) ){ 146 if ( authStr.contains( tr("Script-based") ) ){
147 showUsernamePassword( false ); 147 showUsernamePassword( false );
148 showScriptWindow( true ); 148 showScriptWindow( true );
149 } else if ( authStr.contains( tr("PAP") ) || 149 } else if ( authStr.contains( tr("PAP") ) ||
150 authStr.contains( tr("CHAP") ) ){ 150 authStr.contains( tr("CHAP") ) ){
151 showUsernamePassword( true ); 151 showUsernamePassword( true );
152 showScriptWindow( false ); 152 showScriptWindow( false );
153 } else { 153 } else {
154 qDebug("do not really know how to handle"); 154 qDebug("do not really know how to handle");
155 showUsernamePassword( false ); 155 showUsernamePassword( false );
156 showScriptWindow( false ); 156 showScriptWindow( false );
157 } 157 }
158} 158}
159 159
160 160
161void AuthWidget::showUsernamePassword( bool show ) 161void AuthWidget::showUsernamePassword( bool show )
162{ 162{
163 if (show){ 163 if (show){
164 user_l->show(); 164 user_l->show();
165 userName->show(); 165 userName->show();
166 pw_l->show(); 166 pw_l->show();
167 passWord->show(); 167 passWord->show();
168 store_password->show(); 168 store_password->show();
169 hidePw->show();
169 }else{//!show 170 }else{//!show
170 user_l->hide(); 171 user_l->hide();
171 userName->hide(); 172 userName->hide();
172 pw_l->hide(); 173 pw_l->hide();
173 passWord->hide(); 174 passWord->hide();
174 store_password->hide(); 175 store_password->hide();
176 hidePw->hide();
175 } 177 }
176} 178}
177 179
178void AuthWidget::showScriptWindow( bool show ) 180void AuthWidget::showScriptWindow( bool show )
179{ 181{
180 if (show){ 182 if (show){
181 if (!scriptWidget){ 183 if (!scriptWidget){
182 scriptWidget = new ScriptWidget( _pppdata, this, isNewAccount, "scriptWid"); 184 scriptWidget = new ScriptWidget( _pppdata, this, isNewAccount, "scriptWid");
183 layout->addMultiCellWidget( scriptWidget, 1, 4, 0, 1 ); 185 layout->addMultiCellWidget( scriptWidget, 1, 4, 0, 1 );
184 } 186 }
185 scriptWidget->show(); 187 scriptWidget->show();
186 }else{ // !show 188 }else{ // !show
187 if (scriptWidget) scriptWidget->hide(); 189 if (scriptWidget) scriptWidget->hide();
188 } 190 }
189} 191}
190 192
191void AuthWidget::toggleEchoMode( bool t ) 193void AuthWidget::toggleEchoMode( bool t )
192{ 194{
193 passWord->setEchoMode( t ? QLineEdit::Normal : QLineEdit::Password ); 195 passWord->setEchoMode( t ? QLineEdit::Normal : QLineEdit::Password );
194} 196}
195 197
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index a93f93d..798431b 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -474,257 +474,257 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
474 vmain = 10; 474 vmain = 10;
475 return; 475 return;
476 } 476 }
477 477
478 if (scriptCommand == "Scan") { 478 if (scriptCommand == "Scan") {
479 QString bm = i18n("Scanning %1").arg(scriptArgument); 479 QString bm = i18n("Scanning %1").arg(scriptArgument);
480 messg->setText(bm); 480 messg->setText(bm);
481 emit debugMessage(bm); 481 emit debugMessage(bm);
482 482
483 setScan(scriptArgument); 483 setScan(scriptArgument);
484 scriptindex++; 484 scriptindex++;
485 return; 485 return;
486 } 486 }
487 487
488 if (scriptCommand == "Save") { 488 if (scriptCommand == "Save") {
489 QString bm = i18n("Saving %1").arg(scriptArgument); 489 QString bm = i18n("Saving %1").arg(scriptArgument);
490 messg->setText(bm); 490 messg->setText(bm);
491 emit debugMessage(bm); 491 emit debugMessage(bm);
492 492
493 if (scriptArgument.lower() == "password") { 493 if (scriptArgument.lower() == "password") {
494 _ifaceppp->data()->setPassword(scanvar); 494 _ifaceppp->data()->setPassword(scanvar);
495 // p_kppp->setPW_Edit(scanvar); 495 // p_kppp->setPW_Edit(scanvar);
496 if(_ifaceppp->data()->storePassword()) 496 if(_ifaceppp->data()->storePassword())
497 _ifaceppp->data()->setStoredPassword(scanvar); 497 _ifaceppp->data()->setStoredPassword(scanvar);
498 firstrunPW = true; 498 firstrunPW = true;
499 } 499 }
500 500
501 scriptindex++; 501 scriptindex++;
502 return; 502 return;
503 } 503 }
504 504
505 505
506 if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") { 506 if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") {
507 QString bm = i18n("Sending %1"); 507 QString bm = i18n("Sending %1");
508 508
509 // replace %USERNAME% and %PASSWORD% 509 // replace %USERNAME% and %PASSWORD%
510 QString arg = scriptArgument; 510 QString arg = scriptArgument;
511 QRegExp re1("%USERNAME%"); 511 QRegExp re1("%USERNAME%");
512 QRegExp re2("%PASSWORD%"); 512 QRegExp re2("%PASSWORD%");
513 arg = arg.replace(re1, _ifaceppp->data()->storedUsername()); 513 arg = arg.replace(re1, _ifaceppp->data()->storedUsername());
514 arg = arg.replace(re2, _ifaceppp->data()->storedPassword()); 514 arg = arg.replace(re2, _ifaceppp->data()->storedPassword());
515 515
516 if (scriptCommand == "Send") 516 if (scriptCommand == "Send")
517 bm = bm.arg(scriptArgument); 517 bm = bm.arg(scriptArgument);
518 else { 518 else {
519 for(uint i = 0; i < scriptArgument.length(); i++) 519 for(uint i = 0; i < scriptArgument.length(); i++)
520 bm = bm.arg("*"); 520 bm = bm.arg("*");
521 } 521 }
522 522
523 messg->setText(bm); 523 messg->setText(bm);
524 emit debugMessage(bm); 524 emit debugMessage(bm);
525 525
526 writeline(scriptArgument); 526 writeline(scriptArgument);
527 scriptindex++; 527 scriptindex++;
528 return; 528 return;
529 } 529 }
530 530
531 if (scriptCommand == "Expect") { 531 if (scriptCommand == "Expect") {
532 QString bm = i18n("Expecting %1").arg(scriptArgument); 532 QString bm = i18n("Expecting %1").arg(scriptArgument);
533 messg->setText(bm); 533 messg->setText(bm);
534 emit debugMessage(bm); 534 emit debugMessage(bm);
535 535
536 // The incrementing of the scriptindex MUST be before the 536 // The incrementing of the scriptindex MUST be before the
537 // call to setExpect otherwise the expect will miss a string that is 537 // call to setExpect otherwise the expect will miss a string that is
538 // already in the buffer. 538 // already in the buffer.
539 scriptindex++; 539 scriptindex++;
540 setExpect(scriptArgument); 540 setExpect(scriptArgument);
541 return; 541 return;
542 } 542 }
543 543
544 544
545 if (scriptCommand == "Pause") { 545 if (scriptCommand == "Pause") {
546 QString bm = i18n("Pause %1 seconds").arg(scriptArgument); 546 QString bm = i18n("Pause %1 seconds").arg(scriptArgument);
547 messg->setText(bm); 547 messg->setText(bm);
548 emit debugMessage(bm); 548 emit debugMessage(bm);
549 549
550 pausing = true; 550 pausing = true;
551 551
552 pausetimer->start(scriptArgument.toInt()*1000, true); 552 pausetimer->start(scriptArgument.toInt()*1000, true);
553 timeout_timer->stop(); 553 timeout_timer->stop();
554 554
555 scriptindex++; 555 scriptindex++;
556 return; 556 return;
557 } 557 }
558 558
559 if (scriptCommand == "Timeout") { 559 if (scriptCommand == "Timeout") {
560 560
561 timeout_timer->stop(); 561 timeout_timer->stop();
562 562
563 QString bm = i18n("Timeout %1 seconds").arg(scriptArgument); 563 QString bm = i18n("Timeout %1 seconds").arg(scriptArgument);
564 messg->setText(bm); 564 messg->setText(bm);
565 emit debugMessage(bm); 565 emit debugMessage(bm);
566 566
567 scriptTimeout=scriptArgument.toInt()*1000; 567 scriptTimeout=scriptArgument.toInt()*1000;
568 timeout_timer->start(scriptTimeout); 568 timeout_timer->start(scriptTimeout);
569 569
570 scriptindex++; 570 scriptindex++;
571 return; 571 return;
572 } 572 }
573 573
574 if (scriptCommand == "Hangup") { 574 if (scriptCommand == "Hangup") {
575 messg->setText(i18n("Hangup")); 575 messg->setText(i18n("Hangup"));
576 emit debugMessage(i18n("Hangup")); 576 emit debugMessage(i18n("Hangup"));
577 577
578 writeline(_ifaceppp->data()->modemHangupStr()); 578 writeline(_ifaceppp->data()->modemHangupStr());
579 setExpect(_ifaceppp->data()->modemHangupResp()); 579 setExpect(_ifaceppp->data()->modemHangupResp());
580 580
581 scriptindex++; 581 scriptindex++;
582 return; 582 return;
583 } 583 }
584 584
585 if (scriptCommand == "Answer") { 585 if (scriptCommand == "Answer") {
586 586
587 timeout_timer->stop(); 587 timeout_timer->stop();
588 588
589 messg->setText(i18n("Answer")); 589 messg->setText(i18n("Answer"));
590 emit debugMessage(i18n("Answer")); 590 emit debugMessage(i18n("Answer"));
591 591
592 setExpect(_ifaceppp->data()->modemRingResp()); 592 setExpect(_ifaceppp->data()->modemRingResp());
593 vmain = 150; 593 vmain = 150;
594 return; 594 return;
595 } 595 }
596 596
597 if (scriptCommand == "ID") { 597 if (scriptCommand == "ID") {
598 QString bm = i18n("ID %1").arg(scriptArgument); 598 QString bm = i18n("ID %1").arg(scriptArgument);
599 messg->setText(bm); 599 messg->setText(bm);
600 emit debugMessage(bm); 600 emit debugMessage(bm);
601 601
602 QString idstring = _ifaceppp->data()->storedUsername(); 602 QString idstring = _ifaceppp->data()->password();
603 603
604 if(!idstring.isEmpty() && firstrunID) { 604 if(!idstring.isEmpty() && firstrunID) {
605 // the user entered an Id on the main kppp dialog 605 // the user entered an Id on the main kppp dialog
606 writeline(idstring); 606 writeline(idstring);
607 firstrunID = false; 607 firstrunID = false;
608 scriptindex++; 608 scriptindex++;
609 } 609 }
610 else { 610 else {
611 // the user didn't enter and Id on the main kppp dialog 611 // the user didn't enter and Id on the main kppp dialog
612 // let's query for an ID 612 // let's query for an ID
613 /* if not around yet, then post window... */ 613 /* if not around yet, then post window... */
614 if (prompt->Consumed()) { 614 if (prompt->Consumed()) {
615 if (!(prompt->isVisible())) { 615 if (!(prompt->isVisible())) {
616 prompt->setPrompt(scriptArgument); 616 prompt->setPrompt(scriptArgument);
617 prompt->setEchoModeNormal(); 617 prompt->setEchoModeNormal();
618 prompt->show(); 618 prompt->show();
619 } 619 }
620 } else { 620 } else {
621 /* if prompt withdrawn ... then, */ 621 /* if prompt withdrawn ... then, */
622 if(!(prompt->isVisible())) { 622 if(!(prompt->isVisible())) {
623 writeline(prompt->text()); 623 writeline(prompt->text());
624 prompt->setConsumed(); 624 prompt->setConsumed();
625 scriptindex++; 625 scriptindex++;
626 return; 626 return;
627 } 627 }
628 /* replace timeout value */ 628 /* replace timeout value */
629 } 629 }
630 } 630 }
631 } 631 }
632 632
633 if (scriptCommand == "Password") { 633 if (scriptCommand == "Password") {
634 QString bm = i18n("Password %1").arg(scriptArgument); 634 QString bm = i18n("Password %1").arg(scriptArgument);
635 messg->setText(bm); 635 messg->setText(bm);
636 emit debugMessage(bm); 636 emit debugMessage(bm);
637 637
638 QString pwstring = _ifaceppp->data()->password(); 638 QString pwstring = _ifaceppp->data()->password();
639 639
640 if(!pwstring.isEmpty() && firstrunPW) { 640 if(!pwstring.isEmpty() && firstrunPW) {
641 // the user entered a password on the main kppp dialog 641 // the user entered a password on the main kppp dialog
642 writeline(pwstring); 642 writeline(pwstring);
643 firstrunPW = false; 643 firstrunPW = false;
644 scriptindex++; 644 scriptindex++;
645 } 645 }
646 else { 646 else {
647 // the user didn't enter a password on the main kppp dialog 647 // the user didn't enter a password on the main kppp dialog
648 // let's query for a password 648 // let's query for a password
649 /* if not around yet, then post window... */ 649 /* if not around yet, then post window... */
650 if (prompt->Consumed()) { 650 if (prompt->Consumed()) {
651 if (!(prompt->isVisible())) { 651 if (!(prompt->isVisible())) {
652 prompt->setPrompt(scriptArgument); 652 prompt->setPrompt(scriptArgument);
653 prompt->setEchoModePassword(); 653 prompt->setEchoModePassword();
654 prompt->show(); 654 prompt->show();
655 } 655 }
656 } else { 656 } else {
657 /* if prompt withdrawn ... then, */ 657 /* if prompt withdrawn ... then, */
658 if(!(prompt->isVisible())) { 658 if(!(prompt->isVisible())) {
659 // p_kppp->setPW_Edit(prompt->text()); 659 // p_kppp->setPW_Edit(prompt->text());
660 writeline(prompt->text()); 660 writeline(prompt->text());
661 prompt->setConsumed(); 661 prompt->setConsumed();
662 scriptindex++; 662 scriptindex++;
663 return; 663 return;
664 } 664 }
665 /* replace timeout value */ 665 /* replace timeout value */
666 } 666 }
667 } 667 }
668 } 668 }
669 669
670 if (scriptCommand == "Prompt") { 670 if (scriptCommand == "Prompt") {
671 QString bm = i18n("Prompting %1"); 671 QString bm = i18n("Prompting %1");
672 672
673 // if the scriptindex (aka the prompt text) includes a ## marker 673 // if the scriptindex (aka the prompt text) includes a ## marker
674 // this marker should get substituted with the contents of our stored 674 // this marker should get substituted with the contents of our stored
675 // variable (from the subsequent scan). 675 // variable (from the subsequent scan).
676 676
677 QString ts = scriptArgument; 677 QString ts = scriptArgument;
678 int vstart = ts.find( "##" ); 678 int vstart = ts.find( "##" );
679 if( vstart != -1 ) { 679 if( vstart != -1 ) {
680 ts.remove( vstart, 2 ); 680 ts.remove( vstart, 2 );
681 ts.insert( vstart, scanvar ); 681 ts.insert( vstart, scanvar );
682 } 682 }
683 683
684 bm = bm.arg(ts); 684 bm = bm.arg(ts);
685 messg->setText(bm); 685 messg->setText(bm);
686 emit debugMessage(bm); 686 emit debugMessage(bm);
687 687
688 /* if not around yet, then post window... */ 688 /* if not around yet, then post window... */
689 if (prompt->Consumed()) { 689 if (prompt->Consumed()) {
690 if (!(prompt->isVisible())) { 690 if (!(prompt->isVisible())) {
691 prompt->setPrompt( ts ); 691 prompt->setPrompt( ts );
692 prompt->setEchoModeNormal(); 692 prompt->setEchoModeNormal();
693 prompt->show(); 693 prompt->show();
694 } 694 }
695 } else { 695 } else {
696 /* if prompt withdrawn ... then, */ 696 /* if prompt withdrawn ... then, */
697 if (!(prompt->isVisible())) { 697 if (!(prompt->isVisible())) {
698 writeline(prompt->text()); 698 writeline(prompt->text());
699 prompt->setConsumed(); 699 prompt->setConsumed();
700 scriptindex++; 700 scriptindex++;
701 return; 701 return;
702 } 702 }
703 /* replace timeout value */ 703 /* replace timeout value */
704 } 704 }
705 } 705 }
706 706
707 if (scriptCommand == "PWPrompt") { 707 if (scriptCommand == "PWPrompt") {
708 QString bm = i18n("PW Prompt %1").arg(scriptArgument); 708 QString bm = i18n("PW Prompt %1").arg(scriptArgument);
709 messg->setText(bm); 709 messg->setText(bm);
710 emit debugMessage(bm); 710 emit debugMessage(bm);
711 711
712 /* if not around yet, then post window... */ 712 /* if not around yet, then post window... */
713 if (prompt->Consumed()) { 713 if (prompt->Consumed()) {
714 if (!(prompt->isVisible())) { 714 if (!(prompt->isVisible())) {
715 prompt->setPrompt(scriptArgument); 715 prompt->setPrompt(scriptArgument);
716 prompt->setEchoModePassword(); 716 prompt->setEchoModePassword();
717 prompt->show(); 717 prompt->show();
718 } 718 }
719 } else { 719 } else {
720 /* if prompt withdrawn ... then, */ 720 /* if prompt withdrawn ... then, */
721 if (!(prompt->isVisible())) { 721 if (!(prompt->isVisible())) {
722 writeline(prompt->text()); 722 writeline(prompt->text());
723 prompt->setConsumed(); 723 prompt->setConsumed();
724 scriptindex++; 724 scriptindex++;
725 return; 725 return;
726 } 726 }
727 /* replace timeout value */ 727 /* replace timeout value */
728 } 728 }
729 } 729 }
730 730
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
index 98bb4da..85ddbee 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -1,140 +1,141 @@
1 1
2#include <qmessagebox.h> 2#include <qmessagebox.h>
3#define i18n QObject::tr 3#define i18n QObject::tr
4 4
5#include "auth.h" 5#include "auth.h"
6#include "interfaceppp.h" 6#include "interfaceppp.h"
7#include "modem.h" 7#include "modem.h"
8#include "pppdata.h" 8#include "pppdata.h"
9 9
10InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) 10InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
11 : Interface(parent, name, status), 11 : Interface(parent, name, status),
12 _modemPtr(0), 12 _modemPtr(0),
13 _dataPtr(0) 13 _dataPtr(0)
14{ 14{
15 qDebug("InterfacePPP::InterfacePPP("); 15 qDebug("InterfacePPP::InterfacePPP(");
16} 16}
17 17
18PPPData* InterfacePPP::data() 18PPPData* InterfacePPP::data()
19{ 19{
20 if (!_dataPtr){ 20 if (!_dataPtr){
21 qDebug("creating new Data obj"); 21 qDebug("creating new Data obj");
22 _dataPtr = new PPPData(); 22 _dataPtr = new PPPData();
23 _dataPtr->setModemDevice( getInterfaceName() ); 23 _dataPtr->setModemDevice( getInterfaceName() );
24 _dataPtr->setAccount( getHardwareName() ); 24 _dataPtr->setAccount( getHardwareName() );
25 } 25 }
26 return _dataPtr; 26 return _dataPtr;
27} 27}
28 28
29Modem* InterfacePPP::modem() 29Modem* InterfacePPP::modem()
30{ 30{
31 if (!_modemPtr){ 31 if (!_modemPtr){
32 qDebug("creating new modem obj"); 32 qDebug("creating new modem obj");
33 _modemPtr = new Modem( data() ); 33 _modemPtr = new Modem( data() );
34 } 34 }
35 return _modemPtr; 35 return _modemPtr;
36} 36}
37 37
38bool InterfacePPP::refresh() 38bool InterfacePPP::refresh()
39{ 39{
40 qDebug("InterfacePPP::refresh()"); 40 qDebug("InterfacePPP::refresh()");
41 QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-("); 41 QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-(");
42 return false; 42 return false;
43} 43}
44 44
45void InterfacePPP::start() 45void InterfacePPP::start()
46{ 46{
47 qDebug("InterfacePPP::start"); 47 qDebug("InterfacePPP::start");
48 if (data()->password().isEmpty() ){ 48// should work...
49//FIXME: ask for password 49// if (data()->password().isEmpty() ){
50 qDebug("using dummy password"); 50// //FIXME: ask for password
51 QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)"); 51// qDebug("using dummy password");
52 } 52// QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)");
53// }
53 54
54 55
55 QFileInfo info(pppdPath()); 56 QFileInfo info(pppdPath());
56 57
57 if(!info.exists()){ 58 if(!info.exists()){
58 QMessageBox::warning(0, tr("Error"), 59 QMessageBox::warning(0, tr("Error"),
59 i18n("<qt>Cannot find the PPP daemon!<br>" 60 i18n("<qt>Cannot find the PPP daemon!<br>"
60 "Make sure that pppd is installed and " 61 "Make sure that pppd is installed and "
61 "that you have entered the correct path.</qt>")); 62 "that you have entered the correct path.</qt>"));
62 return; 63 return;
63 } 64 }
64//#if 0 65//#if 0
65 if(!info.isExecutable()){ 66 if(!info.isExecutable()){
66 67
67 QString string; 68 QString string;
68 string = i18n( "<qt>Cannot execute:<br> %1<br>" 69 string = i18n( "<qt>Cannot execute:<br> %1<br>"
69 "Please make sure that you have given " 70 "Please make sure that you have given "
70 "setuid permission and that " 71 "setuid permission and that "
71 "pppd is executable.<br>").arg(pppdPath()); 72 "pppd is executable.<br>").arg(pppdPath());
72 QMessageBox::warning(0, tr("Error"), string); 73 QMessageBox::warning(0, tr("Error"), string);
73 return; 74 return;
74 75
75 } 76 }
76//#endif 77//#endif
77 78
78 QFileInfo info2(data()->modemDevice()); 79 QFileInfo info2(data()->modemDevice());
79 80
80 if(!info2.exists()){ 81 if(!info2.exists()){
81 QString string; 82 QString string;
82 string = i18n( "<qt>Cannot find:<br> %1<br>" 83 string = i18n( "<qt>Cannot find:<br> %1<br>"
83 "Please make sure you have setup " 84 "Please make sure you have setup "
84 "your modem device properly " 85 "your modem device properly "
85 "and/or adjust the location of the modem device on " 86 "and/or adjust the location of the modem device on "
86 "the modem tab of " 87 "the modem tab of "
87 "the setup dialog.</qt>").arg(data()->modemDevice()); 88 "the setup dialog.</qt>").arg(data()->modemDevice());
88 QMessageBox::warning(0, tr("Error"), string); 89 QMessageBox::warning(0, tr("Error"), string);
89 return; 90 return;
90 } 91 }
91 92
92 // if this is a PAP or CHAP account, ensure that username is 93 // if this is a PAP or CHAP account, ensure that username is
93 // supplied 94 // supplied
94 if(data()->authMethod() == AUTH_PAP || 95 if(data()->authMethod() == AUTH_PAP ||
95 data()->authMethod() == AUTH_CHAP || 96 data()->authMethod() == AUTH_CHAP ||
96 data()->authMethod() == AUTH_PAPCHAP ) { 97 data()->authMethod() == AUTH_PAPCHAP ) {
97 if(false){ //FIXME: ID_Edit->text().isEmpty()) { 98 if(false){ //FIXME: ID_Edit->text().isEmpty()) {
98 QMessageBox::warning(0,tr("Error"), 99 QMessageBox::warning(0,tr("Error"),
99 i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>")); 100 i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>"));
100// FIXME: return; 101// FIXME: return;
101 } else { 102 } else {
102 if(!modem()->setSecret(data()->authMethod(), 103 if(!modem()->setSecret(data()->authMethod(),
103 PPPData::encodeWord(data()->storedUsername()), 104 PPPData::encodeWord(data()->storedUsername()),
104 PPPData::encodeWord(data()->password())) 105 PPPData::encodeWord(data()->password()))
105 ) { 106 ) {
106 QString s; 107 QString s;
107 s = i18n("<qt>Cannot create PAP/CHAP authentication<br>" 108 s = i18n("<qt>Cannot create PAP/CHAP authentication<br>"
108 "file \"%1\"</qt>").arg(PAP_AUTH_FILE); 109 "file \"%1\"</qt>").arg(PAP_AUTH_FILE);
109 QMessageBox::warning(0, tr("Error"), s); 110 QMessageBox::warning(0, tr("Error"), s);
110 return; 111 return;
111 } 112 }
112 } 113 }
113 } 114 }
114 115
115 if (data()->phonenumber().isEmpty()) { 116 if (data()->phonenumber().isEmpty()) {
116 QString s = i18n("You must specify a telephone number!"); 117 QString s = i18n("You must specify a telephone number!");
117 QMessageBox::warning(0, tr("Error"), s); 118 QMessageBox::warning(0, tr("Error"), s);
118 return; 119 return;
119 } 120 }
120 121
121 // SEGFAULTS: 122 // SEGFAULTS:
122// setStatus( true ); 123// setStatus( true );
123// emit updateInterface((Interface*) this); 124// emit updateInterface((Interface*) this);
124 125
125 emit begin_connect(); 126 emit begin_connect();
126 127
127 qDebug("InterfacePPP::start END"); 128 qDebug("InterfacePPP::start END");
128} 129}
129 130
130void InterfacePPP::stop() 131void InterfacePPP::stop()
131{ 132{
132 qDebug("InterfacePPP::stop"); 133 qDebug("InterfacePPP::stop");
133 134
134} 135}
135 136
136void InterfacePPP::save() 137void InterfacePPP::save()
137{ 138{
138 data()->save(); 139 data()->save();
139 emit updateInterface((Interface*) this); 140 emit updateInterface((Interface*) this);
140} 141}