KCoreAddons

kprocess.h
1 /*
2  This file is part of the KDE libraries
3 
4  SPDX-FileCopyrightText: 2007 Oswald Buddenhagen <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KPROCESS_H
10 #define KPROCESS_H
11 
12 #include <kcoreaddons_export.h>
13 
14 #include <QProcess>
15 
16 class KProcessPrivate;
17 
31 class KCOREADDONS_EXPORT KProcess : public QProcess
32 {
33  Q_OBJECT
34  Q_DECLARE_PRIVATE(KProcess)
35 
36 public:
37 
42  SeparateChannels = QProcess::SeparateChannels,
45  MergedChannels = QProcess::MergedChannels,
48  ForwardedChannels = QProcess::ForwardedChannels,
51  OnlyStdoutChannel = QProcess::ForwardedErrorChannel,
53  OnlyStderrChannel = QProcess::ForwardedOutputChannel
55  };
56 
60  explicit KProcess(QObject *parent = nullptr);
61 
65  ~KProcess() override;
66 
78  void setOutputChannelMode(OutputChannelMode mode);
79 
85  OutputChannelMode outputChannelMode() const;
86 
96  void setNextOpenMode(QIODevice::OpenMode mode);
97 
108  void setEnv(const QString &name, const QString &value, bool overwrite = true);
109 
117  void unsetEnv(const QString &name);
118 
127  void clearEnvironment();
128 
138  void setProgram(const QString &exe, const QStringList &args = QStringList());
139 
146  void setProgram(const QStringList &argv);
147 
165  KProcess &operator<<(const QString &arg);
166 
173  KProcess &operator<<(const QStringList &args);
174 
178  void clearProgram();
179 
200  void setShellCommand(const QString &cmd);
201 
208  QStringList program() const;
209 
215  void start();
216 
234  int execute(int msecs = -1);
235 
246  static int execute(const QString &exe, const QStringList &args = QStringList(), int msecs = -1);
247 
257  static int execute(const QStringList &argv, int msecs = -1);
258 
273  int startDetached();
274 
283  static int startDetached(const QString &exe, const QStringList &args = QStringList());
284 
292  static int startDetached(const QStringList &argv);
293 
304  int pid() const;
305 
306 protected:
310  KProcess(KProcessPrivate *d, QObject *parent);
311 
315  KProcessPrivate *const d_ptr;
316 
317 private:
318  // hide those
319 #if QT_DEPRECATED_SINCE(5, 13)
322 #endif
325 };
326 
327 #endif
328 
int execute(const QString &program, const QStringList &arguments)
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Child process invocation, monitoring and control.
Definition: kprocess.h:31
QString program() const const
bool startDetached(qint64 *pid)
typedef OpenMode
QProcess::ProcessChannelMode processChannelMode() const const
Q_PID pid() const const
void setReadChannelMode(QProcess::ProcessChannelMode mode)
KProcessPrivate *const d_ptr
Definition: kprocess.h:315
void setProgram(const QString &program)
void setProcessChannelMode(QProcess::ProcessChannelMode mode)
QProcess::ProcessChannelMode readChannelMode() const const
void start(const QString &program, const QStringList &arguments, QIODevice::OpenMode mode)
OutputChannelMode
Modes in which the output channels can be opened.
Definition: kprocess.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 1 2020 22:53:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.