summaryrefslogtreecommitdiff
authorkergoth <kergoth>2003-04-15 00:40:18 (UTC)
committer kergoth <kergoth>2003-04-15 00:40:18 (UTC)
commit414e71d6189ffdeb07dcca8225ecf69331d0023c (patch) (unidiff)
tree7f24b2508735537171aa308c20d499b696c0151a
parent54c3c91b776f277fdcf2e78621a28e98cc55ab5b (diff)
downloadopie-414e71d6189ffdeb07dcca8225ecf69331d0023c.zip
opie-414e71d6189ffdeb07dcca8225ecf69331d0023c.tar.gz
opie-414e71d6189ffdeb07dcca8225ecf69331d0023c.tar.bz2
1) When selecting dhcp, remove the static options, since we're no longer
removing all options. 2) Restart the network interface when saveChanges() is called. 3) Use OWait and a status message to give feedback to the user during the interface restart.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp57
1 files changed, 52 insertions, 5 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 @@
11 11
12#include <opie/oprocess.h>
13
14#ifdef QWS
15#include <opie/owait.h>
16#include <qpe/global.h>
17#include <qapplication.h>
18#endif
19
12#define DNSSCRIPT "changedns" 20#define DNSSCRIPT "changedns"
@@ -36,5 +44,37 @@ InterfaceSetupImp::~InterfaceSetupImp(){
36bool InterfaceSetupImp::saveChanges(){ 44bool InterfaceSetupImp::saveChanges(){
45 bool error;
46 QString iface = interfaces->getInterfaceName(error);
37 if(!saveSettings()) 47 if(!saveSettings())
38 return false; 48 return false;
49
50 qWarning("restarting interface %s\n", iface.latin1());
39 interfaces->write(); 51 interfaces->write();
52
53 QString ifup;
54 ifup += "ifdown ";
55 ifup += iface;
56 ifup += "; ifup ";
57 ifup += iface;
58 ifup += ";";
59
60 OProcess restart;
61 restart << "sh";
62 restart << "-c";
63 restart << ifup;
64
65 OWait *owait = new OWait();
66 Global::statusMessage( tr( "Restarting interface" ) );
67
68 owait->show();
69 qApp->processEvents();
70
71 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
72 qWarning("unstable to spawn ifdown/ifup");
73 }
74
75 owait->hide();
76 delete owait;
77
78 interface->refresh();
79
40 return true; 80 return true;
@@ -62,8 +102,11 @@ bool InterfaceSetupImp::saveSettings(){
62 } 102 }
63 //interfaces.removeAllInterfaceOptions();
64
65 // DHCP 103 // DHCP
66 if(dhcpCheckBox->isChecked()) 104 if(dhcpCheckBox->isChecked()) {
67 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); 105 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
68 else{ 106 interfaces->removeInterfaceOption("address");
107 interfaces->removeInterfaceOption("netmask");
108 interfaces->removeInterfaceOption("gateway");
109 interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
110 interfaces->removeInterfaceOption("down "DNSSCRIPT" -r ");
111 } else{
69 interfaces->setInterfaceMethod("static"); 112 interfaces->setInterfaceMethod("static");
@@ -98,3 +141,3 @@ void InterfaceSetupImp::setProfile(const QString &profile){
98 */ 141 */
99 142
100 QString newInterfaceName = interface->getInterfaceName(); 143 QString newInterfaceName = interface->getInterfaceName();
@@ -145,2 +188,6 @@ void InterfaceSetupImp::setProfile(const QString &profile){
145 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); 188 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
189
190 qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1());
191 qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1());
192
146} 193}