From 62ba0d45d017adb25006973e1e2fd0b3be205ebd Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 15 Jul 2007 16:08:55 +0000 Subject: [PATCH] k3procio-- svn path=/trunk/KDE/kdegraphics/okular/; revision=688262 --- generators/dvi/psgs.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/generators/dvi/psgs.cpp b/generators/dvi/psgs.cpp index a5da72df3..569168ff2 100644 --- a/generators/dvi/psgs.cpp +++ b/generators/dvi/psgs.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -213,7 +212,7 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co // Step 2: Call GS with the File QFile::remove(filename.toAscii()); - K3ProcIO proc; + KProcess proc; QStringList argus; argus << "gs"; argus << "-dSAFER" << "-dPARANOIDSAFER" << "-dDELAYSAFER" << "-dNOPAUSE" << "-dBATCH"; @@ -231,10 +230,14 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co #endif proc << argus; - if (proc.start(K3Process::Block) == false) { + proc.start(); + if (!proc.waitForStarted()) { // Starting ghostscript did not work. // TODO: Issue error message, switch PS support off. kError(kvs::dvi) << "ghostview could not be started" << endl; + } else { + while(!proc.waitForFinished(10)) + qApp->processEvents(); } PSfile.remove(); @@ -245,7 +248,9 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co // No. Check is the reason is that the device is not compiled into // ghostscript. If so, try again with another device. QString GSoutput; - while(proc.readln(GSoutput) != -1) { + proc.setReadChannel(QProcess::StandardOutput); + while(proc.canReadLine()) { + GSoutput = QString::fromLocal8Bit(proc.readLine()); if (GSoutput.contains("Unknown device")) { kDebug(kvs::dvi) << QString("The version of ghostview installed on this computer does not support " "the '%1' ghostview device driver.").arg(*gsDevice) << endl;