summaryrefslogtreecommitdiff
path: root/noncore/net/networksetup/interfaces.cpp
authorbenmeyer <benmeyer>2002-10-18 14:28:42 (UTC)
committer benmeyer <benmeyer>2002-10-18 14:28:42 (UTC)
commit88b3a159060ed7057bfee4cc1ccfcf81a63a4780 (patch) (side-by-side diff)
tree3dd78d403f337c73bb3ca9d75ef0a29f2adae9b6 /noncore/net/networksetup/interfaces.cpp
parent461113126af82cd6343eedab36ecabb4253780ee (diff)
downloadopie-88b3a159060ed7057bfee4cc1ccfcf81a63a4780.zip
opie-88b3a159060ed7057bfee4cc1ccfcf81a63a4780.tar.gz
opie-88b3a159060ed7057bfee4cc1ccfcf81a63a4780.tar.bz2
More profile stuff works
Diffstat (limited to 'noncore/net/networksetup/interfaces.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interfaces.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/noncore/net/networksetup/interfaces.cpp b/noncore/net/networksetup/interfaces.cpp
index 1287d90..eef42df 100644
--- a/noncore/net/networksetup/interfaces.cpp
+++ b/noncore/net/networksetup/interfaces.cpp
@@ -342,15 +342,15 @@ bool Interfaces::setMapping(QString interface){
}
/**
* Adds a new Mapping to the interfaces file with interfaces.
* @param interface the name(s) of the interfaces to set to this mapping
*/
-void Interfaces::addMapping(QString interfaces){
+void Interfaces::addMapping(QString option){
interfaces.append("");
- interfaces.append(QString(MAPPING " %1").arg(interfaces));
+ interfaces.append(QString(MAPPING " %1").arg(option));
}
/**
* Set a map option within a mapping.
* @param map map to use
* @param value value to go with map
@@ -401,17 +401,18 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
QString line = (*it).simplifyWhiteSpace();
if(line.contains(stanza) && line.contains(option)){
if(found == true){
qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1());
}
+ qDebug("Found");
found = true;
iterator = it;
}
}
- return !found;
+ return found;
}
/**
* Sets a value of an option in a stanza
* @param start the start of the stanza
* @param option the option to use when setting value.
@@ -425,26 +426,32 @@ bool Interfaces::setOption(QStringList::Iterator start, QString option, QString
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
if(!found && value != ""){
// Got to the end of the stanza without finding it, so append it.
interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
}
+ found = true;
break;
}
- if((*it).contains(option)){
+ if((*it).contains(option) && it != start){
// Found it in stanza so replace it.
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
if(value == "")
(*it) = "";
else
(*it) = QString("\t%1 %2").arg(option).arg(value);
}
}
- return true;
+ if(!found){
+ QStringList::Iterator p = start;
+ interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
+ found = true;
+ }
+ return found;
}
/**
* Removes all options in a stanza
* @param start the start of the stanza
* @return bool true if successfull, false otherwise.