OSDN Git Service

okular: make use of KTemporaryFile::filePath()
authorIvailo Monev <xakepa10@gmail.com>
Sat, 8 Oct 2022 21:05:23 +0000 (00:05 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 8 Oct 2022 21:05:23 +0000 (00:05 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
okular/generators/dvi/dviFile.cpp
okular/generators/dvi/psgs.cpp

index 3110d80..f3e7782 100644 (file)
 #include "pageSize.h"
 
 #include <klocale.h>
+#include <ktemporaryfile.h>
 
 #include <QProcess>
-#include <QtCore/qglobal.h>
-#include <QTemporaryFile>
 
 #include <cstdlib>
 
@@ -367,11 +366,7 @@ QString dvifile::convertPDFtoPS(const QString &PDFFilename, QString *converrorms
   }
 
   // Get the name of a temporary file.
-  // Must open the QTemporaryFile to access the name.
-  QTemporaryFile tmpfile;
-  tmpfile.open();
-  const QString convertedFileName = tmpfile.fileName();
-  tmpfile.close();
+  const QString convertedFileName = KTemporaryFile::filePath();
 
   // Use pdf2ps to do the conversion
   QProcess pdf2ps;
@@ -421,7 +416,6 @@ QString dvifile::convertPDFtoPS(const QString &PDFFilename, QString *converrorms
   // deconstructed.
   convertedFiles[PDFFilename] = convertedFileName;
 
-  tmpfile.setAutoRemove(false);
   return convertedFileName;
 }
 
index d865cb2..e1e27e1 100644 (file)
@@ -317,11 +317,7 @@ void ghostscript_interface::graphics(const PageNumber& page, double dpi, long ma
     return;
   }
 
-  QTemporaryFile gfxFile;
-  gfxFile.open();
-  const QString gfxFileName = gfxFile.fileName();
-  // We are want the filename, not the file.
-  gfxFile.close();
+  const QString gfxFileName = KTemporaryFile::filePath();
 
   gs_generate_graphics_file(page, gfxFileName, magnification);