Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdata.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index bb1c8ed..109e3b7 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp @@ -51,25 +51,26 @@ PPPData* PPPData::data() qDebug("PPPData::data() opens conffile"); _data->open(); } return _data; } PPPData::PPPData() : //config(0L), highcount(-1), // start out with no entries caccount(-1), // set the current account index also suidprocessid(-1), // process ID of setuid child pppdisrunning(false), - pppderror(0) + pppderror(0), + modemDeviceGroup(-1) { } // // open configuration file // bool PPPData::open() { qDebug("opening configfile NetworkSetupPPP"); if (config) return true; config = new Config("NetworkSetupPPP"); @@ -318,26 +319,34 @@ int PPPData::pppdTimeout() { void PPPData::setpppdTimeout(int n) { writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); } const QString PPPData::modemDevice() { return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); } -void PPPData::setModemDevice(const QString &n) { +bool PPPData::setModemDevice(const QString &n) { + //FIXME: change modem group + bool ret = false; + for (int i = 0; devices[i]; i++) + if (devices[i] == n){ + modemDeviceGroup = i; writeConfig(modemGroup(), MODEMDEV_KEY, n); + ret = true; + } + return ret; } const QString PPPData::flowcontrol() { return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); } void PPPData::setFlowcontrol(const QString &n) { writeConfig(modemGroup(), FLOWCONTROL_KEY, n); } @@ -1084,51 +1093,51 @@ QStringList &PPPData::script() { while(scriptlist.count() > MAX_SCRIPT_ENTRIES) scriptlist.remove(scriptlist.last()); return scriptlist; } void PPPData::setScript(QStringList &list) { writeListConfig(cgroup, SCRIPTARG_KEY, list); } -const QString PPPData::accountingFile() { - return readConfig(cgroup, ACCTFILE_KEY); -} +// const QString PPPData::accountingFile() { +// return readConfig(cgroup, ACCTFILE_KEY); +// } -void PPPData::setAccountingFile(const QString &n) { - writeConfig(cgroup, ACCTFILE_KEY, n); -} +// void PPPData::setAccountingFile(const QString &n) { +// writeConfig(cgroup, ACCTFILE_KEY, n); +// } -const QString PPPData::totalCosts() { - return readConfig(cgroup, TOTALCOSTS_KEY); -} +// const QString PPPData::totalCosts() { +// return readConfig(cgroup, TOTALCOSTS_KEY); +// } -void PPPData::setTotalCosts(const QString &n) { - writeConfig(cgroup, TOTALCOSTS_KEY, n); -} +// void PPPData::setTotalCosts(const QString &n) { +// writeConfig(cgroup, TOTALCOSTS_KEY, n); +// } -int PPPData::totalBytes() { - return readNumConfig(cgroup, TOTALBYTES_KEY, 0); -} +// int PPPData::totalBytes() { +// return readNumConfig(cgroup, TOTALBYTES_KEY, 0); +// } -void PPPData::setTotalBytes(int n) { - writeConfig(cgroup, TOTALBYTES_KEY, n); -} +// void PPPData::setTotalBytes(int n) { +// writeConfig(cgroup, TOTALBYTES_KEY, n); +// } QStringList &PPPData::pppdArgument() { static QStringList arglist; while(arglist.count() > MAX_PPPD_ARGUMENTS) arglist.remove(arglist.last()); readListConfig(cgroup, PPPDARG_KEY, arglist); return arglist; } @@ -1202,25 +1211,26 @@ void PPPData::setpppdRunning(bool set) { } int PPPData::pppdError() const { return pppderror; } void PPPData::setpppdError(int err) { pppderror = err; } QString PPPData::modemGroup() { - return MODEM_GRP; + if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup); + return QString("MODEM_GRP_%1").arg(modemDeviceGroup); } // // // // 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); |