KDevelop API Documentation

ExecCommand Class Reference

This class invokes a binary with the arguments passed in the constructor and emits the signal finished() with the output. More...

#include <execcommand.h>

Inheritance diagram for ExecCommand:

Inheritance graph
[legend]
Collaboration diagram for ExecCommand:

Collaboration graph
[legend]
List of all members.

Signals

void finished (const QString &output, const QString &errorOutput)

Public Member Functions

 ExecCommand (const QString &executable, const QStringList &args, const QString &workingDir=QString::null, const QStringList &env=QStringList(), QObject *parent=0, const char *name=0)
 ~ExecCommand ()

Private Slots

void receivedStdout (KProcess *, char *buffer, int buflen)
void receivedStderr (KProcess *, char *buffer, int buflen)
void processExited ()
void cancelClicked ()

Private Attributes

KProcessproc
KProgressDialogprogressDlg
QString out
QString err

Detailed Description

This class invokes a binary with the arguments passed in the constructor and emits the signal finished() with the output.

It also displays a progress dialog with the possibility to cancel the command. If there was an error or the user pressed cancel, finished will emit a QString::null, otherwise QStrings containing the stdout/stderr. The object will delete itself after the finished signal has been emitted. Additional environment can be set in the QStringList env via QStrings with the format "foo=blah"

Definition at line 39 of file execcommand.h.


Constructor & Destructor Documentation

ExecCommand::ExecCommand const QString executable,
const QStringList args,
const QString workingDir = QString::null,
const QStringList env = QStringList(),
QObject parent = 0,
const char *  name = 0
 

Definition at line 27 of file execcommand.cpp.

References cancelClicked(), KMessageBox::error(), finished(), proc, processExited(), progressDlg, receivedStderr(), receivedStdout(), KProcess::setEnvironment(), KProcess::setWorkingDirectory(), and KProcess::start().

ExecCommand::~ExecCommand  ) 
 

Definition at line 95 of file execcommand.cpp.


Member Function Documentation

void ExecCommand::cancelClicked  )  [private, slot]
 

Definition at line 85 of file execcommand.cpp.

References finished(), KProcess::kill(), proc, and progressDlg.

Referenced by ExecCommand().

void ExecCommand::finished const QString output,
const QString errorOutput
[signal]
 

Referenced by cancelClicked(), ExecCommand(), and processExited().

void ExecCommand::processExited  )  [private, slot]
 

Definition at line 76 of file execcommand.cpp.

References err, finished(), out, and progressDlg.

Referenced by ExecCommand().

void ExecCommand::receivedStderr KProcess ,
char *  buffer,
int  buflen
[private, slot]
 

Definition at line 71 of file execcommand.cpp.

References err.

Referenced by ExecCommand().

void ExecCommand::receivedStdout KProcess ,
char *  buffer,
int  buflen
[private, slot]
 

Definition at line 66 of file execcommand.cpp.

References out.

Referenced by ExecCommand().


Member Data Documentation

QString ExecCommand::err [private]
 

Definition at line 61 of file execcommand.h.

Referenced by processExited(), and receivedStderr().

QString ExecCommand::out [private]
 

Definition at line 60 of file execcommand.h.

Referenced by processExited(), and receivedStdout().

KProcess* ExecCommand::proc [private]
 

Definition at line 58 of file execcommand.h.

Referenced by cancelClicked(), and ExecCommand().

KProgressDialog* ExecCommand::progressDlg [private]
 

Definition at line 59 of file execcommand.h.

Referenced by cancelClicked(), ExecCommand(), and processExited().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:24:23 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003