Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/system.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings2/system.cpp | 53 |
1 files changed, 33 insertions, 20 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 @@ -45,5 +45,4 @@ static char Dig2Hex[] = { System::System( void ) : QObject(), ProbedInterfaces() { - probeInterfaces(); } @@ -53,5 +52,12 @@ System::~System( void ) { } -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"); @@ -70,23 +76,29 @@ int System::runAsRoot( QStringList & S ) { << 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() )); @@ -95,5 +107,6 @@ int System::runAsRoot( QStringList & S ) { OProcess::AllOutput ) ) { owarn << "Error starting " << S << oendl; - delete P; + if( ! Prc ) + delete P; // error starting app return 1; |