author | tille <tille> | 2003-06-03 14:08:04 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-03 14:08:04 (UTC) |
commit | 60d9f66d2b31c659ac652c15423ecaca89a5f312 (patch) (side-by-side diff) | |
tree | bfda269b58eb1c72893057d9d7fae5a6a2e45abc /noncore/settings/networksettings/ppp/pppdata.cpp | |
parent | aaf7709f64dda5a6cb81eeb96e421ba4189654d6 (diff) | |
download | opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.zip opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.tar.gz opie-60d9f66d2b31c659ac652c15423ecaca89a5f312.tar.bz2 |
authentication (except when passwd not stored)
and minor things
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdata.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index 23db409..8f066ff 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp @@ -34,24 +34,25 @@ #include <qapplication.h> // #include <klocale.h> // #include <kconfig.h> // #include <kmessagebox.h> // #include <kapplication.h> #include <assert.h> #define SEPARATOR -sseepp- #define SEP QString("%1SEPARATOR%1") PPPData::PPPData() : modemDeviceGroup(-1), + passwd(""), 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) { highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; if (highcount > MAX_ACCOUNTS) highcount = MAX_ACCOUNTS; if(highcount >= 0 && defaultAccount().isEmpty()) { @@ -208,26 +209,27 @@ void PPPData::writeListConfig(const QString &group, const QString &key, 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() const { - return passwd; +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); } @@ -744,25 +746,25 @@ bool PPPData::isUniqueAccname(const QString &n) { setAccountbyIndex(i); if(accname() == n && i != current) { setAccountbyIndex(current); return false; } } setAccountbyIndex(current); return true; } bool PPPData::deleteAccount() { - //FIXME: + //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++; @@ -817,25 +819,25 @@ int PPPData::newaccount() { // 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 +// 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(); @@ -1267,30 +1269,32 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces() acc = config.readEntry( ACOUNTS_ACC, "error" ); ifaces.insert( dev, acc ); } return ifaces; } void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) { QMap<QString,QString>::Iterator it; int i = 0; Config cfg = config(); - for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){ - cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i)); + for( it = ifaces.begin(); it != ifaces.end(); ++it ){ + cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); cfg.writeEntry( ACOUNTS_DEV, it.key() ); cfg.writeEntry( ACOUNTS_ACC, it.data() ); + qDebug("I %i",i); } cfg.setGroup( ACCLIST_GRP ); + qDebug("saved %i account settings", i); cfg.writeEntry( ACCOUNTS_COUNT, i ); } /** * pppd's getword() function knows about escape characters. * If we write the username and password to the secrets file * we'll therefore have to escape back slashes. */ QString PPPData::encodeWord(const QString &s) { QString r = s; r.replace(QRegExp("\\"), "\\\\"); |