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.cpp326
1 files changed, 161 insertions, 165 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index a3eda9d..2615b60 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -67,3 +67,3 @@
//#include "docking.h"
-//#include "main.h"
+#include "interfaceppp.h"
#include "modem.h"
@@ -76,4 +76,2 @@
-extern KPPPWidget *p_kppp;
-
QString old_hostname;
@@ -82,5 +80,4 @@ bool modified_hostname;
-ConnectWidget::ConnectWidget(QWidget *parent, const char *name)
+ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name)
: QWidget(parent, name),
- // initialize some important variables
myreadbuffer(""),
@@ -98,5 +95,4 @@ ConnectWidget::ConnectWidget(QWidget *parent, const char *name)
pausing(false),
-// termwindow(0),
-// stats(st),
- dialnumber(0)
+ dialnumber(0),
+ _ifaceppp(ifp)
{
@@ -181,3 +177,3 @@ void ConnectWidget::preinit() {
void ConnectWidget::init() {
- PPPData::data()->setpppdError(0);
+ _ifaceppp->data()->setpppdError(0);
inittimer->stop();
@@ -196,10 +192,10 @@ void ConnectWidget::init() {
- p_kppp->con_speed = "";
+// p_kppp->con_speed = "";
-// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || PPPData::data()->quit_on_disconnect());
+// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || _ifaceppp->data()->quit_on_disconnect());
- comlist = &PPPData::data()->scriptType();
- arglist = &PPPData::data()->script();
+ comlist = &_ifaceppp->data()->scriptType();
+ arglist = &_ifaceppp->data()->script();
- QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname());
+ QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname());
setCaption(tit);
@@ -209,3 +205,3 @@ void ConnectWidget::init() {
// run the "before-connect" command
- if (!PPPData::data()->command_before_connect().isEmpty()) {
+ if (!_ifaceppp->data()->command_before_connect().isEmpty()) {
messg->setText(i18n("Running pre-startup command..."));
@@ -215,3 +211,3 @@ void ConnectWidget::init() {
QApplication::flushX();
- pid_t id = execute_command(PPPData::data()->command_before_connect());
+ pid_t id = execute_command(_ifaceppp->data()->command_before_connect());
// int i, status;
@@ -225,3 +221,3 @@ void ConnectWidget::init() {
- int lock = Modem::modem->lockdevice();
+ int lock = _ifaceppp->modem()->lockdevice();
@@ -239,6 +235,6 @@ void ConnectWidget::init() {
- if(Modem::modem->opentty()) {
- messg->setText(Modem::modem->modemMessage());
+ if(_ifaceppp->modem()->opentty()) {
+ messg->setText(_ifaceppp->modem()->modemMessage());
qApp->processEvents();
- if(Modem::modem->hangup()) {
+ if(_ifaceppp->modem()->hangup()) {
@@ -248,7 +244,7 @@ void ConnectWidget::init() {
- Modem::modem->stop();
- Modem::modem->notify(this, SLOT(readChar(unsigned char)));
+ _ifaceppp->modem()->stop();
+ _ifaceppp->modem()->notify(this, SLOT(readChar(unsigned char)));
// if we are stuck anywhere we will time out
- timeout_timer->start(PPPData::data()->modemTimeout()*1000);
+ timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
@@ -262,5 +258,5 @@ void ConnectWidget::init() {
// initialization failed
- messg->setText(Modem::modem->modemMessage());
+ messg->setText(_ifaceppp->modem()->modemMessage());
vmain = 20; // wait until cancel is pressed
- Modem::modem->unlockdevice();
+ _ifaceppp->modem()->unlockdevice();
}
@@ -286,3 +282,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- QString initStr = PPPData::data()->modemInitStr(substate);
+ QString initStr = _ifaceppp->data()->modemInitStr(substate);
if (!initStr.isEmpty()) {
@@ -290,10 +286,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
// let us issue commands.
- if(PPPData::data()->modemPreInitDelay() > 0) {
- usleep(PPPData::data()->modemPreInitDelay() * 5000);
+ if(_ifaceppp->data()->modemPreInitDelay() > 0) {
+ usleep(_ifaceppp->data()->modemPreInitDelay() * 5000);
writeline("");
- usleep(PPPData::data()->modemPreInitDelay() * 5000);
+ usleep(_ifaceppp->data()->modemPreInitDelay() * 5000);
}
- setExpect(PPPData::data()->modemInitResp());
+ setExpect(_ifaceppp->data()->modemInitResp());
writeline(initStr);
- usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
+ usleep(_ifaceppp->data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
}
@@ -308,3 +304,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
*/
- if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration())
+ if (MODEM_TONEDURATION != _ifaceppp->data()->modemToneDuration())
vmain = 5;
@@ -318,3 +314,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!expecting) {
- QString sToneDuration = "ATS11=" + QString::number(PPPData::data()->modemToneDuration());
+ QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration());
QString msg = i18n("Setting ") + sToneDuration;
@@ -322,3 +318,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
emit debugMessage(msg);
- setExpect(PPPData::data()->modemInitResp());
+ setExpect(_ifaceppp->data()->modemInitResp());
writeline(sToneDuration);
@@ -338,3 +334,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
// skip setting the volume if command is empty
- if(PPPData::data()->volumeInitString().isEmpty()) {
+ if(_ifaceppp->data()->volumeInitString().isEmpty()) {
vmain = 4;
@@ -345,7 +341,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- setExpect(PPPData::data()->modemInitResp());
+ setExpect(_ifaceppp->data()->modemInitResp());
QString vol("AT");
- vol += PPPData::data()->volumeInitString();
+ vol += _ifaceppp->data()->volumeInitString();
writeline(vol);
- usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
+ usleep(_ifaceppp->data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec
vmain = 4;
@@ -357,3 +353,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!expecting) {
- if(!PPPData::data()->waitForDialTone()) {
+ if(!_ifaceppp->data()->waitForDialTone()) {
QString msg = i18n("Turning off dial tone waiting...");
@@ -361,4 +357,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
emit debugMessage(msg);
- setExpect(PPPData::data()->modemInitResp());
- writeline(PPPData::data()->modemNoDialToneDetectionStr());
+ setExpect(_ifaceppp->data()->modemInitResp());
+ writeline(_ifaceppp->data()->modemNoDialToneDetectionStr());
}
@@ -374,6 +370,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
- timeout_timer->start(PPPData::data()->modemTimeout()*1000);
+ timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
- QStringList &plist = PPPData::data()->phonenumbers();
- QString bmarg= PPPData::data()->dialPrefix();
+ QStringList &plist = _ifaceppp->data()->phonenumbers();
+ QString bmarg= _ifaceppp->data()->dialPrefix();
bmarg += *plist.at(dialnumber);
@@ -383,4 +379,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- QString pn = PPPData::data()->modemDialStr();
- pn += PPPData::data()->dialPrefix();
+ QString pn = _ifaceppp->data()->modemDialStr();
+ pn += _ifaceppp->data()->dialPrefix();
pn += *plist.at(dialnumber);
@@ -390,3 +386,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- setExpect(PPPData::data()->modemConnectResp());
+ setExpect(_ifaceppp->data()->modemConnectResp());
vmain = 100;
@@ -400,3 +396,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!expecting) {
- myreadbuffer = PPPData::data()->modemConnectResp();
+ myreadbuffer = _ifaceppp->data()->modemConnectResp();
setExpect("\n");
@@ -406,5 +402,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- if(readbuffer.contains(PPPData::data()->modemBusyResp())) {
+ if(readbuffer.contains(_ifaceppp->data()->modemBusyResp())) {
timeout_timer->stop();
- timeout_timer->start(PPPData::data()->modemTimeout()*1000);
+ timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
@@ -412,6 +408,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
emit debugPutChar('\n');
- Modem::modem->hangup();
+ _ifaceppp->modem()->hangup();
- if(PPPData::data()->busyWait() > 0) {
- QString bm = i18n("Line busy. Waiting: %1 seconds").arg(PPPData::data()->busyWait());
+ if(_ifaceppp->data()->busyWait() > 0) {
+ QString bm = i18n("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait());
messg->setText(bm);
@@ -421,3 +417,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- pausetimer->start(PPPData::data()->busyWait()*1000, true);
+ pausetimer->start(_ifaceppp->data()->busyWait()*1000, true);
timeout_timer->stop();
@@ -425,3 +421,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- Modem::modem->setDataMode(false);
+ _ifaceppp->modem()->setDataMode(false);
vmain = 0;
@@ -431,3 +427,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) {
+ if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) {
timeout_timer->stop();
@@ -436,3 +432,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
vmain = 20;
- Modem::modem->unlockdevice();
+ _ifaceppp->modem()->unlockdevice();
return;
@@ -440,3 +436,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) {
+ if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) {
timeout_timer->stop();
@@ -445,3 +441,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
vmain = 20;
- Modem::modem->unlockdevice();
+ _ifaceppp->modem()->unlockdevice();
return;
@@ -453,3 +449,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!expecting) {
- Modem::modem->setDataMode(true); // modem will no longer respond to AT commands
+ _ifaceppp->modem()->setDataMode(true); // modem will no longer respond to AT commands
@@ -459,3 +455,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
vmain = 2;
- scriptTimeout=PPPData::data()->modemTimeout()*1000;
+ scriptTimeout=_ifaceppp->data()->modemTimeout()*1000;
return;
@@ -496,6 +492,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptArgument.lower() == "password") {
- PPPData::data()->setPassword(scanvar);
- p_kppp->setPW_Edit(scanvar);
- if(PPPData::data()->storePassword())
- PPPData::data()->setStoredPassword(scanvar);
+ _ifaceppp->data()->setPassword(scanvar);
+// p_kppp->setPW_Edit(scanvar);
+ if(_ifaceppp->data()->storePassword())
+ _ifaceppp->data()->setStoredPassword(scanvar);
firstrunPW = true;
@@ -515,4 +511,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
QRegExp re2("%PASSWORD%");
- arg = arg.replace(re1, PPPData::data()->storedUsername());
- arg = arg.replace(re2, PPPData::data()->storedPassword());
+ arg = arg.replace(re1, _ifaceppp->data()->storedUsername());
+ arg = arg.replace(re2, _ifaceppp->data()->storedPassword());
@@ -580,4 +576,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- writeline(PPPData::data()->modemHangupStr());
- setExpect(PPPData::data()->modemHangupResp());
+ writeline(_ifaceppp->data()->modemHangupStr());
+ setExpect(_ifaceppp->data()->modemHangupResp());
@@ -594,3 +590,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- setExpect(PPPData::data()->modemRingResp());
+ setExpect(_ifaceppp->data()->modemRingResp());
vmain = 150;
@@ -604,3 +600,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- QString idstring = PPPData::data()->storedUsername();
+ QString idstring = _ifaceppp->data()->storedUsername();
@@ -640,3 +636,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- QString pwstring = PPPData::data()->password();
+ QString pwstring = _ifaceppp->data()->password();
@@ -661,3 +657,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!(prompt->isVisible())) {
- p_kppp->setPW_Edit(prompt->text());
+// p_kppp->setPW_Edit(prompt->text());
writeline(prompt->text());
@@ -787,4 +783,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(!expecting) {
- writeline(PPPData::data()->modemAnswerStr());
- setExpect(PPPData::data()->modemAnswerResp());
+ writeline(_ifaceppp->data()->modemAnswerStr());
+ setExpect(_ifaceppp->data()->modemAnswerResp());
@@ -814,5 +810,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
// stop reading of data
- Modem::modem->stop();
+ _ifaceppp->modem()->stop();
- if(PPPData::data()->authMethod() == AUTH_TERMINAL) {
+ if(_ifaceppp->data()->authMethod() == AUTH_TERMINAL) {
// if (termwindow) {
@@ -833,3 +829,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
// The port is still held open by the helper process.
- Modem::modem->closetty();
+ _ifaceppp->modem()->closetty();
@@ -837,4 +833,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
- if_timeout_timer->start(PPPData::data()->pppdTimeout()*1000);
- qDebug( "started if timeout timer with %i", PPPData::data()->pppdTimeout()*1000);
+ if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000);
+ qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000);
@@ -851,4 +847,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(result) {
- if(!PPPData::data()->autoDNS())
- adddns();
+ if(!_ifaceppp->data()->autoDNS())
+ adddns( _ifaceppp );
@@ -865,10 +861,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
messg->setText("");
- p_kppp->quit_b->setFocus();
- p_kppp->show();
+// p_kppp->quit_b->setFocus();
+// p_kppp->show();
qApp->processEvents();
- Modem::modem->hangup();
+ _ifaceppp->modem()->hangup();
emit stopAccounting();
// p_kppp->con_win->stopClock();
- Modem::modem->closetty();
- Modem::modem->unlockdevice();
+ _ifaceppp->modem()->closetty();
+ _ifaceppp->modem()->unlockdevice();
@@ -892,3 +888,3 @@ void ConnectWidget::set_con_speed_string() {
// or whatever the modemConnectResp() is.
- p_kppp->con_speed = Modem::modem->parseModemSpeed(myreadbuffer);
+// p_kppp->con_speed = _ifaceppp->modem()->parseModemSpeed(myreadbuffer);
}
@@ -971,3 +967,3 @@ void ConnectWidget::pause() {
void ConnectWidget::cancelbutton() {
- Modem::modem->stop();
+ _ifaceppp->modem()->stop();
killTimer(main_timer_ID);
@@ -986,5 +982,5 @@ void ConnectWidget::cancelbutton() {
// just to be sure
- Modem::modem->removeSecret(AUTH_PAP);
- Modem::modem->removeSecret(AUTH_CHAP);
- removedns();
+ _ifaceppp->modem()->removeSecret(AUTH_PAP);
+ _ifaceppp->modem()->removeSecret(AUTH_CHAP);
+ removedns(_ifaceppp);
@@ -992,4 +988,4 @@ void ConnectWidget::cancelbutton() {
- Modem::modem->killPPPDaemon();
- Modem::modem->hangup();
+ _ifaceppp->modem()->killPPPDaemon();
+ _ifaceppp->modem()->hangup();
@@ -997,8 +993,8 @@ void ConnectWidget::cancelbutton() {
messg->setText("");
- p_kppp->quit_b->setFocus();
- p_kppp->show();
+// p_kppp->quit_b->setFocus();
+// p_kppp->show();
emit stopAccounting(); // just to be sure
// p_kppp->con_win->stopClock();
- Modem::modem->closetty();
- Modem::modem->unlockdevice();
+ _ifaceppp->modem()->closetty();
+ _ifaceppp->modem()->unlockdevice();
@@ -1028,3 +1024,3 @@ void ConnectWidget::script_timed_out() {
messg->setText(i18n("Script timed out!"));
- Modem::modem->hangup();
+ _ifaceppp->modem()->hangup();
emit stopAccounting();
@@ -1065,6 +1061,6 @@ void ConnectWidget::if_waiting_timed_out() {
- PPPData::data()->setpppdError(E_IF_TIMEOUT);
+ _ifaceppp->data()->setpppdError(E_IF_TIMEOUT);
// let's kill the stuck pppd
- Modem::modem->killPPPDaemon();
+ _ifaceppp->modem()->killPPPDaemon();
@@ -1090,3 +1086,3 @@ void ConnectWidget::if_waiting_slot() {
-// if(PPPData::data()->pppdError() != 0) {
+// if(_ifaceppp->data()->pppdError() != 0) {
// // we are here if pppd died immediately after starting it.
@@ -1107,4 +1103,4 @@ void ConnectWidget::if_waiting_slot() {
- if(PPPData::data()->autoDNS())
- addpeerdns();
+ if(_ifaceppp->data()->autoDNS())
+ addpeerdns( _ifaceppp );
@@ -1114,5 +1110,5 @@ void ConnectWidget::if_waiting_slot() {
// p_kppp->statdlg->take_stats(); // start taking ppp statistics
- auto_hostname();
+ auto_hostname(_ifaceppp);
- if(!PPPData::data()->command_on_connect().isEmpty()) {
+ if(!_ifaceppp->data()->command_on_connect().isEmpty()) {
messg->setText(i18n("Running startup command..."));
@@ -1121,3 +1117,3 @@ void ConnectWidget::if_waiting_slot() {
qApp->flushX();
- execute_command(PPPData::data()->command_on_connect());
+ execute_command(_ifaceppp->data()->command_on_connect());
messg->setText(i18n("Done"));
@@ -1126,4 +1122,4 @@ void ConnectWidget::if_waiting_slot() {
// remove the authentication file
- Modem::modem->removeSecret(AUTH_PAP);
- Modem::modem->removeSecret(AUTH_CHAP);
+ _ifaceppp->modem()->removeSecret(AUTH_PAP);
+ _ifaceppp->modem()->removeSecret(AUTH_CHAP);
@@ -1143,16 +1139,16 @@ void ConnectWidget::if_waiting_slot() {
- if (PPPData::data()->get_dock_into_panel()) {
-// DockWidget::dock_widget->show();
-// DockWidget::dock_widget->take_stats();
-// this->hide();
- }
- else {
-// p_kppp->con_win->show();
+// if (_ifaceppp->data()->get_dock_into_panel()) {
+// // DockWidget::dock_widget->show();
+// // DockWidget::dock_widget->take_stats();
+// // this->hide();
+// }
+// else {
+// // p_kppp->con_win->show();
- if(PPPData::data()->get_iconify_on_connect()) {
- // p_kppp->con_win->showMinimized();
- }
- }
+// if(_ifaceppp->data()->get_iconify_on_connect()) {
+// // p_kppp->con_win->showMinimized();
+// }
+// }
- Modem::modem->closetty();
+ _ifaceppp->modem()->closetty();
}
@@ -1170,5 +1166,5 @@ bool ConnectWidget::execppp() {
// command += " ";
- // command += PPPData::data()->modemDevice();
+ // command += _ifaceppp->data()->modemDevice();
- command += " " + PPPData::data()->speed();
+ command += " " + _ifaceppp->data()->speed();
@@ -1176,7 +1172,7 @@ bool ConnectWidget::execppp() {
- if(PPPData::data()->ipaddr() != "0.0.0.0" ||
- PPPData::data()->gateway() != "0.0.0.0") {
- if(PPPData::data()->ipaddr() != "0.0.0.0") {
+ if(_ifaceppp->data()->ipaddr() != "0.0.0.0" ||
+ _ifaceppp->data()->gateway() != "0.0.0.0") {
+ if(_ifaceppp->data()->ipaddr() != "0.0.0.0") {
command += " ";
- command += PPPData::data()->ipaddr();
+ command += _ifaceppp->data()->ipaddr();
command += ":";
@@ -1188,11 +1184,11 @@ bool ConnectWidget::execppp() {
- if(PPPData::data()->gateway() != "0.0.0.0")
- command += PPPData::data()->gateway();
+ if(_ifaceppp->data()->gateway() != "0.0.0.0")
+ command += _ifaceppp->data()->gateway();
}
- if(PPPData::data()->subnetmask() != "0.0.0.0")
- command += " netmask " + PPPData::data()->subnetmask();
+ if(_ifaceppp->data()->subnetmask() != "0.0.0.0")
+ command += " netmask " + _ifaceppp->data()->subnetmask();
- if(PPPData::data()->flowcontrol() != "None") {
- if(PPPData::data()->flowcontrol() == "CRTSCTS")
+ if(_ifaceppp->data()->flowcontrol() != "None") {
+ if(_ifaceppp->data()->flowcontrol() == "CRTSCTS")
command += " crtscts";
@@ -1202,9 +1198,9 @@ bool ConnectWidget::execppp() {
- if(PPPData::data()->defaultroute())
+ if(_ifaceppp->data()->defaultroute())
command += " defaultroute";
- if(PPPData::data()->autoDNS())
+ if(_ifaceppp->data()->autoDNS())
command += " usepeerdns";
- QStringList &arglist = PPPData::data()->pppdArgument();
+ QStringList &arglist = _ifaceppp->data()->pppdArgument();
for ( QStringList::Iterator it = arglist.begin();
@@ -1217,5 +1213,5 @@ bool ConnectWidget::execppp() {
// PAP settings
- if(PPPData::data()->authMethod() == AUTH_PAP) {
+ if(_ifaceppp->data()->authMethod() == AUTH_PAP) {
command += " -chap user ";
- command = command + "\"" + PPPData::data()->storedUsername() + "\"";
+ command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
}
@@ -1223,5 +1219,5 @@ bool ConnectWidget::execppp() {
// CHAP settings
- if(PPPData::data()->authMethod() == AUTH_CHAP) {
+ if(_ifaceppp->data()->authMethod() == AUTH_CHAP) {
command += " -pap user ";
- command = command + "\"" + PPPData::data()->storedUsername() + "\"";
+ command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
}
@@ -1229,5 +1225,5 @@ bool ConnectWidget::execppp() {
// PAP/CHAP settings
- if(PPPData::data()->authMethod() == AUTH_PAPCHAP) {
+ if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) {
command += " user ";
- command = command + "\"" + PPPData::data()->storedUsername() + "\"";
+ command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
}
@@ -1235,3 +1231,3 @@ bool ConnectWidget::execppp() {
// check for debug
- if(PPPData::data()->getPPPDebug())
+ if(_ifaceppp->data()->getPPPDebug())
command += " debug";
@@ -1249,3 +1245,3 @@ bool ConnectWidget::execppp() {
- return Modem::modem->execPPPDaemon(command);
+ return _ifaceppp->modem()->execPPPDaemon(command);
}
@@ -1264,3 +1260,3 @@ void ConnectWidget::setMsg(const QString &msg) {
void ConnectWidget::writeline(const QString &s) {
- Modem::modem->writeLine(s.local8Bit());
+ _ifaceppp->modem()->writeLine(s.local8Bit());
}
@@ -1268,3 +1264,3 @@ void ConnectWidget::writeline(const QString &s) {
// Set the hostname and domain from DNS Server
-void auto_hostname() {
+void auto_hostname(InterfacePPP *_ifaceppp) {
struct in_addr local_ip;
@@ -1279,4 +1275,4 @@ void auto_hostname() {
- // if (!p_kppp->stats->local_ip_address.isEmpty() && PPPData::data()->autoname()) {
- if ( PPPData::data()->autoname()) {
+ // if (!p_kppp->stats->local_ip_address.isEmpty() && _ifaceppp->data()->autoname()) {
+ if ( _ifaceppp->data()->autoname()) {
// local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii());
@@ -1288,3 +1284,3 @@ void auto_hostname() {
new_hostname=new_hostname.remove(dot,new_hostname.length()-dot);
- Modem::modem->setHostname(new_hostname);
+ _ifaceppp->modem()->setHostname(new_hostname);
modified_hostname = TRUE;
@@ -1294,3 +1290,3 @@ void auto_hostname() {
- add_domain(new_hostname);
+ add_domain(new_hostname, _ifaceppp);
}
@@ -1302,3 +1298,3 @@ void auto_hostname() {
// disable the nameserver entries if option is enabled
-void add_domain(const QString &domain) {
+void add_domain(const QString &domain, InterfacePPP *_ifaceppp) {
@@ -1311,3 +1307,3 @@ void add_domain(const QString &domain) {
- if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) {
+ if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) {
@@ -1325,3 +1321,3 @@ void add_domain(const QString &domain) {
- if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) {
+ if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_TRUNC)) >= 0) {
QCString tmp = "domain " + domain.local8Bit() +
@@ -1334,3 +1330,3 @@ void add_domain(const QString &domain) {
&& !resolv[j].contains("#kppp temp entry")
- && PPPData::data()->exDNSDisabled()))
+ && _ifaceppp->data()->exDNSDisabled()))
&& !resolv[j].contains("#entry disabled by kppp")) {
@@ -1352,3 +1348,3 @@ void add_domain(const QString &domain) {
// adds the DNS entries in the /etc/resolv.conf file
-void adddns()
+void adddns( InterfacePPP *_ifaceppp)
{
@@ -1356,4 +1352,4 @@ void adddns()
- if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) {
- QStringList &dnslist = PPPData::data()->dns();
+ if ((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_APPEND)) >= 0) {
+ QStringList &dnslist = _ifaceppp->data()->dns();
for ( QStringList::Iterator it = dnslist.begin();
@@ -1368,9 +1364,9 @@ void adddns()
}
- add_domain(PPPData::data()->domain());
+ add_domain(_ifaceppp->data()->domain(), _ifaceppp);
}
-void addpeerdns() {
+void addpeerdns(InterfacePPP *_ifaceppp) {
int fd, fd2;
- if((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) {
+ if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_APPEND)) >= 0) {
if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) {
@@ -1389,3 +1385,3 @@ void addpeerdns() {
}
- add_domain(PPPData::data()->domain());
+ add_domain(_ifaceppp->data()->domain(), _ifaceppp);
}
@@ -1393,3 +1389,3 @@ void addpeerdns() {
// remove the dns entries from the /etc/resolv.conf file
-void removedns() {
+void removedns(InterfacePPP *_ifaceppp) {
@@ -1399,3 +1395,3 @@ void removedns() {
- if((fd = Modem::modem->openResolv(O_RDONLY)) >= 0) {
+ if((fd = _ifaceppp->modem()->openResolv(O_RDONLY)) >= 0) {
@@ -1412,3 +1408,3 @@ void removedns() {
- if((fd = Modem::modem->openResolv(O_WRONLY|O_TRUNC)) >= 0) {
+ if((fd = _ifaceppp->modem()->openResolv(O_WRONLY|O_TRUNC)) >= 0) {
for(int j=0; j < i; j++) {
@@ -1431,3 +1427,3 @@ void removedns() {
if ( modified_hostname ) {
- Modem::modem->setHostname(old_hostname);
+ _ifaceppp->modem()->setHostname(old_hostname);
modified_hostname = FALSE;