• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • io
kprocess.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3 
4  Copyright (C) 2007 Oswald Buddenhagen <ossi@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KPROCESS_H
23 #define KPROCESS_H
24 
25 #include <kdecore_export.h>
26 
27 #include <QtCore/QProcess>
28 
29 class KProcessPrivate;
30 
44 class KDECORE_EXPORT KProcess : public QProcess
45 {
46  Q_OBJECT
47  Q_DECLARE_PRIVATE(KProcess)
48 
49 public:
50 
54  enum OutputChannelMode {
55  SeparateChannels = QProcess::SeparateChannels,
58  MergedChannels = QProcess::MergedChannels,
61  ForwardedChannels = QProcess::ForwardedChannels,
64  OnlyStdoutChannel,
66  OnlyStderrChannel
67  };
68 
72  explicit KProcess(QObject *parent = 0);
73 
77  virtual ~KProcess();
78 
90  void setOutputChannelMode(OutputChannelMode mode);
91 
97  OutputChannelMode outputChannelMode() const;
98 
108  void setNextOpenMode(QIODevice::OpenMode mode);
109 
120  void setEnv(const QString &name, const QString &value, bool overwrite = true);
121 
129  void unsetEnv(const QString &name);
130 
139  void clearEnvironment();
140 
150  void setProgram(const QString &exe, const QStringList &args = QStringList());
151 
158  void setProgram(const QStringList &argv);
159 
177  KProcess &operator<<(const QString& arg);
178 
185  KProcess &operator<<(const QStringList& args);
186 
190  void clearProgram();
191 
212  void setShellCommand(const QString &cmd);
213 
220  QStringList program() const;
221 
227  void start();
228 
246  int execute(int msecs = -1);
247 
258  static int execute(const QString &exe, const QStringList &args = QStringList(), int msecs = -1);
259 
269  static int execute(const QStringList &argv, int msecs = -1);
270 
285  int startDetached();
286 
295  static int startDetached(const QString &exe, const QStringList &args = QStringList());
296 
304  static int startDetached(const QStringList &argv);
305 
316  int pid() const;
317 
318 protected:
322  KProcess(KProcessPrivate *d, QObject *parent);
323 
327  KProcessPrivate * const d_ptr;
328 
329 private:
330  // hide those
331  using QProcess::setReadChannelMode;
332  using QProcess::readChannelMode;
333  using QProcess::setProcessChannelMode;
334  using QProcess::processChannelMode;
335 
336  Q_PRIVATE_SLOT(d_func(), void _k_forwardStdout())
337  Q_PRIVATE_SLOT(d_func(), void _k_forwardStderr())
338 };
339 
340 #endif
341 
QIODevice::OpenMode
typedef OpenMode
QProcess::execute
int execute(const QString &program, const QStringList &arguments)
KProcess
Child process invocation, monitoring and control.
Definition: kprocess.h:44
kdecore_export.h
QProcess::startDetached
bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
KProcessPrivate
Definition: kprocess_p.h:27
QProcess::processChannelMode
ProcessChannelMode processChannelMode() const
QProcess
QObject
QString
QProcess::setReadChannelMode
void setReadChannelMode(ProcessChannelMode mode)
QStringList
KProcess::d_ptr
KProcessPrivate *const d_ptr
Definition: kprocess.h:327
QProcess::pid
Q_PID pid() const
QProcess::setProcessChannelMode
void setProcessChannelMode(ProcessChannelMode mode)
QProcess::readChannelMode
ProcessChannelMode readChannelMode() const
QProcess::start
void start(const QString &program, const QStringList &arguments, QFlags< QIODevice::OpenModeFlag > mode)
KAuth::operator<<
QDataStream & operator<<(QDataStream &d, const ActionReply &reply)
Definition: kauthactionreply.cpp:181
KProcess::OutputChannelMode
OutputChannelMode
Modes in which the output channels can be opened.
Definition: kprocess.h:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal