summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces/interfaces.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfaces.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 436e449..6b161ae 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -41,13 +41,13 @@ Interfaces::Interfaces(QString useInterfacesFile){
currentIface = interfaces.end();
currentMapping = interfaces.end();
}
/**
- * Get a list of all interfaces in the interface file. Usefull for
+ * Get a list of all interfaces in the interface file. Useful for
* hardware that is not currently connected such as an 802.11b card
* not plugged in, but configured for when it is plugged in.
* @return Return string list of interfaces.
**/
QStringList Interfaces::getInterfaceList(){
QStringList list;
@@ -123,13 +123,13 @@ bool Interfaces::setAuto(const QString &interface, bool setAuto){
/**
* Set the current interface to interface. This needs to be done before you
* can call getFamily(), getMethod, and get/setOption().
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::setInterface(QString interface){
interface = interface.simplifyWhiteSpace();
interface = interface.replace(QRegExp(" "), "");
return setStanza(IFACE, interface, currentIface);
}
@@ -146,13 +146,13 @@ bool Interfaces::isInterfaceSet() const {
* Add a new interface of with the settings - family and method
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
* @param family the family of this interface inet or inet, ipx or inet6
* Must of one of the families defined in interfaces.h
* @param method for the family. see interfaces man page for family methods.
- * @return true if successfull.
+ * @return true if successful.
*/
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
qDebug("Interfaces::addInterface(%s)",interface.latin1());
if(0 == acceptedFamily.contains(family))
return false;
QString newInterface = interface.simplifyWhiteSpace();
@@ -162,13 +162,13 @@ bool Interfaces::addInterface(const QString &interface, const QString &family, c
return true;
}
/**
* Copies interface with name interface to name newInterface
* @param newInterface name of the new interface.
- * @return bool true if successfull
+ * @return bool true if successful
*/
bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
if(!setInterface(interface))
return false;
@@ -194,13 +194,13 @@ bool Interfaces::copyInterface(const QString &interface, const QString &newInter
return true;
}
/**
* Remove the currently selected interface and all of its options.
- * @return bool if successfull or not.
+ * @return bool if successful or not.
*/
bool Interfaces::removeInterface(){
return removeStanza(currentIface);
}
/**
@@ -269,13 +269,13 @@ QString Interfaces::getInterfaceMethod(bool &error){
return line;
}
/**
* Sets the interface name to newName.
* @param newName the new name of the interface. All whitespace is removed.
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceName(const QString &newName){
qDebug("setInterfaceName %s", newName.latin1());
if(currentIface == interfaces.end())
return false;
QString name = newName.simplifyWhiteSpace();
@@ -289,13 +289,13 @@ bool Interfaces::setInterfaceName(const QString &newName){
}
/**
* Sets the interface family to newName.
* @param newName the new name of the interface. Must be one of the families
* defined in the interfaces.h file.
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceFamily(const QString &newName){
if(currentIface == interfaces.end())
return false;
if(acceptedFamily.contains(newName)==0)
return false;
@@ -304,13 +304,13 @@ bool Interfaces::setInterfaceFamily(const QString &newName){
return !returnValue;
}
/**
* Sets the interface method to newName
* @param newName the new name of the interface
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::setInterfaceMethod(const QString &newName){
if(currentIface == interfaces.end())
return false;
bool returnValue = false;
(*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName);
@@ -369,24 +369,24 @@ bool Interfaces::removeInterfaceOption(const QString &option){
bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){
return removeOption(currentIface, option, value);
}
/**
* Removes all of the options from the currently selected interface.
- * @return bool error if if successfull
+ * @return bool error if if successful
*/
bool Interfaces::removeAllInterfaceOptions(){
return removeAllOptions(currentIface);
}
/**
* Set the current map to interface's map. This needs to be done before you
* can call addMapping(), set/getMap(), and get/setScript().
* @param interface the name of the interface to set. All whitespace is
* removed from the interface name.
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::setMapping(const QString &interface){
QString interfaceName = interface.simplifyWhiteSpace();
interfaceName = interfaceName.replace(QRegExp(" "), "");
return setStanza(MAPPING, interfaceName, currentMapping);
}
@@ -399,52 +399,52 @@ void Interfaces::addMapping(const QString &option){
interfaces.append("");
interfaces.append(QString(MAPPING " %1").arg(option));
}
/**
* Remove the currently selected map and all of its options.
- * @return bool if successfull or not.
+ * @return bool if successful or not.
*/
bool Interfaces::removeMapping(){
return removeStanza(currentMapping);
}
/**
* Set a map option within a mapping.
* @param map map to use
* @param value value to go with map
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::setMap(const QString &map, const QString &value){
return setOption(currentMapping, map, value);
}
/**
* Removes a map option within a mapping.
* @param map map to use
* @param value value to go with map
- * @return bool true if it is successfull.
+ * @return bool true if it is successful.
*/
bool Interfaces::removeMap(const QString &map, const QString &value){
return removeOption(currentMapping, map, value);
}
/**
* Get a map value within a mapping.
* @param map map to get value of
- * @param bool true if it is successfull.
+ * @param bool true if it is successful.
* @return value that goes to the map
*/
QString Interfaces::getMap(const QString &map, bool &error){
return getOption(currentMapping, map, error);
}
/**
* Sets a script value of the current mapping to argument.
* @param argument the script name.
- * @return true if successfull.
+ * @return true if successful.
*/
bool Interfaces::setScript(const QString &argument){
return setOption(currentMapping, "script", argument);
}
/**
@@ -459,13 +459,13 @@ QString Interfaces::getScript(bool &error){
/**
* Helper function used to parse through the QStringList and put pointers in
* the correct place.
* @param stanza The stanza (auto, iface, mapping) to look for.
* @param option string that must be in the stanza's main line.
- * @param interator interator to place at location of stanza if successfull.
+ * @param interator interator to place at location of stanza if successful.
* @return bool true if the stanza is found.
*/
bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){
bool found = false;
iterator = interfaces.end();
for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) {
@@ -497,13 +497,13 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
}
/**
* 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.
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
qDebug("setting option");
bool found = false;
@@ -551,26 +551,26 @@ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &op
return found;
}
/**
* Removes a stanza and all of its options
* @param stanza the stanza to remove
- * @return bool true if successfull.
+ * @return bool true if successful.
*/
bool Interfaces::removeStanza(QStringList::Iterator &stanza){
if(stanza == interfaces.end())
return false;
(*stanza) = "";
return removeAllOptions(stanza);
}
/**
* Removes a option in a stanza
* @param start the start of the stanza
* @param option the option to remove
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option){
if(start == interfaces.end())
return false;
bool found = false;
@@ -592,13 +592,13 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
}
/**
* Removes a option in a stanza
* @param start the start of the stanza
* @param option the option to use when setting value.
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
bool found = false;
@@ -619,13 +619,13 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
return found;
}
/**
* Removes all options in a stanza
* @param start the start of the stanza
- * @return bool true if successfull, false otherwise.
+ * @return bool true if successful, false otherwise.
*/
bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
if(start == interfaces.end())
return false;
QStringList::Iterator it = start;
@@ -677,13 +677,13 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
return value;
}
/**
* Write out the interfaces file to the file passed into the constructor.
* Removes any excess blank lines over 1 line long.
- * @return bool true if successfull, false if not.
+ * @return bool true if successful, false if not.
*/
bool Interfaces::write(){
QFile::remove(interfacesFile);
QFile file(interfacesFile);
if (!file.open(IO_ReadWrite)){