Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfacesetupimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 4818e37..56bbe93 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp @@ -29,53 +29,50 @@ bool InterfaceSetupImp::saveChanges(){ /** * Save the settings for the current Interface. * @return bool true if successfull, false otherwise */ bool InterfaceSetupImp::saveSettings(){ // eh can't really do anything about it other then return. :-D if(!interfaces.isInterfaceSet()) return true; 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())){ QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); return false; } interfaces.removeAllInterfaceOptions(); // DHCP - if(dhcpCheckBox->isChecked()){ + 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()); 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; } /** * The Profile has changed. * @param QString profile the new profile. */ void InterfaceSetupImp::setProfile(const QString &profile){ /* bool error = false; @@ -101,45 +98,39 @@ void InterfaceSetupImp::setProfile(const QString &profile){ qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); return; } } interfaces.setMap("map", newInterfaceName); interfaces.setScript("getprofile.sh"); } else{ interfaces.addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); if(!interfaces.setInterface(newInterfaceName)){ qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); return; } } } // We must have a valid interface to get this far so read some settings. // DHCP bool error = false; if(interfaces.getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) dhcpCheckBox->setChecked(true); else dhcpCheckBox->setChecked(false); - leaseTime->setValue(interfaces.getInterfaceOption("leasehours", error).toInt()); - if(error) - leaseTime->setValue(interfaces.getInterfaceOption("leasetime", error).toInt()/60/60); - if(error) - leaseTime->setValue(24); // IP Information autoStart->setChecked(interfaces.isAuto(interface->getInterfaceName())); QString dns = interfaces.getInterfaceOption("up "DNSSCRIPT" -a", error); if(dns.contains(" ")){ firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); } ipAddressEdit->setText(interfaces.getInterfaceOption("address", error)); subnetMaskEdit->setText(interfaces.getInterfaceOption("netmask", error)); gatewayEdit->setText(interfaces.getInterfaceOption("gateway", error)); - } // interfacesetup.cpp |