D8087: Make HtmlWriter compatible with Grantlee::OutputStream

Sandro Knauß noreply at phabricator.kde.org
Sun Oct 1 15:48:16 BST 2017


knauss added a comment.


  and bump mimetreeparser version :D

INLINE COMMENTS

> defaultrenderer.cpp:348
> +    {
> +        BufferedHtmlWriter::end();
> +        return QString::fromUtf8(data());

should this be flush() instead of end, because there is no rule not adding antoher thing after reading.

> defaultrenderer.cpp:955
>          }
> -        const auto html = t->render(&c);
> -        htmlWriter->write(html);
> +        Grantlee::OutputStream s(htmlWriter->stream());
> +        t->render(&s, &c);

this looks very implictit and hard to understand what is going on, maybe a function to HtmlWriter to handle this directly, because we'll use this all over the place, but the disadvante is that we add Grantlee dependes to mimetreeparser, so it's a no-go

  htmlWriter->addGrantleeOutput(t, &c);

so maybe better add a util method:

  AddGrantlleOutputToHtmlWriter(t, &c, htmlWriter);

> filehtmlwriter.cpp:59
>  {
> -    flush();
> -    mStream.setDevice(nullptr);

shouldn't we still flush, at the end?

> htmlwriter.h:82
> +    /** Returns the QIODevice backing this HtmlWriter instance.
> +     *  Before writing to this directly, make sure to flush stream().
> +     */

you removed everywhere the flush but add in the docu, that it needs to be flushed, that sounds wired

REPOSITORY
  R94 PIM: Message Library

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

To: vkrause, knauss
Cc: #kde_pim, dvasin, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20171001/d4793ea7/attachment.html>


More information about the kde-pim mailing list