summaryrefslogtreecommitdiff
authorzecke <zecke>2004-12-20 22:29:08 (UTC)
committer zecke <zecke>2004-12-20 22:29:08 (UTC)
commitfd530016abd98bb6164c1ac962de0ca11d82e407 (patch) (side-by-side diff)
treeed352181c3c490ddf300665699a096a494028ef6
parent89b3fd61bdd13e62ff64bd7ab0b15c10a964b867 (diff)
downloadopie-fd530016abd98bb6164c1ac962de0ca11d82e407.zip
opie-fd530016abd98bb6164c1ac962de0ca11d82e407.tar.gz
opie-fd530016abd98bb6164c1ac962de0ca11d82e407.tar.bz2
Restore Changes:
Call ifup/ifdown INTERFACE instead of ifconfig as requested by Chris Larson
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp46
-rw-r--r--noncore/settings/networksettings/interfaces/interface.h1
2 files changed, 42 insertions, 5 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index 46f3e19..44c0264 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -7,5 +7,10 @@
#include <opie2/odebug.h>
+#include <opie2/oprocess.h>
+#include <opie2/owait.h>
+#include <qpe/global.h>
+
+#include <qapplication.h>
#include <qdatetime.h>
#include <qfile.h>
@@ -15,4 +20,6 @@
#define IFCONFIG "/sbin/ifconfig"
+#define IF_UP "/sbin/ifup"
+#define IF_DOWN "/sbin/ifdown"
#define DHCP_INFO_DIR "/etc/dhcpc"
@@ -67,4 +74,27 @@ void Interface::setModuleOwner(Module *owner){
+bool Interface::callProcess( const QStringList& names ) {
+ Opie::Ui::OWait *owait = new Opie::Ui::OWait();
+ Global::statusMessage( tr( "Restarting interface" ) );
+
+ owait->show();
+ qApp->processEvents();
+
+ Opie::Core::OProcess restart;
+ restart << names;
+ if ( !restart.start(Opie::Core::OProcess::Block,
+ Opie::Core::OProcess::NoCommunication ) ) {
+ owarn << "unable to spawn command" << names << oendl;
+ return false;
+ }
+ owait->hide();
+ delete owait;
+
+ if ( restart.normalExit() || restart.exitStatus() != 0 )
+ return false;
+
+ return true;
+}
+
/**
* Try to start the interface.
@@ -77,7 +107,9 @@ void Interface::start(){
}
- int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
- // See if it was successful...
- if(ret != 0){
+ /* prepare command and call it */
+ QStringList lst;
+ lst << IF_UP;
+ lst << name();
+ if ( !callProcess(lst) ) {
emit (updateMessage("Starting interface failed"));
return;
@@ -99,6 +131,10 @@ void Interface::stop(){
}
- int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
- if(ret != 0){
+ QStringList lst;
+ lst << IF_DOWN;
+ lst << name();
+
+ /* prepare command and call it */
+ if( !callProcess( lst ) ){
emit (updateMessage("Stopping interface failed"));
return;
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h
index 83ab088..e9ab0c2 100644
--- a/noncore/settings/networksettings/interfaces/interface.h
+++ b/noncore/settings/networksettings/interfaces/interface.h
@@ -56,4 +56,5 @@ public:
protected:
+ bool callProcess( const QStringList& name );
// Interface information
QString hardwareName;