summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/pppdata.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdata.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 59d68c9..7a6524f 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -130,7 +130,7 @@ void PPPData::cancel() {
130QString PPPData::readConfig(const QString &group, const QString &key, 130QString PPPData::readConfig(const QString &group, const QString &key,
131 const QString &defvalue = "") 131 const QString &defvalue = "")
132{ 132{
133// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); 133 qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
134 QString idx = SEP.arg(group).arg(key); 134 QString idx = SEP.arg(group).arg(key);
135 if (stringEntries.find(idx) != stringEntries.end()) 135 if (stringEntries.find(idx) != stringEntries.end())
136 return stringEntries[idx]; 136 return stringEntries[idx];
@@ -347,6 +347,7 @@ const QString PPPData::modemDevice() {
347 347
348 348
349bool PPPData::setModemDevice(const QString &n) { 349bool PPPData::setModemDevice(const QString &n) {
350 qDebug("Setting modem dev to >%s<", n.latin1());
350 bool ret = false; 351 bool ret = false;
351 for (int i = 0; devices[i]; i++) 352 for (int i = 0; devices[i]; i++)
352 if (devices[i] == n){ 353 if (devices[i] == n){
@@ -354,6 +355,7 @@ bool PPPData::setModemDevice(const QString &n) {
354 writeConfig(modemGroup(), MODEMDEV_KEY, n); 355 writeConfig(modemGroup(), MODEMDEV_KEY, n);
355 ret = true; 356 ret = true;
356 } 357 }
358 qDebug(ret?"SUCCESS":"FAILURE");
357 return ret; 359 return ret;
358} 360}
359 361
@@ -712,13 +714,16 @@ int PPPData::count() const {
712 714
713 715
714bool PPPData::setAccount(const QString &aname) { 716bool PPPData::setAccount(const QString &aname) {
717 qDebug("setting account to >%s<", aname.latin1());
715 for(int i = 0; i <= highcount; i++) { 718 for(int i = 0; i <= highcount; i++) {
716 setAccountbyIndex(i); 719 setAccountbyIndex(i);
717 if(accname() == aname) { 720 if(accname() == aname) {
718 caccount = i; 721 caccount = i;
722 qDebug("SUCCESS");
719 return true; 723 return true;
720 } 724 }
721 } 725 }
726 qDebug("FAILURE");
722 return false; 727 return false;
723} 728}
724 729
@@ -910,6 +915,9 @@ void PPPData::setStoredUsername(const QString &b) {
910 915
911 916
912const QString PPPData::storedPassword() { 917const QString PPPData::storedPassword() {
918 qDebug("getting stored pw");
919 qDebug("g %s", cgroup.latin1() );
920 qDebug("k %s", STORED_PASSWORD_KEY);
913 return readConfig(cgroup, STORED_PASSWORD_KEY, ""); 921 return readConfig(cgroup, STORED_PASSWORD_KEY, "");
914} 922}
915 923
@@ -1274,3 +1282,14 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
1274 cfg.writeEntry( ACCOUNTS_COUNT, i ); 1282 cfg.writeEntry( ACCOUNTS_COUNT, i );
1275 1283
1276} 1284}
1285
1286/**
1287 * pppd's getword() function knows about escape characters.
1288 * If we write the username and password to the secrets file
1289 * we'll therefore have to escape back slashes.
1290 */
1291QString PPPData::encodeWord(const QString &s) {
1292 QString r = s;
1293 r.replace(QRegExp("\\"), "\\\\");
1294 return r;
1295}