17 files changed, 615 insertions, 642 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index d902517..19db9ef 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp @@ -55,3 +55,3 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name ) { - int min = 0; +// int min = 0; QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); @@ -63,3 +63,3 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name ) accountlist_l = new QListBox(this); - accountlist_l->setMinimumSize(160, 128); +// accountlist_l->setMinimumSize(160, 128); connect(accountlist_l, SIGNAL(highlighted(int)), @@ -76,5 +76,5 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name ) - min = edit_b->sizeHint().width(); - min = QMAX(70,min); - edit_b->setMinimumWidth(min); +// min = edit_b->sizeHint().width(); +// min = QMAX(70,min); +// edit_b->setMinimumWidth(min); @@ -167,6 +167,6 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name ) //load up account list from gppdata to the list box - if(gpppdata.count() > 0) { - for(int i=0; i <= gpppdata.count()-1; i++) { - gpppdata.setAccountbyIndex(i); - accountlist_l->insertItem(gpppdata.accname()); + if(PPPData::data()->count() > 0) { + for(int i=0; i <= PPPData::data()->count()-1; i++) { + PPPData::data()->setAccountbyIndex(i); + accountlist_l->insertItem(PPPData::data()->accname()); } @@ -186,4 +186,4 @@ void AccountWidget::slotListBoxSelect(int idx) { if(idx!=-1) { - QString account = gpppdata.accname(); - gpppdata.setAccountbyIndex(accountlist_l->currentItem()); + QString account = PPPData::data()->accname(); + PPPData::data()->setAccountbyIndex(accountlist_l->currentItem()); // reset->setEnabled(TRUE); @@ -195,5 +195,5 @@ void AccountWidget::slotListBoxSelect(int idx) { // voledit->setEnabled(TRUE); - int bytes = gpppdata.totalBytes(); +// int bytes = PPPData::data()->totalBytes(); // voledit->setText(prettyPrintVolume(bytes)); - gpppdata.setAccount(account); + PPPData::data()->setAccount(account); } else{ @@ -242,3 +242,3 @@ void AccountWidget::slotListBoxSelect(int idx) { void AccountWidget::editaccount() { - gpppdata.setAccount(accountlist_l->text(accountlist_l->currentItem())); + PPPData::data()->setAccount(accountlist_l->text(accountlist_l->currentItem())); @@ -247,5 +247,5 @@ void AccountWidget::editaccount() { if(result == QDialog::Accepted) { - accountlist_l->changeItem(gpppdata.accname(),accountlist_l->currentItem()); + accountlist_l->changeItem(PPPData::data()->accname(),accountlist_l->currentItem()); // emit resetaccounts(); - gpppdata.save(); + PPPData::data()->save(); } @@ -273,3 +273,3 @@ void AccountWidget::newaccount() { // { -// if (gpppdata.newaccount() == -1) +// if (PPPData::data()->newaccount() == -1) // return; @@ -280,4 +280,4 @@ void AccountWidget::newaccount() { // case QMessageBox::No: - if (gpppdata.newaccount() == -1){ - qDebug("gpppdata.newaccount() == -1"); + if (PPPData::data()->newaccount() == -1){ + qDebug("PPPData::data()->newaccount() == -1"); return; @@ -291,9 +291,9 @@ void AccountWidget::newaccount() { if(result == QDialog::Accepted) { - accountlist_l->insertItem(gpppdata.accname()); - accountlist_l->setSelected(accountlist_l->findItem(gpppdata.accname()), + accountlist_l->insertItem(PPPData::data()->accname()); + accountlist_l->setSelected(accountlist_l->findItem(PPPData::data()->accname()), true); // emit resetaccounts(); - gpppdata.save(); + PPPData::data()->save(); } else - gpppdata.deleteAccount(); + PPPData::data()->deleteAccount(); } @@ -312,7 +312,7 @@ void AccountWidget::copyaccount() { - gpppdata.copyaccount(accountlist_l->currentItem()); + PPPData::data()->copyaccount(accountlist_l->currentItem()); - accountlist_l->insertItem(gpppdata.accname()); + accountlist_l->insertItem(PPPData::data()->accname()); // emit resetaccounts(); - gpppdata.save(); + PPPData::data()->save(); } @@ -328,3 +328,3 @@ void AccountWidget::deleteaccount() { - if(gpppdata.deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) + if(PPPData::data()->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) accountlist_l->removeItem(accountlist_l->currentItem()); @@ -332,3 +332,3 @@ void AccountWidget::deleteaccount() { emit resetaccounts(); - gpppdata.save(); + PPPData::data()->save(); @@ -340,32 +340,34 @@ void AccountWidget::deleteaccount() { int AccountWidget::doTab(){ - QDialog *dlg = new QDialog( this ); - tabWindow = new QTabWidget( dlg ); - // tabWindow = new KDialogBase( KDialogBase::Tabbed, QString::null, -// KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, -// 0, 0, true); -// KWin::setIcons(tabWindow->winId(), kapp->icon(), kapp->miniIcon()); + QDialog *dlg = new QDialog( this, "newAccount", true ); + QVBoxLayout *layout = new QVBoxLayout( dlg ); + layout->setSpacing( 0 ); + layout->setMargin( 1 ); + + tabWindow = new QTabWidget( dlg, "tabWindow" ); + layout->addWidget( tabWindow ); + bool isnewaccount; - if(gpppdata.accname().isEmpty()) { - tabWindow->setCaption(i18n("New Account")); - isnewaccount = true; + if(PPPData::data()->accname().isEmpty()) { + dlg->setCaption(i18n("New Account")); + isnewaccount = true; } else { - QString tit = i18n("Edit Account: "); - tit += gpppdata.accname(); - tabWindow->setCaption(tit); - isnewaccount = false; + QString tit = i18n("Edit Account: "); + tit += PPPData::data()->accname(); + dlg->setCaption(tit); + isnewaccount = false; } - dial_w = new DialWidget( tabWindow ); - tabWindow->addTab( dial_w, i18n("Dial") );//, i18n("Dial Setup")), isnewaccount); - ip_w = new IPWidget( tabWindow ); - tabWindow->addTab( ip_w, i18n("IP") );//, i18n("IP Setup")), isnewaccount); - gateway_w = new GatewayWidget( tabWindow ); - tabWindow->addTab( gateway_w, i18n("Gateway") );//, i18n("Gateway Setup")), isnewaccount); - dns_w = new DNSWidget( tabWindow ); - tabWindow->addTab( dns_w, i18n("DNS") );//, i18n("DNS Servers")), isnewaccount); - script_w = new ScriptWidget( tabWindow ); - tabWindow->addTab( script_w, i18n("Login Script") ); //, i18n("Edit Login Script")), isnewaccount); - ExecWidget *exec_w = new ExecWidget( tabWindow ); - tabWindow->addTab( exec_w, i18n("Execute") );//, i18n("Execute Programs")), isnewaccount); + dial_w = new DialWidget( tabWindow, isnewaccount, "Dial Setup"); + tabWindow->addTab( dial_w, i18n("Dial") ); + ip_w = new IPWidget( tabWindow, isnewaccount, i18n("IP Setup")); + tabWindow->addTab( ip_w, i18n("IP") ); + gateway_w = new GatewayWidget( tabWindow, isnewaccount, i18n("Gateway Setup")); + tabWindow->addTab( gateway_w, i18n("Gateway") ); + dns_w = new DNSWidget( tabWindow, isnewaccount, i18n("DNS Servers") ); + tabWindow->addTab( dns_w, i18n("DNS") ); + script_w = new ScriptWidget( tabWindow, isnewaccount, i18n("Edit Login Script")); + tabWindow->addTab( script_w, i18n("Login Script") ); + ExecWidget *exec_w = new ExecWidget( tabWindow, isnewaccount, i18n("Execute Programs")); + tabWindow->addTab( exec_w, i18n("Execute") ); // acct = new AccountingSelector( tabWindow, isnewaccount ); @@ -375,2 +377,4 @@ int AccountWidget::doTab(){ bool ok = false; + qDebug("AccountWidget::doTab dlg->showMinimized"); + dlg->showMinimized(); while (!ok){ 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 @@ -181,3 +181,3 @@ void ConnectWidget::preinit() { void ConnectWidget::init() { - gpppdata.setpppdError(0); + PPPData::data()->setpppdError(0); inittimer->stop(); @@ -198,8 +198,8 @@ void ConnectWidget::init() { -// 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); @@ -209,3 +209,3 @@ 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...")); @@ -215,3 +215,3 @@ void ConnectWidget::init() { QApplication::flushX(); - pid_t id = execute_command(gpppdata.command_before_connect()); + pid_t id = execute_command(PPPData::data()->command_before_connect()); // int i, status; @@ -252,3 +252,3 @@ 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); @@ -286,3 +286,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - QString initStr = gpppdata.modemInitStr(substate); + QString initStr = PPPData::data()->modemInitStr(substate); if (!initStr.isEmpty()) { @@ -290,10 +290,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) { // 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 } @@ -308,3 +308,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { */ - if (MODEM_TONEDURATION != gpppdata.modemToneDuration()) + if (MODEM_TONEDURATION != PPPData::data()->modemToneDuration()) vmain = 5; @@ -318,3 +318,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(!expecting) { - QString sToneDuration = "ATS11=" + QString::number(gpppdata.modemToneDuration()); + QString sToneDuration = "ATS11=" + QString::number(PPPData::data()->modemToneDuration()); QString msg = i18n("Setting ") + sToneDuration; @@ -322,3 +322,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(msg); - setExpect(gpppdata.modemInitResp()); + setExpect(PPPData::data()->modemInitResp()); writeline(sToneDuration); @@ -338,3 +338,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { // skip setting the volume if command is empty - if(gpppdata.volumeInitString().isEmpty()) { + if(PPPData::data()->volumeInitString().isEmpty()) { vmain = 4; @@ -345,7 +345,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - 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; @@ -357,3 +357,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(!expecting) { - if(!gpppdata.waitForDialTone()) { + if(!PPPData::data()->waitForDialTone()) { QString msg = i18n("Turning off dial tone waiting..."); @@ -361,4 +361,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { emit debugMessage(msg); - setExpect(gpppdata.modemInitResp()); - writeline(gpppdata.modemNoDialToneDetectionStr()); + setExpect(PPPData::data()->modemInitResp()); + writeline(PPPData::data()->modemNoDialToneDetectionStr()); } @@ -374,6 +374,6 @@ 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); @@ -383,4 +383,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - QString pn = gpppdata.modemDialStr(); - pn += gpppdata.dialPrefix(); + QString pn = PPPData::data()->modemDialStr(); + pn += PPPData::data()->dialPrefix(); pn += *plist.at(dialnumber); @@ -390,3 +390,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - setExpect(gpppdata.modemConnectResp()); + setExpect(PPPData::data()->modemConnectResp()); vmain = 100; @@ -400,3 +400,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(!expecting) { - myreadbuffer = gpppdata.modemConnectResp(); + myreadbuffer = PPPData::data()->modemConnectResp(); setExpect("\n"); @@ -406,5 +406,5 @@ 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); @@ -414,4 +414,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - 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); @@ -421,3 +421,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - pausetimer->start(gpppdata.busyWait()*1000, true); + pausetimer->start(PPPData::data()->busyWait()*1000, true); timeout_timer->stop(); @@ -431,3 +431,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - if(readbuffer.contains(gpppdata.modemNoDialtoneResp())) { + if(readbuffer.contains(PPPData::data()->modemNoDialtoneResp())) { timeout_timer->stop(); @@ -440,3 +440,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - if(readbuffer.contains(gpppdata.modemNoCarrierResp())) { + if(readbuffer.contains(PPPData::data()->modemNoCarrierResp())) { timeout_timer->stop(); @@ -459,3 +459,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { vmain = 2; - scriptTimeout=gpppdata.modemTimeout()*1000; + scriptTimeout=PPPData::data()->modemTimeout()*1000; return; @@ -496,6 +496,6 @@ 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; @@ -515,4 +515,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { 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()); @@ -580,4 +580,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - writeline(gpppdata.modemHangupStr()); - setExpect(gpppdata.modemHangupResp()); + writeline(PPPData::data()->modemHangupStr()); + setExpect(PPPData::data()->modemHangupResp()); @@ -594,3 +594,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - setExpect(gpppdata.modemRingResp()); + setExpect(PPPData::data()->modemRingResp()); vmain = 150; @@ -604,3 +604,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - QString idstring = gpppdata.storedUsername(); + QString idstring = PPPData::data()->storedUsername(); @@ -640,3 +640,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - QString pwstring = gpppdata.password(); + QString pwstring = PPPData::data()->password(); @@ -787,4 +787,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(!expecting) { - writeline(gpppdata.modemAnswerStr()); - setExpect(gpppdata.modemAnswerResp()); + writeline(PPPData::data()->modemAnswerStr()); + setExpect(PPPData::data()->modemAnswerResp()); @@ -816,3 +816,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - if(gpppdata.authMethod() == AUTH_TERMINAL) { + if(PPPData::data()->authMethod() == AUTH_TERMINAL) { // if (termwindow) { @@ -837,4 +837,4 @@ void ConnectWidget::timerEvent(QTimerEvent *) { - 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); @@ -851,3 +851,3 @@ void ConnectWidget::timerEvent(QTimerEvent *) { if(result) { - if(!gpppdata.autoDNS()) + if(!PPPData::data()->autoDNS()) adddns(); @@ -1065,3 +1065,3 @@ void ConnectWidget::if_waiting_timed_out() { - gpppdata.setpppdError(E_IF_TIMEOUT); + PPPData::data()->setpppdError(E_IF_TIMEOUT); @@ -1090,3 +1090,3 @@ void ConnectWidget::if_waiting_slot() { -// if(gpppdata.pppdError() != 0) { +// if(PPPData::data()->pppdError() != 0) { // // we are here if pppd died immediately after starting it. @@ -1107,3 +1107,3 @@ void ConnectWidget::if_waiting_slot() { - if(gpppdata.autoDNS()) + if(PPPData::data()->autoDNS()) addpeerdns(); @@ -1116,3 +1116,3 @@ void ConnectWidget::if_waiting_slot() { - if(!gpppdata.command_on_connect().isEmpty()) { + if(!PPPData::data()->command_on_connect().isEmpty()) { messg->setText(i18n("Running startup command...")); @@ -1121,3 +1121,3 @@ void ConnectWidget::if_waiting_slot() { qApp->flushX(); - execute_command(gpppdata.command_on_connect()); + execute_command(PPPData::data()->command_on_connect()); messg->setText(i18n("Done")); @@ -1143,3 +1143,3 @@ void ConnectWidget::if_waiting_slot() { - if (gpppdata.get_dock_into_panel()) { + if (PPPData::data()->get_dock_into_panel()) { // DockWidget::dock_widget->show(); @@ -1151,3 +1151,3 @@ void ConnectWidget::if_waiting_slot() { - if(gpppdata.get_iconify_on_connect()) { + if(PPPData::data()->get_iconify_on_connect()) { // p_kppp->con_win->showMinimized(); @@ -1170,5 +1170,5 @@ bool ConnectWidget::execppp() { // command += " "; - // command += gpppdata.modemDevice(); + // command += PPPData::data()->modemDevice(); - command += " " + gpppdata.speed(); + command += " " + PPPData::data()->speed(); @@ -1176,7 +1176,7 @@ bool ConnectWidget::execppp() { - 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 += ":"; @@ -1188,11 +1188,11 @@ 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"; @@ -1202,9 +1202,9 @@ 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(); @@ -1217,5 +1217,5 @@ 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() + "\""; } @@ -1223,5 +1223,5 @@ bool ConnectWidget::execppp() { // 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() + "\""; } @@ -1229,5 +1229,5 @@ bool ConnectWidget::execppp() { // 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() + "\""; } @@ -1235,3 +1235,3 @@ bool ConnectWidget::execppp() { // check for debug - if(gpppdata.getPPPDebug()) + if(PPPData::data()->getPPPDebug()) command += " debug"; @@ -1279,4 +1279,4 @@ void auto_hostname() { - // 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()); @@ -1334,3 +1334,3 @@ void add_domain(const QString &domain) { && !resolv[j].contains("#kppp temp entry") - && gpppdata.exDNSDisabled())) + && PPPData::data()->exDNSDisabled())) && !resolv[j].contains("#entry disabled by kppp")) { @@ -1357,3 +1357,3 @@ 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(); @@ -1368,3 +1368,3 @@ void adddns() } - add_domain(gpppdata.domain()); + add_domain(PPPData::data()->domain()); } @@ -1389,3 +1389,3 @@ void addpeerdns() { } - add_domain(gpppdata.domain()); + add_domain(PPPData::data()->domain()); } diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp index d6b3fbe..ad89005 100644 --- a/noncore/settings/networksettings/ppp/conwindow.cpp +++ b/noncore/settings/networksettings/ppp/conwindow.cpp @@ -77,5 +77,5 @@ ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget ) // read window position from config file - int p_x, p_y; - gpppdata.winPosConWin(p_x, p_y); - setGeometry(p_x, p_y, 320, 110); +// int p_x, p_y; +// PPPData::data()->winPosConWin(p_x, p_y); +// setGeometry(p_x, p_y, 320, 110); } @@ -90,3 +90,3 @@ bool ConWindow::event(QEvent *e) { { - gpppdata.setWinPosConWin(x(), y()); +// PPPData::data()->setWinPosConWin(x(), y()); return true; @@ -120,3 +120,3 @@ void ConWindow::accounting(bool on) { accountingEnabled = on; - volumeAccountingEnabled = gpppdata.VolAcctEnabled(); + volumeAccountingEnabled = PPPData::data()->VolAcctEnabled(); @@ -135,3 +135,3 @@ void ConWindow::accounting(bool on) { int vol_lines = 0; - if(gpppdata.VolAcctEnabled()) + if(PPPData::data()->VolAcctEnabled()) vol_lines = 1; @@ -241,5 +241,5 @@ void ConWindow::startClock() { - title = gpppdata.accname(); + title = PPPData::data()->accname(); - if(gpppdata.get_show_clock_on_caption()){ + if(PPPData::data()->get_show_clock_on_caption()){ title += " 00:00" ; @@ -267,3 +267,3 @@ void ConWindow::timeclick() { "Time connected: %3") - .arg(gpppdata.accname()).arg(info2->text()) + .arg(PPPData::data()->accname()).arg(info2->text()) .arg(time_string2); @@ -277,3 +277,3 @@ void ConWindow::timeclick() { volinfo->setEnabled(TRUE); - int bytes = gpppdata.totalBytes(); + int bytes = PPPData::data()->totalBytes(); volinfo->setText(prettyPrintVolume(bytes)); @@ -307,3 +307,3 @@ void ConWindow::timeclick() { - caption_string = gpppdata.accname(); + caption_string = PPPData::data()->accname(); caption_string += " "; @@ -314,3 +314,3 @@ void ConWindow::timeclick() { - if(gpppdata.get_show_clock_on_caption() && (seconds == 1)){ + if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){ // we update the Caption only once per minute not every second @@ -330,3 +330,3 @@ void ConWindow::closeEvent( QCloseEvent *e ){ - if(gpppdata.get_dock_into_panel()) + if(PPPData::data()->get_dock_into_panel()) dock(); diff --git a/noncore/settings/networksettings/ppp/debug.cpp b/noncore/settings/networksettings/ppp/debug.cpp index 8652931..447ccf2 100644 --- a/noncore/settings/networksettings/ppp/debug.cpp +++ b/noncore/settings/networksettings/ppp/debug.cpp @@ -135,3 +135,3 @@ void DebugWidget::toggleVisibility() { bool showlog = isVisible(); - gpppdata.set_show_log_window(showlog); + PPPData::data()->set_show_log_window(showlog); } diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 961047b..6132b80 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp @@ -43,3 +43,3 @@ #include "pppdata.h" -#include "newwidget.h" +//#include "newwidget.h" #include "iplined.h" @@ -52,9 +52,9 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) - QGridLayout *tl = new QGridLayout(parent, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); + QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); - connect_label = new QLabel(i18n("Connection name:"), parent); + connect_label = new QLabel(i18n("Connection name:"), this); tl->addWidget(connect_label, 0, 0); - connectname_l = new QLineEdit(parent); - connectname_l->setMaxLength(ACCNAME_SIZE); + connectname_l = new QLineEdit(this); +// connectname_l->setMaxLength(ACCNAME_SIZE); tl->addWidget(connectname_l, 0, 1); @@ -66,3 +66,3 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) - number_label = new QLabel(i18n("Phone number:"), parent); + number_label = new QLabel(i18n("Phone number:"), this); number_label->setAlignment(AlignTop|AlignLeft); @@ -72,3 +72,3 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) tl->addLayout(lpn, 1, 1); - numbers = new QListBox(parent); + numbers = new QListBox(this); numbers->setMinimumSize(120, 70); @@ -77,9 +77,9 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) lpn->addLayout(lpn1); - add = new QPushButton(i18n("&Add..."), parent); - del = new QPushButton(i18n("&Remove"), parent); + add = new QPushButton(i18n("&Add..."), this); + del = new QPushButton(i18n("&Remove"), this); - up = new QPushButton(parent); + up = new QPushButton(this); //FIXME: QPixmap pm = BarIcon("up"); // up->setPixmap(pm); - down = new QPushButton(parent); + down = new QPushButton(this); //FIXME: pm = BarIcon("down"); @@ -114,6 +114,6 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) - auth_l = new QLabel(i18n("Authentication:"), parent); + auth_l = new QLabel(i18n("Authentication:"), this); tl->addWidget(auth_l, 3, 0); - auth = new QComboBox(parent); + auth = new QComboBox(this); auth->insertItem(i18n("Script-based")); @@ -137,3 +137,3 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) - store_password = new QCheckBox(i18n("Store password"), parent); + store_password = new QCheckBox(i18n("Store password"), this); store_password->setChecked(true); @@ -150,3 +150,3 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) - pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), parent); + pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); @@ -156,6 +156,6 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) if(!isnewaccount) { - connectname_l->setText(gpppdata.accname()); + connectname_l->setText(PPPData::data()->accname()); // insert the phone numbers into the listbox - QString n = gpppdata.phonenumber(); + QString n = PPPData::data()->phonenumber(); QString tmp = ""; @@ -174,4 +174,4 @@ DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) - auth->setCurrentItem(gpppdata.authMethod()); - store_password->setChecked(gpppdata.storePassword()); + auth->setCurrentItem(PPPData::data()->authMethod()); + store_password->setChecked(PPPData::data()->storePassword()); } else { @@ -189,6 +189,6 @@ bool DialWidget::save() { if(connectname_l->text().isEmpty() || - !gpppdata.isUniqueAccname(connectname_l->text())) { + !PPPData::data()->isUniqueAccname(connectname_l->text())) { return false; } else { - gpppdata.setAccname(connectname_l->text()); + PPPData::data()->setAccname(connectname_l->text()); @@ -201,5 +201,5 @@ bool DialWidget::save() { - gpppdata.setPhonenumber(number); - gpppdata.setAuthMethod(auth->currentItem()); - gpppdata.setStorePassword(store_password->isChecked()); + PPPData::data()->setPhonenumber(number); + PPPData::data()->setAuthMethod(auth->currentItem()); + PPPData::data()->setStorePassword(store_password->isChecked()); return true; @@ -224,7 +224,7 @@ void DialWidget::selectionChanged(int) { void DialWidget::addNumber() { - PhoneNumberDialog dlg(this); - if(dlg.exec()) { - numbers->insertItem(dlg.phoneNumber()); - numbersChanged(); - } + PhoneNumberDialog dlg(this); + if(dlg.exec()) { + numbers->insertItem(dlg.phoneNumber()); + numbersChanged(); + } } @@ -277,3 +277,3 @@ ExecWidget::ExecWidget(QWidget *parent, bool isnewaccount, const char *name) : { - QVBoxLayout *tl = new QVBoxLayout(parent, 0 );//, KDialog::spacingHint()); + QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); @@ -285,4 +285,4 @@ i18n("Here you can select commands to run at certain stages of the\n" "Be sure to supply the whole path to the program otherwise\n" - "kppp might be unable to find it."), parent); - l->setMinimumHeight(l->sizeHint().height()); + "kppp might be unable to find it."), this); +// l->setMinimumHeight(l->sizeHint().height()); tl->addWidget(l); @@ -295,7 +295,7 @@ i18n("Here you can select commands to run at certain stages of the\n" - before_connect_l = new QLabel(i18n("Before connect:"), parent); + before_connect_l = new QLabel(i18n("Before connect:"), this); before_connect_l->setAlignment(AlignVCenter); l1->addWidget(before_connect_l, 0, 0); - before_connect = new QLineEdit(parent); - before_connect->setMaxLength(COMMAND_SIZE); + before_connect = new QLineEdit(this); +// before_connect->setMaxLength(COMMAND_SIZE); l1->addWidget(before_connect, 0, 1); @@ -310,7 +310,7 @@ i18n("Here you can select commands to run at certain stages of the\n" - command_label = new QLabel(i18n("Upon connect:"), parent); + command_label = new QLabel(i18n("Upon connect:"), this); command_label->setAlignment(AlignVCenter); l1->addWidget(command_label, 1, 0); - command = new QLineEdit(parent); - command->setMaxLength(COMMAND_SIZE); + command = new QLineEdit(this); +// command->setMaxLength(COMMAND_SIZE); l1->addWidget(command, 1, 1); @@ -326,7 +326,7 @@ i18n("Here you can select commands to run at certain stages of the\n" predisconnect_label = new QLabel(i18n("Before disconnect:"), - parent); + this); predisconnect_label->setAlignment(AlignVCenter); l1->addWidget(predisconnect_label, 2, 0); - predisconnect = new QLineEdit(parent); - predisconnect->setMaxLength(COMMAND_SIZE); + predisconnect = new QLineEdit(this); +// predisconnect->setMaxLength(COMMAND_SIZE); l1->addWidget(predisconnect, 2, 1); @@ -340,3 +340,3 @@ i18n("Here you can select commands to run at certain stages of the\n" discommand_label = new QLabel(i18n("Upon disconnect:"), - parent); + this); discommand_label->setAlignment(AlignVCenter); @@ -344,4 +344,4 @@ i18n("Here you can select commands to run at certain stages of the\n" - discommand = new QLineEdit(parent); - discommand->setMaxLength(COMMAND_SIZE); + discommand = new QLineEdit(this); +// discommand->setMaxLength(COMMAND_SIZE); l1->addWidget(discommand, 3, 1); @@ -362,6 +362,6 @@ i18n("Here you can select commands to run at certain stages of the\n" if(!isnewaccount) { - before_connect->setText(gpppdata.command_before_connect()); - command->setText(gpppdata.command_on_connect()); - discommand->setText(gpppdata.command_on_disconnect()); - predisconnect->setText(gpppdata.command_before_disconnect()); + before_connect->setText(PPPData::data()->command_before_connect()); + command->setText(PPPData::data()->command_on_connect()); + discommand->setText(PPPData::data()->command_on_disconnect()); + predisconnect->setText(PPPData::data()->command_before_disconnect()); } @@ -371,6 +371,6 @@ i18n("Here you can select commands to run at certain stages of the\n" bool ExecWidget::save() { - gpppdata.setCommand_before_connect(before_connect->text()); - gpppdata.setCommand_on_connect(command->text()); - gpppdata.setCommand_before_disconnect(predisconnect->text()); - gpppdata.setCommand_on_disconnect(discommand->text()); + PPPData::data()->setCommand_before_connect(before_connect->text()); + PPPData::data()->setCommand_on_connect(command->text()); + PPPData::data()->setCommand_before_disconnect(predisconnect->text()); + PPPData::data()->setCommand_on_disconnect(discommand->text()); return true; @@ -388,9 +388,9 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) { - QVBoxLayout *topLayout = new QVBoxLayout(parent); + QVBoxLayout *topLayout = new QVBoxLayout(this); topLayout->setSpacing( 3 );//KDialog::spacingHint()); - box = new QVGroupBox(i18n("Configuration"), parent); + box = new QVGroupBox(i18n("Configuration"), this); // box->setInsideSpacing( 1 );//KDialog::spacingHint()); - rb = new QButtonGroup(parent); + rb = new QButtonGroup(this); rb->hide(); @@ -450,4 +450,4 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) - autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), parent); - autoname->setChecked(gpppdata.autoname()); + autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this); + autoname->setChecked(PPPData::data()->autoname()); connect(autoname,SIGNAL(toggled(bool)), @@ -471,11 +471,11 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) if(!isnewaccount) { - if(gpppdata.ipaddr() == "0.0.0.0" && - gpppdata.subnetmask() == "0.0.0.0") { + if(PPPData::data()->ipaddr() == "0.0.0.0" && + PPPData::data()->subnetmask() == "0.0.0.0") { dynamicadd_rb->setChecked(true); hitIPSelect(0); - autoname->setChecked(gpppdata.autoname()); + autoname->setChecked(PPPData::data()->autoname()); } else { - ipaddress_l->setText(gpppdata.ipaddr()); - subnetmask_l->setText(gpppdata.subnetmask()); + ipaddress_l->setText(PPPData::data()->ipaddr()); + subnetmask_l->setText(PPPData::data()->subnetmask()); staticadd_rb->setChecked(true); @@ -512,9 +512,9 @@ void IPWidget::save() { if(dynamicadd_rb->isChecked()) { - gpppdata.setIpaddr("0.0.0.0"); - gpppdata.setSubnetmask("0.0.0.0"); + PPPData::data()->setIpaddr("0.0.0.0"); + PPPData::data()->setSubnetmask("0.0.0.0"); } else { - gpppdata.setIpaddr(ipaddress_l->text()); - gpppdata.setSubnetmask(subnetmask_l->text()); + PPPData::data()->setIpaddr(ipaddress_l->text()); + PPPData::data()->setSubnetmask(subnetmask_l->text()); } - gpppdata.setAutoname(autoname->isChecked()); + PPPData::data()->setAutoname(autoname->isChecked()); } @@ -542,10 +542,10 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) { - // box = new QGroupBox(parent); - QGridLayout *tl = new QGridLayout(parent, 7, 2, 0 );//, KDialog::spacingHint()); + // box = new QGroupBox(this); + QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );//, KDialog::spacingHint()); - dnsdomain_label = new QLabel(i18n("Domain name:"), parent); + dnsdomain_label = new QLabel(i18n("Domain name:"), this); tl->addWidget(dnsdomain_label, 0, 0); - dnsdomain = new QLineEdit(parent); - dnsdomain->setMaxLength(DOMAIN_SIZE); + dnsdomain = new QLineEdit(this); +// dnsdomain->setMaxLength(DOMAIN_SIZE); tl->addWidget(dnsdomain, 0, 1); @@ -563,3 +563,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) - conf_label = new QLabel(i18n("Configuration:"), parent); + conf_label = new QLabel(i18n("Configuration:"), this); tl->addWidget(conf_label, 1, 0); @@ -570,3 +570,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) - autodns = new QRadioButton(i18n("Automatic"), parent); + autodns = new QRadioButton(i18n("Automatic"), this); bg->insert(autodns, 0); @@ -574,6 +574,6 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) // no automatic DNS detection for pppd < 2.3.7 - if(!gpppdata.pppdVersionMin(2, 3, 7)) + if(!PPPData::data()->pppdVersionMin(2, 3, 7)) autodns->setEnabled(false); - mandns = new QRadioButton(i18n("Manual"), parent); + mandns = new QRadioButton(i18n("Manual"), this); bg->insert(mandns, 1); @@ -581,3 +581,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) - dns_label = new QLabel(i18n("DNS IP address:"), parent); + dns_label = new QLabel(i18n("DNS IP address:"), this); tl->addWidget(dns_label, 3, 0); @@ -586,3 +586,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) tl->addLayout(l2, 3, 1); - dnsipaddr = new IPLineEdit(parent); + dnsipaddr = new IPLineEdit(this); connect(dnsipaddr, SIGNAL(returnPressed()), @@ -606,7 +606,7 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) tl->addLayout(l1, 4, 1); - add = new QPushButton(i18n("Add"), parent); + add = new QPushButton(i18n("Add"), this); connect(add, SIGNAL(clicked()), SLOT(adddns())); - int width = add->sizeHint().width(); - width = QMAX(width,60); - add->setMinimumWidth(width); +// int width = add->sizeHint().width(); +// width = QMAX(width,60); +// add->setMinimumWidth(width); l1->addWidget(add); @@ -618,7 +618,7 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) - remove = new QPushButton(i18n("Remove"), parent); + remove = new QPushButton(i18n("Remove"), this); connect(remove, SIGNAL(clicked()), SLOT(removedns())); - width = remove->sizeHint().width(); - width = QMAX(width,60); - remove->setMinimumWidth(width); +// width = remove->sizeHint().width(); +// width = QMAX(width,60); +// remove->setMinimumWidth(width); l1->addWidget(remove); @@ -628,3 +628,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) - servers_label = new QLabel(i18n("DNS address list:"), parent); + servers_label = new QLabel(i18n("DNS address list:"), this); servers_label->setAlignment(AlignTop|AlignLeft); @@ -632,3 +632,3 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) - dnsservers = new QListBox(parent); + dnsservers = new QListBox(this); dnsservers->setMinimumSize(150, 80); @@ -646,4 +646,4 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) "Disable existing DNS servers during connection"), - parent); - exdnsdisabled_toggle->setChecked(gpppdata.exDNSDisabled()); + this); + exdnsdisabled_toggle->setChecked(PPPData::data()->exDNSDisabled()); tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); @@ -663,7 +663,7 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) if(!isnewaccount) { - dnsservers->insertStringList(gpppdata.dns()); - dnsdomain->setText(gpppdata.domain()); + dnsservers->insertStringList(PPPData::data()->dns()); + dnsdomain->setText(PPPData::data()->domain()); } - int mode = gpppdata.autoDNS() ? 0 : 1; + int mode = PPPData::data()->autoDNS() ? 0 : 1; bg->setButton(mode); @@ -697,3 +697,3 @@ void DNSWidget::DNS_Mode_Selected(int mode) { void DNSWidget::save() { - gpppdata.setAutoDNS(bg->id(bg->selected()) == 0); + PPPData::data()->setAutoDNS(bg->id(bg->selected()) == 0); QStringList serverlist; @@ -701,3 +701,3 @@ void DNSWidget::save() { serverlist.append(dnsservers->text(i)); - gpppdata.setDns(serverlist); + PPPData::data()->setDns(serverlist); @@ -706,7 +706,7 @@ void DNSWidget::save() { if(s.left(1) == ".") - gpppdata.setDomain(s.mid(1)); + PPPData::data()->setDomain(s.mid(1)); else - gpppdata.setDomain(dnsdomain->text()); + PPPData::data()->setDomain(dnsdomain->text()); - gpppdata.setExDNSDisabled(exdnsdisabled_toggle->isChecked()); + PPPData::data()->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); } @@ -737,9 +737,9 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na { - QVBoxLayout *topLayout = new QVBoxLayout(parent); + QVBoxLayout *topLayout = new QVBoxLayout(this); topLayout->setSpacing( 2 );//KDialog::spacingHint()); - box = new QVGroupBox(i18n("Configuration"), parent); + box = new QVGroupBox(i18n("Configuration"), this); // box->setInsideSpacing( 2 );//KDialog::spacingHint()); - rb = new QButtonGroup(parent); + rb = new QButtonGroup(this); rb->hide(); @@ -773,3 +773,3 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), - parent); + this); QWhatsThis::add(defaultroute, @@ -787,3 +787,3 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na if(!isnewaccount) { - if(gpppdata.gateway() == "0.0.0.0") { + if(PPPData::data()->gateway() == "0.0.0.0") { defaultgateway->setChecked(true); @@ -792,6 +792,6 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na else { - gatewayaddr->setText(gpppdata.gateway()); + gatewayaddr->setText(PPPData::data()->gateway()); staticgateway->setChecked(true); } - defaultroute->setChecked(gpppdata.defaultroute()); + defaultroute->setChecked(PPPData::data()->defaultroute()); } @@ -805,4 +805,4 @@ GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *na void GatewayWidget::save() { - gpppdata.setGateway(gatewayaddr->text()); - gpppdata.setDefaultroute(defaultroute->isChecked()); + PPPData::data()->setGateway(gatewayaddr->text()); + PPPData::data()->setDefaultroute(defaultroute->isChecked()); } @@ -828,4 +828,4 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name { - QVBoxLayout *tl = new QVBoxLayout(parent, 0 );//, KDialog::spacingHint()); - se = new ScriptEdit(parent); + QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); + se = new ScriptEdit(this); connect(se, SIGNAL(returnPressed()), SLOT(addButton())); @@ -834,3 +834,3 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name // insert equal-sized buttons - QButtonGroup *bbox = new QButtonGroup(parent); + QButtonGroup *bbox = new QButtonGroup(this); add = new QPushButton( bbox, i18n("Add") ); @@ -851,3 +851,3 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name tl->addLayout(l12); - stl = new QListBox(parent); + stl = new QListBox(this); stl->setVScrollBarMode( QScrollView::AlwaysOff ); @@ -856,3 +856,3 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name - sl = new QListBox(parent); + sl = new QListBox(this); sl->setVScrollBarMode( QScrollView::AlwaysOff ); @@ -861,4 +861,4 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name - slb = new QScrollBar(parent); - slb->setFixedWidth(slb->sizeHint().width()); + slb = new QScrollBar(this); +// slb->setFixedWidth(slb->sizeHint().width()); connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); @@ -871,4 +871,4 @@ ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name if(!isnewaccount) { - QStringList &comlist = gpppdata.scriptType(); - QStringList &arglist = gpppdata.script(); + QStringList &comlist = PPPData::data()->scriptType(); + QStringList &arglist = PPPData::data()->script(); QStringList::Iterator itcom = comlist.begin(); @@ -918,4 +918,4 @@ void ScriptWidget::save() { } - gpppdata.setScriptType(typelist); - gpppdata.setScript(arglist); + PPPData::data()->setScriptType(typelist); + PPPData::data()->setScript(arglist); } @@ -1156,3 +1156,3 @@ void ScriptWidget::removeButton() { PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) - : QDialog(parent, 0, true ) { + : QDialog(parent,"PhoneNumberDialog",true) { setCaption( i18n("Add Phone Number") ); @@ -1167,4 +1167,4 @@ PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) - le = newLineEdit(14, hbox); - le->setMinimumWidth(125); + le = new QLineEdit(hbox); +// le->setMinimumWidth(125); diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index f803628..a02ee35 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp @@ -166,3 +166,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) for(int i=0; i <= enter->count()-1; i++) { - if(gpppdata.enter() == enter->text(i)) + if(PPPData::data()->enter() == enter->text(i)) enter->setCurrentItem(i); @@ -175,3 +175,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) - modemlockfile->setChecked(gpppdata.modemLockFile()); + modemlockfile->setChecked(PPPData::data()->modemLockFile()); connect(modemlockfile, SIGNAL(toggled(bool)), @@ -193,3 +193,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) - modemtimeout = new KIntNumInput(gpppdata.modemTimeout(), this); + modemtimeout = new KIntNumInput(PPPData::data()->modemTimeout(), this); modemtimeout->setLabel(i18n("Modem &timeout:")); @@ -208,3 +208,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) for(int i=0; i <= enter->count()-1; i++) { - if(gpppdata.enter() == enter->text(i)) + if(PPPData::data()->enter() == enter->text(i)) enter->setCurrentItem(i); @@ -213,3 +213,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) for(int i=0; i <= modemdevice->count()-1; i++) { - if(gpppdata.modemDevice() == modemdevice->text(i)) + if(PPPData::data()->modemDevice() == modemdevice->text(i)) modemdevice->setCurrentItem(i); @@ -218,3 +218,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) for(int i=0; i <= flowcontrol->count()-1; i++) { - if(gpppdata.flowcontrol() == flowcontrol->text(i)) + if(PPPData::data()->flowcontrol() == flowcontrol->text(i)) flowcontrol->setCurrentItem(i); @@ -224,3 +224,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) for(int i=0; i < baud_c->count(); i++) - if(baud_c->text(i) == gpppdata.speed()) + if(baud_c->text(i) == PPPData::data()->speed()) baud_c->setCurrentItem(i); @@ -232,3 +232,3 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name) void ModemWidget::speed_selection(int) { - gpppdata.setSpeed(baud_c->text(baud_c->currentItem())); + PPPData::data()->setSpeed(baud_c->text(baud_c->currentItem())); } @@ -237,3 +237,3 @@ void ModemWidget::speed_selection(int) { void ModemWidget::setenter(int ) { - gpppdata.setEnter(enter->text(enter->currentItem())); + PPPData::data()->setEnter(enter->text(enter->currentItem())); } @@ -242,3 +242,3 @@ void ModemWidget::setenter(int ) { void ModemWidget::setmodemdc(int i) { - gpppdata.setModemDevice(modemdevice->text(i)); + PPPData::data()->setModemDevice(modemdevice->text(i)); } @@ -247,3 +247,3 @@ void ModemWidget::setmodemdc(int i) { void ModemWidget::setflowcontrol(int i) { - gpppdata.setFlowcontrol(flowcontrol->text(i)); + PPPData::data()->setFlowcontrol(flowcontrol->text(i)); } @@ -252,3 +252,3 @@ void ModemWidget::setflowcontrol(int i) { void ModemWidget::modemlockfilechanged(bool set) { - gpppdata.setModemLockFile(set); + PPPData::data()->setModemLockFile(set); } @@ -257,3 +257,3 @@ void ModemWidget::modemlockfilechanged(bool set) { void ModemWidget::modemtimeoutchanged(int n) { - gpppdata.setModemTimeout(n); + PPPData::data()->setModemTimeout(n); } @@ -268,3 +268,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this); - waitfordt->setChecked(gpppdata.waitForDialTone()); + waitfordt->setChecked(PPPData::data()->waitForDialTone()); connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); @@ -280,3 +280,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) - busywait = new KIntNumInput(gpppdata.busyWait(), this); + busywait = new KIntNumInput(PPPData::data()->busyWait(), this); busywait->setLabel(i18n("B&usy wait:")); @@ -303,3 +303,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) hbl->addWidget(volumeLabel); - volume = new QSlider(0, 2, 1, gpppdata.volume(), QSlider::Horizontal, this); + volume = new QSlider(0, 2, 1, PPPData::data()->volume(), QSlider::Horizontal, this); volumeLabel->setBuddy(volume); @@ -327,3 +327,3 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name) chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this); - chkbox1->setChecked(gpppdata.UseCDLine()); + chkbox1->setChecked(PPPData::data()->UseCDLine()); connect(chkbox1,SIGNAL(toggled(bool)), @@ -404,3 +404,3 @@ void ModemWidget2::query_modem() { void ModemWidget2::use_cdline_toggled(bool on) { - gpppdata.setUseCDLine(on); + PPPData::data()->setUseCDLine(on); } @@ -409,3 +409,3 @@ void ModemWidget2::use_cdline_toggled(bool on) { void ModemWidget2::waitfordtchanged(bool b) { - gpppdata.setWaitForDialTone((int)b); + PPPData::data()->setWaitForDialTone((int)b); } @@ -413,3 +413,3 @@ void ModemWidget2::waitfordtchanged(bool b) { void ModemWidget2::busywaitchanged(int n) { - gpppdata.setbusyWait(n); + PPPData::data()->setbusyWait(n); } @@ -418,3 +418,3 @@ void ModemWidget2::busywaitchanged(int n) { void ModemWidget2::volumeChanged(int v) { - gpppdata.setVolume(v); + PPPData::data()->setVolume(v); } diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index 2f9feda..8d70cd4 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp @@ -160,3 +160,3 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl // this, SLOT(log_window_toggled(bool))); -// log->setChecked(gpppdata.get_show_log_window()); +// log->setChecked(PPPData::data()->get_show_log_window()); // l3->addWidget(log); @@ -193,3 +193,3 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl -// if(gpppdata.access() != KConfig::ReadWrite) +// if(PPPData::data()->access() != KConfig::ReadWrite) // setup_b->setEnabled(false); @@ -293,3 +293,3 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl // if(m_bCmdlAccount){ -// bool result = gpppdata.setAccount(m_strCmdlAccount); +// bool result = PPPData::data()->setAccount(m_strCmdlAccount); // if (!result){ @@ -365,3 +365,3 @@ void KPPPWidget::enterPressedInPW() { void KPPPWidget::saveMyself() { - gpppdata.save(); + PPPData::data()->save(); } @@ -374,3 +374,3 @@ void KPPPWidget::shutDown() { void KPPPWidget::log_window_toggled(bool on) { - gpppdata.set_show_log_window(on); + PPPData::data()->set_show_log_window(on); } @@ -383,3 +383,3 @@ void KPPPWidget::log_window_toggled(bool on) { -// int count = gpppdata.count(); +// int count = PPPData::data()->count(); @@ -394,4 +394,4 @@ void KPPPWidget::log_window_toggled(bool on) { // for(int i=0; i < count; i++) { -// gpppdata.setAccountbyIndex(i); -// connectto_c->insertItem(gpppdata.accname()); +// PPPData::data()->setAccountbyIndex(i); +// connectto_c->insertItem(PPPData::data()->accname()); // } @@ -399,10 +399,10 @@ void KPPPWidget::log_window_toggled(bool on) { // //set the default account -// if(!gpppdata.defaultAccount().isEmpty()) { +// if(!PPPData::data()->defaultAccount().isEmpty()) { // for(int i=0; i < count; i++) -// if(gpppdata.defaultAccount() == connectto_c->text(i)) { +// if(PPPData::data()->defaultAccount() == connectto_c->text(i)) { // connectto_c->setCurrentItem(i); -// gpppdata.setAccountbyIndex(i); +// PPPData::data()->setAccountbyIndex(i); -// ID_Edit->setText(gpppdata.storedUsername()); -// PW_Edit->setText(gpppdata.storedPassword()); +// ID_Edit->setText(PPPData::data()->storedUsername()); +// PW_Edit->setText(PPPData::data()->storedPassword()); // } @@ -411,6 +411,6 @@ void KPPPWidget::log_window_toggled(bool on) { // if(count > 0) { -// gpppdata.setDefaultAccount(connectto_c->text(0)); -// gpppdata.save(); -// ID_Edit->setText(gpppdata.storedUsername()); -// PW_Edit->setText(gpppdata.storedPassword()); +// PPPData::data()->setDefaultAccount(connectto_c->text(0)); +// PPPData::data()->save(); +// ID_Edit->setText(PPPData::data()->storedUsername()); +// PW_Edit->setText(PPPData::data()->storedPassword()); // } @@ -436,3 +436,3 @@ void KPPPWidget::interruptConnection() { // disconnect if online - if (gpppdata.pppdRunning()) + if (PPPData::data()->pppdRunning()) emit disconnect(); @@ -447,3 +447,3 @@ void KPPPWidget::sigPPPDDied() { // such as would be the case when the log file viewer exits. - if(gpppdata.pppdRunning() || gpppdata.pppdError()) { + if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) { qDebug( "It was pppd that died" ); @@ -459,3 +459,3 @@ void KPPPWidget::sigPPPDDied() { - gpppdata.setpppdRunning(false); + PPPData::data()->setpppdRunning(false); @@ -463,3 +463,3 @@ void KPPPWidget::sigPPPDDied() { QApplication::flushX(); - execute_command(gpppdata.command_on_disconnect()); + execute_command(PPPData::data()->command_on_disconnect()); @@ -471,4 +471,4 @@ void KPPPWidget::sigPPPDDied() { - if(!gpppdata.pppdError()) - gpppdata.setpppdError(E_PPPD_DIED); + if(!PPPData::data()->pppdError()) + PPPData::data()->setpppdError(E_PPPD_DIED); removedns(); @@ -477,3 +477,3 @@ void KPPPWidget::sigPPPDDied() { - if(!gpppdata.automatic_redial()) { + if(!PPPData::data()->automatic_redial()) { quit_b->setFocus(); @@ -485,6 +485,6 @@ void KPPPWidget::sigPPPDDied() { - gpppdata.setpppdRunning(false); + PPPData::data()->setpppdRunning(false); // // not in a signal handler !!! KNotifyClient::beep(); QString msg; - if (gpppdata.pppdError() == E_IF_TIMEOUT) + if (PPPData::data()->pppdError() == E_IF_TIMEOUT) msg = i18n("Timeout expired while waiting for the PPP interface " @@ -509,8 +509,8 @@ void KPPPWidget::sigPPPDDied() { - if(gpppdata.authMethod() == AUTH_PAP || - gpppdata.authMethod() == AUTH_CHAP || - gpppdata.authMethod() == AUTH_PAPCHAP) - Modem::modem->setSecret(gpppdata.authMethod(), - encodeWord(gpppdata.storedUsername()), - encodeWord(gpppdata.password())); + if(PPPData::data()->authMethod() == AUTH_PAP || + PPPData::data()->authMethod() == AUTH_CHAP || + PPPData::data()->authMethod() == AUTH_PAPCHAP) + Modem::modem->setSecret(PPPData::data()->authMethod(), + encodeWord(PPPData::data()->storedUsername()), + encodeWord(PPPData::data()->password())); @@ -519,3 +519,3 @@ void KPPPWidget::sigPPPDDied() { // stopAccounting(); - gpppdata.setpppdRunning(false); + PPPData::data()->setpppdRunning(false); // not in a signal handler !!! KNotifyClient::beep(); @@ -524,3 +524,3 @@ void KPPPWidget::sigPPPDDied() { } - gpppdata.setpppdError(0); + PPPData::data()->setpppdError(0); } @@ -545,6 +545,6 @@ void KPPPWidget::sigPPPDDied() { void KPPPWidget::newdefaultaccount(int i) { - gpppdata.setDefaultAccount(connectto_c->text(i)); - gpppdata.save(); - ID_Edit->setText(gpppdata.storedUsername()); - PW_Edit->setText(gpppdata.storedPassword()); + PPPData::data()->setDefaultAccount(connectto_c->text(i)); + PPPData::data()->save(); + ID_Edit->setText(PPPData::data()->storedUsername()); + PW_Edit->setText(PPPData::data()->storedPassword()); } @@ -558,6 +558,6 @@ void KPPPWidget::beginConnect() { // if(!m_bCmdlAccount) { -// gpppdata.setAccount(connectto_c->currentText()); -// gpppdata.setPassword(PW_Edit->text()); +// PPPData::data()->setAccount(connectto_c->currentText()); +// PPPData::data()->setPassword(PW_Edit->text()); // } else { - gpppdata.setPassword(gpppdata.storedPassword()); + PPPData::data()->setPassword(PPPData::data()->storedPassword()); // } @@ -579,3 +579,3 @@ void KPPPWidget::beginConnect() { "setuid permission and that " - "pppd is executable.").arg(gpppdata.pppdPath()); + "pppd is executable.").arg(PPPData::data()->pppdPath()); KMessageBox::error(this, string); @@ -586,3 +586,3 @@ void KPPPWidget::beginConnect() { - QFileInfo info2(gpppdata.modemDevice()); + QFileInfo info2(PPPData::data()->modemDevice()); @@ -594,3 +594,3 @@ void KPPPWidget::beginConnect() { "the modem tab of " - "the setup dialog.").arg(gpppdata.modemDevice()); + "the setup dialog.").arg(PPPData::data()->modemDevice()); QMessageBox::warning(this, "error", string); @@ -601,5 +601,5 @@ void KPPPWidget::beginConnect() { // supplied - if(gpppdata.authMethod() == AUTH_PAP || - gpppdata.authMethod() == AUTH_CHAP || - gpppdata.authMethod() == AUTH_PAPCHAP ) { + if(PPPData::data()->authMethod() == AUTH_PAP || + PPPData::data()->authMethod() == AUTH_CHAP || + PPPData::data()->authMethod() == AUTH_PAPCHAP ) { if(ID_Edit->text().isEmpty()) { @@ -612,5 +612,5 @@ void KPPPWidget::beginConnect() { } else { - if(!Modem::modem->setSecret(gpppdata.authMethod(), - encodeWord(gpppdata.storedUsername()), - encodeWord(gpppdata.password()))) { + if(!Modem::modem->setSecret(PPPData::data()->authMethod(), + encodeWord(PPPData::data()->storedUsername()), + encodeWord(PPPData::data()->password()))) { QString s; @@ -624,3 +624,3 @@ void KPPPWidget::beginConnect() { - if (gpppdata.phonenumber().isEmpty()) { + if (PPPData::data()->phonenumber().isEmpty()) { QString s = i18n("You must specify a telephone number!"); @@ -632,3 +632,3 @@ void KPPPWidget::beginConnect() { - QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); + QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); // con->setCaption(tit); @@ -637,3 +637,3 @@ void KPPPWidget::beginConnect() { - bool show_debug = gpppdata.get_show_log_window(); + bool show_debug = PPPData::data()->get_show_log_window(); // con->debug->setOn(show_debug); // toggle button @@ -652,3 +652,3 @@ void KPPPWidget::beginConnect() { void KPPPWidget::disconnect() { - if (!gpppdata.command_before_disconnect().isEmpty()) { + if (!PPPData::data()->command_before_disconnect().isEmpty()) { // con_win->hide(); @@ -661,3 +661,3 @@ void KPPPWidget::disconnect() { // pid_t id = - execute_command(gpppdata.command_before_disconnect()); + execute_command(PPPData::data()->command_before_disconnect()); // int i, status; @@ -679,3 +679,3 @@ void KPPPWidget::disconnect() { QApplication::flushX(); - execute_command(gpppdata.command_on_disconnect()); + execute_command(PPPData::data()->command_on_disconnect()); @@ -709,3 +709,3 @@ void KPPPWidget::disconnect() { void KPPPWidget::quitbutton() { - if(gpppdata.pppdRunning()) { + if(PPPData::data()->pppdRunning()) { int ok = QMessageBox::warning(this, @@ -716,3 +716,3 @@ void KPPPWidget::quitbutton() { QApplication::flushX(); - execute_command(gpppdata.command_on_disconnect()); + execute_command(PPPData::data()->command_on_disconnect()); removedns(); @@ -721,6 +721,6 @@ void KPPPWidget::quitbutton() { } else { - if (!gpppdata.accname().isEmpty() && !gpppdata.storePassword()) - gpppdata.setStoredPassword(""); + if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword()) + PPPData::data()->setStoredPassword(""); } - gpppdata.save(); + PPPData::data()->save(); qApp->quit(); @@ -738,9 +738,9 @@ void KPPPWidget::quitbutton() { -// kdDebug() << "AcctEnabled: " << gpppdata.AcctEnabled() << endl; +// kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl; // // load the ruleset -// if(!gpppdata.AcctEnabled()) +// if(!PPPData::data()->AcctEnabled()) // return; -// QString d = AccountingBase::getAccountingFile(gpppdata.accountingFile()); +// QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile()); // // if(::access(d.data(), X_OK) != 0) @@ -754,5 +754,5 @@ void KPPPWidget::quitbutton() { -// // if(!acct->loadRuleSet(gpppdata.accountingFile())) { +// // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) { // // QString s= i18n("Can not load the accounting " -// // "ruleset \"%1\"!").arg(gpppdata.accountingFile()); +// // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile()); @@ -771,5 +771,5 @@ void KPPPWidget::quitbutton() { // // if(stats->totalbytes != 0) -// // gpppdata.setTotalBytes(stats->totalbytes); +// // PPPData::data()->setTotalBytes(stats->totalbytes); -// if(!gpppdata.AcctEnabled()) +// if(!PPPData::data()->AcctEnabled()) // return; @@ -794,3 +794,3 @@ void KPPPWidget::usernameChanged(const QString &) { // store username for later use - gpppdata.setStoredUsername(ID_Edit->text()); + PPPData::data()->setStoredUsername(ID_Edit->text()); } @@ -800,6 +800,6 @@ void KPPPWidget::passwordChanged(const QString &) { // store the password if so requested - if(gpppdata.storePassword()) - gpppdata.setStoredPassword(PW_Edit->text()); + if(PPPData::data()->storePassword()) + PPPData::data()->setStoredPassword(PW_Edit->text()); else - gpppdata.setStoredPassword(""); + PPPData::data()->setStoredPassword(""); } @@ -843,3 +843,3 @@ void KPPPWidget::showNews() { #define QUICKHELP_HINT "Hint_QuickHelp" - if(gpppdata.readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { + if(PPPData::data()->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { QDialog dlg(0, 0, true); @@ -895,4 +895,4 @@ void KPPPWidget::showNews() { if(cb->isChecked()) { - gpppdata.writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); - gpppdata.save(); + PPPData::data()->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); + PPPData::data()->save(); } diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index a2f77c5..cd5d21c 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp @@ -103,3 +103,3 @@ speed_t Modem::modemspeed() { // other systems may not have them - int i = gpppdata.speed().toInt()/100; + int i = PPPData::data()->speed().toInt()/100; @@ -153,3 +153,3 @@ bool Modem::opentty() { close(modemfd); -// device = "/dev/modem";//deviceByIndex(request.modem.deviceNum); + device = PPPData::data()->modemDevice(); if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { @@ -163,3 +163,3 @@ bool Modem::opentty() { #if 0 - if(gpppdata.UseCDLine()) { + if(PPPData::data()->UseCDLine()) { if(ioctl(modemfd, TIOCMGET, &flags) == -1) { @@ -211,4 +211,4 @@ bool Modem::opentty() { - if(gpppdata.flowcontrol() != "None") { - if(gpppdata.flowcontrol() == "CRTSCTS") { + if(PPPData::data()->flowcontrol() != "None") { + if(PPPData::data()->flowcontrol() == "CRTSCTS") { tty.c_cflag |= CRTSCTS; @@ -341,3 +341,3 @@ bool Modem::writeLine(const char *buf) { // different modems seem to need different line terminations - QString term = gpppdata.enter(); + QString term = PPPData::data()->enter(); if(term == "LF") @@ -381,5 +381,5 @@ bool Modem::hangup() { // Then hangup command - writeLine(gpppdata.modemHangupStr().local8Bit()); + writeLine(PPPData::data()->modemHangupStr().local8Bit()); - usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 sec + usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec @@ -419,3 +419,3 @@ bool Modem::hangup() { - usleep(gpppdata.modemInitDelay() * 10000); // 0.01 - 3.0 secs + usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 secs @@ -442,7 +442,7 @@ void Modem::escape_to_command_mode() { // +3 because quiet time must be greater than guard time. - usleep((gpppdata.modemEscapeGuardTime()+3)*20000); - QCString tmp = gpppdata.modemEscapeStr().local8Bit(); + usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); + QCString tmp = PPPData::data()->modemEscapeStr().local8Bit(); write(modemfd, tmp.data(), tmp.length()); tcflush(modemfd, TCIOFLUSH); - usleep((gpppdata.modemEscapeGuardTime()+3)*20000); + usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); @@ -562,3 +562,3 @@ int Modem::lockdevice() { - if(!gpppdata.modemLockFile()) { + if(!PPPData::data()->modemLockFile()) { qDebug("The user doesn't want a lockfile."); @@ -571,3 +571,3 @@ int Modem::lockdevice() { QString lockfile = LOCK_DIR"/LCK.."; - lockfile += gpppdata.modemDevice().mid(5); // append everything after /dev/ + lockfile += PPPData::data()->modemDevice().mid(5); // append everything after /dev/ @@ -602,3 +602,3 @@ if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { - fd = openLockfile(gpppdata.modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); + fd = openLockfile(PPPData::data()->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); if(fd >= 0) { diff --git a/noncore/settings/networksettings/ppp/modemcmds.cpp b/noncore/settings/networksettings/ppp/modemcmds.cpp index 766ba0f..65032e8 100644 --- a/noncore/settings/networksettings/ppp/modemcmds.cpp +++ b/noncore/settings/networksettings/ppp/modemcmds.cpp @@ -46,5 +46,2 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name) setCaption(i18n("Edit Modem Commands")); -// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); - QWidget *dummyWidget = new QWidget(this); -// setMainWidget(dummyWidget); @@ -245,36 +242,36 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name) //set stuff from gpppdata - preinitslider->setValue(gpppdata.modemPreInitDelay()); - lpreinitslider->setNum(gpppdata.modemPreInitDelay()); + preinitslider->setValue(PPPData::data()->modemPreInitDelay()); + lpreinitslider->setNum(PPPData::data()->modemPreInitDelay()); for(int i = 0; i < PPPData::NumInitStrings; i++) - initstr[i]->setText(gpppdata.modemInitStr(i)); - initslider->setValue(gpppdata.modemInitDelay()); - linitslider->setNum(gpppdata.modemInitDelay()); - initresp->setText(gpppdata.modemInitResp()); + initstr[i]->setText(PPPData::data()->modemInitStr(i)); + initslider->setValue(PPPData::data()->modemInitDelay()); + linitslider->setNum(PPPData::data()->modemInitDelay()); + initresp->setText(PPPData::data()->modemInitResp()); - durationslider->setValue(gpppdata.modemToneDuration()); - ldurationslider->setNum(gpppdata.modemToneDuration()); + durationslider->setValue(PPPData::data()->modemToneDuration()); + ldurationslider->setNum(PPPData::data()->modemToneDuration()); - nodetectdialtone->setText(gpppdata.modemNoDialToneDetectionStr()); - dialstr->setText(gpppdata.modemDialStr()); - connectresp->setText(gpppdata.modemConnectResp()); - busyresp->setText(gpppdata.modemBusyResp()); - nocarrierresp->setText(gpppdata.modemNoCarrierResp()); - nodialtoneresp->setText(gpppdata.modemNoDialtoneResp()); + nodetectdialtone->setText(PPPData::data()->modemNoDialToneDetectionStr()); + dialstr->setText(PPPData::data()->modemDialStr()); + connectresp->setText(PPPData::data()->modemConnectResp()); + busyresp->setText(PPPData::data()->modemBusyResp()); + nocarrierresp->setText(PPPData::data()->modemNoCarrierResp()); + nodialtoneresp->setText(PPPData::data()->modemNoDialtoneResp()); - escapestr->setText(gpppdata.modemEscapeStr()); - escaperesp->setText(gpppdata.modemEscapeResp()); + escapestr->setText(PPPData::data()->modemEscapeStr()); + escaperesp->setText(PPPData::data()->modemEscapeResp()); - hangupstr->setText(gpppdata.modemHangupStr()); - hangupresp->setText(gpppdata.modemHangupResp()); + hangupstr->setText(PPPData::data()->modemHangupStr()); + hangupresp->setText(PPPData::data()->modemHangupResp()); - answerstr->setText(gpppdata.modemAnswerStr()); - ringresp->setText(gpppdata.modemRingResp()); - answerresp->setText(gpppdata.modemAnswerResp()); + answerstr->setText(PPPData::data()->modemAnswerStr()); + ringresp->setText(PPPData::data()->modemRingResp()); + answerresp->setText(PPPData::data()->modemAnswerResp()); - slider->setValue(gpppdata.modemEscapeGuardTime()); - lslider->setNum(gpppdata.modemEscapeGuardTime()); + slider->setValue(PPPData::data()->modemEscapeGuardTime()); + lslider->setNum(PPPData::data()->modemEscapeGuardTime()); - volume_off->setText(gpppdata.volumeOff()); - volume_medium->setText(gpppdata.volumeMedium()); - volume_high->setText(gpppdata.volumeHigh()); + volume_off->setText(PPPData::data()->volumeOff()); + volume_medium->setText(PPPData::data()->volumeMedium()); + volume_high->setText(PPPData::data()->volumeHigh()); } @@ -283,31 +280,31 @@ ModemCommands::ModemCommands(QWidget *parent, const char *name) void ModemCommands::slotOk() { - gpppdata.setModemPreInitDelay(lpreinitslider->text().toInt()); + PPPData::data()->setModemPreInitDelay(lpreinitslider->text().toInt()); for(int i = 0; i < PPPData::NumInitStrings; i++) - gpppdata.setModemInitStr(i, initstr[i]->text()); - gpppdata.setModemInitResp(initresp->text()); - gpppdata.setModemInitDelay(linitslider->text().toInt()); - - gpppdata.setModemToneDuration(ldurationslider->text().toInt()); - gpppdata.setModemNoDialToneDetectionStr(nodetectdialtone->text()); - gpppdata.setModemDialStr(dialstr->text()); - gpppdata.setModemConnectResp(connectresp->text()); - gpppdata.setModemBusyResp(busyresp->text()); - gpppdata.setModemNoCarrierResp(nocarrierresp->text()); - gpppdata.setModemNoDialtoneResp(nodialtoneresp->text()); - - gpppdata.setModemEscapeStr(escapestr->text()); - gpppdata.setModemEscapeResp(escaperesp->text()); - gpppdata.setModemEscapeGuardTime(lslider->text().toInt()); - gpppdata.setModemHangupStr(hangupstr->text()); - gpppdata.setModemHangupResp(hangupresp->text()); - - gpppdata.setModemAnswerStr(answerstr->text()); - gpppdata.setModemRingResp(ringresp->text()); - gpppdata.setModemAnswerResp(answerresp->text()); - - gpppdata.setVolumeHigh(volume_high->text()); - gpppdata.setVolumeMedium(volume_medium->text()); - gpppdata.setVolumeOff(volume_off->text()); - - gpppdata.save(); + PPPData::data()->setModemInitStr(i, initstr[i]->text()); + PPPData::data()->setModemInitResp(initresp->text()); + PPPData::data()->setModemInitDelay(linitslider->text().toInt()); + + PPPData::data()->setModemToneDuration(ldurationslider->text().toInt()); + PPPData::data()->setModemNoDialToneDetectionStr(nodetectdialtone->text()); + PPPData::data()->setModemDialStr(dialstr->text()); + PPPData::data()->setModemConnectResp(connectresp->text()); + PPPData::data()->setModemBusyResp(busyresp->text()); + PPPData::data()->setModemNoCarrierResp(nocarrierresp->text()); + PPPData::data()->setModemNoDialtoneResp(nodialtoneresp->text()); + + PPPData::data()->setModemEscapeStr(escapestr->text()); + PPPData::data()->setModemEscapeResp(escaperesp->text()); + PPPData::data()->setModemEscapeGuardTime(lslider->text().toInt()); + PPPData::data()->setModemHangupStr(hangupstr->text()); + PPPData::data()->setModemHangupResp(hangupresp->text()); + + PPPData::data()->setModemAnswerStr(answerstr->text()); + PPPData::data()->setModemRingResp(ringresp->text()); + PPPData::data()->setModemAnswerResp(answerresp->text()); + + PPPData::data()->setVolumeHigh(volume_high->text()); + PPPData::data()->setVolumeMedium(volume_medium->text()); + PPPData::data()->setVolumeOff(volume_off->text()); + + PPPData::data()->save(); accept(); diff --git a/noncore/settings/networksettings/ppp/newwidget.cpp b/noncore/settings/networksettings/ppp/newwidget.cpp deleted file mode 100644 index d2182fb..0000000 --- a/noncore/settings/networksettings/ppp/newwidget.cpp +++ b/dev/null @@ -1,17 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// functions generating layout-aware widgets -// -///////////////////////////////////////////////////////////////////////////// - -#include "newwidget.h" - -QLineEdit *newLineEdit(int visiblewidth, QWidget *parent) { - QLineEdit *l = new QLineEdit(parent); - if(visiblewidth == 0) - l->setMinimumWidth(l->sizeHint().width()); - else - l->setFixedWidth(l->fontMetrics().width('H') * visiblewidth); - - return l; -} diff --git a/noncore/settings/networksettings/ppp/newwidget.h b/noncore/settings/networksettings/ppp/newwidget.h deleted file mode 100644 index 52f2ec7..0000000 --- a/noncore/settings/networksettings/ppp/newwidget.h +++ b/dev/null @@ -1,19 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// functions generating layout-aware widgets -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef __NEWWIDGET__H__ -#define __NEWWIDGET__H__ - -#include <qwidget.h> -#include <qlineedit.h> - -#define L_FIXEDW 1 -#define L_FIXEDH 2 -#define L_FIXED (L_FIXEDW | L_FIXEDH) - -QLineEdit *newLineEdit(int visiblewidth, QWidget *parent); - -#endif diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro index a456427..ebfc713 100644 --- a/noncore/settings/networksettings/ppp/ppp.pro +++ b/noncore/settings/networksettings/ppp/ppp.pro @@ -6,4 +6,4 @@ CONFIG += qt warn_on debug DESTDIR = $(OPIEDIR)/plugins/networksettings -HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h knuminput.h knumvalidator.h kpppwidget.h conwindow.h debug.h accounts.h connect.h edit.h scriptedit.h pppdargs.h newwidget.h iplined.h pwentry.h pppconfig.h -SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp knuminput.cpp knumvalidator.cpp kpppwidget.cpp conwindow.cpp debug.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp newwidget.cpp iplined.cpp pwentry.cpp pppconfig.cpp +HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h knuminput.h knumvalidator.h kpppwidget.h conwindow.h debug.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h +SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp knuminput.cpp knumvalidator.cpp kpppwidget.cpp conwindow.cpp debug.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp index 7b2b21b..c0f1fef 100644 --- a/noncore/settings/networksettings/ppp/pppconfig.cpp +++ b/noncore/settings/networksettings/ppp/pppconfig.cpp @@ -52,3 +52,3 @@ void PPPConfigWidget::accept() { - gpppdata.save(); + PPPData::data()->save(); QDialog::accept(); @@ -59,3 +59,3 @@ void PPPConfigWidget::reject() { - gpppdata.cancel(); + PPPData::data()->cancel(); QDialog::reject(); diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp index 04d0dd0..b7fca3f 100644 --- a/noncore/settings/networksettings/ppp/pppdargs.cpp +++ b/noncore/settings/networksettings/ppp/pppdargs.cpp @@ -123,6 +123,6 @@ void PPPdArguments::defaultsbutton() { // save current list - QStringList arglist(gpppdata.pppdArgument()); + QStringList arglist(PPPData::data()->pppdArgument()); // get defaults - gpppdata.setpppdArgumentDefaults(); + PPPData::data()->setpppdArgumentDefaults(); init(); @@ -130,3 +130,3 @@ void PPPdArguments::defaultsbutton() { // restore old list - gpppdata.setpppdArgument(arglist); + PPPData::data()->setpppdArgument(arglist); } @@ -138,3 +138,3 @@ void PPPdArguments::closebutton() { arglist.append(arguments->text(i)); - gpppdata.setpppdArgument(arglist); + PPPData::data()->setpppdArgument(arglist); @@ -148,3 +148,3 @@ void PPPdArguments::init() { - QStringList &arglist = gpppdata.pppdArgument(); + QStringList &arglist = PPPData::data()->pppdArgument(); for ( QStringList::Iterator it = arglist.begin(); diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index f2386fc..646facd 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp @@ -40,7 +40,20 @@ -PPPData gpppdata; +PPPData *PPPData::_data = 0; +Config *PPPData::config = 0; +PPPData* PPPData::data() +{ + if (!_data){ + qDebug("PPPData::data() creates new Instance"); + _data = new PPPData(); + } + if (!_data->config){ + qDebug("PPPData::data() opens conffile"); + _data->open(); + } + return _data; +} PPPData::PPPData() - : config(0L), + : //config(0L), highcount(-1), // start out with no entries @@ -58,21 +71,5 @@ PPPData::PPPData() bool PPPData::open() { - - config = new Config("NetworkSetup"); - /* - config = kapp->config(); - - if (config->getConfigState() == KConfig::NoAccess) { - KMessageBox::error(0L, - i18n("The application-specific config file could not " - "be opened in either read-write or read-only mode.\n" - "The superuser might have to change its ownership " - "by issuing the following command in your home directory:\n" - "chown {YourUsername} .kde/share/config/kppprc"), - kapp->name()); - return false; - } - - // don't expand shell variables - config->setDollarExpansion(false); - */ + qDebug("opening configfile NetworkSetupPPP"); + if (config) return true; + config = new Config("NetworkSetupPPP"); @@ -106,3 +103,9 @@ void PPPData::save() { writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); -// config->sync(); + delete config; + config = 0; + qDebug("worte confi NetworkSetupPPP"); + } + if (_data){ + delete _data; + _data = 0; } @@ -125,7 +128,7 @@ void PPPData::cancel() { -// currently differentiates between READWRITE and NONE only -int PPPData::access() const { +// // currently differentiates between READWRITE and NONE only +// int PPPData::access() const { - return 0;//config->getConfigState(); -} +// return 1;//config->getConfigState(); +// } @@ -136,2 +139,3 @@ QString PPPData::readConfig(const QString &group, const QString &key, { +// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); if (config) { @@ -720,4 +724,5 @@ bool PPPData::isUniqueAccname(const QString &n) { bool PPPData::deleteAccount() { - if(caccount < 0) - return false; + //FIXME: +// if(caccount < 0) + return false; @@ -726,4 +731,3 @@ bool PPPData::deleteAccount() { - // set all entries of the current account to "" -// tille: do not handle the accounts here... (?) +// // set all entries of the current account to "" // map = config->entryMap(cgroup); @@ -758,9 +762,9 @@ bool PPPData::deleteAccount() { - highcount--; - if(caccount > highcount) - caccount = highcount; +// highcount--; +// if(caccount > highcount) +// caccount = highcount; - setAccountbyIndex(caccount); +// setAccountbyIndex(caccount); - return true; +// return true; } @@ -780,4 +784,5 @@ int PPPData::newaccount() { - if(!config || highcount >= MAX_ACCOUNTS) - return -1; + qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); + if(!config) open(); + if (highcount >= MAX_ACCOUNTS) return -1; @@ -787,3 +792,3 @@ int PPPData::newaccount() { setpppdArgumentDefaults(); - + qDebug("PPPData::newaccount -> %i",caccount); return caccount; @@ -793,22 +798,22 @@ int PPPData::copyaccount(int i) { - if(highcount >= MAX_ACCOUNTS) +// if(highcount >= MAX_ACCOUNTS) return -1; - setAccountbyIndex(i); +// setAccountbyIndex(i); -// QMap <QString, QString> map = config->entryMap(cgroup); -// QMap <QString, QString>::ConstIterator it = map.begin(); +// QMap <QString, QString> map = config->entryMap(cgroup); +// QMap <QString, QString>::ConstIterator it = map.begin(); - QString newname = i18n("%1_copy").arg(accname()); +// QString newname = i18n("%1_copy").arg(accname()); - newaccount(); +// newaccount(); -// while (it != map.end()) { -// config->writeEntry(it.key(), *it); -// it++; -// } +// while (it != map.end()) { +// config->writeEntry(it.key(), *it); +// it++; +// } - setAccname(newname); +// setAccname(newname); - return caccount; +// return caccount; } @@ -831,3 +836,3 @@ void PPPData::setAccname(const QString &n) { -#define SEPARATOR_CHAR ':' +#define SEPARATOR_CHAR '&' QStringList &PPPData::phonenumbers() { @@ -1013,3 +1018,3 @@ bool PPPData::autoDNS() { bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); - return (set && gpppdata.pppdVersionMin(2, 3, 7)); + return (set && PPPData::data()->pppdVersionMin(2, 3, 7)); } @@ -1141,45 +1146,45 @@ void PPPData::setpppdArgumentDefaults() { -// graphing widget -void PPPData::setGraphingOptions(bool enable, - QColor bg, - QColor text, - QColor in, - QColor out) -{ - if(config) { - config->setGroup(GRAPH_GRP); - config->writeEntry(GENABLED, enable); -// config->writeEntry(GCOLOR_BG, bg); -// config->writeEntry(GCOLOR_TEXT, text); -// config->writeEntry(GCOLOR_IN, in); -// config->writeEntry(GCOLOR_OUT, out); - } -} - -void PPPData::graphingOptions(bool &enable, - QColor &bg, - QColor &text, - QColor &in, - QColor &out) -{ - QColor c; - - if(config) { - config->setGroup(GRAPH_GRP); - enable = config->readBoolEntry(GENABLED, true); - bg = Qt::white; - //bg = config->readColorEntry(GCOLOR_BG, &c); - text = Qt::black; - //text = config->readColorEntry(GCOLOR_TEXT, &c); - in = Qt::blue; - //in = config->readColorEntry(GCOLOR_IN, &c); - out = Qt::red; - //out = config->readColorEntry(GCOLOR_OUT, &c); - } -} +// // graphing widget +// void PPPData::setGraphingOptions(bool enable, +// QColor bg, +// QColor text, +// QColor in, +// QColor out) +// { +// if(config) { +// config->setGroup(GRAPH_GRP); +// config->writeEntry(GENABLED, enable); +// // config->writeEntry(GCOLOR_BG, bg); +// // config->writeEntry(GCOLOR_TEXT, text); +// // config->writeEntry(GCOLOR_IN, in); +// // config->writeEntry(GCOLOR_OUT, out); +// } +// } + +// void PPPData::graphingOptions(bool &enable, +// QColor &bg, +// QColor &text, +// QColor &in, +// QColor &out) +// { +// QColor c; + +// if(config) { +// config->setGroup(GRAPH_GRP); +// enable = config->readBoolEntry(GENABLED, true); +// bg = Qt::white; +// //bg = config->readColorEntry(GCOLOR_BG, &c); +// text = Qt::black; +// //text = config->readColorEntry(GCOLOR_TEXT, &c); +// in = Qt::blue; +// //in = config->readColorEntry(GCOLOR_IN, &c); +// out = Qt::red; +// //out = config->readColorEntry(GCOLOR_OUT, &c); +// } +// } -bool PPPData::graphingEnabled() { - return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); -} +// bool PPPData::graphingEnabled() { +// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); +// } @@ -1207,23 +1212,23 @@ void PPPData::setpppdError(int err) { -// -// window position -// -void PPPData::winPosConWin(int& p_x, int& p_y) { - p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160); - p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55); -} +// // +// // window position +// // +// void PPPData::winPosConWin(int& p_x, int& p_y) { +// p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160); +// p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55); +// } -void PPPData::setWinPosConWin(int p_x, int p_y) { - writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x); - writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y); -} +// void PPPData::setWinPosConWin(int p_x, int p_y) { +// writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x); +// writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y); +// } -void PPPData::winPosStatWin(int& p_x, int& p_y) { - p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160); - p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55); -} +// void PPPData::winPosStatWin(int& p_x, int& p_y) { +// p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160); +// p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55); +// } -void PPPData::setWinPosStatWin(int p_x, int p_y) { - writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x); - writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y); -} +// void PPPData::setWinPosStatWin(int p_x, int p_y) { +// writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x); +// writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y); +// } diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h index e286b70..57ce2fd 100644 --- a/noncore/settings/networksettings/ppp/pppdata.h +++ b/noncore/settings/networksettings/ppp/pppdata.h @@ -57,7 +57,7 @@ class Config; // groups -#define GENERAL_GRP "General" -#define MODEM_GRP "Modem" -#define ACCOUNT_GRP "Account" -#define GRAPH_GRP "Graph" -#define WINPOS_GRP "WindowPosition" +#define GENERAL_GRP "PPP_General" +#define MODEM_GRP "PPP_Modem" +#define ACCOUNT_GRP "PPP_Account" +//#define GRAPH_GRP "Graph" +//#define WINPOS_GRP "WindowPosition" @@ -163,2 +163,3 @@ public: ~PPPData() {}; + static PPPData* data(); @@ -170,3 +171,3 @@ public: void cancel(); - int access() const; // read/write access +// int access() const; // read/write access @@ -428,37 +429,38 @@ public: - // graphing widget - void setGraphingOptions(bool enabled, - QColor bg, - QColor text, - QColor in, - QColor out); - void graphingOptions(bool &enabled, - QColor &bg, - QColor &text, - QColor &in, - QColor &out); - bool graphingEnabled(); - - // window positions - void winPosConWin(int &, int &); - void setWinPosConWin(int, int); - void winPosStatWin(int &, int &); - void setWinPosStatWin(int, int); +// // graphing widget +// void setGraphingOptions(bool enabled, +// QColor bg, +// QColor text, +// QColor in, +// QColor out); +// void graphingOptions(bool &enabled, +// QColor &bg, +// QColor &text, +// QColor &in, +// QColor &out); +// bool graphingEnabled(); + +// // window positions +// void winPosConWin(int &, int &); +// void setWinPosConWin(int, int); +// void winPosStatWin(int &, int &); +// void setWinPosStatWin(int, int); private: - QString passwd; - Config* config; // configuration object - int highcount; // index of highest account - int caccount; // index of the current account - QString cgroup; // name of current config group - pid_t suidprocessid; // process ID of setuid child - bool pppdisrunning; // pppd process - // daemon - int pppderror; // error encounterd running pppd - int pppdVer, pppdMod, pppdPatch; // pppd version - - QStringList phonelist; -}; -extern PPPData gpppdata; + static PPPData *_data; + + QString passwd; + static Config* config; // configuration object + int highcount; // index of highest account + int caccount; // index of the current account + QString cgroup; // name of current config group + pid_t suidprocessid; // process ID of setuid child + bool pppdisrunning; // pppd process + // daemon + int pppderror; // error encounterd running pppd + int pppdVer, pppdMod, pppdPatch; // pppd version + + QStringList phonelist; +}; diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index d6ca88a..da17e26 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp @@ -2,3 +2,3 @@ #include "pppmodule.h" -//#include "pppimp.h" +#include "pppdata.h" #include "kpppwidget.h" @@ -100,2 +100,3 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){ return new Interface( 0, newInterface ); + PPPData::data()->save(); } |