author | benmeyer <benmeyer> | 2002-10-18 14:28:42 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-18 14:28:42 (UTC) |
commit | 88b3a159060ed7057bfee4cc1ccfcf81a63a4780 (patch) (unidiff) | |
tree | 3dd78d403f337c73bb3ca9d75ef0a29f2adae9b6 /noncore/net/networksetup/interfaces.cpp | |
parent | 461113126af82cd6343eedab36ecabb4253780ee (diff) | |
download | opie-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.cpp | 17 |
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){ | |||
342 | } | 342 | } |
343 | 343 | ||
344 | /** | 344 | /** |
345 | * Adds a new Mapping to the interfaces file with interfaces. | 345 | * Adds a new Mapping to the interfaces file with interfaces. |
346 | * @param interface the name(s) of the interfaces to set to this mapping | 346 | * @param interface the name(s) of the interfaces to set to this mapping |
347 | */ | 347 | */ |
348 | void Interfaces::addMapping(QString interfaces){ | 348 | void Interfaces::addMapping(QString option){ |
349 | interfaces.append(""); | 349 | interfaces.append(""); |
350 | interfaces.append(QString(MAPPING " %1").arg(interfaces)); | 350 | interfaces.append(QString(MAPPING " %1").arg(option)); |
351 | } | 351 | } |
352 | 352 | ||
353 | /** | 353 | /** |
354 | * Set a map option within a mapping. | 354 | * Set a map option within a mapping. |
355 | * @param map map to use | 355 | * @param map map to use |
356 | * @param value value to go with map | 356 | * @param value value to go with map |
@@ -401,17 +401,18 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator | |||
401 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { | 401 | for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { |
402 | QString line = (*it).simplifyWhiteSpace(); | 402 | QString line = (*it).simplifyWhiteSpace(); |
403 | if(line.contains(stanza) && line.contains(option)){ | 403 | if(line.contains(stanza) && line.contains(option)){ |
404 | if(found == true){ | 404 | if(found == true){ |
405 | qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1()); | 405 | qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1()); |
406 | } | 406 | } |
407 | qDebug("Found"); | ||
407 | found = true; | 408 | found = true; |
408 | iterator = it; | 409 | iterator = it; |
409 | } | 410 | } |
410 | } | 411 | } |
411 | return !found; | 412 | return found; |
412 | } | 413 | } |
413 | 414 | ||
414 | /** | 415 | /** |
415 | * Sets a value of an option in a stanza | 416 | * Sets a value of an option in a stanza |
416 | * @param start the start of the stanza | 417 | * @param start the start of the stanza |
417 | * @param option the option to use when setting value. | 418 | * @param option the option to use when setting value. |
@@ -425,26 +426,32 @@ bool Interfaces::setOption(QStringList::Iterator start, QString option, QString | |||
425 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { | 426 | for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { |
426 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ | 427 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ |
427 | if(!found && value != ""){ | 428 | if(!found && value != ""){ |
428 | // Got to the end of the stanza without finding it, so append it. | 429 | // Got to the end of the stanza without finding it, so append it. |
429 | interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); | 430 | interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); |
430 | } | 431 | } |
432 | found = true; | ||
431 | break; | 433 | break; |
432 | } | 434 | } |
433 | if((*it).contains(option)){ | 435 | if((*it).contains(option) && it != start){ |
434 | // Found it in stanza so replace it. | 436 | // Found it in stanza so replace it. |
435 | if(found) | 437 | if(found) |
436 | qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); | 438 | qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); |
437 | found = true; | 439 | found = true; |
438 | if(value == "") | 440 | if(value == "") |
439 | (*it) = ""; | 441 | (*it) = ""; |
440 | else | 442 | else |
441 | (*it) = QString("\t%1 %2").arg(option).arg(value); | 443 | (*it) = QString("\t%1 %2").arg(option).arg(value); |
442 | } | 444 | } |
443 | } | 445 | } |
444 | return true; | 446 | if(!found){ |
447 | QStringList::Iterator p = start; | ||
448 | interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); | ||
449 | found = true; | ||
450 | } | ||
451 | return found; | ||
445 | } | 452 | } |
446 | 453 | ||
447 | /** | 454 | /** |
448 | * Removes all options in a stanza | 455 | * Removes all options in a stanza |
449 | * @param start the start of the stanza | 456 | * @param start the start of the stanza |
450 | * @return bool true if successfull, false otherwise. | 457 | * @return bool true if successfull, false otherwise. |