summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces
authorkergoth <kergoth>2003-08-09 17:14:54 (UTC)
committer kergoth <kergoth>2003-08-09 17:14:54 (UTC)
commita7e015198a8c5ad3b6e144a9032b059086253e00 (patch) (side-by-side diff)
treeb712b6f11310d88744fe393a92b3160b741a7efe /noncore/settings/networksettings/interfaces
parentbeba0e73306815337bf04dee39502233595e9739 (diff)
downloadopie-a7e015198a8c5ad3b6e144a9032b059086253e00.zip
opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.gz
opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.bz2
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/settings/networksettings/interfaces') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/interface.h2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceadvanced.ui2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformation.ui233
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp14
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.h2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp54
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp4
8 files changed, 191 insertions, 122 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index cc45525..69b55d1 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -132,13 +132,13 @@ bool Interface::refresh(){
leaseExpires = "";
emit(updateInterface(this));
return true;
}
QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
- int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
+ int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
if(ret != 0){
qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
return false;
}
QFile file(fileName);
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h
index 7e98deb..ec82851 100644
--- a/noncore/settings/networksettings/interfaces/interface.h
+++ b/noncore/settings/networksettings/interfaces/interface.h
@@ -44,13 +44,13 @@ public:
public slots:
virtual bool refresh();
virtual void start();
virtual void stop();
virtual void restart();
-private:
+protected:
// Interface information
QString hardwareName;
Module *moduleOwner;
bool status;
bool attached;
diff --git a/noncore/settings/networksettings/interfaces/interfaceadvanced.ui b/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
index 2e106cb..12dbb1d 100644
--- a/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
+++ b/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
@@ -15,13 +15,13 @@
<height>290</height>
</rect>
</property>
<property stdset="1">
<name>maximumSize</name>
<size>
- <width>240</width>
+ <width>32767</width>
<height>32767</height>
</size>
</property>
<property stdset="1">
<name>caption</name>
<string>Advanced Interface Information</string>
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformation.ui b/noncore/settings/networksettings/interfaces/interfaceinformation.ui
index 763ad90..207200e 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformation.ui
+++ b/noncore/settings/networksettings/interfaces/interfaceinformation.ui
@@ -9,250 +9,246 @@
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>219</width>
- <height>255</height>
+ <height>323</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Interface Information</string>
</property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <property>
+ <name>layoutMargin</name>
</property>
- <widget row="4" column="0" rowspan="1" colspan="2" >
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout1</cstring>
+ <property>
+ <name>layoutSpacing</name>
</property>
- <grid>
+ <vbox>
<property stdset="1">
<name>margin</name>
- <number>0</number>
+ <number>4</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>3</number>
</property>
- <widget row="1" column="0" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>refreshButton</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&amp;Refresh</string>
- </property>
- </widget>
- <widget row="0" column="1" >
- <class>QPushButton</class>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>stopButton</cstring>
+ <cstring>TextLabel22</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>S&amp;top</string>
+ <string>IP Address</string>
</property>
</widget>
- <widget row="1" column="1" >
- <class>QPushButton</class>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>restartButton</cstring>
+ <cstring>ipAddressLabel</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>R&amp;estart</string>
+ <name>frameShape</name>
+ <enum>Panel</enum>
</property>
- </widget>
- <widget row="0" column="0" >
- <class>QPushButton</class>
<property stdset="1">
- <name>name</name>
- <cstring>startButton</cstring>
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
- <string>&amp;Start</string>
+ <string>0.0.0.0</string>
</property>
</widget>
- </grid>
- </widget>
- <widget row="0" column="0" >
+ <widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>Line1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
- <widget row="0" column="0" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel22</cstring>
+ <cstring>TextLabel23</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>IP Address</string>
+ <string>Subnet Mask</string>
</property>
</widget>
- <widget row="1" column="0" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel23</cstring>
+ <cstring>subnetMaskLabel</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Subnet Mask</string>
+ <name>frameShape</name>
+ <enum>Panel</enum>
</property>
- </widget>
- <widget row="2" column="0" >
- <class>QLabel</class>
<property stdset="1">
- <name>name</name>
- <cstring>TextLabel21</cstring>
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
- <string>MAC Address</string>
+ <string>0.0.0.0</string>
</property>
</widget>
- <widget row="3" column="0" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel24</cstring>
+ <cstring>macAddressLabel</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
- <enum>MShape</enum>
+ <enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
- <enum>MShadow</enum>
+ <enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
- <string>Broadcast</string>
+ <string>00:00:00:00:00:00</string>
</property>
</widget>
- <widget row="1" column="1" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>subnetMaskLabel</cstring>
+ <cstring>TextLabel21</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>MAC Address</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>broadcastLabel</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
- <string>0.0.0.0</string>
+ <string></string>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>macAddressLabel</cstring>
+ <cstring>TextLabel24</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
- <enum>Panel</enum>
+ <enum>MShape</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
- <enum>Sunken</enum>
+ <enum>MShadow</enum>
</property>
<property stdset="1">
<name>text</name>
- <string>00:00:00:00:00:00</string>
+ <string>Broadcast</string>
</property>
</widget>
- <widget row="3" column="1" >
- <class>QLabel</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>broadcastLabel</cstring>
+ <cstring>Layout1</cstring>
</property>
+ <grid>
<property stdset="1">
- <name>frameShape</name>
- <enum>Panel</enum>
+ <name>margin</name>
+ <number>0</number>
</property>
<property stdset="1">
- <name>frameShadow</name>
- <enum>Sunken</enum>
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>refreshButton</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string></string>
+ <string>&amp;Refresh</string>
</property>
</widget>
<widget row="0" column="1" >
- <class>QLabel</class>
+ <class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>ipAddressLabel</cstring>
+ <cstring>stopButton</cstring>
</property>
<property stdset="1">
- <name>frameShape</name>
- <enum>Panel</enum>
+ <name>text</name>
+ <string>S&amp;top</string>
</property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QPushButton</class>
<property stdset="1">
- <name>frameShadow</name>
- <enum>Sunken</enum>
+ <name>name</name>
+ <cstring>restartButton</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>0.0.0.0</string>
+ <string>R&amp;estart</string>
</property>
</widget>
- <spacer row="7" column="1" >
- <property>
+ <widget row="0" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer18</cstring>
+ <cstring>startButton</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Vertical</enum>
+ <name>text</name>
+ <string>&amp;Start</string>
</property>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>Line</class>
<property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
+ <name>name</name>
+ <cstring>Line5</cstring>
</property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
- </spacer>
- <widget row="6" column="0" rowspan="1" colspan="2" >
+ </widget>
+ <widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</cstring>
</property>
<hbox>
@@ -295,24 +291,45 @@
<name>text</name>
<string>&amp;View Advanced Information</string>
</property>
</widget>
</hbox>
</widget>
- <widget row="5" column="0" rowspan="1" colspan="2" >
- <class>Line</class>
- <property stdset="1">
+ <spacer>
+ <property>
<name>name</name>
- <cstring>Line5</cstring>
+ <cstring>Spacer18</cstring>
</property>
<property stdset="1">
<name>orientation</name>
- <enum>Horizontal</enum>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CheckBoxSilent</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>be &amp;silent</string>
</property>
</widget>
- </grid>
+ </vbox>
</widget>
<tabstops>
<tabstop>startButton</tabstop>
<tabstop>stopButton</tabstop>
<tabstop>refreshButton</tabstop>
<tabstop>restartButton</tabstop>
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index e00dcce..37c3a91 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,14 +1,17 @@
#include "interfaceinformationimp.h"
#include "interfaceadvanced.h"
+#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <qmessagebox.h>
+#include <qpe/config.h>
+
#ifdef QWS
#else
#define showMaximized show
#endif
/**
@@ -21,12 +24,22 @@ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *na
updateInterface(interface);
connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
+ Config cfg("networksettings", Config::User);
+ cfg.setGroup("interface");
+ CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
+}
+
+InterfaceInformationImp::~InterfaceInformationImp()
+{
+ Config cfg("networksettings", Config::User);
+ cfg.setGroup("interface");
+ cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
}
/**
* Update the interface information and buttons.
* @param Intarface *i the interface to update (should be the one we already
* know about).
@@ -69,11 +82,12 @@ void InterfaceInformationImp::advanced(){
/**
* Messages from the interface if start/stop went as planned.
* Purly for user feedback.
* @param message the message to display.
*/
void InterfaceInformationImp::showMessage(const QString &message){
+ if (CheckBoxSilent->isChecked()) return;
QMessageBox::information(this, "Message", message, QMessageBox::Ok);
}
// infoimp.cpp
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
index 65cdfe0..9c93d1d 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
@@ -7,13 +7,13 @@
class InterfaceInformationImp : public InterfaceInformation {
Q_OBJECT
public:
InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0);
- ~InterfaceInformationImp(){};
+ ~InterfaceInformationImp();
private slots:
void advanced();
void updateInterface(Interface *i);
void showMessage(const QString &message);
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 71d0cf5..436e449 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -1,8 +1,9 @@
#include "interfaces.h"
+#include <qcheckbox.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qregexp.h>
// The three stanza's
#define AUTO "auto"
@@ -148,12 +149,13 @@ bool Interfaces::isInterfaceSet() const {
* @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.
*/
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();
newInterface = newInterface.replace(QRegExp(" "), "");
interfaces.append("");
interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
@@ -163,12 +165,13 @@ bool Interfaces::addInterface(const QString &interface, const QString &family, c
/**
* Copies interface with name interface to name newInterface
* @param newInterface name of the new interface.
* @return bool true if successfull
*/
bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
+ qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
if(!setInterface(interface))
return false;
// Store the old interface and bump past the stanza line.
QStringList::Iterator it = currentIface;
it++;
@@ -269,18 +272,22 @@ QString Interfaces::getInterfaceMethod(bool &error){
/**
* 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){
+ qDebug("setInterfaceName %s", newName.latin1());
if(currentIface == interfaces.end())
return false;
QString name = newName.simplifyWhiteSpace();
name = name.replace(QRegExp(" "), "");
bool returnValue = false;
- (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
+ QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
+ qDebug("setting %s",tmp.latin1());
+
+ (*currentIface) = tmp;
return !returnValue;
}
/**
* Sets the interface family to newName.
* @param newName the new name of the interface. Must be one of the families
@@ -324,18 +331,24 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){
return getOption(currentIface, option, error);
}
/**
* Set a value for an option in the currently selected interface. If option
* doesn't exist then it is added along with the value.
+ * If value isEmpty() then we will remove the option
+ *
* @param option the options to set the value.
* @param value the value that option should be set to.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
+ if( value.stripWhiteSpace().isEmpty() )
+ return removeInterfaceOption( option );
+
+ qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1());
return setOption(currentIface, option, value);
}
/**
* Removes a value for an option in the currently selected interface.
* @param option the options to set the value.
@@ -489,36 +502,55 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
* @param option the option to use when setting value.
* @return bool true if successfull, 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;
+ bool replaced = false;
+ QStringList::Iterator insertAt = NULL;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
- if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
- if(!found && value != ""){
- // Got to the end of the stanza without finding it, so append it.
- interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
- }
+ qDebug(" Interfaces::setOption got line >%s<",(*it).latin1());
+ // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line
+ // but since it works with an empty interfaces file I (tille) will not do anything more
+ if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){
+ if (found) break;
+// && it != start){
+// if(!found && value != ""){
+// // Got to the end of the stanza without finding it, so append it.
+// qDebug(" Got to the end of the stanza without finding it, so append it.");
+// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
+// }
+ qDebug("found 1");
+// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value));
found = true;
- break;
+ insertAt = it;
+
}
if((*it).contains(option) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
+ qDebug("found 2");
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
+ replaced = true;
(*it) = QString("\t%1 %2").arg(option).arg(value);
}
}
if(!found){
+ qDebug("! found insert anyway");
QStringList::Iterator p = start;
interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
found = true;
}
+
+ if(found && !replaced){
+ qDebug("found iface but not the option so insert it here...");
+ interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value));
+ }
return found;
}
/**
* Removes a stanza and all of its options
* @param stanza the stanza to remove
@@ -549,13 +581,14 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
}
if((*it).contains(option) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
- (*it) = "";
+ it = interfaces.remove( it ); // we really want to remove the line
+ --it; // we do ++it later in the head of the for loop
}
}
return found;
}
/**
@@ -576,13 +609,14 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
}
if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
- (*it) = "";
+ it = interfaces.remove( it ); // we really want to remove the line
+ --it; // we do ++it later in the head of the for loop
}
}
return found;
}
/**
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index b40d101..e844d8a 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -41,12 +41,13 @@ InterfaceSetupImp::~InterfaceSetupImp(){
/**
* Save the current settings, then write out the interfaces file and close.
*/
bool InterfaceSetupImp::saveChanges(){
bool error;
QString iface = interfaces->getInterfaceName(error);
+ qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() );
if(!saveSettings())
return false;
interfaces->write();
if (interface->getStatus()) {
@@ -114,12 +115,15 @@ bool InterfaceSetupImp::saveSettings(){
interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
interfaces->setInterfaceOption("gateway", gatewayEdit->text());
if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
+ }else{
+ interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
+ interfaces->removeInterfaceOption("down "DNSSCRIPT" -r");
}
}
// IP Information
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;