summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2
authorwimpie <wimpie>2005-01-06 15:15:01 (UTC)
committer wimpie <wimpie>2005-01-06 15:15:01 (UTC)
commit0baf6b4c6862738d712f479cb7e99a5f2534d74d (patch) (side-by-side diff)
treefb02c5279fb7e3949c08e51202ada1caf5e408fa /noncore/settings/networksettings2/networksettings2
parentba9ce5a0fcd66031ade038f7e6a7ac26908225a5 (diff)
downloadopie-0baf6b4c6862738d712f479cb7e99a5f2534d74d.zip
opie-0baf6b4c6862738d712f479cb7e99a5f2534d74d.tar.gz
opie-0baf6b4c6862738d712f479cb7e99a5f2534d74d.tar.bz2
added support for HCI Sniffing (still not tested)
changed GPRS plugin name (no support for capital letters)
Diffstat (limited to 'noncore/settings/networksettings2/networksettings2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp53
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.h7
2 files changed, 36 insertions, 24 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
index 141484c..9512579 100644
--- a/noncore/settings/networksettings2/networksettings2/system.cpp
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -44,7 +44,6 @@ static char Dig2Hex[] = {
#define LN(x) Dig2Hex[((x)&0x0f)]
System::System( void ) : QObject(), ProbedInterfaces() {
- probeInterfaces();
}
System::~System( void ) {
@@ -52,7 +51,14 @@ System::~System( void ) {
delete ProcDevNet;
}
-int System::runAsRoot( QStringList & S ) {
+QDict<InterfaceInfo> & System::interfaces( void ) {
+ if( ProbedInterfaces.count() == 0 ) {
+ probeInterfaces();
+ }
+ return ProbedInterfaces;
+}
+
+int System::runAsRoot( QStringList & S, MyProcess * Prc ) {
char * usr = getenv("USER");
if( S.count() == 0 ) {
@@ -69,32 +75,39 @@ int System::runAsRoot( QStringList & S ) {
<< S.join( " ")
<< oendl;
} else {
- MyProcess * P = new MyProcess();
- emit processEvent( tr("Command : ") + S.join( " " ) );
+ MyProcess * P;
- P->process() << S;
-
- connect( P,
- SIGNAL( stdoutLine( const QString & ) ),
- this,
- SIGNAL( stdoutLine( const QString & ) ) );
-
- connect( P,
- SIGNAL( stderrLine( const QString & ) ),
- this,
- SIGNAL( stderrLine( const QString & ) ) );
+ if( Prc ) {
+ P = Prc;
+ } else {
+ P = new MyProcess();
+ emit processEvent( tr("Command : ") + S.join( " " ) );
+
+ connect( P,
+ SIGNAL( stdoutLine( const QString & ) ),
+ this,
+ SIGNAL( stdoutLine( const QString & ) ) );
+
+ connect( P,
+ SIGNAL( stderrLine( const QString & ) ),
+ this,
+ SIGNAL( stderrLine( const QString & ) ) );
+
+ connect( P,
+ SIGNAL(processExited(MyProcess*) ),
+ this, SLOT
+ (SLOT_ProcessExited(MyProcess*) ) );
+ }
- connect( P,
- SIGNAL(processExited(MyProcess*) ),
- this, SLOT
- (SLOT_ProcessExited(MyProcess*) ) );
+ P->process() << S;
Log(("Executing %s\n", S.join( " " ).latin1() ));
if( ! P->process().start( OProcess::DontCare,
OProcess::AllOutput ) ) {
owarn << "Error starting " << S << oendl;
- delete P;
+ if( ! Prc )
+ delete P;
// error starting app
return 1;
}
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h
index e67d695..f7a7274 100644
--- a/noncore/settings/networksettings2/networksettings2/system.h
+++ b/noncore/settings/networksettings2/networksettings2/system.h
@@ -96,13 +96,12 @@ public :
System( void );
~System( void );
- QDict<InterfaceInfo> & interfaces( void )
- { return ProbedInterfaces; }
+ QDict<InterfaceInfo> & interfaces( void );
InterfaceInfo * interface( const QString& N )
- { return ProbedInterfaces[N]; }
+ { return interfaces()[N]; }
// exec command as root
- int runAsRoot( QStringList & S );
+ int runAsRoot( QStringList & S, MyProcess * Prc = 0 );
// exec command as user
int execAsUser( QStringList & Cmd );