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
00042 class KDECORE_EXPORT KProcess : public QProcess
00043 {
00044 Q_OBJECT
00045 Q_DECLARE_PRIVATE(KProcess)
00046
00047 public:
00048
00052 enum OutputChannelMode {
00053 SeparateChannels = QProcess::SeparateChannels,
00056 MergedChannels = QProcess::MergedChannels,
00059 ForwardedChannels = QProcess::ForwardedChannels,
00062 OnlyStdoutChannel,
00064 OnlyStderrChannel
00065 };
00066
00070 explicit KProcess(QObject *parent = 0);
00071
00075 virtual ~KProcess();
00076
00088 void setOutputChannelMode(OutputChannelMode mode);
00089
00095 OutputChannelMode outputChannelMode() const;
00096
00106 void setNextOpenMode(QIODevice::OpenMode mode);
00107
00118 void setEnv(const QString &name, const QString &value, bool overwrite = true);
00119
00127 void unsetEnv(const QString &name);
00128
00137 void clearEnvironment();
00138
00148 void setProgram(const QString &exe, const QStringList &args = QStringList());
00149
00156 void setProgram(const QStringList &argv);
00157
00175 KProcess &operator<<(const QString& arg);
00176
00183 KProcess &operator<<(const QStringList& args);
00184
00188 void clearProgram();
00189
00206 void setShellCommand(const QString &cmd);
00207
00214 QStringList program() const;
00215
00221 void start();
00222
00240 int execute(int msecs = -1);
00241
00252 static int execute(const QString &exe, const QStringList &args = QStringList(), int msecs = -1);
00253
00263 static int execute(const QStringList &argv, int msecs = -1);
00264
00279 int startDetached();
00280
00289 static int startDetached(const QString &exe, const QStringList &args = QStringList());
00290
00298 static int startDetached(const QStringList &argv);
00299
00310 int pid() const;
00311
00312 protected:
00316 KProcess(KProcessPrivate *d, QObject *parent);
00317
00321 KProcessPrivate * const d_ptr;
00322
00323 private:
00324
00325 using QProcess::setReadChannelMode;
00326 using QProcess::readChannelMode;
00327 using QProcess::setProcessChannelMode;
00328 using QProcess::processChannelMode;
00329
00330 Q_PRIVATE_SLOT(d_func(), void _k_forwardStdout())
00331 Q_PRIVATE_SLOT(d_func(), void _k_forwardStderr())
00332 };
00333
00334 #endif
00335