[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Review Request 122314: Sanitize whitespace in notification popups
From:       "Martin Klapetek" <martin.klapetek () gmail ! com>
Date:       2015-01-30 11:37:56
Message-ID: 20150130113756.13679.46499 () probe ! kde ! org
[Download RAW message or body]

--===============2893368735669282773==
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/122314/
-----------------------------------------------------------

(Updated Jan. 30, 2015, 12:37 p.m.)


Review request for Plasma.


Changes
-------

Fix the regexp; I went with my extended version as in the best case that \
one will not do a single replace (case when there are only single <br/>s)


Bugs: 343532
    https://bugs.kde.org/show_bug.cgi?id=343532


Repository: plasma-workspace


Description
-------

While looking into https://bugs.kde.org/show_bug.cgi?id=343532 I noticed \
that wall sends message always starting with \n, but with our limited \
space, that makes no sense.

With this patch the text is first trimmed from whitespace at the beginning \
and end, then all \ns are converted to <br/> (as before), then the text \
replaces all remaining inner whitespace with single space and finally, if \
there are two new lines in succession, it turns it into just one.

The bug itself, which is about messages from wall not appearing in the \
popup, will only partially get solved by this as the popup is limited in \
max height, so it displays at most 3 lines of text and with wall first two \
lines are already taken, that leaves just one line for the actual message.

However these are persistant so they get saved in the notification history \
anyway.


Diffs (updated)
-----

  dataengines/notifications/notificationsengine.cpp 6e566b4 

Diff: https://git.reviewboard.kde.org/r/122314/diff/


Testing
-------

Now I'm able to see the message sent with wall.


Thanks,

Martin Klapetek


--===============2893368735669282773==
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/122314/">https://git.reviewboard.kde.org/r/122314/</a>
  </td>
    </tr>
   </table>
   <br />





<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.</div>
<div>By Martin Klapetek.</div>


<p style="color: grey;"><i>Updated Jan. 30, 2015, 12:37 p.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: \
1.5em;">Changes</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;">Fix the regexp; I went with my extended version as in the best \
case that one will not do a single replace (case when there are only single \
&lt;br/&gt;s)</pre>  </td>
 </tr>
</table>





<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=343532">343532</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;">While looking into \
https://bugs.kde.org/show_bug.cgi?id=343532 I noticed that wall sends \
message always starting with \n, but with our limited space, that makes no \
sense.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">With this patch the text is \
first trimmed from whitespace at the beginning and end, then all \ns are \
converted to &lt;br/&gt; (as before), then the text replaces all remaining \
inner whitespace with single space and finally, if there are two new lines \
in succession, it turns it into just one.</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">The bug itself, which is about messages from wall not appearing \
in the popup, will only partially get solved by this as the popup is \
limited in max height, so it displays at most 3 lines of text and with wall \
first two lines are already taken, that leaves just one line for the actual \
message.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">However these are persistant \
so they get saved in the notification history anyway.</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;">Now I'm able to see the \
message sent with wall.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> \
(updated)</h1> <ul style="margin-left: 3em; padding-left: 0;">

 <li>dataengines/notifications/notificationsengine.cpp <span style="color: \
grey">(6e566b4)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/122314/diff/" \
style="margin-left: 3em;">View Diff</a></p>






  </td>
 </tr>
</table>




  </div>
 </body>
</html>


--===============2893368735669282773==--



_______________________________________________
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