author | tille <tille> | 2003-06-06 13:38:57 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-06 13:38:57 (UTC) |
commit | 225486a1c3714b4b0c0e60286df13d8ede029768 (patch) (side-by-side diff) | |
tree | a49c0faa1d439308ebb60181e1cd5afd5479d092 | |
parent | d3e9154252841f3adcfbd9868e263475fc698ebb (diff) | |
download | opie-225486a1c3714b4b0c0e60286df13d8ede029768.zip opie-225486a1c3714b4b0c0e60286df13d8ede029768.tar.gz opie-225486a1c3714b4b0c0e60286df13d8ede029768.tar.bz2 |
more arm fixes..
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index 8f066ff..8f45e54 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp @@ -103,769 +103,769 @@ void PPPData::save() qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); cfg.setGroup(keys[0]); cfg.writeEntry(keys[1], val); } for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); it != listEntries.end(); ++it ){ QStringList val = it.data(); key = it.key(); QChar sep = sepEntries[key]; // qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); keys = QStringList::split( "SEPARATOR", key ); qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() ); cfg.setGroup(keys[0]); cfg.writeEntry(keys[1], val, sep); } } // // cancel changes // void PPPData::cancel() { stringEntries.clear(); intEntries.clear(); listEntries.clear(); } // functions to read/write date to configuration file QString PPPData::readConfig(const QString &group, const QString &key, const QString &defvalue = "") { // qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); QString idx = SEP.arg(group).arg(key); if (stringEntries.find(idx) != stringEntries.end()) return stringEntries[idx]; Config cfg = config(); cfg.setGroup(group); return cfg.readEntry(key, defvalue); } int PPPData::readNumConfig(const QString &group, const QString &key, int defvalue) { QString idx = SEP.arg(group).arg(key); if (intEntries.find(idx) != intEntries.end()) return intEntries[idx]; Config cfg = config(); cfg.setGroup(group); return cfg.readNumEntry(key, defvalue); // if (config) { // config->setGroup(group); // return config->readNumEntry(key, defvalue); // } else // return defvalue; } bool PPPData::readListConfig(const QString &group, const QString &key, QStringList &list, char sep) { list.clear(); QString idx = SEP.arg(group).arg(key); if (listEntries.find(idx) != listEntries.end()){ list = listEntries[idx]; return true; } Config cfg = config(); cfg.setGroup(group); list = cfg.readListEntry(key, sep); if (list.count() > 0) return true; return false; // if (config) { // config->setGroup(group); // list = config->readListEntry(key, sep); // return true; // } else // return false; } void PPPData::writeConfig(const QString &group, const QString &key, const QString &value) { stringEntries.insert( SEP.arg(group).arg(key), value ); // if (config) { // config->setGroup(group); // config->writeEntry(key, value); // } } void PPPData::writeConfig(const QString &group, const QString &key, int value) { intEntries.insert( SEP.arg(group).arg(key), value ); // if (config) { // config->setGroup(group); // config->writeEntry(key, value); // } } void PPPData::writeListConfig(const QString &group, const QString &key, QStringList &list, char sep) { listEntries.insert( SEP.arg(group).arg(key), list ); sepEntries.insert( SEP.arg(group).arg(key), sep ); // if (config) { // config->setGroup(group); // config->writeEntry(key, list, sep); // } } // // functions to set/return general information // QString PPPData::password(){ if ( storePassword() ) return storedPassword(); else return passwd; } void PPPData::setPassword(const QString &pw) { passwd = pw; } const QString PPPData::defaultAccount() { return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY); } void PPPData::setDefaultAccount(const QString &n) { writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n); //now set the current account index to the default account setAccount(defaultAccount()); } bool PPPData::get_show_clock_on_caption() { return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true); } void PPPData::set_show_clock_on_caption(bool set) { writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); } bool PPPData::get_xserver_exit_disconnect() { return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); } void PPPData::setPPPDebug(bool set) { writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); } bool PPPData::getPPPDebug() { return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); } void PPPData::set_xserver_exit_disconnect(bool set) { writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); } bool PPPData::quit_on_disconnect() { return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); } void PPPData::set_quit_on_disconnect(bool set) { writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); } bool PPPData::get_show_log_window() { return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); } void PPPData::set_show_log_window(bool set) { writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); } bool PPPData::automatic_redial() { return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); } void PPPData::set_automatic_redial(bool set) { writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); } // bool PPPData::get_iconify_on_connect() { // return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); // } // void PPPData::set_iconify_on_connect(bool set) { // writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); // } // bool PPPData::get_dock_into_panel() { // return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); // } // void PPPData::set_dock_into_panel(bool set) { // writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); // } QString PPPData::pppdVersion() { return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); } bool PPPData::pppdVersionMin(int ver, int mod, int patch) { // check if pppd version fulfills minimum requirement return (pppdVer > ver || (pppdVer == ver && pppdMod > mod) || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); } int PPPData::pppdTimeout() { return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); } void PPPData::setpppdTimeout(int n) { writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); } const QString PPPData::modemDevice() { return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); } bool PPPData::setModemDevice(const QString &n) { qDebug("Setting modem dev to >%s<", n.latin1()); bool ret = false; for (int i = 0; devices[i]; i++) if (devices[i] == n){ modemDeviceGroup = i; writeConfig(modemGroup(), MODEMDEV_KEY, n); ret = true; } qDebug(ret?"SUCCESS":"FAILURE"); return ret; } const QString PPPData::flowcontrol() { return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); } void PPPData::setFlowcontrol(const QString &n) { writeConfig(modemGroup(), FLOWCONTROL_KEY, n); } const QString PPPData::speed() { QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); // undo the damage of a bug in former versions. It left an empty Speed= // entry in kppprc. kppp did set the serial port to 57600 as default but // pppd wouldn't receive the speed via the command line. if(s.toUInt() == 0) s = "57600"; return s; } void PPPData::setSpeed(const QString &n) { writeConfig(modemGroup(), SPEED_KEY, n); } #if 0 void PPPData::setUseCDLine(const int n) { writeConfig(modemGroup(),USECDLINE_KEY,n); } int PPPData::UseCDLine() { return readNumConfig(modemGroup(),USECDLINE_KEY,0); } #endif const QString PPPData::modemEscapeStr() { return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); } void PPPData::setModemEscapeStr(const QString &n) { writeConfig(modemGroup(),ESCAPESTR_KEY,n); } const QString PPPData::modemEscapeResp() { return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); } void PPPData::setModemEscapeResp(const QString &n) { writeConfig(modemGroup(),ESCAPERESP_KEY,n); } int PPPData::modemEscapeGuardTime() { return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); } void PPPData::setModemEscapeGuardTime(int n) { writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); } bool PPPData::modemLockFile() { return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); } void PPPData::setModemLockFile(bool set) { writeConfig(modemGroup(), LOCKFILE_KEY, set); } int PPPData::modemTimeout() { return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); } void PPPData::setModemTimeout(int n) { writeConfig(modemGroup(), TIMEOUT_KEY, n); } int PPPData::modemToneDuration() { return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); } void PPPData::setModemToneDuration(int n) { writeConfig(modemGroup(), TONEDURATION_KEY, n); } int PPPData::busyWait() { return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); } void PPPData::setbusyWait(int n) { writeConfig(modemGroup(), BUSYWAIT_KEY, n); } // //Advanced "Modem" dialog // // defaults: InitString=ATZ, InitString1="" etc. const QString PPPData::modemInitStr(int i) { assert(i >= 0 && i < NumInitStrings); if(i == 0) return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); else return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); } void PPPData::setModemInitStr(int i, const QString &n) { assert(i >= 0 && i < NumInitStrings); - QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); + QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : QString("")); writeConfig(modemGroup(), k, n); } const QString PPPData::modemInitResp() { return readConfig(modemGroup(), INITRESP_KEY, "OK"); } void PPPData::setModemInitResp(const QString &n) { writeConfig(modemGroup(), INITRESP_KEY, n); } int PPPData::modemPreInitDelay() { return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); } void PPPData::setModemPreInitDelay(int n) { writeConfig(modemGroup(), PREINITDELAY_KEY, n); } int PPPData::modemInitDelay() { return readNumConfig(modemGroup(), INITDELAY_KEY, 50); } void PPPData::setModemInitDelay(int n) { writeConfig(modemGroup(), INITDELAY_KEY, n); } QString PPPData::modemNoDialToneDetectionStr() { return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); } void PPPData::setModemNoDialToneDetectionStr(const QString &n) { writeConfig(modemGroup(), NODTDETECT_KEY, n); } const QString PPPData::modemDialStr() { return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); } void PPPData::setModemDialStr(const QString &n) { writeConfig(modemGroup(), DIALSTR_KEY, n); } const QString PPPData::modemConnectResp() { return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); } void PPPData::setModemConnectResp(const QString &n) { writeConfig(modemGroup(), CONNECTRESP_KEY, n); } const QString PPPData::modemBusyResp() { return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY"); } void PPPData::setModemBusyResp(const QString &n) { writeConfig(modemGroup(), BUSYRESP_KEY, n); } const QString PPPData::modemNoCarrierResp() { return readConfig(modemGroup(), NOCARRIERRESP_KEY, "NO CARRIER"); } void PPPData::setModemNoCarrierResp(const QString &n) { writeConfig(modemGroup(), NOCARRIERRESP_KEY, n); } const QString PPPData::modemNoDialtoneResp() { return readConfig(modemGroup(), NODIALTONERESP_KEY, "NO DIALTONE"); } void PPPData::setModemNoDialtoneResp(const QString &n) { writeConfig(modemGroup(), NODIALTONERESP_KEY, n); } const QString PPPData::modemHangupStr() { return readConfig(modemGroup(), HANGUPSTR_KEY, "+++ATH"); } void PPPData::setModemHangupStr(const QString &n) { writeConfig(modemGroup(), HANGUPSTR_KEY, n); } const QString PPPData::modemHangupResp() { return readConfig(modemGroup(), HANGUPRESP_KEY, "OK"); } void PPPData::setModemHangupResp(const QString &n) { writeConfig(modemGroup(), HANGUPRESP_KEY, n); } const QString PPPData::modemAnswerStr() { return readConfig(modemGroup(), ANSWERSTR_KEY, "ATA"); } QString PPPData::volumeOff() { return readConfig(modemGroup(), VOLUME_OFF, "M0L0"); } void PPPData::setVolumeOff(const QString &s) { writeConfig(modemGroup(), VOLUME_OFF, s); } QString PPPData::volumeMedium() { return readConfig(modemGroup(), VOLUME_MEDIUM, "M1L1"); } void PPPData::setVolumeMedium(const QString &s) { writeConfig(modemGroup(), VOLUME_MEDIUM, s); } QString PPPData::volumeHigh() { QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3"); if(tmp == "M1L4") tmp = "M1L3"; return tmp; } void PPPData::setVolumeHigh(const QString &s) { writeConfig(modemGroup(), VOLUME_HIGH, s); } QString PPPData::volumeInitString() { QString s; switch(volume()) { case 0: s = volumeOff(); break; case 1: s = volumeMedium(); break; case 2: s = volumeHigh(); break; default: s = volumeMedium(); } return s; } int PPPData::volume() { return readNumConfig(modemGroup(), VOLUME_KEY, 1); } void PPPData::setVolume(int i) { writeConfig(modemGroup(), VOLUME_KEY, i); } int PPPData::waitForDialTone() { return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); } void PPPData::setWaitForDialTone(int i) { writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); } void PPPData::setModemAnswerStr(const QString &n) { writeConfig(modemGroup(), ANSWERSTR_KEY, n); } const QString PPPData::modemRingResp() { return readConfig(modemGroup(), RINGRESP_KEY, "RING"); } void PPPData::setModemRingResp(const QString &n) { writeConfig(modemGroup(), RINGRESP_KEY, n); } const QString PPPData::modemAnswerResp() { return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); } void PPPData::setModemAnswerResp(const QString &n) { writeConfig(modemGroup(), ANSWERRESP_KEY, n); } const QString PPPData::enter() { return readConfig(modemGroup(), ENTER_KEY, "CR"); } void PPPData::setEnter(const QString &n) { writeConfig(modemGroup(), ENTER_KEY, n); } // // functions to set/return account information // //returns number of accounts int PPPData::count() const { return highcount + 1; } bool PPPData::setAccount(const QString &aname) { qDebug("setting account to >%s<", aname.latin1()); for(int i = 0; i <= highcount; i++) { setAccountbyIndex(i); if(accname() == aname) { caccount = i; qDebug("SUCCESS"); return true; } } qDebug("FAILURE"); return false; } bool PPPData::setAccountbyIndex(int i) { if(i >= 0 && i <= highcount) { caccount = i; cgroup.sprintf("%s%i", ACCOUNT_GRP, i); return true; } return false; } bool PPPData::isUniqueAccname(const QString &n) { int current = caccount; for(int i=0; i <= highcount; i++) { setAccountbyIndex(i); if(accname() == n && i != current) { setAccountbyIndex(current); return false; } } setAccountbyIndex(current); return true; } bool PPPData::deleteAccount() { //FIXME: PPPData::deleteAccount // if(caccount < 0) return false; // QMap <QString, QString> map; // QMap <QString, QString>::Iterator it; // // set all entries of the current account to "" // map = config->entryMap(cgroup); // it = map.begin(); // while (it != map.end()) { // config->writeEntry(it.key(), ""); // it++; // } // // shift the succeeding accounts // for(int i = caccount+1; i <= highcount; i++) { // setAccountbyIndex(i); // map = config->entryMap(cgroup); // it = map.begin(); // setAccountbyIndex(i-1); // config->setGroup(cgroup); // while (it != map.end()) { // config->writeEntry(it.key(), *it); // it++; // } // } // // make sure the top account is cleared // setAccountbyIndex(highcount); // map = config->entryMap(cgroup); // it = map.begin(); // config->setGroup(cgroup); // while (it.key() != QString::null) { // config->writeEntry(it.key(), ""); // it++; // } // highcount--; // if(caccount > highcount) // caccount = highcount; // setAccountbyIndex(caccount); // return true; } bool PPPData::deleteAccount(const QString &aname) { if(!setAccount(aname)) return false; deleteAccount(); return true; } int PPPData::newaccount() { qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); // if(!config) open(); if (highcount >= MAX_ACCOUNTS) return -1; highcount++; setAccountbyIndex(highcount); setpppdArgumentDefaults(); qDebug("PPPData::newaccount -> %i",caccount); return caccount; } int PPPData::copyaccount(int i) { // FIXME: PPPData::copyaccount // if(highcount >= MAX_ACCOUNTS) return -1; // setAccountbyIndex(i); // QMap <QString, QString> map = config->entryMap(cgroup); // QMap <QString, QString>::ConstIterator it = map.begin(); // QString newname = i18n("%1_copy").arg(accname()); // newaccount(); // while (it != map.end()) { // config->writeEntry(it.key(), *it); // it++; // } // setAccname(newname); // return caccount; } const QString PPPData::accname() { return readConfig(cgroup, NAME_KEY); } void PPPData::setAccname(const QString &n) { if(!cgroup.isNull()) { // are we manipulating the default account's name ? then change it, too. bool def = accname() == defaultAccount(); writeConfig(cgroup, NAME_KEY, n); if (def) setDefaultAccount(n); } } #define SEPARATOR_CHAR '&' QStringList &PPPData::phonenumbers() { |