Diffstat (limited to 'noncore/settings/networksettings/ppp/connect.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 180 |
1 files changed, 90 insertions, 90 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index b7e229e..a3eda9d 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp @@ -180,5 +180,5 @@ void ConnectWidget::preinit() { void ConnectWidget::init() { - gpppdata.setpppdError(0); + PPPData::data()->setpppdError(0); inittimer->stop(); vmain = 0; @@ -197,10 +197,10 @@ void ConnectWidget::init() { p_kppp->con_speed = ""; -// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || gpppdata.quit_on_disconnect()); +// p_kppp->setQuitOnDisconnect (p_kppp->quitOnDisconnect() || PPPData::data()->quit_on_disconnect()); - comlist = &gpppdata.scriptType(); - arglist = &gpppdata.script(); + comlist = &PPPData::data()->scriptType(); + arglist = &PPPData::data()->script(); - QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); + QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); setCaption(tit); @@ -208,5 +208,5 @@ void ConnectWidget::init() { // run the "before-connect" command - if (!gpppdata.command_before_connect().isEmpty()) { + if (!PPPData::data()->command_before_connect().isEmpty()) { messg->setText(i18n("Running pre-startup command...")); emit debugMessage(i18n("Running pre-startup command...")); @@ -214,5 +214,5 @@ void ConnectWidget::init() { qApp->processEvents(); QApplication::flushX(); - pid_t id = execute_command(gpppdata.command_before_connect()); + pid_t id = execute_command(PPPData::data()->command_before_connect()); // int i, status; @@ -251,5 +251,5 @@ void ConnectWidget::init() { // if we are stuck anywhere we will time out - timeout_timer->start(gpppdata.modemTimeout()*1000); + timeout_timer->start(PPPData::data()->modemTimeout()*1000); // this timer will run the script etc. @@ -285,16 +285,16 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } - QString initStr = gpppdata.modemInitStr(substate); + QString initStr = PPPData::data()->modemInitStr(substate); if (!initStr.isEmpty()) { // send a carriage return and then wait a bit so that the modem will // let us issue commands. - if(gpppdata.modemPreInitDelay() > 0) { - usleep(gpppdata.modemPreInitDelay() * 5000); + if(PPPData::data()->modemPreInitDelay() > 0) { + usleep(PPPData::data()->modemPreInitDelay() * 5000); writeline(""); - usleep(gpppdata.modemPreInitDelay() * 5000); + usleep(PPPData::data()->modemPreInitDelay() * 5000); } - setExpect(gpppdata.modemInitResp()); + setExpect(PPPData::data()->modemInitResp()); writeline(initStr); - usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec + usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec } @@ -307,5 +307,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { * a "Modem Query" */ - if (MODEM_TONEDURATION != gpppdata.modemToneDuration()) + if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration()) vmain = 5; else @@ -317,9 +317,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if (vmain == 5) { if(!expecting) { - QString sToneDuration = "ATS11=" + QString::number(gpppdata.modemToneDuration()); + QString sToneDuration = "ATS11=" + QString::number(PPPData::data()->modemToneDuration()); QString msg = i18n("Setting ") + sToneDuration; messg->setText(msg); emit debugMessage(msg); - setExpect(gpppdata.modemInitResp()); + setExpect(PPPData::data()->modemInitResp()); writeline(sToneDuration); } @@ -337,5 +337,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { substate = -1; // skip setting the volume if command is empty - if(gpppdata.volumeInitString().isEmpty()) { + if(PPPData::data()->volumeInitString().isEmpty()) { vmain = 4; return; @@ -344,9 +344,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(i18n("Setting speaker volume...")); - setExpect(gpppdata.modemInitResp()); + setExpect(PPPData::data()->modemInitResp()); QString vol("AT"); - vol += gpppdata.volumeInitString(); + vol += PPPData::data()->volumeInitString(); writeline(vol); - usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec + usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec vmain = 4; return; @@ -356,10 +356,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(vmain == 4) { if(!expecting) { - if(!gpppdata.waitForDialTone()) { + if(!PPPData::data()->waitForDialTone()) { QString msg = i18n("Turning off dial tone waiting..."); messg->setText(msg); emit debugMessage(msg); - setExpect(gpppdata.modemInitResp()); - writeline(gpppdata.modemNoDialToneDetectionStr()); + setExpect(PPPData::data()->modemInitResp()); + writeline(PPPData::data()->modemNoDialToneDetectionStr()); } vmain = 1; @@ -373,8 +373,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { timeout_timer->stop(); - timeout_timer->start(gpppdata.modemTimeout()*1000); + timeout_timer->start(PPPData::data()->modemTimeout()*1000); - QStringList &plist = gpppdata.phonenumbers(); - QString bmarg= gpppdata.dialPrefix(); + QStringList &plist = PPPData::data()->phonenumbers(); + QString bmarg= PPPData::data()->dialPrefix(); bmarg += *plist.at(dialnumber); QString bm = i18n("Dialing %1").arg(bmarg); @@ -382,6 +382,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(bm); - QString pn = gpppdata.modemDialStr(); - pn += gpppdata.dialPrefix(); + QString pn = PPPData::data()->modemDialStr(); + pn += PPPData::data()->dialPrefix(); pn += *plist.at(dialnumber); if(++dialnumber >= plist.count()) @@ -389,5 +389,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { writeline(pn); - setExpect(gpppdata.modemConnectResp()); + setExpect(PPPData::data()->modemConnectResp()); vmain = 100; return; @@ -399,5 +399,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(vmain == 100) { if(!expecting) { - myreadbuffer = gpppdata.modemConnectResp(); + myreadbuffer = PPPData::data()->modemConnectResp(); setExpect("\n"); vmain = 101; @@ -405,7 +405,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } - if(readbuffer.contains(gpppdata.modemBusyResp())) { + if(readbuffer.contains(PPPData::data()->modemBusyResp())) { timeout_timer->stop(); - timeout_timer->start(gpppdata.modemTimeout()*1000); + timeout_timer->start(PPPData::data()->modemTimeout()*1000); messg->setText(i18n("Line busy. Hanging up...")); @@ -413,6 +413,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { Modem::modem->hangup(); - if(gpppdata.busyWait() > 0) { - QString bm = i18n("Line busy. Waiting: %1 seconds").arg(gpppdata.busyWait()); + if(PPPData::data()->busyWait() > 0) { + QString bm = i18n("Line busy. Waiting: %1 seconds").arg(PPPData::data()->busyWait()); messg->setText(bm); emit debugMessage(bm); @@ -420,5 +420,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { pausing = true; - pausetimer->start(gpppdata.busyWait()*1000, true); + pausetimer->start(PPPData::data()->busyWait()*1000, true); timeout_timer->stop(); } @@ -430,5 +430,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } - if(readbuffer.contains(gpppdata.modemNoDialtoneResp())) { + if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) { timeout_timer->stop(); @@ -439,5 +439,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { } - if(readbuffer.contains(gpppdata.modemNoCarrierResp())) { + if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) { timeout_timer->stop(); @@ -458,5 +458,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { vmain = 2; - scriptTimeout=gpppdata.modemTimeout()*1000; + scriptTimeout=PPPData::data()->modemTimeout()*1000; return; } @@ -495,8 +495,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if (scriptArgument.lower() == "password") { - gpppdata.setPassword(scanvar); + PPPData::data()->setPassword(scanvar); p_kppp->setPW_Edit(scanvar); - if(gpppdata.storePassword()) - gpppdata.setStoredPassword(scanvar); + if(PPPData::data()->storePassword()) + PPPData::data()->setStoredPassword(scanvar); firstrunPW = true; } @@ -514,6 +514,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { QRegExp re1("%USERNAME%"); QRegExp re2("%PASSWORD%"); - arg = arg.replace(re1, gpppdata.storedUsername()); - arg = arg.replace(re2, gpppdata.storedPassword()); + arg = arg.replace(re1, PPPData::data()->storedUsername()); + arg = arg.replace(re2, PPPData::data()->storedPassword()); if (scriptCommand == "Send") @@ -579,6 +579,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(i18n("Hangup")); - writeline(gpppdata.modemHangupStr()); - setExpect(gpppdata.modemHangupResp()); + writeline(PPPData::data()->modemHangupStr()); + setExpect(PPPData::data()->modemHangupResp()); scriptindex++; @@ -593,5 +593,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(i18n("Answer")); - setExpect(gpppdata.modemRingResp()); + setExpect(PPPData::data()->modemRingResp()); vmain = 150; return; @@ -603,5 +603,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(bm); - QString idstring = gpppdata.storedUsername(); + QString idstring = PPPData::data()->storedUsername(); if(!idstring.isEmpty() && firstrunID) { @@ -639,5 +639,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(bm); - QString pwstring = gpppdata.password(); + QString pwstring = PPPData::data()->password(); if(!pwstring.isEmpty() && firstrunPW) { @@ -786,6 +786,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(vmain == 150) { if(!expecting) { - writeline(gpppdata.modemAnswerStr()); - setExpect(gpppdata.modemAnswerResp()); + writeline(PPPData::data()->modemAnswerStr()); + setExpect(PPPData::data()->modemAnswerResp()); vmain = 2; @@ -815,5 +815,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { Modem::modem->stop(); - if(gpppdata.authMethod() == AUTH_TERMINAL) { + if(PPPData::data()->authMethod() == AUTH_TERMINAL) { // if (termwindow) { // delete termwindow; @@ -836,6 +836,6 @@ void ConnectWidget::timerEvent(QTimerEvent *) { killTimer( main_timer_ID ); - if_timeout_timer->start(gpppdata.pppdTimeout()*1000); - qDebug( "started if timeout timer with %i", gpppdata.pppdTimeout()*1000); + if_timeout_timer->start(PPPData::data()->pppdTimeout()*1000); + qDebug( "started if timeout timer with %i", PPPData::data()->pppdTimeout()*1000); // find out PPP interface and notify the stats module @@ -850,5 +850,5 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(result) { - if(!gpppdata.autoDNS()) + if(!PPPData::data()->autoDNS()) adddns(); @@ -1064,5 +1064,5 @@ void ConnectWidget::if_waiting_timed_out() { qDebug("if_waiting_timed_out()"); - gpppdata.setpppdError(E_IF_TIMEOUT); + PPPData::data()->setpppdError(E_IF_TIMEOUT); // let's kill the stuck pppd @@ -1089,5 +1089,5 @@ void ConnectWidget::if_waiting_slot() { // if(!stats->ifIsUp()) { -// if(gpppdata.pppdError() != 0) { +// if(PPPData::data()->pppdError() != 0) { // // we are here if pppd died immediately after starting it. // pppdDied(); @@ -1106,5 +1106,5 @@ void ConnectWidget::if_waiting_slot() { usleep(200000); - if(gpppdata.autoDNS()) + if(PPPData::data()->autoDNS()) addpeerdns(); @@ -1115,10 +1115,10 @@ void ConnectWidget::if_waiting_slot() { auto_hostname(); - if(!gpppdata.command_on_connect().isEmpty()) { + if(!PPPData::data()->command_on_connect().isEmpty()) { messg->setText(i18n("Running startup command...")); // make sure that we don't get any async errors qApp->flushX(); - execute_command(gpppdata.command_on_connect()); + execute_command(PPPData::data()->command_on_connect()); messg->setText(i18n("Done")); } @@ -1142,5 +1142,5 @@ void ConnectWidget::if_waiting_slot() { // p_kppp->con_win->accounting(false); - if (gpppdata.get_dock_into_panel()) { + if (PPPData::data()->get_dock_into_panel()) { // DockWidget::dock_widget->show(); // DockWidget::dock_widget->take_stats(); @@ -1150,5 +1150,5 @@ void ConnectWidget::if_waiting_slot() { // p_kppp->con_win->show(); - if(gpppdata.get_iconify_on_connect()) { + if(PPPData::data()->get_iconify_on_connect()) { // p_kppp->con_win->showMinimized(); } @@ -1169,15 +1169,15 @@ bool ConnectWidget::execppp() { // which is the serial port we connected stdin/stdout to in opener.cpp. // command += " "; - // command += gpppdata.modemDevice(); + // command += PPPData::data()->modemDevice(); - command += " " + gpppdata.speed(); + command += " " + PPPData::data()->speed(); command += " -detach"; - if(gpppdata.ipaddr() != "0.0.0.0" || - gpppdata.gateway() != "0.0.0.0") { - if(gpppdata.ipaddr() != "0.0.0.0") { + if(PPPData::data()->ipaddr() != "0.0.0.0" || + PPPData::data()->gateway() != "0.0.0.0") { + if(PPPData::data()->ipaddr() != "0.0.0.0") { command += " "; - command += gpppdata.ipaddr(); + command += PPPData::data()->ipaddr(); command += ":"; } @@ -1187,13 +1187,13 @@ bool ConnectWidget::execppp() { } - if(gpppdata.gateway() != "0.0.0.0") - command += gpppdata.gateway(); + if(PPPData::data()->gateway() != "0.0.0.0") + command += PPPData::data()->gateway(); } - if(gpppdata.subnetmask() != "0.0.0.0") - command += " netmask " + gpppdata.subnetmask(); + if(PPPData::data()->subnetmask() != "0.0.0.0") + command += " netmask " + PPPData::data()->subnetmask(); - if(gpppdata.flowcontrol() != "None") { - if(gpppdata.flowcontrol() == "CRTSCTS") + if(PPPData::data()->flowcontrol() != "None") { + if(PPPData::data()->flowcontrol() == "CRTSCTS") command += " crtscts"; else @@ -1201,11 +1201,11 @@ bool ConnectWidget::execppp() { } - if(gpppdata.defaultroute()) + if(PPPData::data()->defaultroute()) command += " defaultroute"; - if(gpppdata.autoDNS()) + if(PPPData::data()->autoDNS()) command += " usepeerdns"; - QStringList &arglist = gpppdata.pppdArgument(); + QStringList &arglist = PPPData::data()->pppdArgument(); for ( QStringList::Iterator it = arglist.begin(); it != arglist.end(); @@ -1216,23 +1216,23 @@ bool ConnectWidget::execppp() { // PAP settings - if(gpppdata.authMethod() == AUTH_PAP) { + if(PPPData::data()->authMethod() == AUTH_PAP) { command += " -chap user "; - command = command + "\"" + gpppdata.storedUsername() + "\""; + command = command + "\"" + PPPData::data()->storedUsername() + "\""; } // CHAP settings - if(gpppdata.authMethod() == AUTH_CHAP) { + if(PPPData::data()->authMethod() == AUTH_CHAP) { command += " -pap user "; - command = command + "\"" + gpppdata.storedUsername() + "\""; + command = command + "\"" + PPPData::data()->storedUsername() + "\""; } // PAP/CHAP settings - if(gpppdata.authMethod() == AUTH_PAPCHAP) { + if(PPPData::data()->authMethod() == AUTH_PAPCHAP) { command += " user "; - command = command + "\"" + gpppdata.storedUsername() + "\""; + command = command + "\"" + PPPData::data()->storedUsername() + "\""; } // check for debug - if(gpppdata.getPPPDebug()) + if(PPPData::data()->getPPPDebug()) command += " debug"; @@ -1278,6 +1278,6 @@ void auto_hostname() { old_hostname=tmp_str; // copy to QString - // if (!p_kppp->stats->local_ip_address.isEmpty() && gpppdata.autoname()) { - if ( gpppdata.autoname()) { + // if (!p_kppp->stats->local_ip_address.isEmpty() && PPPData::data()->autoname()) { + if ( PPPData::data()->autoname()) { // local_ip.s_addr=inet_addr(p_kppp->stats->local_ip_address.ascii()); hostname_entry=gethostbyaddr((const char *)&local_ip,sizeof(in_addr),AF_INET); @@ -1333,5 +1333,5 @@ void add_domain(const QString &domain) { ( resolv[j].contains("nameserver") && !resolv[j].contains("#kppp temp entry") - && gpppdata.exDNSDisabled())) + && PPPData::data()->exDNSDisabled())) && !resolv[j].contains("#entry disabled by kppp")) { QCString tmp = "# " + resolv[j].local8Bit() + @@ -1356,5 +1356,5 @@ void adddns() if ((fd = Modem::modem->openResolv(O_WRONLY|O_APPEND)) >= 0) { - QStringList &dnslist = gpppdata.dns(); + QStringList &dnslist = PPPData::data()->dns(); for ( QStringList::Iterator it = dnslist.begin(); it != dnslist.end(); @@ -1367,5 +1367,5 @@ void adddns() close(fd); } - add_domain(gpppdata.domain()); + add_domain(PPPData::data()->domain()); } @@ -1388,5 +1388,5 @@ void addpeerdns() { close(fd); } - add_domain(gpppdata.domain()); + add_domain(PPPData::data()->domain()); } |