[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:23:46 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=0509197

The following commit has been merged in the master branch:
commit 050919718a46aa16707cc6b79fbae87e07c998b6
Author: Andrea Scarpino <andrea at archlinux.org>
Date:   Fri Apr 5 20:46:54 2013 +0200

    Latex filter: delete all temporary files
---
 filters/latex/latex-filter.cpp | 26 +++++++++++++++-----------
 filters/latex/latex-filter.h   |  1 -
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/filters/latex/latex-filter.cpp b/filters/latex/latex-filter.cpp
index 8f31faa..4e9601f 100644
--- a/filters/latex/latex-filter.cpp
+++ b/filters/latex/latex-filter.cpp
@@ -88,16 +88,15 @@ QString LatexFilter::handleLatex(const QString &latexFormula)
                     .arg(latexFormula));
     latexText.append(QLatin1String("\end{document}"));
 
-    KTemporaryFile *texFile(new KTemporaryFile);
-    texFile->setPrefix(QLatin1String("ktplatex-"));
-    texFile->setSuffix(QLatin1String(".tex"));
-    if (!texFile->open()) {
+    KTemporaryFile texFile;
+    texFile.setPrefix(QLatin1String("ktplatex-"));
+    texFile.setSuffix(QLatin1String(".tex"));
+    if (!texFile.open()) {
       kError() << "Cannot create the TeX file";
       return QString();
     }
-    texFile->write(latexText.toAscii());
-    texFile->close();
-    m_tempFiles << texFile;
+    texFile.write(latexText.toAscii());
+    texFile.close();
 
     if (LatexConfig::latexCmd().isEmpty()) {
         kError() << "No TeX compiler set!";
@@ -111,7 +110,7 @@ QString LatexFilter::handleLatex(const QString &latexFormula)
     }
     const KStandardDirs outputDir;
     latexArgs << QString(QLatin1String("-output-directory=%1")).arg(outputDir.resourceDirs("tmp").first());
-    latexArgs << texFile->fileName();
+    latexArgs << texFile.fileName();
 
     if (KStandardDirs::findExe(latexCmd.first()).isEmpty()) {
         kError() << "Cannot find the TeX" << latexCmd.first() << " program.
;"
@@ -136,8 +135,8 @@ QString LatexFilter::handleLatex(const QString &latexFormula)
         return QString();
     }
 
-    const QString dviFile = texFile->fileName().replace(QLatin1String(".tex"),QLatin1String(".dvi"));
-    const QString imageFile = texFile->fileName().replace(QLatin1String(".tex"),QLatin1String(".png"));
+    const QString dviFile = texFile.fileName().replace(QLatin1String(".tex"), QLatin1String(".dvi"));
+    const QString imageFile = texFile.fileName().replace(QLatin1String(".tex"), QLatin1String(".png"));
 
     QStringList dvipngArgs;
     dvipngArgs << QLatin1String("-D300");
@@ -158,6 +157,12 @@ QString LatexFilter::handleLatex(const QString &latexFormula)
     file.open(QIODevice::ReadOnly);
     QByteArray image = file.readAll();
 
+    // We don't need the files anymore
+    QFile::remove(dviFile);
+    QFile::remove(imageFile);
+    QFile::remove(texFile.fileName().replace(QLatin1String(".tex"), QLatin1String(".aux")));
+    QFile::remove(texFile.fileName().replace(QLatin1String(".tex"), QLatin1String(".log")));
+
     return QString::fromAscii(image.toBase64());
 }
 
@@ -173,7 +178,6 @@ bool LatexFilter::isSafe(const QString &latexFormula)
 
 LatexFilter::~LatexFilter()
 {
-    qDeleteAll(m_tempFiles);
 }
 
 K_PLUGIN_FACTORY(MessageFilterFactory, registerPlugin<LatexFilter>();)
diff --git a/filters/latex/latex-filter.h b/filters/latex/latex-filter.h
index cd4ca08..eef653a 100644
--- a/filters/latex/latex-filter.h
+++ b/filters/latex/latex-filter.h
@@ -35,7 +35,6 @@ public:
 private:
     bool isSafe(const QString &latexFormula);
     QString handleLatex(const QString &latexFormula);
-    QList<KTemporaryFile *> m_tempFiles;
 
 };
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list