[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request 121296: Escape ampersands in notifications
From: "Mark Gaiser" <markg85 () gmail ! com>
Date: 2014-11-30 21:14:19
Message-ID: 20141130211419.22787.77832 () probe ! kde ! org
[Download RAW message or body]
--===============3986961108686964977==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121296/#review71134
-----------------------------------------------------------
This didn't work? http://qt-project.org/doc/qt-5/qstring.html#toHtmlEscaped
- Mark Gaiser
On nov 30, 2014, 8:33 p.m., Kai Uwe Broulik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121296/
> -----------------------------------------------------------
>
> (Updated nov 30, 2014, 8:33 p.m.)
>
>
> Review request for Plasma and Martin Klapetek.
>
>
> Bugs: 341029
> https://bugs.kde.org/show_bug.cgi?id=341029
>
>
> Repository: plasma-workspace
>
>
> Description
> -------
>
> Since notifications now enforce StyledText and due to how QtQuick Text (or \
> QTextDocument for that matter) treat HTML entities, it cuts off text whenever \
> there's a alone & somewhere.
> This fancy regexp from [1] keeps &quot; &amp; &lt; &gt; and \
> &apos; while replacing any other with &. This makes the StyledText \
> enforcement safe for 5.1 imho.
> (My impression is that an & triggeres the "look for the semicolon that terminates \
> this entity" which it won't find and then just cut off the text, see QTBUG-33368, \
> in contrast to every webbrowser that just prints these verbatim)
> [1] https://stackoverflow.com/questions/16423089/regex-match-ampersand-but-not-escaped-xml-characters
>
>
> Diffs
> -----
>
> dataengines/notifications/notificationsengine.cpp 8bc50e7
>
> Diff: https://git.reviewboard.kde.org/r/121296/diff/
>
>
> Testing
> -------
>
> Deleting "Battery & Brightness" undo notification works as expected and kdialog \
> --passivepopup "test & test & test "test"" works as expected
>
> Thanks,
>
> Kai Uwe Broulik
>
>
--===============3986961108686964977==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;"> \
<tr> <td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/121296/">https://git.reviewboard.kde.org/r/121296/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This \
didn't work? http://qt-project.org/doc/qt-5/qstring.html#toHtmlEscaped</p></pre> <br \
/>
<p>- Mark Gaiser</p>
<br />
<p>On november 30th, 2014, 8:33 p.m. UTC, Kai Uwe Broulik wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;"> <tr>
<td>
<div>Review request for Plasma and Martin Klapetek.</div>
<div>By Kai Uwe Broulik.</div>
<p style="color: grey;"><i>Updated nov 30, 2014, 8:33 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://bugs.kde.org/show_bug.cgi?id=341029">341029</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
plasma-workspace
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Since notifications now enforce StyledText and due to \
how QtQuick Text (or QTextDocument for that matter) treat HTML entities, it cuts off \
text whenever there's a alone & somewhere.</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This \
fancy regexp from [1] keeps &amp;quot; &amp;amp; &amp;lt; &amp;gt; \
and &amp;apos; while replacing any other with &amp;. This makes the \
StyledText enforcement safe for 5.1 imho.</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">(My impression is that \
an & triggeres the "look for the semicolon that terminates this entity" which it \
won't find and then just cut off the text, see QTBUG-33368, in contrast to every \
webbrowser that just prints these verbatim)</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">[1] \
https://stackoverflow.com/questions/16423089/regex-match-ampersand-but-not-escaped-xml-characters</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Deleting "Battery & Brightness" undo notification \
works as expected and kdialog --passivepopup "test & test &amp; test \
&quot;test&quot;" works as expected</p></pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>dataengines/notifications/notificationsengine.cpp <span style="color: \
grey">(8bc50e7)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/121296/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
--===============3986961108686964977==--
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic