D13563: Save and load latex entries render results into cws

Alexander Semke noreply at phabricator.kde.org
Sat Jun 16 10:01:03 UTC 2018


asemke added inline comments.

INLINE COMMENTS

> latexentry.cpp:120
>              const KArchiveFile* imageFile=static_cast<const KArchiveFile*>(imageEntry);
> -            QString dir=QStandardPaths::writableLocation(QStandardPaths::TempLocation) + QLatin1String("/") + QLatin1String("cantor");
> +            QString dir=QStandardPaths::writableLocation(QStandardPaths::TempLocation);
>              imageFile->copyTo(dir);

can be declared const QString& dir.

> latexentry.cpp:122
>              imageFile->copyTo(dir);
> -            QString imagePath=QString(dir+QLatin1String("/")+imageFile->name());
> +            QString imagePath=QDir(dir).absoluteFilePath(imageFile->name());
>  

const QString& imagePath = dir + QDir::separator() + imageFile->name();

This should be faster than your variant.

> latexentry.cpp:160
> +        el.setAttribute(QLatin1String("filename"), url.fileName());
> +    }
> +

will this logic always work? What happens if the temporary file was deleted in between? I think it would be more safer to save the rendered image in LatexEntry::evaluate() to a private member of LatexEntry and to use it in LatexEntry::toXml()  (save it first to a temporary file and add it to archive).

REPOSITORY
  R55 Cantor

REVISION DETAIL
  https://phabricator.kde.org/D13563

To: sirgienko, asemke
Cc: kde-edu, asemke, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20180616/89d491c5/attachment-0001.html>


More information about the kde-edu mailing list