summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/kpppwidget.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp89
1 files changed, 39 insertions, 50 deletions
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index 7b5c74d..e466358 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -33,61 +33,50 @@
33#include <qdialog.h> 33#include <qdialog.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qtabwidget.h> 37#include <qtabwidget.h>
38#include <qdialog.h> 38#include <qdialog.h>
39#include <qwhatsthis.h> 39#include <qwhatsthis.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41 41
42// #include <kaboutdata.h> 42// #include <kaboutdata.h>
43// #include <kapplication.h> 43// #include <kapplication.h>
44#include <qbuttongroup.h> 44#include <qbuttongroup.h>
45//#include <kcmdlineargs.h>
46//#include <kconfig.h>
47//#include <kdebug.h>
48#define i18n QObject::tr
49//#include <kiconloader.h> // For BarIcon
50//#include <klocale.h>
51#include <qmessagebox.h> 45#include <qmessagebox.h>
52// #include <kseparator.h>
53// #include <kstandarddirs.h>
54// #include <kwin.h>
55// #include <khelpmenu.h>
56#include <qpushbutton.h> 46#include <qpushbutton.h>
57//#include <kguiitem.h>
58 47
59#include <stdlib.h> 48#include <stdlib.h>
60#include <errno.h> 49#include <errno.h>
61#include <signal.h> 50#include <signal.h>
62 51
63#include "runtests.h" 52#include "runtests.h"
64 53
65//#include "main.h" 54//#include "main.h"
66#include "auth.h" 55#include "auth.h"
67#include "modem.h" 56#include "modem.h"
68//#include "ppplog.h" 57//#include "ppplog.h"
69//#include "opener.h" 58//#include "opener.h"
70//#include "requester.h" 59//#include "requester.h"
71//#include "pppstats.h" 60//#include "pppstats.h"
72#include "pppdata.h" 61#include "pppdata.h"
73#include "general.h" 62#include "general.h"
74#include "interface.h" 63#include "interface.h"
75 64
76#define execute_command system 65#define execute_command system
77 66
78KPPPWidget *p_kppp = 0; 67KPPPWidget *p_kppp = 0;
79 68
80KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) 69KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl )
81 : QDialog(parent, name, modal, fl), _pppdata(pd) 70 : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd)
82{ 71{
83// tabWindow = 0; 72// tabWindow = 0;
84 p_kppp = this; 73 p_kppp = this;
85 // before doing anything else, run a few tests 74 // before doing anything else, run a few tests
86 if (!_pppdata->setModemDevice( i->getInterfaceName() )) 75 if (!_pppdata->setModemDevice( i->getInterfaceName() ))
87 _pppdata->setModemDevice("/dev/modem"); 76 _pppdata->setModemDevice("/dev/modem");
88 qDebug("PPPConfigWidget::PPPConfigWidget"); 77 qDebug("PPPConfigWidget::PPPConfigWidget");
89 qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); 78 qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1());
90 if (!_pppdata->setAccount( i->getHardwareName() )) 79 if (!_pppdata->setAccount( i->getHardwareName() ))
91 _pppdata->setAccount( 0 ); 80 _pppdata->setAccount( 0 );
92 81
93 qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); 82 qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1());
@@ -99,130 +88,130 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
99 88
100// installEventFilter(this); 89// installEventFilter(this);
101 90
102 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 91 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
103 92
104 QGridLayout *l1 = new QGridLayout(3, 4); 93 QGridLayout *l1 = new QGridLayout(3, 4);
105 tl->addLayout(l1); 94 tl->addLayout(l1);
106 l1->addColSpacing(0, 10); 95 l1->addColSpacing(0, 10);
107 l1->addColSpacing(3, 10); 96 l1->addColSpacing(3, 10);
108 l1->setColStretch(1, 3); 97 l1->setColStretch(1, 3);
109 l1->setColStretch(2, 4); 98 l1->setColStretch(2, 4);
110 99
111 label1 = new QLabel(i18n("C&onnect to: "), this); 100 label1 = new QLabel(QObject::tr("C&onnect to: "), this);
112 l1->addWidget(label1, 0, 1); 101 l1->addWidget(label1, 0, 1);
113 102
114 connectto_c = new QComboBox(false, this); 103 connectto_c = new QComboBox(false, this);
115 label1->setBuddy(connectto_c); 104 label1->setBuddy(connectto_c);
116 105
117 connect(connectto_c, SIGNAL(activated(int)), 106 connect(connectto_c, SIGNAL(activated(int)),
118 SLOT(newdefaultaccount(int))); 107 SLOT(newdefaultaccount(int)));
119 l1->addWidget(connectto_c, 0, 2); 108 l1->addWidget(connectto_c, 0, 2);
120 109
121 ID_Label = new QLabel(i18n("&Login ID:"), this); 110 ID_Label = new QLabel(QObject::tr("&Login ID:"), this);
122 l1->addWidget(ID_Label, 1, 1); 111 l1->addWidget(ID_Label, 1, 1);
123 112
124 // the entry line for usernames 113 // the entry line for usernames
125 ID_Edit = new QLineEdit(this); 114 ID_Edit = new QLineEdit(this);
126 ID_Label->setBuddy(ID_Edit); 115 ID_Label->setBuddy(ID_Edit);
127 l1->addWidget(ID_Edit, 1, 2); 116 l1->addWidget(ID_Edit, 1, 2);
128 connect(ID_Edit, SIGNAL(returnPressed()), 117 connect(ID_Edit, SIGNAL(returnPressed()),
129 this, SLOT(enterPressedInID())); 118 this, SLOT(enterPressedInID()));
130 QString tmp = i18n("<p>Type in the username that you got from your\n" 119 QString tmp = QObject::tr("<p>Type in the username that you got from your\n"
131 "ISP. This is especially important for PAP\n" 120 "ISP. This is especially important for PAP\n"
132 "and CHAP. You may omit this when you use\n" 121 "and CHAP. You may omit this when you use\n"
133 "terminal-based or script-based authentication.\n" 122 "terminal-based or script-based authentication.\n"
134 "\n" 123 "\n"
135 "<b>Important</b>: case is important here:\n" 124 "<b>Important</b>: case is important here:\n"
136 "<i>myusername</i> is not the same as <i>MyUserName</i>!"); 125 "<i>myusername</i> is not the same as <i>MyUserName</i>!");
137 126
138 QWhatsThis::add(ID_Label,tmp); 127 QWhatsThis::add(ID_Label,tmp);
139 QWhatsThis::add(ID_Edit,tmp); 128 QWhatsThis::add(ID_Edit,tmp);
140 129
141 PW_Label = new QLabel(i18n("&Password:"), this); 130 PW_Label = new QLabel(QObject::tr("&Password:"), this);
142 l1->addWidget(PW_Label, 2, 1); 131 l1->addWidget(PW_Label, 2, 1);
143 132
144 PW_Edit= new QLineEdit(this); 133 PW_Edit= new QLineEdit(this);
145 PW_Label->setBuddy(PW_Edit); 134 PW_Label->setBuddy(PW_Edit);
146 PW_Edit->setEchoMode(QLineEdit::Password); 135 PW_Edit->setEchoMode(QLineEdit::Password);
147 l1->addWidget(PW_Edit, 2, 2); 136 l1->addWidget(PW_Edit, 2, 2);
148 connect(PW_Edit, SIGNAL(returnPressed()), 137 connect(PW_Edit, SIGNAL(returnPressed()),
149 this, SLOT(enterPressedInPW())); 138 this, SLOT(enterPressedInPW()));
150 139
151 tmp = i18n("<p>Type in the password that you got from your\n" 140 tmp = QObject::tr("<p>Type in the password that you got from your\n"
152 "ISP. This is especially important for PAP\n" 141 "ISP. This is especially important for PAP\n"
153 "and CHAP. You may omit this when you use\n" 142 "and CHAP. You may omit this when you use\n"
154 "terminal-based or script-based authentication.\n" 143 "terminal-based or script-based authentication.\n"
155 "\n" 144 "\n"
156 "<b>Important</b>: case is important here:\n" 145 "<b>Important</b>: case is important here:\n"
157 "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); 146 "<i>mypassword</i> is not the same as <i>MyPassword</i>!");
158 147
159 QWhatsThis::add(PW_Label,tmp); 148 QWhatsThis::add(PW_Label,tmp);
160 QWhatsThis::add(PW_Edit,tmp); 149 QWhatsThis::add(PW_Edit,tmp);
161 150
162 QHBoxLayout *l3 = new QHBoxLayout; 151 QHBoxLayout *l3 = new QHBoxLayout;
163 tl->addSpacing(5); 152 tl->addSpacing(5);
164 tl->addLayout(l3); 153 tl->addLayout(l3);
165 tl->addSpacing(5); 154 tl->addSpacing(5);
166 l3->addSpacing(10); 155 l3->addSpacing(10);
167 log = new QCheckBox(i18n("Show lo&g window"), this); 156 log = new QCheckBox(QObject::tr("Show lo&g window"), this);
168 connect(log, SIGNAL(toggled(bool)), 157 connect(log, SIGNAL(toggled(bool)),
169 this, SLOT(log_window_toggled(bool))); 158 this, SLOT(log_window_toggled(bool)));
170 log->setChecked(_pppdata->get_show_log_window()); 159 log->setChecked(_pppdata->get_show_log_window());
171 l3->addWidget(log); 160 l3->addWidget(log);
172 161
173 QWhatsThis::add(log, 162 QWhatsThis::add(log,
174 i18n("<p>This controls whether a log window is shown.\n" 163 QObject::tr("<p>This controls whether a log window is shown.\n"
175 "A log window shows the communication between\n" 164 "A log window shows the communication between\n"
176 "<i>kppp</i> and your modem. This will help you\n" 165 "<i>kppp</i> and your modem. This will help you\n"
177 "in tracking down problems.\n" 166 "in tracking down problems.\n"
178 "\n" 167 "\n"
179 "Turn it off if <i>kppp</i> routinely connects without\n" 168 "Turn it off if <i>kppp</i> routinely connects without\n"
180 "problems")); 169 "problems"));
181 170
182// fline = new QSeparator( KSeparator::HLine, this); 171// fline = new QSeparator( KSeparator::HLine, this);
183// tl->addWidget(fline); 172// tl->addWidget(fline);
184 173
185 QHBoxLayout *l2 = new QHBoxLayout(this); 174 QHBoxLayout *l2 = new QHBoxLayout(this);
186 tl->addLayout(l2); 175 tl->addLayout(l2);
187 176
188 int minw = 0; 177 int minw = 0;
189 quit_b = new QPushButton(i18n("&Quit"), this); 178 quit_b = new QPushButton(QObject::tr("&Quit"), this);
190 // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); 179 // quit_b-> setGuiItem (KGuiItem(QObject::tr("&Quit"), "exit" ) );
191 connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); 180 connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton()));
192 if(quit_b->sizeHint().width() > minw) 181 if(quit_b->sizeHint().width() > minw)
193 minw = quit_b->sizeHint().width(); 182 minw = quit_b->sizeHint().width();
194 183
195 setup_b = new QPushButton(i18n("&Setup..."), this); 184 setup_b = new QPushButton(QObject::tr("&Setup..."), this);
196// setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); 185// setup_b->setGuiItem (KGuiItem(QObject::tr("&Setup...")) );
197 connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); 186 connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton()));
198 if(setup_b->sizeHint().width() > minw) 187 if(setup_b->sizeHint().width() > minw)
199 minw = setup_b->sizeHint().width(); 188 minw = setup_b->sizeHint().width();
200 189
201 190
202 191
203// if(_pppdata->access() != KConfig::ReadWrite) 192// if(_pppdata->access() != KConfig::ReadWrite)
204 // setup_b->setEnabled(false); 193 // setup_b->setEnabled(false);
205 194
206// help_b = new QPushButton(i18n("&Help"), this); 195// help_b = new QPushButton(QObject::tr("&Help"), this);
207// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); 196// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton()));
208 197
209// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); 198// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true);
210// help_b->setPopup((QPopupMenu*)helpMenu->menu()); 199// help_b->setPopup((QPopupMenu*)helpMenu->menu());
211// help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); 200// help_b->setGuiItem (KGuiItem(QObject::tr("&Help"), "help" ) );
212 201
213// if(help_b->sizeHint().width() > minw) 202// if(help_b->sizeHint().width() > minw)
214// minw = help_b->sizeHint().width(); 203// minw = help_b->sizeHint().width();
215 204
216 connect_b = new QPushButton(i18n("&Connect"), this); 205 connect_b = new QPushButton(QObject::tr("&Connect"), this);
217 connect_b->setDefault(true); 206 connect_b->setDefault(true);
218 connect_b->setFocus(); 207 connect_b->setFocus();
219 connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); 208 connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect()));
220 if(connect_b->sizeHint().width() > minw) 209 if(connect_b->sizeHint().width() > minw)
221 minw = connect_b->sizeHint().width(); 210 minw = connect_b->sizeHint().width();
222 211
223 quit_b->setFixedWidth(minw); 212 quit_b->setFixedWidth(minw);
224 setup_b->setFixedWidth(minw); 213 setup_b->setFixedWidth(minw);
225// help_b->setFixedWidth(help_b->sizeHint().width()); 214// help_b->setFixedWidth(help_b->sizeHint().width());
226 connect_b->setFixedWidth(minw); 215 connect_b->setFixedWidth(minw);
227 216
228 l2->addWidget(quit_b); 217 l2->addWidget(quit_b);
@@ -277,25 +266,25 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
277// m_strCmdlAccount = args->getOption("c"); 266// m_strCmdlAccount = args->getOption("c");
278// m_bQuitOnDisconnect = args->isSet("q"); 267// m_bQuitOnDisconnect = args->isSet("q");
279 268
280// if(!m_strCmdlAccount.isEmpty()) { 269// if(!m_strCmdlAccount.isEmpty()) {
281// m_bCmdlAccount = true; 270// m_bCmdlAccount = true;
282// kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; 271// kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl;
283// } 272// }
284 273
285// if(m_bCmdlAccount){ 274// if(m_bCmdlAccount){
286// bool result = _pppdata->setAccount(m_strCmdlAccount); 275// bool result = _pppdata->setAccount(m_strCmdlAccount);
287// if (!result){ 276// if (!result){
288// QString string; 277// QString string;
289// string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); 278// string = QObject::tr("No such Account:\n%1").arg(m_strCmdlAccount);
290// KMessageBox::error(this, string); 279// KMessageBox::error(this, string);
291// m_bCmdlAccount = false; 280// m_bCmdlAccount = false;
292// this->show(); 281// this->show();
293// } else { 282// } else {
294// beginConnect(); 283// beginConnect();
295// } 284// }
296// } else 285// } else
297// expandbutton(); 286// expandbutton();
298// show(); 287// show();
299 288
300 289
301//#define KPPP_SHOW_NEWS 290//#define KPPP_SHOW_NEWS
@@ -473,39 +462,39 @@ void KPPPWidget::sigPPPDDied() {
473 if(!_pppdata->automatic_redial()) { 462 if(!_pppdata->automatic_redial()) {
474 quit_b->setFocus(); 463 quit_b->setFocus();
475 show(); 464 show();
476 con_win->stopClock(); 465 con_win->stopClock();
477 //stopAccounting(); 466 //stopAccounting();
478 con_win->hide(); 467 con_win->hide();
479 con->hide(); 468 con->hide();
480 469
481 _pppdata->setpppdRunning(false); 470 _pppdata->setpppdRunning(false);
482 // // not in a signal handler !!! KNotifyClient::beep(); 471 // // not in a signal handler !!! KNotifyClient::beep();
483 QString msg; 472 QString msg;
484 if (_pppdata->pppdError() == E_IF_TIMEOUT) 473 if (_pppdata->pppdError() == E_IF_TIMEOUT)
485 msg = i18n("Timeout expired while waiting for the PPP interface " 474 msg = QObject::tr("Timeout expired while waiting for the PPP interface "
486 "to come up!"); 475 "to come up!");
487 else { 476 else {
488 msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); 477 msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>");
489 Modem::modem->pppdExitStatus(); 478 Modem::modem->pppdExitStatus();
490 if (Modem::modem->lastStatus != 99) {// more recent pppds only 479 if (Modem::modem->lastStatus != 99) {// more recent pppds only
491 msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); 480 msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus);
492 msg += i18n("</p><p>See 'man pppd' for an explanation of the error " 481 msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error "
493 "codes or take a look at the kppp FAQ on " 482 "codes or take a look at the kppp FAQ on "
494 " <a href=http://devel-home.kde.org/~kppp/index.html>" 483 " <a href=http://devel-home.kde.org/~kppp/index.html>"
495 "http://devel-home.kde.org/~kppp/index.html</a></p>"); 484 "http://devel-home.kde.org/~kppp/index.html</a></p>");
496 } 485 }
497 } 486 }
498 487
499 // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) 488 // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No)
500 // // PPPL_ShowLog(); 489 // // PPPL_ShowLog();
501// } else { /* reconnect on disconnect */ 490// } else { /* reconnect on disconnect */
502 if (false){ 491 if (false){
503 qDebug( "Trying to reconnect... " ); 492 qDebug( "Trying to reconnect... " );
504 493
505 if(_pppdata->authMethod() == AUTH_PAP || 494 if(_pppdata->authMethod() == AUTH_PAP ||
506 _pppdata->authMethod() == AUTH_CHAP || 495 _pppdata->authMethod() == AUTH_CHAP ||
507 _pppdata->authMethod() == AUTH_PAPCHAP) 496 _pppdata->authMethod() == AUTH_PAPCHAP)
508 Modem::modem->setSecret(_pppdata->authMethod(), 497 Modem::modem->setSecret(_pppdata->authMethod(),
509 encodeWord(_pppdata->storedUsername()), 498 encodeWord(_pppdata->storedUsername()),
510 encodeWord(_pppdata->password())); 499 encodeWord(_pppdata->password()));
511 500
@@ -518,25 +507,25 @@ void KPPPWidget::sigPPPDDied() {
518 } 507 }
519 } 508 }
520 _pppdata->setpppdError(0); 509 _pppdata->setpppdError(0);
521 } 510 }
522} 511}
523 512
524// void KPPPWidget::sigChld() { 513// void KPPPWidget::sigChld() {
525// qDebug( "sigchld()" ); 514// qDebug( "sigchld()" );
526// // pid_t id = wait(0L); 515// // pid_t id = wait(0L);
527// // if(id == helperPid && helperPid != -1) { 516// // if(id == helperPid && helperPid != -1) {
528// // kdDebug(5002) << "It was the setuid child that died" << endl; 517// // kdDebug(5002) << "It was the setuid child that died" << endl;
529// // helperPid = -1; 518// // helperPid = -1;
530// QString msg = i18n("kppp's helper process just died.\n" 519// QString msg = QObject::tr("kppp's helper process just died.\n"
531// "Since a further execution would be pointless, " 520// "Since a further execution would be pointless, "
532// "kppp will shut down now."); 521// "kppp will shut down now.");
533// QMessageBox::warning(0L,"error", msg); 522// QMessageBox::warning(0L,"error", msg);
534// //remove_pidfile(); 523// //remove_pidfile();
535// exit(1); 524// exit(1);
536// // } 525// // }
537// } 526// }
538 527
539 528
540void KPPPWidget::newdefaultaccount(int i) { 529void KPPPWidget::newdefaultaccount(int i) {
541 _pppdata->setDefaultAccount(connectto_c->text(i)); 530 _pppdata->setDefaultAccount(connectto_c->text(i));
542 _pppdata->save(); 531 _pppdata->save();
@@ -551,102 +540,102 @@ void KPPPWidget::beginConnect() {
551 // make sure to connect to the account that is selected in the combo box 540 // make sure to connect to the account that is selected in the combo box
552 // (exeption: an account given by a command line argument) 541 // (exeption: an account given by a command line argument)
553 // if(!m_bCmdlAccount) { 542 // if(!m_bCmdlAccount) {
554// _pppdata->setAccount(connectto_c->currentText()); 543// _pppdata->setAccount(connectto_c->currentText());
555// _pppdata->setPassword(PW_Edit->text()); 544// _pppdata->setPassword(PW_Edit->text());
556// } else { 545// } else {
557 _pppdata->setPassword(_pppdata->storedPassword()); 546 _pppdata->setPassword(_pppdata->storedPassword());
558// } 547// }
559 548
560 QFileInfo info(pppdPath()); 549 QFileInfo info(pppdPath());
561 550
562 if(!info.exists()){ 551 if(!info.exists()){
563 QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" 552 QMessageBox::warning(this, "error", QObject::tr("Cannot find the PPP daemon!\n"
564 "Make sure that pppd is installed and " 553 "Make sure that pppd is installed and "
565 "that you have entered the correct path.")); 554 "that you have entered the correct path."));
566 return; 555 return;
567 } 556 }
568#if 0 557#if 0
569 if(!info.isExecutable()){ 558 if(!info.isExecutable()){
570 559
571 QString string; 560 QString string;
572 string = i18n("kppp cannot execute:\n %1\n" 561 string = QObject::tr("kppp cannot execute:\n %1\n"
573 "Please make sure that you have given kppp " 562 "Please make sure that you have given kppp "
574 "setuid permission and that " 563 "setuid permission and that "
575 "pppd is executable.").arg(_pppdata->pppdPath()); 564 "pppd is executable.").arg(_pppdata->pppdPath());
576 KMessageBox::error(this, string); 565 KMessageBox::error(this, string);
577 return; 566 return;
578 567
579 } 568 }
580#endif 569#endif
581 570
582 QFileInfo info2(_pppdata->modemDevice()); 571 QFileInfo info2(_pppdata->modemDevice());
583 572
584 if(!info2.exists()){ 573 if(!info2.exists()){
585 QString string; 574 QString string;
586 string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " 575 string = QObject::tr("kppp can not find:\n %1\nPlease make sure you have setup "
587 "your modem device properly " 576 "your modem device properly "
588 "and/or adjust the location of the modem device on " 577 "and/or adjust the location of the modem device on "
589 "the modem tab of " 578 "the modem tab of "
590 "the setup dialog.").arg(_pppdata->modemDevice()); 579 "the setup dialog.").arg(_pppdata->modemDevice());
591 QMessageBox::warning(this, "error", string); 580 QMessageBox::warning(this, "error", string);
592 return; 581 return;
593 } 582 }
594 583
595 // if this is a PAP or CHAP account, ensure that username is 584 // if this is a PAP or CHAP account, ensure that username is
596 // supplied 585 // supplied
597 if(_pppdata->authMethod() == AUTH_PAP || 586 if(_pppdata->authMethod() == AUTH_PAP ||
598 _pppdata->authMethod() == AUTH_CHAP || 587 _pppdata->authMethod() == AUTH_CHAP ||
599 _pppdata->authMethod() == AUTH_PAPCHAP ) { 588 _pppdata->authMethod() == AUTH_PAPCHAP ) {
600 if(ID_Edit->text().isEmpty()) { 589 if(ID_Edit->text().isEmpty()) {
601 QMessageBox::warning(this,"error", 590 QMessageBox::warning(this,"error",
602 i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!")); 591 QObject::tr("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!"));
603 return; 592 return;
604 } else { 593 } else {
605 if(!Modem::modem->setSecret(_pppdata->authMethod(), 594 if(!Modem::modem->setSecret(_pppdata->authMethod(),
606 encodeWord(_pppdata->storedUsername()), 595 encodeWord(_pppdata->storedUsername()),
607 encodeWord(_pppdata->password()))) { 596 encodeWord(_pppdata->password()))) {
608 QString s; 597 QString s;
609 s = i18n("Cannot create PAP/CHAP authentication\n" 598 s = QObject::tr("Cannot create PAP/CHAP authentication\n"
610 "file \"%1\"").arg(PAP_AUTH_FILE); 599 "file \"%1\"").arg(PAP_AUTH_FILE);
611 QMessageBox::warning(this, "error", s); 600 QMessageBox::warning(this, "error", s);
612 return; 601 return;
613 } 602 }
614 } 603 }
615 } 604 }
616 605
617 if (_pppdata->phonenumber().isEmpty()) { 606 if (_pppdata->phonenumber().isEmpty()) {
618 QString s = i18n("You must specify a telephone number!"); 607 QString s = QObject::tr("You must specify a telephone number!");
619 QMessageBox::warning(this, "error", s); 608 QMessageBox::warning(this, "error", s);
620 return; 609 return;
621 } 610 }
622 611
623 this->hide(); 612 this->hide();
624 613
625 QString tit = i18n("Connecting to: %1").arg(_pppdata->accname()); 614 QString tit = QObject::tr("Connecting to: %1").arg(_pppdata->accname());
626// con->setCaption(tit); 615// con->setCaption(tit);
627 616
628// con->show(); 617// con->show();
629 618
630 619
631 emit begin_connect(); 620 emit begin_connect();
632} 621}
633 622
634 623
635void KPPPWidget::disconnect() { 624void KPPPWidget::disconnect() {
636 if (!_pppdata->command_before_disconnect().isEmpty()) { 625 if (!_pppdata->command_before_disconnect().isEmpty()) {
637 con_win->hide(); 626 con_win->hide();
638 con->show(); 627 con->show();
639 con->setCaption(i18n("Disconnecting...")); 628 con->setCaption(QObject::tr("Disconnecting..."));
640 con->setMsg(i18n("Executing command before disconnection.")); 629 con->setMsg(QObject::tr("Executing command before disconnection."));
641 630
642 qApp->processEvents(); 631 qApp->processEvents();
643 QApplication::flushX(); 632 QApplication::flushX();
644// pid_t id = 633// pid_t id =
645 execute_command(_pppdata->command_before_disconnect()); 634 execute_command(_pppdata->command_before_disconnect());
646// int i, status; 635// int i, status;
647 636
648// do { 637// do {
649// kapp->processEvents(); 638// kapp->processEvents();
650// i = waitpid(id, &status, WNOHANG); 639// i = waitpid(id, &status, WNOHANG);
651// usleep(500000); 640// usleep(500000);
652// } while (i == 0 && errno == 0); 641// } while (i == 0 && errno == 0);
@@ -683,26 +672,26 @@ void KPPPWidget::disconnect() {
683// } 672// }
684} 673}
685 674
686 675
687// void KPPPWidget::helpbutton() { 676// void KPPPWidget::helpbutton() {
688// kapp->invokeHelp(); 677// kapp->invokeHelp();
689// } 678// }
690 679
691 680
692void KPPPWidget::quitbutton() { 681void KPPPWidget::quitbutton() {
693 if(_pppdata->pppdRunning()) { 682 if(_pppdata->pppdRunning()) {
694 int ok = QMessageBox::warning(this, 683 int ok = QMessageBox::warning(this,
695 i18n("Exiting kPPP will close your PPP Session."), 684 QObject::tr("Exiting kPPP will close your PPP Session."),
696 i18n("Quit kPPP?")); 685 QObject::tr("Quit kPPP?"));
697 if(ok == QMessageBox::Yes) { 686 if(ok == QMessageBox::Yes) {
698 Modem::modem->killPPPDaemon(); 687 Modem::modem->killPPPDaemon();
699 QApplication::flushX(); 688 QApplication::flushX();
700 execute_command(_pppdata->command_on_disconnect()); 689 execute_command(_pppdata->command_on_disconnect());
701 removedns(); 690 removedns();
702 Modem::modem->unlockdevice(); 691 Modem::modem->unlockdevice();
703 } 692 }
704 } else { 693 } else {
705 if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) 694 if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword())
706 _pppdata->setStoredPassword(""); 695 _pppdata->setStoredPassword("");
707 } 696 }
708 _pppdata->save(); 697 _pppdata->save();
@@ -727,25 +716,25 @@ void KPPPWidget::quitbutton() {
727 716
728// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); 717// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile());
729// // if(::access(d.data(), X_OK) != 0) 718// // if(::access(d.data(), X_OK) != 0)
730// acct = new Accounting(this, stats); 719// acct = new Accounting(this, stats);
731// // else 720// // else
732// // acct = new ExecutableAccounting(this); 721// // acct = new ExecutableAccounting(this);
733 722
734// // connect to the accounting object 723// // connect to the accounting object
735// connect(acct, SIGNAL(changed(QString, QString)), 724// connect(acct, SIGNAL(changed(QString, QString)),
736 // con_win, SLOT(slotAccounting(QString, QString))); 725 // con_win, SLOT(slotAccounting(QString, QString)));
737 726
738// // if(!acct->loadRuleSet(_pppdata->accountingFile())) { 727// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
739// // QString s= i18n("Can not load the accounting " 728// // QString s= QObject::tr("Can not load the accounting "
740 // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); 729 // // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
741 730
742// // starting the messagebox with a timer will prevent us 731// // starting the messagebox with a timer will prevent us
743// // from blocking the calling function ConnectWidget::timerEvent 732// // from blocking the calling function ConnectWidget::timerEvent
744// ruleset_load_errmsg = s; 733// ruleset_load_errmsg = s;
745// QTimer::singleShot(0, this, SLOT(rulesetLoadError())); 734// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
746// return; 735// return;
747// } 736// }
748// //else 737// //else
749// // acct->slotStart(); 738// // acct->slotStart();
750// } 739// }
751 740
@@ -817,66 +806,66 @@ QString KPPPWidget::encodeWord(const QString &s) {
817// { 806// {
818// m_bQuitOnDisconnect = b; 807// m_bQuitOnDisconnect = b;
819// } 808// }
820 809
821void KPPPWidget::showNews() { 810void KPPPWidget::showNews() {
822#ifdef KPPP_SHOW_NEWS 811#ifdef KPPP_SHOW_NEWS
823 /* 812 /*
824 * Introduce the QuickHelp feature to new users of this version 813 * Introduce the QuickHelp feature to new users of this version
825 */ 814 */
826 #define QUICKHELP_HINT "Hint_QuickHelp" 815 #define QUICKHELP_HINT "Hint_QuickHelp"
827 if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { 816 if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
828 QDialog dlg(0, 0, true); 817 QDialog dlg(0, 0, true);
829 dlg.setCaption(i18n("Recent Changes in KPPP")); 818 dlg.setCaption(QObject::tr("Recent Changes in KPPP"));
830 819
831 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); 820 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10);
832 QHBoxLayout *l1 = new QHBoxLayout(10); 821 QHBoxLayout *l1 = new QHBoxLayout(10);
833 QVBoxLayout *l2 = new QVBoxLayout(10); 822 QVBoxLayout *l2 = new QVBoxLayout(10);
834 tl->addLayout(l1); 823 tl->addLayout(l1);
835 824
836 QLabel *icon = new QLabel(&dlg); 825 QLabel *icon = new QLabel(&dlg);
837 icon->setPixmap(BarIcon("exclamation")); 826 icon->setPixmap(BarIcon("exclamation"));
838 icon->setFixedSize(icon->sizeHint()); 827 icon->setFixedSize(icon->sizeHint());
839 l1->addWidget(icon); 828 l1->addWidget(icon);
840 l1->addLayout(l2); 829 l1->addLayout(l2);
841 830
842 QLabel *l = new QLabel(i18n("From version 1.4.8 on, kppp has a new feature\n" 831 QLabel *l = new QLabel(QObject::tr("From version 1.4.8 on, kppp has a new feature\n"
843 "called \"Quickhelp\". It's similar to a tooltip,\n" 832 "called \"Quickhelp\". It's similar to a tooltip,\n"
844 "but you can activate it whenever you want.\n" 833 "but you can activate it whenever you want.\n"
845 "\n" 834 "\n"
846 "To activate it, simply click on a control like\n" 835 "To activate it, simply click on a control like\n"
847 "a button or a label with the right mouse button.\n" 836 "a button or a label with the right mouse button.\n"
848 "If the item supports Quickhelp, a popup menu\n" 837 "If the item supports Quickhelp, a popup menu\n"
849 "will appear leading to Quickhelp.\n" 838 "will appear leading to Quickhelp.\n"
850 "\n" 839 "\n"
851 "To test it, right-click somewhere in this text."), 840 "To test it, right-click somewhere in this text."),
852 &dlg); 841 &dlg);
853 842
854 QCheckBox *cb = new QCheckBox(i18n("Don't show this hint again"), &dlg); 843 QCheckBox *cb = new QCheckBox(QObject::tr("Don't show this hint again"), &dlg);
855 cb->setFixedSize(cb->sizeHint()); 844 cb->setFixedSize(cb->sizeHint());
856 845
857 KButtonBox *bbox = new KButtonBox(&dlg); 846 KButtonBox *bbox = new KButtonBox(&dlg);
858 bbox->addStretch(1); 847 bbox->addStretch(1);
859 QPushButton *ok = bbox->addButton(i18n("OK")); 848 QPushButton *ok = bbox->addButton(QObject::tr("OK"));
860 ok->setDefault(true); 849 ok->setDefault(true);
861 dlg.connect(ok, SIGNAL(clicked()), 850 dlg.connect(ok, SIGNAL(clicked()),
862 &dlg, SLOT(accept())); 851 &dlg, SLOT(accept()));
863 bbox->addStretch(1); 852 bbox->addStretch(1);
864 bbox->layout(); 853 bbox->layout();
865 854
866 l2->addWidget(l); 855 l2->addWidget(l);
867 l2->addWidget(cb); 856 l2->addWidget(cb);
868 tl->addWidget(bbox); 857 tl->addWidget(bbox);
869 858
870 QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n" 859 QString tmp = QObject::tr("This is an example of <b>QuickHelp</b>.\n"
871 "This window will stay open until you\n" 860 "This window will stay open until you\n"
872 "click a mouse button or a press a key.\n"); 861 "click a mouse button or a press a key.\n");
873 862
874 QWhatsThis::add(cb,tmp); 863 QWhatsThis::add(cb,tmp);
875 QWhatsThis::add(l, tmp); 864 QWhatsThis::add(l, tmp);
876 865
877 dlg.exec(); 866 dlg.exec();
878 if(cb->isChecked()) { 867 if(cb->isChecked()) {
879 _pppdata->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); 868 _pppdata->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1);
880 _pppdata->save(); 869 _pppdata->save();
881 } 870 }
882 } 871 }