summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interfaces/interfacesetupimp.cpp12
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp12
2 files changed, 14 insertions, 10 deletions
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp
index d42b45d..6587d6f 100644
--- a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp
+++ b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp
@@ -53,36 +53,38 @@ bool InterfaceSetupImp::saveSettings(){
bool error = false;
// Loopback case
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
- if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){
- QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok");
+ if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
+ QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n and gateway entries.", "Ok");
return false;
}
interfaces->removeAllInterfaceOptions();
// DHCP
if(dhcpCheckBox->isChecked()){
interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value()));
interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60));
}
else{
interfaces->setInterfaceMethod("static");
interfaces->setInterfaceOption("address", ipAddressEdit->text());
interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
interfaces->setInterfaceOption("gateway", gatewayEdit->text());
- QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
- interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
- interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
+ 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);
+ }
}
// IP Information
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
/**
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index d42b45d..6587d6f 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -53,36 +53,38 @@ bool InterfaceSetupImp::saveSettings(){
bool error = false;
// Loopback case
if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
- if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){
- QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok");
+ if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
+ QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n and gateway entries.", "Ok");
return false;
}
interfaces->removeAllInterfaceOptions();
// DHCP
if(dhcpCheckBox->isChecked()){
interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value()));
interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60));
}
else{
interfaces->setInterfaceMethod("static");
interfaces->setInterfaceOption("address", ipAddressEdit->text());
interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
interfaces->setInterfaceOption("gateway", gatewayEdit->text());
- QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
- interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
- interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
+ 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);
+ }
}
// IP Information
interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
return true;
}
/**