summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/connect.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/ppp/connect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp166
1 files changed, 95 insertions, 71 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index 2400d7b..e3fab24 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -33,5 +33,4 @@
//#include <kdebug.h>
//#include <klocale.h>
-#define i18n QObject::tr
#include <qmessagebox.h>
#include <qpushbutton.h>
@@ -100,5 +99,5 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
QVBoxLayout *tl = new QVBoxLayout(this, 8, 10);
- QString tit = i18n("Connecting to: ");
+ QString tit = QObject::tr("Connecting to: ");
setCaption(tit);
@@ -109,5 +108,5 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
messg->setFrameStyle(QFrame::Panel|QFrame::Sunken);
messg->setAlignment(AlignCenter);
- messg->setText(i18n("Unable to create modem lock file."));
+ messg->setText(QObject::tr("Unable to create modem lock file."));
messg->setMinimumHeight(messg->sizeHint().height() + 5);
// int messw = (messg->sizeHint().width() * 12) / 10;
@@ -115,7 +114,7 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
// messg->setMinimumWidth(messw);
if (_ifaceppp->getStatus())
- messg->setText(i18n("Online"));
+ messg->setText(QObject::tr("Online"));
else
- messg->setText(i18n("Offline"));
+ messg->setText(QObject::tr("Offline"));
l0->addSpacing(10);
l0->addWidget(messg);
@@ -126,10 +125,10 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
l1->addStretch(1);
- debug = new QPushButton(i18n("Log"), this);
+ debug = new QPushButton(QObject::tr("Log"), this);
debug->setToggleButton(true);
debug->setEnabled( false ); // FIXME: disable the log button
connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow()));
- cancel = new QPushButton(i18n("Cancel"), this);
+ cancel = new QPushButton(QObject::tr("Cancel"), this);
cancel->setFocus();
connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton()));
@@ -174,5 +173,5 @@ void ConnectWidget::preinit() {
// this is all just to keep the GUI nice and snappy ....
// you have to see to believe ...
- messg->setText(i18n("Looking for modem..."));
+ messg->setText(QObject::tr("Looking for modem..."));
inittimer->start(100);
}
@@ -202,5 +201,5 @@ void ConnectWidget::init() {
arglist = &_ifaceppp->data()->script();
- QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname());
+ QString tit = QObject::tr("Connecting to: %1").arg(_ifaceppp->data()->accname());
setCaption(tit);
@@ -209,6 +208,6 @@ void ConnectWidget::init() {
// run the "before-connect" command
if (!_ifaceppp->data()->command_before_connect().isEmpty()) {
- messg->setText(i18n("Running pre-startup command..."));
- emit debugMessage(i18n("Running pre-startup command..."));
+ messg->setText(QObject::tr("Running pre-startup command..."));
+ emit debugMessage(QObject::tr("Running pre-startup command..."));
qApp->processEvents();
@@ -227,5 +226,5 @@ void ConnectWidget::init() {
if (lock == 1) {
- messg->setText(i18n("Modem device is locked."));
+ messg->setText(QObject::tr("Modem device is locked."));
vmain = 20; // wait until cancel is pressed
return;
@@ -233,5 +232,5 @@ void ConnectWidget::init() {
if (lock == -1) {
- messg->setText(i18n("Unable to create modem lock file."));
+ messg->setText(QObject::tr("Unable to create modem lock file."));
vmain = 20; // wait until cancel is pressed
return;
@@ -280,6 +279,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
// first init string ?
if(substate == -1) {
- messg->setText(i18n("Initializing modem..."));
- emit debugMessage(i18n("Initializing modem..."));
+ messg->setText(QObject::tr("Initializing modem..."));
+ emit debugMessage(QObject::tr("Initializing modem..."));
substate = 0;
}
@@ -318,5 +317,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!expecting) {
QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration());
- QString msg = i18n("Setting ") + sToneDuration;
+ QString msg = QObject::tr("Setting ") + sToneDuration;
messg->setText(msg);
emit debugMessage(msg);
@@ -341,6 +340,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
return;
}
- messg->setText(i18n("Setting speaker volume..."));
- emit debugMessage(i18n("Setting speaker volume..."));
+ messg->setText(QObject::tr("Setting speaker volume..."));
+ emit debugMessage(QObject::tr("Setting speaker volume..."));
setExpect(_ifaceppp->data()->modemInitResp());
@@ -357,5 +356,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!expecting) {
if(!_ifaceppp->data()->waitForDialTone()) {
- QString msg = i18n("Turning off dial tone waiting...");
+ QString msg = QObject::tr("Turning off dial tone waiting...");
messg->setText(msg);
emit debugMessage(msg);
@@ -378,5 +377,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
QString bmarg= _ifaceppp->data()->dialPrefix();
bmarg += *plist.at(dialnumber);
- QString bm = i18n("Dialing %1").arg(bmarg);
+ QString bm = QObject::tr("Dialing %1").arg(bmarg);
messg->setText(bm);
emit debugMessage(bm);
@@ -409,10 +408,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
- messg->setText(i18n("Line busy. Hanging up..."));
+ messg->setText(QObject::tr("Line busy. Hanging up..."));
emit debugPutChar('\n');
_ifaceppp->modem()->hangup();
if(_ifaceppp->data()->busyWait() > 0) {
- QString bm = i18n("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait());
+ QString bm = QObject::tr("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait());
messg->setText(bm);
emit debugMessage(bm);
@@ -433,5 +432,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
- messg->setText(i18n("No Dialtone"));
+ messg->setText(QObject::tr("No Dialtone"));
vmain = 20;
_ifaceppp->modem()->unlockdevice();
@@ -442,5 +441,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
- messg->setText(i18n("No Carrier"));
+ messg->setText(QObject::tr("No Carrier"));
vmain = 20;
_ifaceppp->modem()->unlockdevice();
@@ -480,5 +479,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Scan") {
- QString bm = i18n("Scanning %1").arg(scriptArgument);
+ QString bm = QObject::tr("Scanning %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -490,5 +489,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Save") {
- QString bm = i18n("Saving %1").arg(scriptArgument);
+ QString bm = QObject::tr("Saving %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -508,5 +507,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") {
- QString bm = i18n("Sending %1");
+ QString bm = QObject::tr("Sending %1");
// replace %USERNAME% and %PASSWORD%
@@ -533,5 +532,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Expect") {
- QString bm = i18n("Expecting %1").arg(scriptArgument);
+ QString bm = QObject::tr("Expecting %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -547,5 +546,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Pause") {
- QString bm = i18n("Pause %1 seconds").arg(scriptArgument);
+ QString bm = QObject::tr("Pause %1 seconds").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -564,5 +563,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
- QString bm = i18n("Timeout %1 seconds").arg(scriptArgument);
+ QString bm = QObject::tr("Timeout %1 seconds").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -576,6 +575,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Hangup") {
- messg->setText(i18n("Hangup"));
- emit debugMessage(i18n("Hangup"));
+ messg->setText(QObject::tr("Hangup"));
+ emit debugMessage(QObject::tr("Hangup"));
writeline(_ifaceppp->data()->modemHangupStr());
@@ -590,6 +589,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
- messg->setText(i18n("Answer"));
- emit debugMessage(i18n("Answer"));
+ messg->setText(QObject::tr("Answer"));
+ emit debugMessage(QObject::tr("Answer"));
setExpect(_ifaceppp->data()->modemRingResp());
@@ -599,5 +598,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "ID") {
- QString bm = i18n("ID %1").arg(scriptArgument);
+ QString bm = QObject::tr("ID %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -635,5 +634,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Password") {
- QString bm = i18n("Password %1").arg(scriptArgument);
+ QString bm = QObject::tr("Password %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -672,5 +671,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Prompt") {
- QString bm = i18n("Prompting %1");
+ QString bm = QObject::tr("Prompting %1");
// if the scriptindex (aka the prompt text) includes a ## marker
@@ -709,5 +708,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "PWPrompt") {
- QString bm = i18n("PW Prompt %1").arg(scriptArgument);
+ QString bm = QObject::tr("PW Prompt %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -734,5 +733,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "LoopStart") {
- QString bm = i18n("Loop Start %1").arg(scriptArgument);
+ QString bm = QObject::tr("Loop Start %1").arg(scriptArgument);
// The incrementing of the scriptindex MUST be before the
@@ -742,8 +741,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if ( loopnest > (MAXLOOPNEST-2) ) {
- bm += i18n("ERROR: Nested too deep, ignored.");
+ bm += QObject::tr("ERROR: Nested too deep, ignored.");
vmain=20;
cancelbutton();
- QMessageBox::critical(0, "error", i18n("Loops nested too deeply!"));
+ QMessageBox::critical(0, "error", QObject::tr("Loops nested too deeply!"));
} else {
setExpect(scriptArgument);
@@ -759,7 +758,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "LoopEnd") {
- QString bm = i18n("Loop End %1").arg(scriptArgument);
+ QString bm = QObject::tr("Loop End %1").arg(scriptArgument);
if ( loopnest <= 0 ) {
- bm = i18n("LoopEnd without matching Start! Line: %1").arg(bm);
+ bm = QObject::tr("LoopEnd without matching Start! Line: %1").arg(bm);
vmain=20;
cancelbutton();
@@ -849,5 +848,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
result = execppp();
- emit debugMessage(i18n("Starting pppd..."));
+ emit debugMessage(QObject::tr("Starting pppd..."));
qDebug("execppp() returned with return-code %i", result );
@@ -931,5 +930,5 @@ void ConnectWidget::checkBuffers() {
// Show the Variabel content in the debug window
- QString sv = i18n("Scan Var: %1").arg(scanvar);
+ QString sv = QObject::tr("Scan Var: %1").arg(scanvar);
emit debugMessage(sv);
}
@@ -941,5 +940,5 @@ void ConnectWidget::checkBuffers() {
readbuffer.remove(0, readbuffer.find(expectstr) + expectstr.length());
- QString ts = i18n("Found: %1").arg(expectstr);
+ QString ts = QObject::tr("Found: %1").arg(expectstr);
emit debugMessage(ts);
@@ -952,5 +951,5 @@ void ConnectWidget::checkBuffers() {
expecting = false;
readbuffer = "";
- QString ts = i18n("Looping: %1").arg(loopstr[loopnest]);
+ QString ts = QObject::tr("Looping: %1").arg(loopstr[loopnest]);
emit debugMessage(ts);
scriptindex = loopstartindex[loopnest];
@@ -985,5 +984,5 @@ void ConnectWidget::cancelbutton() {
// }
- messg->setText(i18n("One moment please..."));
+ messg->setText(QObject::tr("One moment please..."));
// just to be sure
@@ -1007,9 +1006,12 @@ void ConnectWidget::cancelbutton() {
//abort prompt window...
if (prompt->isVisible()) {
- prompt->hide();
+ prompt->hide();
}
prompt->setConsumed();
- messg->setText(tr("offline"));
+ _ifaceppp->setStatus( false );
+ _ifaceppp->refresh();
+// messg->setText(tr("offline"));
+ refresh();
}
@@ -1027,5 +1029,5 @@ void ConnectWidget::script_timed_out() {
prompt->setConsumed();
- messg->setText(i18n("Script timed out!"));
+ messg->setText(QObject::tr("Script timed out!"));
_ifaceppp->modem()->hangup();
emit stopAccounting();
@@ -1042,5 +1044,5 @@ void ConnectWidget::setScan(const QString &n) {
scanbuffer = "";
- QString ts = i18n("Scanning: %1").arg(n);
+ QString ts = QObject::tr("Scanning: %1").arg(n);
emit debugMessage(ts);
}
@@ -1051,5 +1053,5 @@ void ConnectWidget::setExpect(const QString &n) {
expectstr = n;
- QString ts = i18n("Expecting: %1").arg(n);
+ QString ts = QObject::tr("Expecting: %1").arg(n);
ts.replace(QRegExp("\n"), "<LF>");
emit debugMessage(ts);
@@ -1086,5 +1088,5 @@ void ConnectWidget::pppdDied()
void ConnectWidget::if_waiting_slot() {
- messg->setText(i18n("Logging on to network..."));
+ messg->setText(QObject::tr("Logging on to network..."));
// if(!stats->ifIsUp()) {
@@ -1117,10 +1119,10 @@ void ConnectWidget::if_waiting_slot() {
if(!_ifaceppp->data()->command_on_connect().isEmpty()) {
- messg->setText(i18n("Running startup command..."));
+ messg->setText(QObject::tr("Running startup command..."));
// make sure that we don't get any async errors
qApp->flushX();
execute_command(_ifaceppp->data()->command_on_connect());
- messg->setText(i18n("Done"));
+ messg->setText(QObject::tr("Done"));
}
@@ -1129,12 +1131,17 @@ void ConnectWidget::if_waiting_slot() {
_ifaceppp->modem()->removeSecret(AUTH_CHAP);
- emit debugMessage(i18n("Done"));
+ emit debugMessage(QObject::tr("Done"));
set_con_speed_string();
// p_kppp->con_win->setConnectionSpeed(p_kppp->con_speed);
- this->hide();
- messg->setText("");
+// this->hide();
+// messg->setText("");
_ifaceppp->setStatus( true );
+
+ m_refreshTimer = new QTimer( this );
+ connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
+ m_refreshTimer->start( 3000 );
+ //_ifaceppp->refresh();
// emit _ifaceppp->updateInterface(_ifaceppp);
@@ -1162,4 +1169,13 @@ void ConnectWidget::if_waiting_slot() {
}
+void ConnectWidget::refresh() {
+ _ifaceppp->refresh();
+ if ( _ifaceppp->getStatus() ) {
+ messg->setText(QObject::tr("Online"));
+ } else {
+ messg->setText(QObject::tr("Offline"));
+ }
+}
+
bool ConnectWidget::execppp() {
@@ -1211,16 +1227,9 @@ bool ConnectWidget::execppp() {
command += " usepeerdns";
- QStringList &arglist = _ifaceppp->data()->pppdArgument();
- for ( QStringList::Iterator it = arglist.begin();
- it != arglist.end();
- ++it )
- {
- command += " " + *it;
- }
// PAP settings
if(_ifaceppp->data()->authMethod() == AUTH_PAP) {
command += " -chap user ";
- command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
+ command = command + _ifaceppp->data()->storedUsername();
}
@@ -1228,11 +1237,14 @@ bool ConnectWidget::execppp() {
if(_ifaceppp->data()->authMethod() == AUTH_CHAP) {
command += " -pap user ";
- command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
+ command = command + _ifaceppp->data()->storedUsername();
}
// PAP/CHAP settings
if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) {
- command += " user ";
- command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
+ QString tmpName = _ifaceppp->data()->storedUsername();
+ if ( !tmpName.isEmpty() ) {
+ command += " user ";
+ command = command + tmpName;
+ }
}
@@ -1241,6 +1253,16 @@ bool ConnectWidget::execppp() {
command += " debug";
+ QStringList &arglist = _ifaceppp->data()->pppdArgument();
+ for ( QStringList::Iterator it = arglist.begin();
+ it != arglist.end();
+ ++it )
+ {
+ command += " " + *it;
+ }
+
+ command += " call opie-kppp logfd 11";
+
if (command.length() > MAX_CMDLEN) {
- QMessageBox::critical(this, "error", i18n(
+ QMessageBox::critical(this, "error", QObject::tr(
"pppd command + command-line arguments exceed "
"2024 characters in length."
@@ -1250,4 +1272,6 @@ bool ConnectWidget::execppp() {
}
+ qWarning("Command IS: %s",command.latin1() );
+
qApp->flushX();