summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfacesetupimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp4
1 files changed, 4 insertions, 0 deletions
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
@@ -35,24 +35,25 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac
35InterfaceSetupImp::~InterfaceSetupImp(){ 35InterfaceSetupImp::~InterfaceSetupImp(){
36 if(delInterfaces) { 36 if(delInterfaces) {
37 delete interfaces; 37 delete interfaces;
38 } 38 }
39} 39}
40 40
41/** 41/**
42 * Save the current settings, then write out the interfaces file and close. 42 * Save the current settings, then write out the interfaces file and close.
43 */ 43 */
44bool InterfaceSetupImp::saveChanges(){ 44bool InterfaceSetupImp::saveChanges(){
45 bool error; 45 bool error;
46 QString iface = interfaces->getInterfaceName(error); 46 QString iface = interfaces->getInterfaceName(error);
47 qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() );
47 if(!saveSettings()) 48 if(!saveSettings())
48 return false; 49 return false;
49 50
50 interfaces->write(); 51 interfaces->write();
51 52
52 if (interface->getStatus()) { 53 if (interface->getStatus()) {
53 QString ifup; 54 QString ifup;
54 ifup += "ifdown "; 55 ifup += "ifdown ";
55 ifup += iface; 56 ifup += iface;
56 ifup += "; ifup "; 57 ifup += "; ifup ";
57 ifup += iface; 58 ifup += iface;
58 ifup += ";"; 59 ifup += ";";
@@ -108,24 +109,27 @@ bool InterfaceSetupImp::saveSettings(){
108 interfaces->removeInterfaceOption("gateway"); 109 interfaces->removeInterfaceOption("gateway");
109 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a "); 110 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
110 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r "); 111 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r ");
111 } else{ 112 } else{
112 interfaces->setInterfaceMethod("static"); 113 interfaces->setInterfaceMethod("static");
113 interfaces->setInterfaceOption("address", ipAddressEdit->text()); 114 interfaces->setInterfaceOption("address", ipAddressEdit->text());
114 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); 115 interfaces->setInterfaceOption("netmask", subnetMaskEdit->text());
115 interfaces->setInterfaceOption("gateway", gatewayEdit->text()); 116 interfaces->setInterfaceOption("gateway", gatewayEdit->text());
116 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ 117 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
117 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); 118 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
118 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); 119 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
119 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); 120 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
121 }else{
122 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
123 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r");
120 } 124 }
121 } 125 }
122 126
123 // IP Information 127 // IP Information
124 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 128 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
125 return true; 129 return true;
126} 130}
127 131
128/** 132/**
129 * The Profile has changed. 133 * The Profile has changed.
130 * @param QString profile the new profile. 134 * @param QString profile the new profile.
131 */ 135 */