Use QProcess instead of the low-level API popen(). Thanks to André Wöbbeking for the hint.

svn path=/trunk/KDE/kdebase/apps/; revision=1004024
This commit is contained in:
Peter Penz 2009-07-29 06:31:20 +00:00
parent 9eaecac019
commit d4ba16b900

View file

@ -19,8 +19,6 @@
#include "revisioncontrolplugin.h" #include "revisioncontrolplugin.h"
#include <stdio.h>
RevisionControlPlugin::RevisionControlPlugin() RevisionControlPlugin::RevisionControlPlugin()
{ {
} }
@ -35,15 +33,17 @@ RevisionControlPlugin::~RevisionControlPlugin()
#include <kaction.h> #include <kaction.h>
#include <kdialog.h> #include <kdialog.h>
#include <kfileitem.h>
#include <kicon.h> #include <kicon.h>
#include <klocale.h> #include <klocale.h>
#include <krun.h> #include <krun.h>
#include <kshell.h> #include <kshell.h>
#include <kfileitem.h>
#include <kvbox.h> #include <kvbox.h>
#include <QDir> #include <QDir>
#include <QLabel> #include <QLabel>
#include <QProcess>
#include <QString> #include <QString>
#include <QStringList>
#include <QTextEdit> #include <QTextEdit>
#include <QTextStream> #include <QTextStream>
@ -101,14 +101,17 @@ bool SubversionPlugin::beginRetrieval(const QString& directory)
{ {
Q_ASSERT(directory.endsWith('/')); Q_ASSERT(directory.endsWith('/'));
const QString statusCommand = "svn status " + directory; QStringList arguments;
FILE* in = popen(statusCommand.toAscii().data(), "r"); arguments << "status" << directory;
if (in == 0) {
QProcess process;
process.start("svn", arguments);
if (!process.waitForReadyRead()) {
return false; return false;
} }
char buffer[1024]; char buffer[1024];
while (fgets(buffer, sizeof(buffer), in) != 0) { while (process.readLine(buffer, sizeof(buffer)) > 0) {
RevisionState state = NormalRevision; RevisionState state = NormalRevision;
switch (buffer[0]) { switch (buffer[0]) {