summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp55
1 files changed, 51 insertions, 4 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index fc65c5f..8d78828 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -11,2 +11,10 @@
+#include <opie/oprocess.h>
+
+#ifdef QWS
+#include <opie/owait.h>
+#include <qpe/global.h>
+#include <qapplication.h>
+#endif
+
#define DNSSCRIPT "changedns"
@@ -36,5 +44,37 @@ InterfaceSetupImp::~InterfaceSetupImp(){
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");
+ }
+
+ owait->hide();
+ delete owait;
+
+ interface->refresh();
+
return true;
@@ -62,8 +102,11 @@ bool InterfaceSetupImp::saveSettings(){
}
- //interfaces.removeAllInterfaceOptions();
-
// DHCP
- if(dhcpCheckBox->isChecked())
+ if(dhcpCheckBox->isChecked()) {
interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
- else{
+ interfaces->removeInterfaceOption("address");
+ interfaces->removeInterfaceOption("netmask");
+ interfaces->removeInterfaceOption("gateway");
+ interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
+ interfaces->removeInterfaceOption("down "DNSSCRIPT" -r ");
+ } else{
interfaces->setInterfaceMethod("static");
@@ -145,2 +188,6 @@ void InterfaceSetupImp::setProfile(const QString &profile){
gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
+
+ qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1());
+ qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1());
+
}