[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdelibs/frameworks] /: Port from KProcess to QProcess
From: Matt Williams <matt () milliams ! com>
Date: 2012-02-21 15:26:53
Message-ID: 20120221152653.8418BA60A6 () git ! kde ! org
[Download RAW message or body]
Git commit 66fda6d3faafeadac82eae6b8308787b3fe96911 by Matt Williams.
Committed on 21/02/2012 at 16:32.
Pushed by milliams into branch 'frameworks'.
Port from KProcess to QProcess
M +2 -2 kconf_update/tests/test_kconf_update.cpp
M +5 -5 kded/tests/kmimeassociationstest.cpp
M +9 -8 kdeui/tests/kglobalsettingstest.cpp
M +7 -7 kdeui/tests/kuniqueapptest.cpp
M +3 -4 khtml/java/kjavaprocess.cpp
M +2 -2 khtml/java/kjavaprocess.h
M +5 -6 kinit/klauncher.cpp
M +2 -2 kinit/klauncher.h
M +0 -1 kio/kfile/kfilemetadataprovider_p.h
M +3 -4 kio/kio/kbuildsycocaprogressdialog.cpp
M +5 -6 kio/kio/ksambashare.cpp
M +0 -1 kio/tests/kdcopcheck.cpp
M +0 -1 knewstuff/knewstuff3/core/engine.cpp
M +17 -17 knewstuff/knewstuff3/core/security.cpp
M +1 -2 knewstuff/knewstuff3/core/security.h
M +5 -2 kunitconversion/currency.cpp
M +0 -1 plasma/remote/signing.cpp
M +0 -1 security/crypto/crypto.cpp
http://commits.kde.org/kdelibs/66fda6d3faafeadac82eae6b8308787b3fe96911
diff --git a/kconf_update/tests/test_kconf_update.cpp \
b/kconf_update/tests/test_kconf_update.cpp index c9cb491..aec83c2 100644
--- a/kconf_update/tests/test_kconf_update.cpp
+++ b/kconf_update/tests/test_kconf_update.cpp
@@ -24,11 +24,11 @@
#include <QFile>
#include <QDir>
#include <QSharedPointer>
+#include <QtCore/QProcess>
#include <qtemporaryfile.h>
// KDE
#include <kdebug.h>
-#include <kprocess.h>
#include <kstandarddirs.h>
#include <qtest.h>
@@ -67,7 +67,7 @@ static QTemporaryFile* writeUpdFile(const QString &content)
static void runKConfUpdate(const QString &updPath)
{
QString exePath = KStandardDirs::findExe("kconf_update");
- KProcess::execute(QStringList() << exePath << "--debug" << updPath);
+ QProcess::execute(exePath, QStringList() << "--debug" << updPath);
}
void TestKConfUpdate::test_data()
diff --git a/kded/tests/kmimeassociationstest.cpp \
b/kded/tests/kmimeassociationstest.cpp index 2b06d79..3b98269 100644
--- a/kded/tests/kmimeassociationstest.cpp
+++ b/kded/tests/kmimeassociationstest.cpp
@@ -19,7 +19,7 @@
*/
#include <QDir>
-#include <kprocess.h>
+#include <QtCore/QProcess>
#include <kconfiggroup.h>
#include <kdesktopfile.h>
#include <kmimetypetrader.h>
@@ -401,12 +401,12 @@ private:
// (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;
+ QProcess proc;
const QString kbuildsycoca = KStandardDirs::findExe(KBUILDSYCOCA_EXENAME);
QVERIFY(!kbuildsycoca.isEmpty());
- proc << kbuildsycoca;
- proc.setOutputChannelMode(KProcess::MergedChannels); // silence kbuildsycoca \
output
- proc.execute();
+ proc.setProcessChannelMode(QProcess::MergedChannels); // silence \
kbuildsycoca output + proc.start(kbuildsycoca);
+ proc.waitForFinished();
loop.exec();
}
diff --git a/kdeui/tests/kglobalsettingstest.cpp \
b/kdeui/tests/kglobalsettingstest.cpp index b688bbc..cfe1c65 100644
--- a/kdeui/tests/kglobalsettingstest.cpp
+++ b/kdeui/tests/kglobalsettingstest.cpp
@@ -24,7 +24,7 @@ QTEST_KDEMAIN( KGlobalSettingsTest, GUI )
#include <kglobalsettings.h>
#include <kdebug.h>
-#include <kprocess.h>
+#include <QtCore/QProcess>
#include <QtCore/QEventLoop>
#include <QtDBus/QtDBus>
@@ -61,21 +61,22 @@ void KGlobalSettingsTest::initTestCase()
QSignalSpy appearance_spy( settings, SIGNAL(appearanceChanged()) )
static void callClient( const QString& opt, const char* signalToWaitFor ) {
- KProcess proc;
+ QProcess proc;
+ QString processName;
#ifdef Q_OS_WIN
- proc << "kglobalsettingsclient.exe";
+ processName = "kglobalsettingsclient.exe";
#else
if (QFile::exists("./kglobalsettingsclient.shell"))
- proc << "./kglobalsettingsclient.shell";
+ processName = "./kglobalsettingsclient.shell";
else {
QVERIFY(QFile::exists("./kglobalsettingsclient"));
- proc << "./kglobalsettingsclient";
+ processName = "./kglobalsettingsclient";
}
#endif
- proc << opt;
// kDebug() << proc.args();
- int ok = proc.execute();
- QVERIFY(ok == 0);
+ proc.start(processName, QStringList() << opt);
+ bool ok = proc.waitForFinished();
+ QVERIFY(ok);
QVERIFY(QTest::kWaitForSignal(KGlobalSettings::self(), signalToWaitFor, 5000));
}
diff --git a/kdeui/tests/kuniqueapptest.cpp b/kdeui/tests/kuniqueapptest.cpp
index 6a4bf12..d053cbf 100644
--- a/kdeui/tests/kuniqueapptest.cpp
+++ b/kdeui/tests/kuniqueapptest.cpp
@@ -24,10 +24,10 @@
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <kdebug.h>
-#include <kprocess.h>
#include <QTimer>
#include <QFile>
+#include <QtCore/QProcess>
class TestApp : public KUniqueApplication
{
@@ -40,19 +40,19 @@ public:
private Q_SLOTS:
void executeNewChild() {
// Duplicated from kglobalsettingstest.cpp - make a shared helper method?
- KProcess* proc = new KProcess(this);
- const QString appName = "kuniqueapptest";
+ QProcess* proc = new QProcess(this);
+ QString appName = "kuniqueapptest";
#ifdef Q_OS_WIN
- (*proc) << appName + ".exe";
+ appName = appName + ".exe";
#else
if (QFile::exists(appName+".shell"))
- (*proc) << "./" + appName+".shell";
+ appName = "./" + appName+".shell";
else {
Q_ASSERT(QFile::exists(appName));
- (*proc) << "./" + appName;
+ appName = "./" + appName;
}
#endif
- proc->start();
+ proc->start(appName);
}
private:
int m_callCount;
diff --git a/khtml/java/kjavaprocess.cpp b/khtml/java/kjavaprocess.cpp
index 2fcf6aa..89a65d0 100644
--- a/khtml/java/kjavaprocess.cpp
+++ b/khtml/java/kjavaprocess.cpp
@@ -43,7 +43,7 @@ private:
};
KJavaProcess::KJavaProcess( QObject* parent )
- : KProcess( parent ),
+ : QProcess( parent ),
d(new KJavaProcessPrivate)
{
@@ -229,9 +229,8 @@ bool KJavaProcess::invokeJVM()
kDebug(6100) << "Invoking JVM" << d->jvmPath << "now...with arguments = " << \
KShell::joinArgs(args);
- setOutputChannelMode(KProcess::SeparateChannels);
- setProgram( d->jvmPath, args );
- start();
+ setProcessChannelMode(QProcess::SeparateChannels);
+ start(d->jvmPath, args);
return waitForStarted();
}
diff --git a/khtml/java/kjavaprocess.h b/khtml/java/kjavaprocess.h
index 28a6412..5ea7d90 100644
--- a/khtml/java/kjavaprocess.h
+++ b/khtml/java/kjavaprocess.h
@@ -24,7 +24,7 @@
#ifndef KJAVAPROCESS_H
#define KJAVAPROCESS_H
-#include <kprocess.h>
+#include <QtCore/QProcess>
/**
* @short A class for invoking a Java VM
@@ -38,7 +38,7 @@
*/
class KJavaProcessPrivate;
-class KJavaProcess : public KProcess //QObject
+class KJavaProcess : public QProcess //QObject
{
Q_OBJECT
diff --git a/kinit/klauncher.cpp b/kinit/klauncher.cpp
index 0f1f8d8..22561ab 100644
--- a/kinit/klauncher.cpp
+++ b/kinit/klauncher.cpp
@@ -625,8 +625,8 @@ KLauncher::requestStart(KLaunchRequest *request)
requestList.append( request );
lastRequest = request;
- KProcess *process = new KProcess;
- process->setOutputChannelMode(KProcess::MergedChannels);
+ QProcess *process = new QProcess;
+ process->setProcessChannelMode(QProcess::MergedChannels);
connect(process ,SIGNAL(readyReadStandardOutput()),this, SLOT(slotGotOutput()) );
connect(process ,SIGNAL(finished(int,QProcess::ExitStatus)),this, \
SLOT(slotFinished(int,QProcess::ExitStatus)) ); request->process = process;
@@ -642,8 +642,7 @@ KLauncher::requestStart(KLaunchRequest *request)
if (!bundlepath.isEmpty())
executable = bundlepath;
#endif
- process->setProgram(executable,args);
- process->start();
+ process->start(executable,args);
if (!process->waitForStarted())
{
@@ -1299,7 +1298,7 @@ void
KLauncher::slotGotOutput()
{
#ifdef USE_KPROCESS_FOR_KIOSLAVES
- KProcess *p = static_cast<KProcess *>(sender());
+ QProcess *p = static_cast<QProcess *>(sender());
QByteArray _stdout = p->readAllStandardOutput();
kDebug(7016) << _stdout.data();
#endif
@@ -1309,7 +1308,7 @@ void
KLauncher::slotFinished(int exitCode, QProcess::ExitStatus exitStatus )
{
#ifdef USE_KPROCESS_FOR_KIOSLAVES
- KProcess *p = static_cast<KProcess *>(sender());
+ QProcess *p = static_cast<QProcess *>(sender());
kDebug(7016) << "process finished exitcode=" << exitCode << "exitStatus=" << \
exitStatus;
foreach (KLaunchRequest *request, requestList)
diff --git a/kinit/klauncher.h b/kinit/klauncher.h
index bff73ed..6bc2493 100644
--- a/kinit/klauncher.h
+++ b/kinit/klauncher.h
@@ -40,10 +40,10 @@
#include <QtCore/QTimer>
#include <QtCore/QList>
#include <QtCore/QObject>
+#include <QtCore/QProcess>
#include <QtDBus/QtDBus>
#include <kservice.h>
-#include <kprocess.h>
#include <kurl.h>
#include <kio/connection.h>
@@ -107,7 +107,7 @@ public:
QString cwd;
#ifdef USE_KPROCESS_FOR_KIOSLAVES
protected:
- KProcess *process;
+ QProcess *process;
friend class KLauncher;
#endif
};
diff --git a/kio/kfile/kfilemetadataprovider_p.h \
b/kio/kfile/kfilemetadataprovider_p.h index 09d924a..f0df879 100644
--- a/kio/kfile/kfilemetadataprovider_p.h
+++ b/kio/kfile/kfilemetadataprovider_p.h
@@ -33,7 +33,6 @@
#endif
class KFileItemList;
-class KProcess;
class KUrl;
class QWidget;
diff --git a/kio/kio/kbuildsycocaprogressdialog.cpp \
b/kio/kio/kbuildsycocaprogressdialog.cpp index d37ad13..749bc92 100644
--- a/kio/kio/kbuildsycocaprogressdialog.cpp
+++ b/kio/kio/kbuildsycocaprogressdialog.cpp
@@ -17,10 +17,10 @@
*/
#include "kbuildsycocaprogressdialog.h"
#include <ksycoca.h>
-#include <kprocess.h>
#include <qstandardpaths.h>
#include <klocale.h>
#include <QtDBus/QtDBus>
+#include <QtCore/QProcess>
class KBuildSycocaProgressDialogPrivate
{
@@ -51,9 +51,8 @@ void KBuildSycocaProgressDialog::rebuildKSycoca(QWidget *parent)
} else {
// kded not running, e.g. when using keditfiletype out of a KDE session
QObject::connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), &dlg, \
SLOT(_k_slotFinished()));
- KProcess* proc = new KProcess(&dlg);
- (*proc) << QStandardPaths::findExecutable(KBUILDSYCOCA_EXENAME);
- proc->start();
+ QProcess* proc = new QProcess(&dlg);
+ proc->start(KBUILDSYCOCA_EXENAME);
}
dlg.exec();
}
diff --git a/kio/kio/ksambashare.cpp b/kio/kio/ksambashare.cpp
index 019dd4c..87e4198 100644
--- a/kio/kio/ksambashare.cpp
+++ b/kio/kio/ksambashare.cpp
@@ -29,11 +29,11 @@
#include <QtCore/QFileInfo>
#include <QtCore/QTextStream>
#include <QtCore/QStringList>
+#include <QtCore/QProcess>
#include <kdirwatch.h>
#include <kdebug.h>
#include <kglobal.h>
-#include <kprocess.h>
#include <kuser.h>
// Default smb.conf locations
@@ -108,11 +108,10 @@ void KSambaSharePrivate::setUserSharePath()
int KSambaSharePrivate::runProcess(const QString &progName, const QStringList &args,
QByteArray &stdOut, QByteArray &stdErr)
{
- KProcess process;
+ QProcess process;
- process.setProgram(progName, args);
- process.setOutputChannelMode(KProcess::SeparateChannels);
- process.start();
+ process.setProcessChannelMode(QProcess::SeparateChannels);
+ process.start(progName, args);
//TODO: make it async in future
process.waitForFinished();
@@ -359,7 +358,7 @@ KSambaShareData::UserShareError KSambaSharePrivate::remove(const \
KSambaShareData
args << QLatin1String("usershare") << QLatin1String("delete") << \
shareData.name();
- int result = KProcess::execute(QLatin1String("net"), args);
+ int result = QProcess::execute(QLatin1String("net"), args);
return (result == 0) ? KSambaShareData::UserShareOk : \
KSambaShareData::UserShareSystemError; }
diff --git a/kio/tests/kdcopcheck.cpp b/kio/tests/kdcopcheck.cpp
index 4d48499..832291c 100644
--- a/kio/tests/kdcopcheck.cpp
+++ b/kio/tests/kdcopcheck.cpp
@@ -5,7 +5,6 @@
#include <kstandarddirs.h>
#include <kservicegroup.h>
#include <kprotocolinfo.h>
-#include <kprocess.h>
#include <QtCore/QTimer>
#include <kcmdlineargs.h>
#include "kdcopcheck.h"
diff --git a/knewstuff/knewstuff3/core/engine.cpp \
b/knewstuff/knewstuff3/core/engine.cpp index 50d809c..3cef49f 100644
--- a/knewstuff/knewstuff3/core/engine.cpp
+++ b/knewstuff/knewstuff3/core/engine.cpp
@@ -34,7 +34,6 @@
#include <klocale.h>
#include <kstandarddirs.h>
#include <kcodecs.h>
-#include <kprocess.h>
#include <kshell.h>
#include <kio/job.h>
diff --git a/knewstuff/knewstuff3/core/security.cpp \
b/knewstuff/knewstuff3/core/security.cpp index e0176e9..0cf3b45 100644
--- a/knewstuff/knewstuff3/core/security.cpp
+++ b/knewstuff/knewstuff3/core/security.cpp
@@ -27,6 +27,7 @@
#include <QtCore/QStringList>
#include <QtCore/QTextStream>
#include <QtCore/QTimer>
+#include <QtCore/QStringList>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QCryptographicHash>
@@ -42,7 +43,6 @@ typedef QCryptographicHash Q5CryptographicHash;
#include <klocale.h>
#include <kmessagebox.h>
#include <kpassworddialog.h>
-#include <kprocess.h>
#include <kstandarddirs.h>
using namespace KNS3;
@@ -78,9 +78,9 @@ void Security::readKeys()
}
m_runMode = List;
m_keys.clear();
- m_process = new KProcess();
- *m_process << gpgExecutable()
- << "--no-secmem-warning"
+ m_process = new QProcess();
+ QStringList arguments;
+ arguments << "--no-secmem-warning"
<< "--no-tty"
<< "--with-colon"
<< "--list-keys";
@@ -88,7 +88,7 @@ void Security::readKeys()
this, SLOT(slotFinished(int,QProcess::ExitStatus)));
connect(m_process, SIGNAL(readyReadStandardOutput()),
this, SLOT(slotReadyReadStandardOutput()));
- m_process->start();
+ m_process->start(gpgExecutable(), arguments);
if (!m_process->waitForStarted()) {
KMessageBox::error(0L, i18n("<qt>Cannot start <i>gpg</i> and retrieve the \
available keys. Make sure that <i>gpg</i> is installed, otherwise verification of \
downloaded resources will not be possible.</qt>")); delete m_process;
@@ -104,9 +104,9 @@ void Security::readSecretKeys()
return;
}
m_runMode = ListSecret;
- m_process = new KProcess();
- *m_process << gpgExecutable()
- << "--no-secmem-warning"
+ m_process = new QProcess();
+ QStringList arguments;
+ arguments << "--no-secmem-warning"
<< "--no-tty"
<< "--with-colon"
<< "--list-secret-keys";
@@ -114,7 +114,7 @@ void Security::readSecretKeys()
this, SLOT(slotFinished(int,QProcess::ExitStatus)));
connect(m_process, SIGNAL(readyReadStandardOutput()),
this, SLOT(slotReadyReadStandardOutput()));
- m_process->start();
+ m_process->start(gpgExecutable(), arguments);
if (!m_process->waitForStarted()) {
delete m_process;
m_process = 0;
@@ -276,9 +276,9 @@ void Security::slotCheckValidity()
m_signatureKey.trusted = false;
//verify the signature
- m_process = new KProcess();
- *m_process << gpgExecutable()
- << "--no-secmem-warning"
+ m_process = new QProcess();
+ QStringList arguments;
+ arguments << "--no-secmem-warning"
<< "--status-fd=2"
<< "--command-fd=0"
<< "--verify"
@@ -288,7 +288,7 @@ void Security::slotCheckValidity()
this, SLOT(slotFinished(int,QProcess::ExitStatus)));
connect(m_process, SIGNAL(readyReadStandardOutput()),
this, SLOT(slotReadyReadStandardOutput()));
- m_process->start();
+ m_process->start(gpgExecutable(), arguments);
if (m_process->waitForStarted())
m_gpgRunning = true;
else {
@@ -357,9 +357,9 @@ void Security::slotSignFile()
m_secretKey = secretKeys[0];
//verify the signature
- m_process = new KProcess();
- *m_process << gpgExecutable()
- << "--no-secmem-warning"
+ m_process = new QProcess();
+ QStringList arguments;
+ arguments << "--no-secmem-warning"
<< "--status-fd=2"
<< "--command-fd=0"
<< "--no-tty"
@@ -374,7 +374,7 @@ void Security::slotSignFile()
connect(m_process, SIGNAL(readyReadStandardOutput()),
this, SLOT(slotReadyReadStandardOutput()));
m_runMode = Sign;
- m_process->start();
+ m_process->start(gpgExecutable(), arguments);
if (m_process->waitForStarted())
m_gpgRunning = true;
else {
diff --git a/knewstuff/knewstuff3/core/security.h \
b/knewstuff/knewstuff3/core/security.h index 4c14b7a..d6420c7 100644
--- a/knewstuff/knewstuff3/core/security.h
+++ b/knewstuff/knewstuff3/core/security.h
@@ -32,7 +32,6 @@ struct KeyStruct {
bool secret;
};
-class KProcess;
namespace KNS3
{
@@ -126,7 +125,7 @@ private:
QMap<QString, KeyStruct> m_keys; /// holds information about the available key
QString m_fileName; /// the file to sign/verify
QString m_secretKey; /// the key used for signing
- KProcess *m_process;
+ QProcess *m_process;
private Q_SLOTS:
void slotFinished(int exitCode, QProcess::ExitStatus exitStatus);
diff --git a/kunitconversion/currency.cpp b/kunitconversion/currency.cpp
index e43f6f8..c4930af 100644
--- a/kunitconversion/currency.cpp
+++ b/kunitconversion/currency.cpp
@@ -25,10 +25,10 @@
#include <QtCore/QFileInfo>
#include <QtCore/QDateTime>
#include <QtCore/QMutex>
+#include <QtCore/QProcess>
#include <QtXml/QDomDocument>
#include <kdebug.h>
#include <klocale.h>
-#include <kprocess.h>
#include <kstandarddirs.h>
#ifndef KUNITCONVERSION_NO_SOLID
@@ -550,7 +550,10 @@ Value Currency::convert(const Value& value, UnitPtr to)
*/
kDebug() << "Removed previous cache:" << QFile::remove(m_cache);
#ifndef KUNITCONVERSION_NO_KIO
- if (KProcess::execute(QStringList() << "kioclient" << "copy" << \
"--noninteractive" << URL << m_cache) == 0) { + QProcess copyProcess;
+ copyProcess.start("kioclient", QStringList() << "copy" << \
"--noninteractive" << URL << m_cache); + copyProcess.waitForFinished(-1);
+ if (copyProcess.exitStatus() == QProcess::NormalExit && \
copyProcess.exitCode() == 0) { m_update = true;
}
#else
diff --git a/plasma/remote/signing.cpp b/plasma/remote/signing.cpp
index 3515d73..56e940c 100644
--- a/plasma/remote/signing.cpp
+++ b/plasma/remote/signing.cpp
@@ -39,7 +39,6 @@
#include <kdirwatch.h>
#include <kdebug.h>
#include <kstandarddirs.h>
-#include <kprocess.h>
#include <kuser.h>
#include "plasma/package.h"
diff --git a/security/crypto/crypto.cpp b/security/crypto/crypto.cpp
index a192a10..5a9660e 100644
--- a/security/crypto/crypto.cpp
+++ b/security/crypto/crypto.cpp
@@ -60,7 +60,6 @@
#include <kmessagebox.h>
#include <kpassworddialog.h>
#include <knewpassworddialog.h>
-#include <kprocess.h>
#include <kpushbutton.h>
#include <k3resolver.h>
#include <kseparator.h>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic