summaryrefslogtreecommitdiff
Unidiff
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(){
53 53
54 bool error = false; 54 bool error = false;
55 // Loopback case 55 // Loopback case
56 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 56 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
57 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 57 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
58 return true; 58 return true;
59 } 59 }
60 60
61 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ 61 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
62 QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); 62 QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n and gateway entries.", "Ok");
63 return false; 63 return false;
64 } 64 }
65 interfaces->removeAllInterfaceOptions(); 65 interfaces->removeAllInterfaceOptions();
66 66
67 // DHCP 67 // DHCP
68 if(dhcpCheckBox->isChecked()){ 68 if(dhcpCheckBox->isChecked()){
69 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); 69 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
70 interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); 70 interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value()));
71 interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); 71 interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60));
72 } 72 }
73 else{ 73 else{
74 interfaces->setInterfaceMethod("static"); 74 interfaces->setInterfaceMethod("static");
75 interfaces->setInterfaceOption("address", ipAddressEdit->text()); 75 interfaces->setInterfaceOption("address", ipAddressEdit->text());
76 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); 76 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
77 interfaces->setInterfaceOption("gateway", gatewayEdit->text()); 77 interfaces->setInterfaceOption("gateway", gatewayEdit->text());
78 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); 78 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
79 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); 79 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
80 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); 80 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
81 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
82 }
81 } 83 }
82 84
83 // IP Information 85 // IP Information
84 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 86 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
85 return true; 87 return true;
86} 88}
87 89
88/** 90/**
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(){
53 53
54 bool error = false; 54 bool error = false;
55 // Loopback case 55 // Loopback case
56 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 56 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
57 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 57 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
58 return true; 58 return true;
59 } 59 }
60 60
61 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ 61 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
62 QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); 62 QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n and gateway entries.", "Ok");
63 return false; 63 return false;
64 } 64 }
65 interfaces->removeAllInterfaceOptions(); 65 interfaces->removeAllInterfaceOptions();
66 66
67 // DHCP 67 // DHCP
68 if(dhcpCheckBox->isChecked()){ 68 if(dhcpCheckBox->isChecked()){
69 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); 69 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
70 interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); 70 interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value()));
71 interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); 71 interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60));
72 } 72 }
73 else{ 73 else{
74 interfaces->setInterfaceMethod("static"); 74 interfaces->setInterfaceMethod("static");
75 interfaces->setInterfaceOption("address", ipAddressEdit->text()); 75 interfaces->setInterfaceOption("address", ipAddressEdit->text());
76 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); 76 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
77 interfaces->setInterfaceOption("gateway", gatewayEdit->text()); 77 interfaces->setInterfaceOption("gateway", gatewayEdit->text());
78 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); 78 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
79 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); 79 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
80 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); 80 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
81 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
82 }
81 } 83 }
82 84
83 // IP Information 85 // IP Information
84 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 86 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
85 return true; 87 return true;
86} 88}
87 89
88/** 90/**