summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index 8d78828..49a47ae 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -26,78 +26,78 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac
if (j == 0) {
delInterfaces = true;
interfaces = new Interfaces;
}
}
/**
* Destructor
*/
InterfaceSetupImp::~InterfaceSetupImp(){
if(delInterfaces) {
delete interfaces;
}
}
/**
* Save the current settings, then write out the interfaces file and close.
*/
bool InterfaceSetupImp::saveChanges(){
bool error;
QString iface = interfaces->getInterfaceName(error);
if(!saveSettings())
return false;
- qWarning("restarting interface %s\n", iface.latin1());
interfaces->write();
- QString ifup;
- ifup += "ifdown ";
- ifup += iface;
- ifup += "; ifup ";
- ifup += iface;
- ifup += ";";
-
- OProcess restart;
- restart << "sh";
- restart << "-c";
- restart << ifup;
-
- OWait *owait = new OWait();
- Global::statusMessage( tr( "Restarting interface" ) );
-
- owait->show();
- qApp->processEvents();
-
- if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
- qWarning("unstable to spawn ifdown/ifup");
+ if (interface->getStatus()) {
+ QString ifup;
+ ifup += "ifdown ";
+ ifup += iface;
+ ifup += "; ifup ";
+ ifup += iface;
+ ifup += ";";
+
+ OProcess restart;
+ restart << "sh";
+ restart << "-c";
+ restart << ifup;
+
+ OWait *owait = new OWait();
+ Global::statusMessage( tr( "Restarting interface" ) );
+
+ owait->show();
+ qApp->processEvents();
+
+ if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
+ qWarning("unstable to spawn ifdown/ifup");
+ }
+
+ owait->hide();
+ delete owait;
+
+ interface->refresh();
}
-
- owait->hide();
- delete owait;
-
- interface->refresh();
-
return true;
}
/**
* 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;
}
// DHCP