summaryrefslogtreecommitdiff
path: root/noncore/net/networksetup/interfaces.cpp
Unidiff
Diffstat (limited to 'noncore/net/networksetup/interfaces.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interfaces.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/net/networksetup/interfaces.cpp b/noncore/net/networksetup/interfaces.cpp
index 9155890..377a6db 100644
--- a/noncore/net/networksetup/interfaces.cpp
+++ b/noncore/net/networksetup/interfaces.cpp
@@ -48,13 +48,13 @@ Interfaces::Interfaces(QString useInterfacesFile){
48 * @return Return string list of interfaces. 48 * @return Return string list of interfaces.
49 **/ 49 **/
50QStringList Interfaces::getInterfaceList(){ 50QStringList Interfaces::getInterfaceList(){
51 QStringList list; 51 QStringList list;
52 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 52 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
53 QString line = (*it).simplifyWhiteSpace(); 53 QString line = (*it).simplifyWhiteSpace();
54 if(line.contains(IFACE)){ 54 if(line.contains(IFACE) && line.at(0) != '#'){
55 line = line.mid(QString(IFACE).length() +1, line.length()); 55 line = line.mid(QString(IFACE).length() +1, line.length());
56 line = line.simplifyWhiteSpace(); 56 line = line.simplifyWhiteSpace();
57 int findSpace = line.find(" "); 57 int findSpace = line.find(" ");
58 if( findSpace >= 0){ 58 if( findSpace >= 0){
59 line = line.mid(0, findSpace); 59 line = line.mid(0, findSpace);
60 list.append(line); 60 list.append(line);
@@ -454,13 +454,13 @@ QString Interfaces::getScript(bool &error){
454 */ 454 */
455bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator &iterator){ 455bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator &iterator){
456 bool found = false; 456 bool found = false;
457 iterator = interfaces.end(); 457 iterator = interfaces.end();
458 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { 458 for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
459 QString line = (*it).simplifyWhiteSpace(); 459 QString line = (*it).simplifyWhiteSpace();
460 if(line.contains(stanza) && line.contains(option)){ 460 if(line.contains(stanza) && line.contains(option) && line.at(0) != '#'){
461 uint point = line.find(option); 461 uint point = line.find(option);
462 bool valid = true; 462 bool valid = true;
463 if(point > 0){ 463 if(point > 0){
464 // There are more chars in the line. check +1 464 // There are more chars in the line. check +1
465 if(line.at(point-1) != ' ') 465 if(line.at(point-1) != ' ')
466 valid = false; 466 valid = false;
@@ -500,13 +500,13 @@ bool Interfaces::setOption(QStringList::Iterator start, QString option, QString
500 // Got to the end of the stanza without finding it, so append it. 500 // Got to the end of the stanza without finding it, so append it.
501 interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); 501 interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
502 } 502 }
503 found = true; 503 found = true;
504 break; 504 break;
505 } 505 }
506 if((*it).contains(option) && it != start){ 506 if((*it).contains(option) && it != start && (*it).at(0) != '#'){
507 // Found it in stanza so replace it. 507 // Found it in stanza so replace it.
508 if(found) 508 if(found)
509 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 509 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
510 found = true; 510 found = true;
511 (*it) = QString("\t%1 %2").arg(option).arg(value); 511 (*it) = QString("\t%1 %2").arg(option).arg(value);
512 } 512 }
@@ -531,13 +531,13 @@ bool Interfaces::removeOption(QStringList::Iterator start, QString option, QStri
531 bool found = false; 531 bool found = false;
532 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 532 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
533 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 533 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
534 // got to the end without finding it 534 // got to the end without finding it
535 break; 535 break;
536 } 536 }
537 if((*it).contains(option) && (*it).contains(value) &&it != start){ 537 if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
538 // Found it in stanza so replace it. 538 // Found it in stanza so replace it.
539 if(found) 539 if(found)
540 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); 540 qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
541 found = true; 541 found = true;
542 (*it) = ""; 542 (*it) = "";
543 } 543 }
@@ -584,13 +584,13 @@ QString Interfaces::getOption(QStringList::Iterator start, QString option, bool
584 QString value; 584 QString value;
585 bool found = false; 585 bool found = false;
586 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { 586 for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
587 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ 587 if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
588 break; 588 break;
589 } 589 }
590 if((*it).contains(option)){ 590 if((*it).contains(option) && (*it).at(0) != '#'){
591 if(found) 591 if(found)
592 qDebug(QString("Interfaces: Get Options found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1()); 592 qDebug(QString("Interfaces: Get Options found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1());
593 found = true; 593 found = true;
594 QString line = (*it).simplifyWhiteSpace(); 594 QString line = (*it).simplifyWhiteSpace();
595 int space = line.find(" ", option.length()); 595 int space = line.find(" ", option.length());
596 if(space != -1) 596 if(space != -1)