Diffstat (limited to 'noncore/settings/networksettings/interfaces.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/interfaces.cpp b/noncore/settings/networksettings/interfaces.cpp index eef42df..0927258 100644 --- a/noncore/settings/networksettings/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces.cpp | |||
@@ -169,2 +169,28 @@ bool Interfaces::addInterface(QString interface, QString family, QString method) | |||
169 | /** | 169 | /** |
170 | * Copies interface with name interface to name newInterface | ||
171 | * @param newInterface name of the new interface. | ||
172 | * @return bool true if successfull | ||
173 | */ | ||
174 | bool Interfaces::copyInterface(QString interface, QString newInterface){ | ||
175 | if(!setInterface(interface)) return false; | ||
176 | |||
177 | QStringList::Iterator it = currentIface; | ||
178 | it++; | ||
179 | |||
180 | bool error; | ||
181 | addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); | ||
182 | if(!setInterface(newInterface)) return false; | ||
183 | QStringList::Iterator newIface = currentIface; | ||
184 | newIface++; | ||
185 | |||
186 | for ( it; it != interfaces.end(); ++it ){ | ||
187 | if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO))) | ||
188 | break; | ||
189 | newIface = interfaces.insert(newIface, *it); | ||
190 | } | ||
191 | |||
192 | return true; | ||
193 | } | ||
194 | |||
195 | /** | ||
170 | * Remove the currently selected interface and all of its options. | 196 | * Remove the currently selected interface and all of its options. |
@@ -403,2 +429,16 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator | |||
403 | if(line.contains(stanza) && line.contains(option)){ | 429 | if(line.contains(stanza) && line.contains(option)){ |
430 | uint point = line.find(option); | ||
431 | bool valid = true; | ||
432 | if(point > 0){ | ||
433 | // There are more chars in the line. check +1 | ||
434 | if(line.at(point-1) != ' ') | ||
435 | valid = false; | ||
436 | } | ||
437 | point += option.length(); | ||
438 | if(point < line.length()-1){ | ||
439 | // There are more chars in the line. check -1 | ||
440 | if(line.at(point) != ' ') | ||
441 | valid = false; | ||
442 | } | ||
443 | if(valid){ | ||
404 | if(found == true){ | 444 | if(found == true){ |
@@ -406,3 +446,2 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator | |||
406 | } | 446 | } |
407 | qDebug("Found"); | ||
408 | found = true; | 447 | found = true; |
@@ -411,2 +450,3 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator | |||
411 | } | 450 | } |
451 | } | ||
412 | return found; | 452 | return found; |