KDECore
kprocess.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KPROCESS_H
00023 #define KPROCESS_H
00024
00025 #include <kdecore_export.h>
00026
00027 #include <QtCore/QProcess>
00028
00029 class KProcessPrivate;
00030
00044 class KDECORE_EXPORT KProcess : public QProcess
00045 {
00046 Q_OBJECT
00047 Q_DECLARE_PRIVATE(KProcess)
00048
00049 public:
00050
00054 enum OutputChannelMode {
00055 SeparateChannels = QProcess::SeparateChannels,
00058 MergedChannels = QProcess::MergedChannels,
00061 ForwardedChannels = QProcess::ForwardedChannels,
00064 OnlyStdoutChannel,
00066 OnlyStderrChannel
00067 };
00068
00072 explicit KProcess(QObject *parent = 0);
00073
00077 virtual ~KProcess();
00078
00090 void setOutputChannelMode(OutputChannelMode mode);
00091
00097 OutputChannelMode outputChannelMode() const;
00098
00108 void setNextOpenMode(QIODevice::OpenMode mode);
00109
00120 void setEnv(const QString &name, const QString &value, bool overwrite = true);
00121
00129 void unsetEnv(const QString &name);
00130
00139 void clearEnvironment();
00140
00150 void setProgram(const QString &exe, const QStringList &args = QStringList());
00151
00158 void setProgram(const QStringList &argv);
00159
00177 KProcess &operator<<(const QString& arg);
00178
00185 KProcess &operator<<(const QStringList& args);
00186
00190 void clearProgram();
00191
00212 void setShellCommand(const QString &cmd);
00213
00220 QStringList program() const;
00221
00227 void start();
00228
00246 int execute(int msecs = -1);
00247
00258 static int execute(const QString &exe, const QStringList &args = QStringList(), int msecs = -1);
00259
00269 static int execute(const QStringList &argv, int msecs = -1);
00270
00285 int startDetached();
00286
00295 static int startDetached(const QString &exe, const QStringList &args = QStringList());
00296
00304 static int startDetached(const QStringList &argv);
00305
00316 int pid() const;
00317
00318 protected:
00322 KProcess(KProcessPrivate *d, QObject *parent);
00323
00327 KProcessPrivate * const d_ptr;
00328
00329 private:
00330
00331 using QProcess::setReadChannelMode;
00332 using QProcess::readChannelMode;
00333 using QProcess::setProcessChannelMode;
00334 using QProcess::processChannelMode;
00335
00336 Q_PRIVATE_SLOT(d_func(), void _k_forwardStdout())
00337 Q_PRIVATE_SLOT(d_func(), void _k_forwardStderr())
00338 };
00339
00340 #endif
00341