generic: replace KProcess with QProcess where feasable

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-04-30 16:22:26 +00:00
parent 0b8812445a
commit f1cfe7bdba
54 changed files with 181 additions and 250 deletions

View file

@ -78,8 +78,12 @@ bool BacktraceGenerator::start()
return false;
}
m_proc = new KProcess;
m_proc->setEnv("LC_ALL", "C"); // force C locale
m_proc = new QProcess(this);
// force C locale
QProcessEnvironment procenv = QProcessEnvironment::systemEnvironment();
procenv.insert("LC_ALL", "C");
m_proc->setProcessEnvironment(procenv);
m_temp = new KTemporaryFile;
m_temp->open();
@ -91,15 +95,15 @@ bool BacktraceGenerator::start()
QString str = m_debugger.command();
Debugger::expandString(str, Debugger::ExpansionUsageShell, m_temp->fileName());
*m_proc << KShell::splitArgs(str);
m_proc->setOutputChannelMode(KProcess::OnlyStdoutChannel);
m_proc->setNextOpenMode(QIODevice::ReadWrite | QIODevice::Text);
m_proc->setReadChannel(QProcess::StandardOutput);
connect(m_proc, SIGNAL(readyReadStandardOutput()),
SLOT(slotReadInput()));
connect(m_proc, SIGNAL(finished(int,QProcess::ExitStatus)),
SLOT(slotProcessExited(int,QProcess::ExitStatus)));
m_proc->start();
QStringList procargs = KShell::splitArgs(str);
QString procprog = procargs.takeAt(0);
m_proc->start(procprog, procargs, QIODevice::ReadWrite | QIODevice::Text);
if (!m_proc->waitForStarted()) {
//we mustn't keep these around...
m_proc->deleteLater();

View file

@ -28,7 +28,7 @@
#ifndef BACKTRACEGENERATOR_H
#define BACKTRACEGENERATOR_H
#include <KProcess>
#include <QProcess>
#include "debugger.h"
@ -77,7 +77,7 @@ private Q_SLOTS:
private:
const Debugger m_debugger;
KProcess * m_proc;
QProcess * m_proc;
KTemporaryFile * m_temp;
QByteArray m_output;
State m_state;

View file

@ -155,7 +155,7 @@ void CrashedApplication::restart()
int ret = -1;
//start the application via kdeinit, as it needs to have a pristine environment and
//KProcess::startDetached() can't start a new process with custom environment variables.
//QProcess::startDetached() can't start a new process with custom environment variables.
if (!m_fakeBaseName.isEmpty()) {
// if m_fakeBaseName is set, this means m_executable is the path to kdeinit4
// so we need to use the fakeBaseName to restart the app

View file

@ -16,10 +16,10 @@
*/
#include "debuggerlaunchers.h"
#include <QtCore/QProcess>
#include <QtDBus/QDBusConnection>
#include <KShell>
#include <KProcess>
#include <KDebug>
#include "detachedprocessmonitor.h"
@ -49,9 +49,12 @@ void DefaultDebuggerLauncher::start()
Debugger::expandString(str, Debugger::ExpansionUsageShell);
emit starting();
int pid = KProcess::startDetached(KShell::splitArgs(str));
if ( pid > 0 ) {
m_monitor->startMonitoring(pid);
QStringList procargs = KShell::splitArgs(str);
QString procprog = procargs.takeAt(0);
QProcess proc;
proc.startDetached(procprog, procargs);
if ( proc.pid() > 0 ) {
m_monitor->startMonitoring(proc.pid());
} else {
kError() << "Could not start debugger:" << name();
emit finished();

View file

@ -23,7 +23,6 @@
#include <KStandardDirs>
#include <KDebug>
#include <KProcess>
#include <KLocalizedString>
#include <KProgressDialog>
@ -52,14 +51,14 @@ void DebugPackageInstaller::installDebugPackages()
if (!m_installerProcess) {
//Run process
m_installerProcess = new KProcess(this);
m_installerProcess = new QProcess(this);
connect(m_installerProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(processFinished(int,QProcess::ExitStatus)));
*m_installerProcess << m_executablePath
<< DrKonqi::crashedApplication()->executable().absoluteFilePath()
<< m_missingLibraries;
m_installerProcess->start();
QStringList installerArguments;
installerArguments << DrKonqi::crashedApplication()->executable().absoluteFilePath()
<< m_missingLibraries;
m_installerProcess->start(m_executablePath, installerArguments);
//Show dialog
m_progressDialog = new KProgressDialog(qobject_cast<QWidget*>(parent()));

View file

@ -22,7 +22,6 @@
#include <QtCore/QObject>
#include <QtCore/QProcess>
class KProcess;
class KProgressDialog;
class DebugPackageInstaller: public QObject
@ -48,7 +47,7 @@ class DebugPackageInstaller: public QObject
void canceled();
private:
KProcess * m_installerProcess;
QProcess * m_installerProcess;
KProgressDialog * m_progressDialog;
QString m_executablePath;
QStringList m_missingLibraries;

View file

@ -29,7 +29,6 @@
#include <QtCore/QFile>
#include <KStandardDirs>
#include <KProcess>
#include <KDebug>
#include <KConfig>
#include <KConfigGroup>

View file

@ -19,9 +19,9 @@
*/
#include "componentchooserfilemanager.h"
#include <QProcess>
#include <kbuildsycocaprogressdialog.h>
#include <kdebug.h>
#include <kprocess.h>
#include <kmimetypetrader.h>
#include <kopenwithdialog.h>
#include <kglobalsettings.h>
@ -102,10 +102,7 @@ void CfgFileManager::save(KConfig *)
void CfgFileManager::slotAddFileManager()
{
KProcess proc;
proc << "keditfiletype";
proc << "inode/directory";
if (proc.execute() == 0) {
if (QProcess::execute("keditfiletype", QStringList() << "inode/directory")) {
load(0);
}
}

View file

@ -165,14 +165,14 @@ bool CfgWm::tryWmLaunch()
if( wmLaunchingState == WmLaunching )
{ // time out
wmLaunchingState = WmFailed;
KProcess::startDetached( "kwin", QStringList() << "--replace" );
QProcess::startDetached( "kwin", QStringList() << "--replace" );
// Let's hope KWin never fails.
KMessageBox::sorry( window(),
i18n( "The running window manager has been reverted to the default KDE window manager KWin." ));
}
else if( wmLaunchingState == WmFailed )
{
KProcess::startDetached( "kwin", QStringList() << "--replace" );
QProcess::startDetached( "kwin", QStringList() << "--replace" );
// Let's hope KWin never fails.
KMessageBox::sorry( window(),
i18n( "The new window manager has failed to start.\n"
@ -296,6 +296,6 @@ void CfgWm::configureWm()
QStringList args;
if( !currentWmData().parentArgument.isEmpty())
args << currentWmData().parentArgument << QString::number( window()->winId());
if( !KProcess::startDetached( currentWmData().configureCommand, args ))
if( !QProcess::startDetached( currentWmData().configureCommand, args ))
KMessageBox::sorry( window(), i18n( "Running the configuration tool failed" ));
}

View file

@ -43,7 +43,6 @@
#include <kdebug.h>
#include <klocale.h>
#include <kprocess.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kdialog.h>

View file

@ -38,8 +38,8 @@
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kstandarddirs.h>
#include <kprocess.h>
#include <kauthhelpersupport.h>
#include <QProcess>
#include <QFile>
#include <QDir>
@ -85,9 +85,7 @@ int ClockHelper::ntp( const QStringList& ntpServers, bool ntpEnabled )
// Would this be better?: s/^.*\(([^)]*)\).*$/\1/
}
KProcess proc;
proc << ntpUtility << timeServer;
if ( proc.execute() != 0 ) {
if ( !QProcess::execute(ntpUtility, QStringList() << timeServer) ) {
ret |= NTPError;
}
} else if( ntpEnabled ) {
@ -109,7 +107,7 @@ int ClockHelper::date( const QString& newdate, const QString& olddate )
QString hwclock = KStandardDirs::findExe("hwclock", exePath);
if (!hwclock.isEmpty()) {
KProcess::execute(hwclock, QStringList() << "--systohc");
QProcess::execute(hwclock, QStringList() << "--systohc");
}
return 0;
}

View file

@ -30,7 +30,6 @@
#include <kdialog.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <kprocess.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
@ -78,8 +77,6 @@ KclockModule::KclockModule(QWidget *parent, const QVariantList &)
setButtons(Help|Apply);
setNeedsAuthorization(true);
process = NULL;
}
void KclockModule::save()

View file

@ -25,7 +25,6 @@
class Dtime;
class QTabWidget;
class KProcess;
class KclockModule : public KCModule
@ -41,7 +40,6 @@ public:
private:
QTabWidget *tab;
Dtime *dtime;
KProcess *process;
};
#endif // main_included

View file

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <QProcess>
#include <QCheckBox>
#include <QComboBox>
#include <QLabel>
@ -32,7 +33,6 @@
#include <KGlobalSettings>
#include <KMessageBox>
#include <KNumInput>
#include <KProcess>
#include <KConfig>
#include <KStandardDirs>
#include <KDebug>
@ -758,9 +758,8 @@ void KFonts::save()
// if the setting is reset in the module, remove the dpi value,
// otherwise don't explicitly remove it and leave any possible system-wide value
if( dpi == 0 && dpi_original != 0 ) {
KProcess proc;
proc << "xrdb" << "-quiet" << "-remove" << "-nocpp";
proc.start();
QProcess proc;
proc.start("xrdb", QStringList() << "-quiet" << "-remove" << "-nocpp");
if (proc.waitForStarted()) {
proc.write( QByteArray( "Xft.dpi\n" ) );
proc.closeWriteChannel();

View file

@ -22,7 +22,6 @@
#include <kglobal.h>
#include <kstandarddirs.h>
#include <kurl.h>
#include <kprocess.h>
#include <kio/job.h>
#include <kio/netaccess.h>
#include <kmessagebox.h>

View file

@ -27,22 +27,20 @@
#include <QtCore/QSettings>
#include <QtCore/QTextCodec>
#include <QToolTip>
//Added by qt3to4:
#include <QPixmap>
#include <QByteArray>
#include <QTextStream>
#include <QDateTime>
#include <QtDBus/QtDBus>
#include <QProcess>
#include <ktoolinvocation.h>
#include <klauncher_iface.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kstandarddirs.h>
#include <kprocess.h>
#include <ksavefile.h>
#include <ktemporaryfile.h>
#include <klocale.h>
@ -520,9 +518,8 @@ void runRdb( uint flags )
contents += "Xft.dpi: " + cfgfonts.readEntry( "forceFontDPI" ) + '\n';
else
{
KProcess proc;
proc << "xrdb" << "-quiet" << "-remove" << "-nocpp";
proc.start();
QProcess proc;
proc.start("xrdb", QStringList() << "-quiet" << "-remove" << "-nocpp");
if (proc.waitForStarted())
{
proc.write( QByteArray( "Xft.dpi\n" ) );
@ -537,13 +534,14 @@ void runRdb( uint flags )
tmpFile.flush();
KProcess proc;
QProcess proc;
QStringList procargs;
#ifndef NDEBUG
proc << "xrdb" << "-merge" << tmpFile.fileName();
procargs << "-merge" << tmpFile.fileName();
#else
proc << "xrdb" << "-quiet" << "-merge" << tmpFile.fileName();
procargs << "-quiet" << "-merge" << tmpFile.fileName();
#endif
proc.execute();
proc.execute("xrdb", procargs);
applyGtkStyles(exportColors, 1);
applyGtkStyles(exportColors, 2);

View file

@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ktoolinvocation.h>
#include <solid/powermanagement.h>
#include <qprocess.h>
#include <qdbusservicewatcher.h>
#include <qdbusconnection.h>
#include <qdbusconnectioninterface.h>
@ -179,7 +180,7 @@ void RandrMonitorModule::showKcm()
void RandrMonitorModule::tryAutoConfig()
{
KProcess::execute(QStringList() << "xrandr" << "--auto");
QProcess::execute("xrandr", QStringList() << "--auto");
}
QStringList RandrMonitorModule::connectedMonitors() const
@ -366,7 +367,7 @@ void RandrMonitorModule::resumedFromSuspend()
void RandrMonitorModule::enableOutput( RandROutput* output, bool enable )
{ // a bit lame, but I don't know how to do this easily with this codebase :-/
KProcess::execute( QStringList() << "xrandr" << "--output" << output->name() << ( enable ? "--auto" : "--off" ));
QProcess::execute( "xrandr", QStringList() << "--output" << output->name() << ( enable ? "--auto" : "--off" ));
}
QList< RandROutput* > RandrMonitorModule::connectedOutputs( RandRDisplay &display )

View file

@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RANDRMONITOR_H
#include <kdedmodule.h>
#include <kprocess.h>
#include <qwidget.h>
#include <X11/Xlib.h>

View file

@ -63,7 +63,7 @@
#include <KAboutData>
#include <KIcon>
#include <KNumInput>
#include <KProcess>
#include <QProcess>
//#include <KServiceGroup>
#include <KPluginFactory>
#include <KPluginLoader>
@ -129,10 +129,10 @@ KScreenSaver::KScreenSaver(QWidget *parent, const QVariantList&)
readSettings();
mSetupProc = new KProcess;
mSetupProc = new QProcess;
connect(mSetupProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotSetupDone()));
mPreviewProc = new KProcess;
mPreviewProc = new QProcess;
connect(mPreviewProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotPreviewExited()));
mSaverListView->setColumnCount(1);
@ -532,15 +532,14 @@ void KScreenSaver::slotPreviewExited()
XSelectInput(QX11Info::display(), mMonitor->winId(), widgetEventMask );
if (mSelected >= 0) {
mPreviewProc->clearProgram();
QString saver = mSaverList.at(mSelected)->saver();
QString saver = mSaverList.at(mSelected)->saver();
QHash<QChar, QString> keyMap;
keyMap.insert('w', QString::number(mMonitor->winId()));
*mPreviewProc << KShell::splitArgs(KMacroExpander::expandMacrosShellQuote(saver, keyMap));
QStringList previewArgs = KShell::splitArgs(KMacroExpander::expandMacrosShellQuote(saver, keyMap));
QString previewProgram = previewArgs.takeAt(0);
mPreviewProc->start();
mPreviewProc->start(previewProgram, previewArgs);
}
mPrevSelected = mSelected;
@ -632,8 +631,6 @@ void KScreenSaver::slotSetup()
if (mSetupProc->state() == QProcess::Running)
return;
mSetupProc->clearProgram();
QString saver = mSaverList.at(mSelected)->setup();
if( saver.isEmpty())
return;
@ -646,36 +643,30 @@ void KScreenSaver::slotSetup()
if (!path.isEmpty())
{
(*mSetupProc) << path;
QStringList setupArgs;
// Add caption and icon to about dialog
if (!kxsconfig) {
word = "-caption";
(*mSetupProc) << word;
word = mSaverList.at(mSelected)->name();
(*mSetupProc) << word;
word = "-icon";
(*mSetupProc) << word;
word = "kscreensaver";
(*mSetupProc) << word;
setupArgs << "-caption"
<< mSaverList.at(mSelected)->name()
<< "-icon"
<< "kscreensaver";
}
while (!ts.atEnd())
{
ts >> word;
(*mSetupProc) << word;
setupArgs << word;
}
// Pass translated name to kxsconfig
if (kxsconfig) {
word = mSaverList.at(mSelected)->name();
(*mSetupProc) << word;
setupArgs << mSaverList.at(mSelected)->name();
}
mSetupBt->setEnabled( false );
kapp->flush();
mSetupProc->start();
mSetupProc->start(path);
}
}
@ -687,11 +678,10 @@ void KScreenSaver::slotTest()
return;
if (!mTestProc) {
mTestProc = new KProcess;
mTestProc = new QProcess;
} else {
mPreviewProc->kill();
mPreviewProc->waitForFinished();
mTestProc->clearProgram();
}
if (!mTestWin)
@ -716,9 +706,10 @@ void KScreenSaver::slotTest()
QString saver = mSaverList.at(mSelected)->saver();
QHash<QChar, QString> keyMap;
keyMap.insert('w', QString::number(mTestWin->winId()));
*mTestProc << KShell::splitArgs(KMacroExpander::expandMacrosShellQuote(saver, keyMap));
QStringList testArgs = KShell::splitArgs(KMacroExpander::expandMacrosShellQuote(saver, keyMap));
QString testProgram = testArgs.takeAt(0);
mTestProc->start();
mTestProc->start(testProgram, testArgs);
mTesting = true;
}

View file

@ -30,8 +30,6 @@
#include <QWidget>
#include <QtGui/qevent.h>
#include <QtGui/qevent.h>
#include <QtGui/qevent.h>
#include <KCModule>
@ -42,7 +40,6 @@
class QTimer;
class KProcess;
class KIntSpinBox;
class ScreenPreviewWidget;
@ -96,9 +93,9 @@ protected:
protected:
TestWin *mTestWin;
KProcess *mTestProc;
KProcess *mSetupProc;
KProcess *mPreviewProc;
QProcess *mTestProc;
QProcess *mSetupProc;
QProcess *mPreviewProc;
KSSMonitor *mMonitor;
ScreenPreviewWidget *mMonitorPreview;
KService::List mSaverServices;

View file

@ -12,6 +12,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <QProcess>
#include <QDir>
#include <QLabel>
#include <QLayout>
@ -19,11 +20,9 @@
#include <QPixmap>
#include <QFrame>
#include <QHBoxLayout>
#include <QtGui/qevent.h>
#include <QVBoxLayout>
#include <QtGui/qevent.h>
#include <QtGui/qevent.h>
#include <QScrollArea>
#include <QtGui/qevent.h>
#include "installer.h"
@ -32,7 +31,6 @@
#include <kglobalsettings.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kprocess.h>
#include <kpushbutton.h>
#include <kstandarddirs.h>
#include <ktar.h>
@ -527,35 +525,21 @@ void SplashInstaller::slotTest()
qDebug() << "the engine is " << mEngineOfSelected << "for" << themeName;
if( mEngineOfSelected == "None" )
return;
else if( mEngineOfSelected == "Simple" )
{
KProcess proc;
proc << "ksplashsimple" << themeName << "--test";
if (proc.execute())
KMessageBox::error(this,i18n("Failed to successfully test the splash screen."));
return;
}
else if( mEngineOfSelected == "KSplashX" )
{
KProcess proc;
proc << "ksplashx" << themeName << "--test";
if (proc.execute())
if (QProcess::execute("ksplashx", QStringList() << themeName << "--test"))
KMessageBox::error(this,i18n("Failed to successfully test the splash screen."));
return;
}
else if( mEngineOfSelected == "KSplashQML" )
{
KProcess proc;
proc << "ksplashqml" << themeName << "--test";
if (proc.execute())
if (QProcess::execute("ksplashqml", QStringList() << themeName << "--test"))
KMessageBox::error(this,i18n("Failed to successfully test the splash screen."));
return;
}
else // KSplashML engines
{
KProcess proc;
proc << "ksplash" << "--test" << "--theme" << themeName;
if (proc.execute())
if (QProcess::execute("ksplash", QStringList() << "--test" << "--theme" << themeName))
KMessageBox::error(this,i18n("Failed to successfully test the splash screen."));
}
}

View file

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <kdialog.h>
#include <klocale.h>
#include <kprocess.h>
#include <kseparator.h>
#include <kstandarddirs.h>
#include <KStandardGuiItem>
@ -48,7 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <QStylePainter>
#include <QStyle>
#include <QTreeWidget>
#include <QtGui/qtreewidget.h>
#include <QProcess>
#include <stdlib.h>
@ -338,10 +337,9 @@ KDMShutdown::KDMShutdown(int _uid, QWidget *_parent)
static int
getDate(const char *str)
{
KProcess prc;
prc.setOutputChannelMode(KProcess::OnlyStdoutChannel);
prc << "/bin/date" << "+%s" << "-d" << str;
if (prc.execute())
QProcess prc;
prc.setReadChannel(QProcess::StandardOutput);
if (prc.execute("/bin/date", QStringList() << "+%s" << "-d" << str))
return -1;
return prc.readAll().simplified().toInt();
}

View file

@ -23,11 +23,11 @@
#include <kdebug.h>
#include <kdeversion.h>
#include <kprocess.h>
#include <kstandarddirs.h>
#include <QtCore/qxmlstream.h>
#include <QFile>
#include <QProcess>
/// WARNING: this code is duplicated between apps/nsplugins and runtime/filetypes
@ -136,12 +136,9 @@ void MimeTypeWriter::runUpdateMimeDatabase()
{
const QString localPackageDir = KStandardDirs::locateLocal("xdgdata-mime", QString());
Q_ASSERT(!localPackageDir.isEmpty());
KProcess proc;
proc << "update-mime-database";
proc << localPackageDir;
const int exitCode = proc.execute();
if (exitCode) {
kWarning() << proc.program() << "exited with error code" << exitCode;
QProcess proc;
if (!proc.execute("update-mime-database", QStringList() << localPackageDir)) {
kWarning() << "update-mime-database exited with error code" << proc.exitCode();
}
}

View file

@ -17,7 +17,7 @@
Boston, MA 02110-1301, USA.
*/
#include <kprocess.h>
#include <QProcess>
#include <kservice.h>
#include <qtest_kde.h>
@ -362,10 +362,9 @@ private: // helper methods
// (The real KCM code simply does the refresh in a slot, asynchronously)
QEventLoop loop;
QObject::connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), &loop, SLOT(quit()));
KProcess proc;
proc << KStandardDirs::findExe(KBUILDSYCOCA_EXENAME);
proc.setOutputChannelMode(KProcess::MergedChannels); // silence kbuildsycoca output
proc.execute();
QProcess proc;
proc.setProcessChannelMode(QProcess::MergedChannels); // silence kbuildsycoca output
proc.execute(KStandardDirs::findExe(KBUILDSYCOCA_EXENAME));
loop.exec();
}

View file

@ -25,6 +25,7 @@
#include <QByteArray>
#include <QRegExp>
#include <QProcess>
#include <kdebug.h>
#include <kcomponentdata.h>
@ -32,7 +33,6 @@
#include <kstandarddirs.h>
#include <klocale.h>
#include <kurl.h>
#include <kprocess.h>
#include <kdemacros.h>
@ -115,13 +115,14 @@ void FingerProtocol::get(const KUrl& url )
//kDebug() << "Refresh rate: " << refreshRate;
KProcess proc;
proc << *myPerlPath << *myFingerPerlScript
QProcess proc;
QStringList perlArgs;
perlArgs << *myFingerPerlScript
<< *myFingerPath << *myFingerCSSFile
<< refreshRate << myURL->host() << myURL->user();
proc.setOutputChannelMode(KProcess::MergedChannels);
proc.execute();
proc.setProcessChannelMode(QProcess::MergedChannels);
proc.execute(*myPerlPath, perlArgs);
data(proc.readAllStandardOutput());
data(QByteArray());
finished();

View file

@ -17,11 +17,6 @@
/*
This code contains fragments and ideas from the ftp kioslave
done by David Faure <faure@kde.org>.
Structure is a bit complicated, since I made the mistake to use
KProcess... now there is a lightweight homebrew async IO system
inside, but if signals/slots become available for ioslaves, switching
back to KProcess should be easy.
*/
#include "fish.h"

View file

@ -19,7 +19,6 @@
#include <kurl.h>
#include <kio/global.h>
#include <kio/slavebase.h>
#include <kprocess.h>
#include <kio/authinfo.h>
#include <time.h>

View file

@ -23,7 +23,7 @@
#include <unistd.h>
#include <QByteArray>
#include <QDir>
#include <KProcess>
#include <QProcess>
#include <kshell.h>
void SMBSlave::special( const QByteArray & data)
@ -74,10 +74,10 @@ void SMBSlave::special( const QByteArray & data)
// using smbmount instead of "mount -t smbfs", because mount does not allow a non-root
// user to do a mount, but a suid smbmnt does allow this
KProcess proc;
proc.setOutputChannelMode(KProcess::SeparateChannels);
proc << "smbmount";
QProcess proc;
proc.setProcessChannelMode(QProcess::SeparateChannels);
QStringList procArgs;
QString options;
if ( smburl.user().isEmpty() )
@ -98,11 +98,11 @@ void SMBSlave::special( const QByteArray & data)
//if ( ! m_default_encoding.isEmpty() )
//options += ",codepage=" + KShell::quoteArg(m_default_encoding);
proc << remotePath;
proc << mountPoint;
proc << "-o" << options;
procArgs << remotePath;
procArgs << mountPoint;
procArgs << "-o" << options;
proc.start();
proc.start("smbmount", procArgs);
if (!proc.waitForFinished())
{
error(KIO::ERR_CANNOT_LAUNCH_PROCESS,
@ -133,12 +133,10 @@ void SMBSlave::special( const QByteArray & data)
QString mountPoint;
stream >> mountPoint;
KProcess proc;
proc.setOutputChannelMode(KProcess::SeparateChannels);
proc << "smbumount";
proc << mountPoint;
QProcess proc;
proc.setProcessChannelMode(QProcess::SeparateChannels);
proc.start();
proc.start("smbumount", QStringList() << mountPoint);
if ( !proc.waitForFinished() )
{
error(KIO::ERR_CANNOT_LAUNCH_PROCESS,

View file

@ -37,12 +37,12 @@
#include <ktar.h>
#include <kdebug.h>
#include <ktempdir.h>
#include <kprocess.h>
#include <memory>
#include <QtCore/QFile>
#include <QtCore/QEventLoop>
#include <QtCore/QProcess>
// For KIO-Thumbnail debug outputs
#define KIO_THUMB 11371
@ -280,17 +280,15 @@ int ComicCreator::startProcess(const QString& processPath, const QStringList& ar
/// Run a process and store std::out, std::err data in their respective buffers.
int ret = 0;
m_process.reset(new KPtyProcess(this));
m_process->setOutputChannelMode(KProcess::SeparateChannels);
m_process.reset(new QProcess(this));
m_process->setProcessChannelMode(QProcess::SeparateChannels);
connect(m_process.data(), SIGNAL(readyReadStandardOutput()), SLOT(readProcessOut()));
connect(m_process.data(), SIGNAL(readyReadStandardError()), SLOT(readProcessErr()));
connect(m_process.data(), SIGNAL(finished(int, QProcess::ExitStatus)),
SLOT(finishedProcess(int, QProcess::ExitStatus)));
m_process->setProgram(processPath, args);
m_process->setNextOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered);
m_process->start();
m_process->start(processPath, args, QIODevice::ReadWrite | QIODevice::Unbuffered);
QEventLoop loop;
m_loop = &loop;
ret = loop.exec(QEventLoop::WaitForMoreEvents);

View file

@ -34,10 +34,9 @@
#include <QtCore/QByteArray>
#include <QtCore/QStringList>
#include <QImage>
#include <QtCore/QScopedPointer>
#include <kptyprocess.h>
#include <QtCore/QProcess>
#include <QtGui/QImage>
class KArchiveDirectory;
class QEventLoop;
@ -77,7 +76,7 @@ class ComicCreator : public QObject, public ThumbCreator
void finishedProcess(int exitCode, QProcess::ExitStatus exitStatus);
private:
QScopedPointer<KPtyProcess> m_process;
QScopedPointer<QProcess> m_process;
QByteArray m_stdOut;
QByteArray m_stdErr;
QEventLoop* m_loop;

View file

@ -31,7 +31,6 @@
#include <kstandarddirs.h>
#include <kdesktopfile.h>
#include <kdebug.h>
#include <kprocess.h>
#include <kmessagebox.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>

View file

@ -181,9 +181,10 @@ bool ScreenSaverWindow::startXScreenSaver()
QHash<QChar, QString> keyMap;
keyMap.insert(QLatin1Char( 'w' ), QString::number(winId()));
m_ScreenSaverProcess << KShell::splitArgs(KMacroExpander::expandMacrosShellQuote(m_saverExec, keyMap));
QStringList saverArgs = KShell::splitArgs(KMacroExpander::expandMacrosShellQuote(m_saverExec, keyMap));
QString saverProgram = saverArgs.takeAt(0);
m_ScreenSaverProcess.start();
m_ScreenSaverProcess.start(saverProgram, saverArgs);
if (m_ScreenSaverProcess.waitForStarted()) {
#ifdef HAVE_SETPRIORITY
setpriority(PRIO_PROCESS, m_ScreenSaverProcess.pid(), mPriority);

View file

@ -22,8 +22,7 @@
#define SCREENSAVERWINDOW_H
#include <QWidget>
#include <KProcess>
#include <QProcess>
class QMouseEvent;
class QTimer;
@ -56,7 +55,7 @@ private:
void stopXScreenSaver();
void readSaver();
KProcess m_ScreenSaverProcess;
QProcess m_ScreenSaverProcess;
QPoint m_startMousePos;
QString m_saver;
QString m_saverExec;

View file

@ -26,9 +26,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KDE
#include <KDebug>
#include <KIdleTime>
#include <KProcess>
#include <KRandom>
// Qt
#include <QProcess>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusReply>
@ -205,14 +205,12 @@ void Interface::configure()
void Interface::setupPlasma()
{
KProcess *plasmaProc = new KProcess;
plasmaProc->setProgram(QLatin1String( "plasma-overlay" ));
*plasmaProc << QLatin1String( "--setup" );
QProcess *plasmaProc = new QProcess;
//make sure it goes away when it's done (and not before)
connect(plasmaProc, SIGNAL(finished(int,QProcess::ExitStatus)), plasmaProc, SLOT(deleteLater()));
plasmaProc->start();
plasmaProc->start("plasma-overlay", QStringList() << "--setup");
}
void Interface::saverLockReady()

View file

@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KIdleTime>
#include <KLocalizedString>
#include <KNotification>
#include <KProcess>
#include <QProcess>
#include <KStandardDirs>
// Qt
#include <QtCore/QTimer>

View file

@ -105,7 +105,7 @@ KSMServer* KSMServer::self()
/*! Utility function to execute a command on the local machine. Used
* to restart applications.
*/
KProcess* KSMServer::startApplication( const QStringList& cmd, const QString& clientMachine,
QProcess* KSMServer::startApplication( const QStringList& cmd, const QString& clientMachine,
const QString& userId, bool wm )
{
QStringList command = cmd;
@ -125,17 +125,17 @@ KProcess* KSMServer::startApplication( const QStringList& cmd, const QString& cl
command.prepend( xonCommand ); // "xon" by default
}
// TODO this function actually should not use KProcess at all and use klauncher (kdeinit) instead.
// TODO this function actually should not use QProcess at all and use klauncher (kdeinit) instead.
// Klauncher should also have support for tracking whether the launched process is still alive
// or not, so this should be redone. For now, use KProcess for wm's, as they need to be tracked,
// or not, so this should be redone. For now, use QProcess for wm's, as they need to be tracked,
// klauncher for the rest where ksmserver doesn't care.
if( wm ) {
KProcess* process = new KProcess( this );
*process << command;
QProcess* process = new QProcess( this );
QString program = command.takeAt(0);
// make it auto-delete
connect( process, SIGNAL(error(QProcess::ProcessError)), process, SLOT(deleteLater()));
connect( process, SIGNAL(finished(int,QProcess::ExitStatus)), process, SLOT(deleteLater()));
process->start();
process->start(program, command);
return process;
} else {
int n = command.count();
@ -157,7 +157,9 @@ void KSMServer::executeCommand( const QStringList& command )
if ( command.isEmpty() )
return;
KProcess::execute( command );
QStringList args = command;
QString program = args.takeAt(0);
QProcess::execute( program, args );
}
IceAuthDataEntry *authDataEntries = 0;
@ -462,9 +464,7 @@ Status SetAuthentication (int count, IceListenObj *listenObjs,
return 0;
}
KProcess p;
p << iceAuth << "source" << addTempFile.fileName();
p.execute();
QProcess::execute(iceAuth, QStringList() << "source" << addTempFile.fileName());
return (1);
}
@ -494,9 +494,7 @@ void FreeAuthenticationData(int count, IceAuthDataEntry *authDataEntries)
if (remTempFile)
{
KProcess p;
p << iceAuth << "source" << remTempFile->fileName();
p.execute();
QProcess::execute(iceAuth, QStringList() << "source" << remTempFile->fileName());
}
delete remTempFile;

View file

@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define QT_CLEAN_NAMESPACE 1
#include <QStringList>
#include <QObject>
#include <QProcess>
#include <kapplication.h>
#include <kworkspace/kworkspace.h>
@ -54,8 +55,6 @@ extern "C" {
#define SESSION_PREVIOUS_LOGOUT "saved at previous logout"
#define SESSION_BY_USER "saved by user"
class KProcess;
class KSMListener;
class KSMConnection;
class KSMClient;
@ -169,7 +168,7 @@ private:
void startProtection();
void endProtection();
KProcess* startApplication( const QStringList& command,
QProcess* startApplication( const QStringList& command,
const QString& clientMachine = QString(),
const QString& userId = QString(),
bool wm = false );
@ -240,7 +239,7 @@ private:
KSMClient* clientInteracting;
QString wm;
QStringList wmCommands;
KProcess* wmProcess;
QProcess* wmProcess;
QString sessionGroup;
QString sessionName;
QTimer protectionTimer;

View file

@ -69,7 +69,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <ktemporaryfile.h>
#include <knotification.h>
#include <kconfiggroup.h>
#include <kprocess.h>
#include "global.h"
#include "server.h"

View file

@ -33,9 +33,9 @@
#include <QTimer>
#include <QDesktopWidget>
#include <QApplication>
#include <QProcess>
#include <kdebug.h>
#include <kprocess.h>
#include <klocale.h>
#include <kcomponentdata.h>
#include <kwindowsystem.h>
@ -51,8 +51,9 @@
// some globals
static KProcess* proc = 0;
static QProcess* proc = 0;
static QString exe;
static QStringList exeArgs;
static QString url;
static QString windowtitle;
static QString windowclass;
@ -82,7 +83,7 @@ KStart::KStart()
//finally execute the comand
if (proc) {
if( int pid = proc->startDetached() ) {
if( int pid = proc->startDetached(exe, exeArgs) ) {
KStartupInfoData data;
data.addPid( pid );
data.setName( exe );
@ -348,9 +349,9 @@ int main( int argc, char *argv[] )
KCmdLineArgs::usageError(i18n("No command specified"));
exe = args->arg(0);
proc = new KProcess;
proc = new QProcess;
for(int i=0; i < args->count(); i++)
(*proc) << args->arg(i);
exeArgs << args->arg(i);
}
desktop = args->getOption( "desktop" ).toInt();

View file

@ -66,10 +66,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QVector2D>
#include <QVector4D>
#include <QMatrix4x4>
#include <QProcess>
#include <KLocalizedString>
#include <KNotification>
#include <KProcess>
namespace KWin
{
@ -570,7 +570,7 @@ bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const {
dialog.asyncCall("warn", message, details, "");
} else {
const QByteArray args = "warn " + message.toLocal8Bit().toBase64() + " details " + details.toLocal8Bit().toBase64();
KProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args);
QProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args);
}
QDBusConnection::sessionBus().interface()->setTimeout(oldTimeout);
return false;
@ -602,7 +602,7 @@ bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const {
} else {
const QByteArray args = "warn " + message.toLocal8Bit().toBase64() + " details " +
details.toLocal8Bit().toBase64() + " dontagain kwin_dialogsrc:max_tex_warning";
KProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args);
QProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args);
}
QDBusConnection::sessionBus().interface()->setTimeout(oldTimeout);
}

View file

@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "desktopmodel.h"
#include "tabboxconfig.h"
// Qt
#include <QProcess>
#include <QtGui/qevent.h>
#include <QtCore/qabstractitemmodel.h>
#include <QTimer>
@ -33,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <X11/Xlib.h>
// KDE
#include <KDebug>
#include <KProcess>
#include <KWindowSystem>
namespace KWin
@ -237,7 +237,7 @@ void TabBoxHandler::show()
QStringList args;
args << "--passivepopup" << /*i18n*/("The Window Switcher installation is broken, resources are missing.\n"
"Contact your distribution about this.") << "20";
KProcess::startDetached("kdialog", args);
QProcess::startDetached("kdialog", args);
hide();
return;
}

View file

@ -43,7 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KKeySequenceWidget>
#include <KProcess>
#include <KToolInvocation>
#include <X11/extensions/Xrandr.h>
@ -54,6 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QCheckBox>
#include <QPointer>
#include <QPushButton>
#include <QProcess>
#include <kglobalsettings.h>
#include <KIcon>
@ -207,7 +207,7 @@ void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer<Cl
}
if (!c.isNull())
args << "--embed" << QString::number(c.data()->window());
KProcess::startDetached("kdialog", args);
QProcess::startDetached("kdialog", args);
}
@ -1260,7 +1260,7 @@ static bool screenSwitchImpossible()
QStringList args;
args << "--passivepopup" << i18n("The window manager is configured to consider the screen with the mouse on it as active one.\n"
"Therefore it is not possible to switch to a screen explicitly.") << "20";
KProcess::startDetached("kdialog", args);
QProcess::startDetached("kdialog", args);
return true;
}

View file

@ -30,8 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <kcombobox.h>
#include <klineedit.h>
#include <kuser.h>
#include <kprocess.h>
#include <QProcess>
#include <QRegExp>
#include <QLayout>
#include <QLabel>
@ -541,12 +541,11 @@ KWinbindGreeter::slotChanged()
void
KWinbindGreeter::slotStartDomainList()
{
m_domainLister = new KProcess(this);
(*m_domainLister) << "wbinfo" << "--own-domain" << "--trusted-domains";
m_domainLister->setOutputChannelMode(KProcess::OnlyStdoutChannel);
m_domainLister = new QProcess(this);
m_domainLister->setReadChannel(QProcess::StandardOutput);
connect(m_domainLister, SIGNAL(finished(int,QProcess::ExitStatus)),
SLOT(slotEndDomainList()));
m_domainLister->start();
m_domainLister->start("wbinfo", QStringList() << "--own-domain" << "--trusted-domains");
}
void

View file

@ -35,7 +35,7 @@ class KComboBox;
class KLineEdit;
class KSimpleConfig;
class QLabel;
class KProcess;
class QProcess;
class KWinbindGreeter : public QObject, public KGreeterPlugin {
Q_OBJECT
@ -82,7 +82,7 @@ class KWinbindGreeter : public QObject, public KGreeterPlugin {
KLineEdit *passwdEdit, *passwd1Edit, *passwd2Edit;
QString fixedDomain, fixedUser, curUser;
QStringList allUsers;
KProcess* m_domainLister;
QProcess* m_domainLister;
Function func;
Context ctx;

View file

@ -20,7 +20,6 @@
*/
#include <kdebug.h>
#include <kprocess.h>
#include <kshell.h>
#include <klocale.h>
@ -50,8 +49,8 @@ SensorShellAgent::~SensorShellAgent()
bool SensorShellAgent::start( const QString &host, const QString &shell,
const QString &command, int )
{
mDaemon = new KProcess();
mDaemon->setOutputChannelMode( KProcess::SeparateChannels );
mDaemon = new QProcess();
mDaemon->setProcessChannelMode( QProcess::SeparateChannels );
mRetryCount=3;
setHostName( host );
mShell = shell;
@ -67,11 +66,13 @@ bool SensorShellAgent::start( const QString &host, const QString &shell,
SLOT(errMsgRcvd()) );
if ( !command.isEmpty() ) {
*mDaemon << KShell::splitArgs(command);
QStringList args = KShell::splitArgs(command);
QString program = args.takeAt(0);
mDaemon->start(program, args);
} else {
mDaemon->start(mShell, QStringList() << hostName() << "ksysguardd");
}
else
*mDaemon << mShell << hostName() << "ksysguardd";
mDaemon->start();
return true;
}

View file

@ -30,8 +30,6 @@
class QString;
class KProcess;
namespace KSGRD {
class SensorManager;
@ -65,7 +63,7 @@ class SensorShellAgent : public SensorAgent
private:
bool writeMsg( const char *msg, int len );
int mRetryCount;
QPointer<KProcess> mDaemon;
QPointer<QProcess> mDaemon;
QString mShell;
QString mCommand;
};

View file

@ -21,6 +21,7 @@
***************************************************************************/
// Qt
#include <QProcess>
#include <QAction>
#include <QGraphicsLinearLayout>
#include <QDBusConnection>
@ -30,7 +31,6 @@
// KDE
#include <KConfigDialog>
#include <KProcess>
#include <KRun>
#include <KStandardDirs>
#include <KShortcut>
@ -92,7 +92,7 @@ QList<QAction *> HomerunLauncher::contextualActions()
void HomerunLauncher::startMenuEditor()
{
KProcess::execute("kmenuedit");
QProcess::execute("kmenuedit");
}
void HomerunLauncher::startViewer()

View file

@ -18,7 +18,7 @@
#include "processrunner.h"
#include <KProcess>
#include <QProcess>
ProcessRunner::ProcessRunner(QObject *parent) : QObject(parent)
{
@ -30,7 +30,7 @@ ProcessRunner::~ProcessRunner()
void ProcessRunner::execute(const QString& name)
{
KProcess::execute(name);
QProcess::execute(name);
}
#include "moc_processrunner.cpp"

View file

@ -21,6 +21,7 @@
#include "applet/applet.h"
// Qt
#include <QtCore/QProcess>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QGraphicsView>
@ -32,7 +33,6 @@
#include <KIcon>
#include <KDebug>
#include <KConfigDialog>
#include <KProcess>
// Plasma
#include <Plasma/IconWidget>
@ -148,7 +148,7 @@ void LauncherApplet::switchMenuStyle()
void LauncherApplet::startMenuEditor()
{
KProcess::execute("kmenuedit");
QProcess::execute("kmenuedit");
}
void LauncherApplet::createConfigurationInterface(KConfigDialog *parent)

View file

@ -24,18 +24,17 @@
#include "simpleapplet/menuview.h"
// Qt
#include <QtCore/QProcess>
#include <QtCore/qmetaobject.h>
#include <QtCore/QSharedPointer>
#include <QtGui/QLabel>
#include <QtGui/QCheckBox>
#include <QtGui/QSpinBox>
#include <QtGui/QGridLayout>
#include <QtGui/QGraphicsView>
#include <QtCore/QMetaObject>
#include <QtCore/qmetaobject.h>
#include <QtCore/qsharedpointer.h>
#include <QtGui/QGraphicsLinearLayout>
#include <QtGui/QSpacerItem>
#include <QtGui/QListWidget>
#include <QtGui/qlistwidget.h>
// KDE Libs
#include <KActionCollection>
@ -47,7 +46,6 @@
#include <KIconButton>
#include <KIconLoader>
#include <KMenu>
#include <KProcess>
#include <KRun>
#include <KServiceTypeTrader>
#include <KToolInvocation>
@ -392,7 +390,7 @@ void MenuLauncherApplet::switchMenuStyle()
void MenuLauncherApplet::startMenuEditor()
{
KProcess::execute("kmenuedit");
QProcess::execute("kmenuedit");
}
void MenuLauncherApplet::customContextMenuRequested(QMenu* menu, const QPoint& pos)

View file

@ -33,7 +33,7 @@
#include <KMessageBox>
#include <KLocale>
#include <KNotification>
#include <KProcess>
#include <QProcess>
#include <KRun>
#include <KSharedConfig>
#include <KStandardDirs>
@ -222,11 +222,11 @@ void Trash::emptyTrash()
//KonqOperations::emptyTrash(&m_menu);
m_emptyAction->setEnabled(false);
m_emptyAction->setText(i18n("Emptying Trashcan..."));
m_emptyProcess = new KProcess(this);
m_emptyProcess = new QProcess(this);
connect(m_emptyProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(emptyFinished(int,QProcess::ExitStatus)));
(*m_emptyProcess) << KStandardDirs::findExe("ktrash") << "--empty";
m_emptyProcess->start();
QString ktrash = KStandardDirs::findExe("ktrash");
m_emptyProcess->start(ktrash, QStringList() << "--empty");
}
void Trash::emptyFinished(int exitCode, QProcess::ExitStatus exitStatus)

View file

@ -35,7 +35,6 @@ class QAction;
class KCModuleProxy;
class KDialog;
class KFilePlacesModel;
class KProcess;
namespace Plasma
{
@ -87,7 +86,7 @@ class Trash : public Plasma::Applet
bool m_showText;
KFilePlacesModel *m_places;
KCModuleProxy *m_proxy;
KProcess *m_emptyProcess;
QProcess *m_emptyProcess;
};
K_EXPORT_PLASMA_APPLET(trash, Trash)

View file

@ -20,10 +20,10 @@
#include "killrunner.h"
#include <QAction>
#include <QProcess>
#include <KDebug>
#include <KIcon>
#include <KProcess>
#include <KUser>
#include <kauthaction.h>
@ -180,10 +180,8 @@ void KillRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMa
QStringList args;
args << QString("-%1").arg(signal) << QString("%1").arg(pid);
KProcess *process = new KProcess(this);
int returnCode = process->execute("kill", args);
if (returnCode == 0)
if (QProcess::execute("kill", args))
{
return;
}

View file

@ -30,7 +30,6 @@
#include <kapplication.h>
#include <kdebug.h>
#include <klocale.h>
#include <kprocess.h>
#include <krun.h>
#include <kmessagebox.h>
#include <kstandardguiitem.h>