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
00208 void setShellCommand(const QString &cmd);
00209
00216 QStringList program() const;
00217
00223 void start();
00224
00242 int execute(int msecs = -1);
00243
00254 static int execute(const QString &exe, const QStringList &args = QStringList(), int msecs = -1);
00255
00265 static int execute(const QStringList &argv, int msecs = -1);
00266
00281 int startDetached();
00282
00291 static int startDetached(const QString &exe, const QStringList &args = QStringList());
00292
00300 static int startDetached(const QStringList &argv);
00301
00312 int pid() const;
00313
00314 protected:
00318 KProcess(KProcessPrivate *d, QObject *parent);
00319
00323 KProcessPrivate * const d_ptr;
00324
00325 private:
00326
00327 using QProcess::setReadChannelMode;
00328 using QProcess::readChannelMode;
00329 using QProcess::setProcessChannelMode;
00330 using QProcess::processChannelMode;
00331
00332 Q_PRIVATE_SLOT(d_func(), void _k_forwardStdout())
00333 Q_PRIVATE_SLOT(d_func(), void _k_forwardStderr())
00334 };
00335
00336 #endif
00337