summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/kpppwidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (show 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 @@
#include <qdialog.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qregexp.h>
#include <qtabwidget.h>
#include <qdialog.h>
#include <qwhatsthis.h>
#include <qcheckbox.h>
// #include <kaboutdata.h>
// #include <kapplication.h>
#include <qbuttongroup.h>
-//#include <kcmdlineargs.h>
-//#include <kconfig.h>
-//#include <kdebug.h>
-#define i18n QObject::tr
-//#include <kiconloader.h> // For BarIcon
-//#include <klocale.h>
#include <qmessagebox.h>
-// #include <kseparator.h>
-// #include <kstandarddirs.h>
-// #include <kwin.h>
-// #include <khelpmenu.h>
#include <qpushbutton.h>
-//#include <kguiitem.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include "runtests.h"
//#include "main.h"
#include "auth.h"
#include "modem.h"
//#include "ppplog.h"
//#include "opener.h"
//#include "requester.h"
//#include "pppstats.h"
#include "pppdata.h"
#include "general.h"
#include "interface.h"
#define execute_command system
KPPPWidget *p_kppp = 0;
KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl )
- : QDialog(parent, name, modal, fl), _pppdata(pd)
+ : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd)
{
// tabWindow = 0;
p_kppp = this;
// before doing anything else, run a few tests
if (!_pppdata->setModemDevice( i->getInterfaceName() ))
_pppdata->setModemDevice("/dev/modem");
qDebug("PPPConfigWidget::PPPConfigWidget");
qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1());
if (!_pppdata->setAccount( i->getHardwareName() ))
_pppdata->setAccount( 0 );
qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1());
@@ -99,130 +88,130 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
// installEventFilter(this);
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
QGridLayout *l1 = new QGridLayout(3, 4);
tl->addLayout(l1);
l1->addColSpacing(0, 10);
l1->addColSpacing(3, 10);
l1->setColStretch(1, 3);
l1->setColStretch(2, 4);
- label1 = new QLabel(i18n("C&onnect to: "), this);
+ label1 = new QLabel(QObject::tr("C&onnect to: "), this);
l1->addWidget(label1, 0, 1);
connectto_c = new QComboBox(false, this);
label1->setBuddy(connectto_c);
connect(connectto_c, SIGNAL(activated(int)),
SLOT(newdefaultaccount(int)));
l1->addWidget(connectto_c, 0, 2);
- ID_Label = new QLabel(i18n("&Login ID:"), this);
+ ID_Label = new QLabel(QObject::tr("&Login ID:"), this);
l1->addWidget(ID_Label, 1, 1);
// the entry line for usernames
ID_Edit = new QLineEdit(this);
ID_Label->setBuddy(ID_Edit);
l1->addWidget(ID_Edit, 1, 2);
connect(ID_Edit, SIGNAL(returnPressed()),
this, SLOT(enterPressedInID()));
- QString tmp = i18n("<p>Type in the username that you got from your\n"
+ QString tmp = QObject::tr("<p>Type in the username that you got from your\n"
"ISP. This is especially important for PAP\n"
"and CHAP. You may omit this when you use\n"
"terminal-based or script-based authentication.\n"
"\n"
"<b>Important</b>: case is important here:\n"
"<i>myusername</i> is not the same as <i>MyUserName</i>!");
QWhatsThis::add(ID_Label,tmp);
QWhatsThis::add(ID_Edit,tmp);
- PW_Label = new QLabel(i18n("&Password:"), this);
+ PW_Label = new QLabel(QObject::tr("&Password:"), this);
l1->addWidget(PW_Label, 2, 1);
PW_Edit= new QLineEdit(this);
PW_Label->setBuddy(PW_Edit);
PW_Edit->setEchoMode(QLineEdit::Password);
l1->addWidget(PW_Edit, 2, 2);
connect(PW_Edit, SIGNAL(returnPressed()),
this, SLOT(enterPressedInPW()));
- tmp = i18n("<p>Type in the password that you got from your\n"
+ tmp = QObject::tr("<p>Type in the password that you got from your\n"
"ISP. This is especially important for PAP\n"
"and CHAP. You may omit this when you use\n"
"terminal-based or script-based authentication.\n"
"\n"
"<b>Important</b>: case is important here:\n"
"<i>mypassword</i> is not the same as <i>MyPassword</i>!");
QWhatsThis::add(PW_Label,tmp);
QWhatsThis::add(PW_Edit,tmp);
QHBoxLayout *l3 = new QHBoxLayout;
tl->addSpacing(5);
tl->addLayout(l3);
tl->addSpacing(5);
l3->addSpacing(10);
- log = new QCheckBox(i18n("Show lo&g window"), this);
+ log = new QCheckBox(QObject::tr("Show lo&g window"), this);
connect(log, SIGNAL(toggled(bool)),
this, SLOT(log_window_toggled(bool)));
log->setChecked(_pppdata->get_show_log_window());
l3->addWidget(log);
QWhatsThis::add(log,
- i18n("<p>This controls whether a log window is shown.\n"
+ QObject::tr("<p>This controls whether a log window is shown.\n"
"A log window shows the communication between\n"
"<i>kppp</i> and your modem. This will help you\n"
"in tracking down problems.\n"
"\n"
"Turn it off if <i>kppp</i> routinely connects without\n"
"problems"));
// fline = new QSeparator( KSeparator::HLine, this);
// tl->addWidget(fline);
QHBoxLayout *l2 = new QHBoxLayout(this);
tl->addLayout(l2);
int minw = 0;
- quit_b = new QPushButton(i18n("&Quit"), this);
- // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) );
+ quit_b = new QPushButton(QObject::tr("&Quit"), this);
+ // quit_b-> setGuiItem (KGuiItem(QObject::tr("&Quit"), "exit" ) );
connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton()));
if(quit_b->sizeHint().width() > minw)
minw = quit_b->sizeHint().width();
- setup_b = new QPushButton(i18n("&Setup..."), this);
-// setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) );
+ setup_b = new QPushButton(QObject::tr("&Setup..."), this);
+// setup_b->setGuiItem (KGuiItem(QObject::tr("&Setup...")) );
connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton()));
if(setup_b->sizeHint().width() > minw)
minw = setup_b->sizeHint().width();
// if(_pppdata->access() != KConfig::ReadWrite)
// setup_b->setEnabled(false);
-// help_b = new QPushButton(i18n("&Help"), this);
+// help_b = new QPushButton(QObject::tr("&Help"), this);
// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton()));
// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true);
// help_b->setPopup((QPopupMenu*)helpMenu->menu());
-// help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) );
+// help_b->setGuiItem (KGuiItem(QObject::tr("&Help"), "help" ) );
// if(help_b->sizeHint().width() > minw)
// minw = help_b->sizeHint().width();
- connect_b = new QPushButton(i18n("&Connect"), this);
+ connect_b = new QPushButton(QObject::tr("&Connect"), this);
connect_b->setDefault(true);
connect_b->setFocus();
connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect()));
if(connect_b->sizeHint().width() > minw)
minw = connect_b->sizeHint().width();
quit_b->setFixedWidth(minw);
setup_b->setFixedWidth(minw);
// help_b->setFixedWidth(help_b->sizeHint().width());
connect_b->setFixedWidth(minw);
l2->addWidget(quit_b);
@@ -277,25 +266,25 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
// m_strCmdlAccount = args->getOption("c");
// m_bQuitOnDisconnect = args->isSet("q");
// if(!m_strCmdlAccount.isEmpty()) {
// m_bCmdlAccount = true;
// kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl;
// }
// if(m_bCmdlAccount){
// bool result = _pppdata->setAccount(m_strCmdlAccount);
// if (!result){
// QString string;
-// string = i18n("No such Account:\n%1").arg(m_strCmdlAccount);
+// string = QObject::tr("No such Account:\n%1").arg(m_strCmdlAccount);
// KMessageBox::error(this, string);
// m_bCmdlAccount = false;
// this->show();
// } else {
// beginConnect();
// }
// } else
// expandbutton();
// show();
//#define KPPP_SHOW_NEWS
@@ -473,39 +462,39 @@ void KPPPWidget::sigPPPDDied() {
if(!_pppdata->automatic_redial()) {
quit_b->setFocus();
show();
con_win->stopClock();
// stopAccounting();
con_win->hide();
con->hide();
_pppdata->setpppdRunning(false);
// // not in a signal handler !!! KNotifyClient::beep();
QString msg;
if (_pppdata->pppdError() == E_IF_TIMEOUT)
- msg = i18n("Timeout expired while waiting for the PPP interface "
+ msg = QObject::tr("Timeout expired while waiting for the PPP interface "
"to come up!");
else {
- msg = i18n("<p>The pppd daemon died unexpectedly!</p>");
+ msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>");
Modem::modem->pppdExitStatus();
if (Modem::modem->lastStatus != 99) { // more recent pppds only
- msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus);
- msg += i18n("</p><p>See 'man pppd' for an explanation of the error "
+ msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus);
+ msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error "
"codes or take a look at the kppp FAQ on "
" <a href=http://devel-home.kde.org/~kppp/index.html>"
"http://devel-home.kde.org/~kppp/index.html</a></p>");
}
}
-// if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No)
+// if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No)
// // PPPL_ShowLog();
// } else { /* reconnect on disconnect */
if (false){
qDebug( "Trying to reconnect... " );
if(_pppdata->authMethod() == AUTH_PAP ||
_pppdata->authMethod() == AUTH_CHAP ||
_pppdata->authMethod() == AUTH_PAPCHAP)
Modem::modem->setSecret(_pppdata->authMethod(),
encodeWord(_pppdata->storedUsername()),
encodeWord(_pppdata->password()));
@@ -518,25 +507,25 @@ void KPPPWidget::sigPPPDDied() {
}
}
_pppdata->setpppdError(0);
}
}
// void KPPPWidget::sigChld() {
// qDebug( "sigchld()" );
// // pid_t id = wait(0L);
// // if(id == helperPid && helperPid != -1) {
// // kdDebug(5002) << "It was the setuid child that died" << endl;
// // helperPid = -1;
-// QString msg = i18n("kppp's helper process just died.\n"
+// QString msg = QObject::tr("kppp's helper process just died.\n"
// "Since a further execution would be pointless, "
// "kppp will shut down now.");
// QMessageBox::warning(0L,"error", msg);
// //remove_pidfile();
// exit(1);
// // }
// }
void KPPPWidget::newdefaultaccount(int i) {
_pppdata->setDefaultAccount(connectto_c->text(i));
_pppdata->save();
@@ -551,102 +540,102 @@ void KPPPWidget::beginConnect() {
// make sure to connect to the account that is selected in the combo box
// (exeption: an account given by a command line argument)
// if(!m_bCmdlAccount) {
// _pppdata->setAccount(connectto_c->currentText());
// _pppdata->setPassword(PW_Edit->text());
// } else {
_pppdata->setPassword(_pppdata->storedPassword());
// }
QFileInfo info(pppdPath());
if(!info.exists()){
- QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n"
+ QMessageBox::warning(this, "error", QObject::tr("Cannot find the PPP daemon!\n"
"Make sure that pppd is installed and "
"that you have entered the correct path."));
return;
}
#if 0
if(!info.isExecutable()){
QString string;
- string = i18n("kppp cannot execute:\n %1\n"
+ string = QObject::tr("kppp cannot execute:\n %1\n"
"Please make sure that you have given kppp "
"setuid permission and that "
"pppd is executable.").arg(_pppdata->pppdPath());
KMessageBox::error(this, string);
return;
}
#endif
QFileInfo info2(_pppdata->modemDevice());
if(!info2.exists()){
QString string;
- string = i18n("kppp can not find:\n %1\nPlease make sure you have setup "
+ string = QObject::tr("kppp can not find:\n %1\nPlease make sure you have setup "
"your modem device properly "
"and/or adjust the location of the modem device on "
"the modem tab of "
"the setup dialog.").arg(_pppdata->modemDevice());
QMessageBox::warning(this, "error", string);
return;
}
// if this is a PAP or CHAP account, ensure that username is
// supplied
if(_pppdata->authMethod() == AUTH_PAP ||
_pppdata->authMethod() == AUTH_CHAP ||
_pppdata->authMethod() == AUTH_PAPCHAP ) {
if(ID_Edit->text().isEmpty()) {
QMessageBox::warning(this,"error",
- i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!"));
+ QObject::tr("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!"));
return;
} else {
if(!Modem::modem->setSecret(_pppdata->authMethod(),
encodeWord(_pppdata->storedUsername()),
encodeWord(_pppdata->password()))) {
QString s;
- s = i18n("Cannot create PAP/CHAP authentication\n"
+ s = QObject::tr("Cannot create PAP/CHAP authentication\n"
"file \"%1\"").arg(PAP_AUTH_FILE);
QMessageBox::warning(this, "error", s);
return;
}
}
}
if (_pppdata->phonenumber().isEmpty()) {
- QString s = i18n("You must specify a telephone number!");
+ QString s = QObject::tr("You must specify a telephone number!");
QMessageBox::warning(this, "error", s);
return;
}
this->hide();
- QString tit = i18n("Connecting to: %1").arg(_pppdata->accname());
+ QString tit = QObject::tr("Connecting to: %1").arg(_pppdata->accname());
// con->setCaption(tit);
// con->show();
emit begin_connect();
}
void KPPPWidget::disconnect() {
if (!_pppdata->command_before_disconnect().isEmpty()) {
con_win->hide();
con->show();
- con->setCaption(i18n("Disconnecting..."));
- con->setMsg(i18n("Executing command before disconnection."));
+ con->setCaption(QObject::tr("Disconnecting..."));
+ con->setMsg(QObject::tr("Executing command before disconnection."));
qApp->processEvents();
QApplication::flushX();
// pid_t id =
execute_command(_pppdata->command_before_disconnect());
// int i, status;
// do {
// kapp->processEvents();
// i = waitpid(id, &status, WNOHANG);
// usleep(500000);
// } while (i == 0 && errno == 0);
@@ -683,26 +672,26 @@ void KPPPWidget::disconnect() {
// }
}
// void KPPPWidget::helpbutton() {
// kapp->invokeHelp();
// }
void KPPPWidget::quitbutton() {
if(_pppdata->pppdRunning()) {
int ok = QMessageBox::warning(this,
- i18n("Exiting kPPP will close your PPP Session."),
- i18n("Quit kPPP?"));
+ QObject::tr("Exiting kPPP will close your PPP Session."),
+ QObject::tr("Quit kPPP?"));
if(ok == QMessageBox::Yes) {
Modem::modem->killPPPDaemon();
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
removedns();
Modem::modem->unlockdevice();
}
} else {
if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword())
_pppdata->setStoredPassword("");
}
_pppdata->save();
@@ -727,25 +716,25 @@ void KPPPWidget::quitbutton() {
// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile());
// // if(::access(d.data(), X_OK) != 0)
// acct = new Accounting(this, stats);
// // else
// // acct = new ExecutableAccounting(this);
// // connect to the accounting object
// connect(acct, SIGNAL(changed(QString, QString)),
// con_win, SLOT(slotAccounting(QString, QString)));
// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
-// // QString s= i18n("Can not load the accounting "
+// // QString s= QObject::tr("Can not load the accounting "
// // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
// // starting the messagebox with a timer will prevent us
// // from blocking the calling function ConnectWidget::timerEvent
// ruleset_load_errmsg = s;
// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
// return;
// }
// //else
// // acct->slotStart();
// }
@@ -817,66 +806,66 @@ QString KPPPWidget::encodeWord(const QString &s) {
// {
// m_bQuitOnDisconnect = b;
// }
void KPPPWidget::showNews() {
#ifdef KPPP_SHOW_NEWS
/*
* Introduce the QuickHelp feature to new users of this version
*/
#define QUICKHELP_HINT "Hint_QuickHelp"
if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
QDialog dlg(0, 0, true);
- dlg.setCaption(i18n("Recent Changes in KPPP"));
+ dlg.setCaption(QObject::tr("Recent Changes in KPPP"));
QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10);
QHBoxLayout *l1 = new QHBoxLayout(10);
QVBoxLayout *l2 = new QVBoxLayout(10);
tl->addLayout(l1);
QLabel *icon = new QLabel(&dlg);
icon->setPixmap(BarIcon("exclamation"));
icon->setFixedSize(icon->sizeHint());
l1->addWidget(icon);
l1->addLayout(l2);
- QLabel *l = new QLabel(i18n("From version 1.4.8 on, kppp has a new feature\n"
+ QLabel *l = new QLabel(QObject::tr("From version 1.4.8 on, kppp has a new feature\n"
"called \"Quickhelp\". It's similar to a tooltip,\n"
"but you can activate it whenever you want.\n"
"\n"
"To activate it, simply click on a control like\n"
"a button or a label with the right mouse button.\n"
"If the item supports Quickhelp, a popup menu\n"
"will appear leading to Quickhelp.\n"
"\n"
"To test it, right-click somewhere in this text."),
&dlg);
- QCheckBox *cb = new QCheckBox(i18n("Don't show this hint again"), &dlg);
+ QCheckBox *cb = new QCheckBox(QObject::tr("Don't show this hint again"), &dlg);
cb->setFixedSize(cb->sizeHint());
KButtonBox *bbox = new KButtonBox(&dlg);
bbox->addStretch(1);
- QPushButton *ok = bbox->addButton(i18n("OK"));
+ QPushButton *ok = bbox->addButton(QObject::tr("OK"));
ok->setDefault(true);
dlg.connect(ok, SIGNAL(clicked()),
&dlg, SLOT(accept()));
bbox->addStretch(1);
bbox->layout();
l2->addWidget(l);
l2->addWidget(cb);
tl->addWidget(bbox);
- QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n"
+ QString tmp = QObject::tr("This is an example of <b>QuickHelp</b>.\n"
"This window will stay open until you\n"
"click a mouse button or a press a key.\n");
QWhatsThis::add(cb,tmp);
QWhatsThis::add(l, tmp);
dlg.exec();
if(cb->isChecked()) {
_pppdata->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1);
_pppdata->save();
}
}