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

List:       kde-frameworks-devel
Subject:    Re: Review Request 121094: KCoreAddons: add KTextToHTML class for plaintext -> HTML conversion
From:       "Laurent Montel" <montel () kde ! org>
Date:       2014-11-11 12:22:50
Message-ID: 20141111122250.2122.97658 () probe ! kde ! org
[Download RAW message or body]

--===============9221846419083931887==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121094/#review70234
-----------------------------------------------------------



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49110>

    same here



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49111>

    QStringLiteral here ?



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49112>

    QStringLiteral ?



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49104>

    ++helper.mpos;



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49105>

    ++x



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49106>

    same here



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49107>

    same here



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49108>

    same here



src/lib/text/ktexttohtml.cpp
<https://git.reviewboard.kde.org/r/121094/#comment49109>

    same here


- Laurent Montel


On nov. 10, 2014, 3:59 après-midi, Dan Vrátil wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121094/
> -----------------------------------------------------------
> 
> (Updated nov. 10, 2014, 3:59 après-midi)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Repository: kcoreaddons
> 
> 
> Description
> -------
> 
> This class comes from KPimUtils::LinkLocator from kdepimlibs.git. This class takes \
> plaintext string, and converts it to HTML while perserving spacing, converting URLs \
> and email addresses into <a href...> links and interpreting highligting markup \
> (*bold*, _underline_, /italic/) and wrapping it to corresponding HTML tags. It can \
> also convert text emoticons into <img> smileys. 
> The last - emoticons conversion - depends on KEmoticons, which we can't use \
> directly from KCoreAddons, so I moved the actual KEmoticons code into \
> FrameworkIntegration plugin. There is a dummy implementation provided by default in \
> KCoreAddons that is loaded when the FrameworkIntegration plugin is not available, \
> or when the application is only a QCoreApplication (since KEmoticons require \
> QGuiApplication, so we must not load the plugin). The dummy implementation does \
> nothing and returns the original string unaltered. 
> The reason for moving the class from KPimUtils is that KPimUtils is going to die, \
> and while we could make this internal to KDE PIM, I think this is a rather useful \
> code, that can be used by many applications that need to deal with 3rd party text \
> data and want to provide user-friendly clickable links. 
> If you compare this with the original KPimUtils::LinkLocator you find, that I \
> removed all public API except for the convertToHTML method. This is because the \
> remaining methods (getUrl, getEmailAddress) depend on the actual state of the \
> LinkLocator object, but LinkLocator provides no API for step-by-step parsing, so \
> they were actually useless for public use. For that reason I decided to only \
> publish the convertToHTML method, and hide the remaining methods as internal \
> methods of the KTextToHTMLHelper (useful for unit-testing). 
> This patch also contains a unit-test from KPimUtils.
> 
> 
> Diffs
> -----
> 
> autotests/ktexttohtmltest.cpp PRE-CREATION 
> src/lib/CMakeLists.txt 1dc5627 
> src/lib/text/ktexttohtml.h PRE-CREATION 
> src/lib/text/ktexttohtml.cpp PRE-CREATION 
> src/lib/text/ktexttohtml_p.h PRE-CREATION 
> src/lib/text/ktexttohtmlemoticonsinterface.h PRE-CREATION 
> autotests/CMakeLists.txt d5a5feb 
> autotests/ktexttohtmltest.h PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/121094/diff/
> 
> 
> Testing
> -------
> 
> Unit test passes
> 
> 
> Thanks,
> 
> Dan Vrátil
> 
> 


--===============9221846419083931887==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




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











<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line242" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">242</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            \
<span class="n">mPos</span><span class="o">++</span><span \
class="p">;</span></pre></td>  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">same \
here</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line287" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">287</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">QRegExp</span><span class="p">(</span><span class="n">QString</span><span \
class="o">::</span><span class="n">fromLatin1</span><span class="p">(</span><span \
class="s">&quot;</span><span class="se">\\</span><span class="s">%1((</span><span \
class="se">\\</span><span class="s">w+)([</span><span class="se">\\</span><span \
class="s">s-&#39;]</span><span class="se">\\</span><span class="s">w+)*( \
?[,.:</span><span class="se">\\</span><span class="s">?!;])?)</span><span \
class="se">\\</span><span class="s">%2&quot;</span><span class="p">).</span><span \
class="n">arg</span><span class="p">(</span><span class="n">ch</span><span \
class="p">).</span><span class="n">arg</span><span class="p">(</span><span \
class="n">ch</span><span class="p">));</span></pre></td>  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">QStringLiteral here ?</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line324" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">324</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="k">return</span> <span class="n">QString</span><span class="o">::</span><span \
class="n">fromLatin1</span><span class="p">(</span><span \
class="s">&quot;data:image/png;base64,%1&quot;</span><span class="p">).</span><span \
class="n">arg</span><span class="p">(</span><span class="n">QLatin1String</span><span \
class="p">(</span><span class="n">ba</span><span class="p">.</span><span \
class="n">toBase64</span><span class="p">().</span><span \
class="n">constData</span><span class="p">()));</span></pre></td>  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">QStringLiteral ?</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line358" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">358</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="n">helper</span><span class="p">.</span><span class="n">mPos</span><span \
class="o">++</span><span class="p">;</span></pre></td>  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">++helper.mpos;</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line359" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">359</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="n">x</span><span class="o">++</span><span class="p">;</span></pre></td>  \
</tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">++x</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line363" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">363</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="n">helper</span><span class="p">.</span><span class="n">mPos</span><span \
class="o">--</span><span class="p">;</span></pre></td>  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">same \
here</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line364" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">364</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="n">x</span><span class="o">--</span><span class="p">;</span></pre></td>  \
</tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">same \
here</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line378" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">378</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="n">x</span><span class="o">++</span><span class="p">;</span></pre></td>  \
</tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">same \
here</p></pre>  </div>
</div>
<br />

<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121094/diff/1/?file=327569#file327569line380" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/text/ktexttohtml.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">380</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="n">x</span><span class="o">--</span><span class="p">;</span></pre></td>  \
</tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">same \
here</p></pre>  </div>
</div>
<br />



<p>- Laurent Montel</p>


<br />
<p>On novembre 10th, 2014, 3:59 après-midi UTC, Dan Vrátil 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 KDE Frameworks.</div>
<div>By Dan Vrátil.</div>


<p style="color: grey;"><i>Updated nov. 10, 2014, 3:59 après-midi</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kcoreaddons
</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;">This class comes from KPimUtils::LinkLocator from \
kdepimlibs.git. This class takes plaintext string, and converts it to HTML while \
perserving spacing, converting URLs and email addresses into &lt;a href...&gt; links \
and interpreting highligting markup (<em style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: normal;">bold</em>, <em \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">underline</em>, /italic/) and wrapping it to corresponding HTML tags. It can \
also convert text emoticons into &lt;img&gt; smileys.</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The \
last - emoticons conversion - depends on KEmoticons, which we can't use directly from \
KCoreAddons, so I moved the actual KEmoticons code into FrameworkIntegration plugin. \
There is a dummy implementation provided by default in KCoreAddons that is loaded \
when the FrameworkIntegration plugin is not available, or when the application is \
only a QCoreApplication (since KEmoticons require QGuiApplication, so we must not \
load the plugin). The dummy implementation does nothing and returns the original \
string unaltered.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">The reason for moving the class from \
KPimUtils is that KPimUtils is going to die, and while we could make this internal to \
KDE PIM, I think this is a rather useful code, that can be used by many applications \
that need to deal with 3rd party text data and want to provide user-friendly \
clickable links.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">If you compare this with the original \
KPimUtils::LinkLocator you find, that I removed all public API except for the \
convertToHTML method. This is because the remaining methods (getUrl, getEmailAddress) \
depend on the actual state of the LinkLocator object, but LinkLocator provides no API \
for step-by-step parsing, so they were actually useless for public use. For that \
reason I decided to only publish the convertToHTML method, and hide the remaining \
methods as internal methods of the KTextToHTMLHelper (useful for unit-testing).</p> \
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This patch also contains a unit-test from \
KPimUtils.</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;">Unit test passes</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>autotests/ktexttohtmltest.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/lib/CMakeLists.txt <span style="color: grey">(1dc5627)</span></li>

 <li>src/lib/text/ktexttohtml.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>src/lib/text/ktexttohtml.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/lib/text/ktexttohtml_p.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/lib/text/ktexttohtmlemoticonsinterface.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>autotests/CMakeLists.txt <span style="color: grey">(d5a5feb)</span></li>

 <li>autotests/ktexttohtmltest.h <span style="color: grey">(PRE-CREATION)</span></li>

</ul>

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






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








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


--===============9221846419083931887==--



_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


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

Configure | About | News | Add a list | Sponsored by KoreLogic