summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/interfaces') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp114
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp2
2 files changed, 59 insertions, 57 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index a62a90c..71d0cf5 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -13,6 +13,6 @@
* Constructor. Reads in the interfaces file and then split the file up by
- * the \n for interfaces variable.
+ * the \n for interfaces variable.
* @param useInterfacesFile if an interface file other then the default is
* desired to be used it should be passed in.
- */
+ */
Interfaces::Interfaces(QString useInterfacesFile){
@@ -21,3 +21,3 @@ Interfaces::Interfaces(QString useInterfacesFile){
acceptedFamily.append(INTERFACES_FAMILY_INET6);
-
+
interfacesFile = useInterfacesFile;
@@ -38,3 +38,3 @@ Interfaces::Interfaces(QString useInterfacesFile){
interfaces = QStringList::split("\n", line, true);
-
+
currentIface = interfaces.end();
@@ -46,6 +46,6 @@ Interfaces::Interfaces(QString useInterfacesFile){
* Get a list of all interfaces in the interface file. Usefull for
- * hardware that is not currently connected such as an 802.11b card
+ * 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(){
@@ -69,6 +69,6 @@ QStringList Interfaces::getInterfaceList(){
* Find out if interface is in an "auto" group or not.
- * Report any duplicates such as eth0 being in two differnt auto's
+ * Report any duplicates such as eth0 being in two differnt auto's
* @param interface interface to check to see if it is on or not.
* @return true is interface is in auto
- */
+ */
bool Interfaces::isAuto(const QString &interface) const {
@@ -86,3 +86,3 @@ bool Interfaces::isAuto(const QString &interface) const {
* @return false if already set to setAuto.
- * */
+ * */
bool Interfaces::setAuto(const QString &interface, bool setAuto){
@@ -91,3 +91,3 @@ bool Interfaces::setAuto(const QString &interface, bool setAuto){
return false;
-
+
bool changed = false;
@@ -127,4 +127,4 @@ bool Interfaces::setAuto(const QString &interface, bool setAuto){
* removed from the interface name.
- * @return bool true if it is successfull.
- */
+ * @return bool true if it is successfull.
+ */
bool Interfaces::setInterface(QString interface){
@@ -138,3 +138,3 @@ bool Interfaces::setInterface(QString interface){
* @return bool true if set, false otherwise.
- */
+ */
bool Interfaces::isInterfaceSet() const {
@@ -151,3 +151,3 @@ bool Interfaces::isInterfaceSet() const {
* @return true if successfull.
- */
+ */
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
@@ -166,3 +166,3 @@ bool Interfaces::addInterface(const QString &interface, const QString &family, c
* @return bool true if successfull
- */
+ */
bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
@@ -174,3 +174,3 @@ bool Interfaces::copyInterface(const QString &interface, const QString &newInter
it++;
-
+
// Add the new interface
@@ -180,6 +180,6 @@ bool Interfaces::copyInterface(const QString &interface, const QString &newInter
return false;
-
+
QStringList::Iterator newIface = currentIface;
newIface++;
-
+
// Copy all of the lines
@@ -190,3 +190,3 @@ bool Interfaces::copyInterface(const QString &interface, const QString &newInter
}
-
+
return true;
@@ -197,3 +197,3 @@ bool Interfaces::copyInterface(const QString &interface, const QString &newInter
* @return bool if successfull or not.
- */
+ */
bool Interfaces::removeInterface(){
@@ -206,3 +206,3 @@ bool Interfaces::removeInterface(){
* @param error set to true if any error occurs, false otherwise.
- */
+ */
QString Interfaces::getInterfaceName(bool &error){
@@ -228,3 +228,3 @@ QString Interfaces::getInterfaceName(bool &error){
* @param error set to true if any error occurs, false otherwise.
- */
+ */
QString Interfaces::getInterfaceFamily(bool &error){
@@ -251,3 +251,3 @@ QString Interfaces::getInterfaceFamily(bool &error){
* @param error set to true if any error occurs, false otherwise.
- */
+ */
QString Interfaces::getInterfaceMethod(bool &error){
@@ -269,6 +269,6 @@ QString Interfaces::getInterfaceMethod(bool &error){
/**
- * Sets the interface name to newName.
+ * Sets the interface name to newName.
* @param newName the new name of the interface. All whitespace is removed.
* @return bool true if successfull.
- */
+ */
bool Interfaces::setInterfaceName(const QString &newName){
@@ -280,3 +280,3 @@ bool Interfaces::setInterfaceName(const QString &newName){
(*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
- return !returnValue;
+ return !returnValue;
}
@@ -284,3 +284,3 @@ bool Interfaces::setInterfaceName(const QString &newName){
/**
- * Sets the interface family to newName.
+ * Sets the interface family to newName.
* @param newName the new name of the interface. Must be one of the families
@@ -288,3 +288,3 @@ bool Interfaces::setInterfaceName(const QString &newName){
* @return bool true if successfull.
- */
+ */
bool Interfaces::setInterfaceFamily(const QString &newName){
@@ -296,3 +296,3 @@ bool Interfaces::setInterfaceFamily(const QString &newName){
(*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(newName).arg(getInterfaceMethod(returnValue));
- return !returnValue;
+ return !returnValue;
}
@@ -303,3 +303,3 @@ bool Interfaces::setInterfaceFamily(const QString &newName){
* @return bool true if successfull.
- */
+ */
bool Interfaces::setInterfaceMethod(const QString &newName){
@@ -309,3 +309,3 @@ bool Interfaces::setInterfaceMethod(const QString &newName){
(*currentIface) = QString("iface %1 %2 %3").arg(getInterfaceName(returnValue)).arg(getInterfaceFamily(returnValue)).arg(newName);
- return !returnValue;
+ return !returnValue;
}
@@ -321,3 +321,3 @@ bool Interfaces::setInterfaceMethod(const QString &newName){
* @return QString the options value. QString::null if error == true
- */
+ */
QString Interfaces::getInterfaceOption(const QString &option, bool &error){
@@ -333,3 +333,3 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){
* @return QString the options value. QString::null if error == true
- */
+ */
bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
@@ -339,3 +339,3 @@ bool Interfaces::setInterfaceOption(const QString &option, const QString &value)
/**
- * Removes a value for an option in the currently selected interface.
+ * Removes a value for an option in the currently selected interface.
* @param option the options to set the value.
@@ -343,3 +343,3 @@ bool Interfaces::setInterfaceOption(const QString &option, const QString &value)
* @return QString the options value. QString::null if error == true
- */
+ */
bool Interfaces::removeInterfaceOption(const QString &option){
@@ -349,3 +349,3 @@ bool Interfaces::removeInterfaceOption(const QString &option){
/**
- * Removes a value for an option in the currently selected interface.
+ * Removes a value for an option in the currently selected interface.
* @param option the options to set the value.
@@ -354,3 +354,3 @@ bool Interfaces::removeInterfaceOption(const QString &option){
* @return QString the options value. QString::null if error == true
- */
+ */
bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){
@@ -361,4 +361,4 @@ bool Interfaces::removeInterfaceOption(const QString &option, const QString &val
* Removes all of the options from the currently selected interface.
- * @return bool error if if successfull
- */
+ * @return bool error if if successfull
+ */
bool Interfaces::removeAllInterfaceOptions(){
@@ -372,4 +372,4 @@ bool Interfaces::removeAllInterfaceOptions(){
* removed from the interface name.
- * @return bool true if it is successfull.
- */
+ * @return bool true if it is successfull.
+ */
bool Interfaces::setMapping(const QString &interface){
@@ -383,3 +383,3 @@ bool Interfaces::setMapping(const QString &interface){
* @param interface the name(s) of the interfaces to set to this mapping
- */
+ */
void Interfaces::addMapping(const QString &option){
@@ -395,3 +395,3 @@ bool Interfaces::removeMapping(){
return removeStanza(currentMapping);
-}
+}
@@ -402,3 +402,3 @@ bool Interfaces::removeMapping(){
* @return bool true if it is successfull.
- */
+ */
bool Interfaces::setMap(const QString &map, const QString &value){
@@ -412,3 +412,3 @@ bool Interfaces::setMap(const QString &map, const QString &value){
* @return bool true if it is successfull.
- */
+ */
bool Interfaces::removeMap(const QString &map, const QString &value){
@@ -422,3 +422,3 @@ bool Interfaces::removeMap(const QString &map, const QString &value){
* @return value that goes to the map
- */
+ */
QString Interfaces::getMap(const QString &map, bool &error){
@@ -431,3 +431,3 @@ QString Interfaces::getMap(const QString &map, bool &error){
* @return true if successfull.
- */
+ */
bool Interfaces::setScript(const QString &argument){
@@ -439,3 +439,3 @@ bool Interfaces::setScript(const QString &argument){
* @return QString the argument of the script for the current mapping.
- */
+ */
QString Interfaces::getScript(bool &error){
@@ -447,3 +447,3 @@ QString Interfaces::getScript(bool &error){
/**
- * Helper function used to parse through the QStringList and put pointers in
+ * Helper function used to parse through the QStringList and put pointers in
* the correct place.
@@ -453,3 +453,3 @@ QString Interfaces::getScript(bool &error){
* @return bool true if the stanza is found.
- */
+ */
bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){
@@ -494,3 +494,3 @@ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &op
return false;
-
+
bool found = false;
@@ -525,3 +525,3 @@ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &op
* @return bool true if successfull.
- */
+ */
bool Interfaces::removeStanza(QStringList::Iterator &stanza){
@@ -542,3 +542,3 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
return false;
-
+
bool found = false;
@@ -569,3 +569,3 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
return false;
-
+
bool found = false;
@@ -595,3 +595,3 @@ bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
return false;
-
+
QStringList::Iterator it = start;
@@ -622,3 +622,3 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
}
-
+
QString value;
@@ -649,3 +649,3 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString
* @return bool true if successfull, false if not.
- */
+ */
bool Interfaces::write(){
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index f19cbdd..b40d101 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -189,2 +189,4 @@ void InterfaceSetupImp::setProfile(const QString &profile){
subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error));
+ if (subnetMaskEdit->text().isEmpty())
+ subnetMaskEdit->setText( "255.255.255.0" );
gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));