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

List:       kde-core-devel
Subject:    Re: Review Request 111852: Ensure MImeType's XML Data is Loaded before Returning Properties
From:       "David Faure" <faure () kde ! org>
Date:       2013-08-03 12:32:00
Message-ID: 20130803123200.15969.63432 () vidsolbach ! de
[Download RAW message or body]

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111852/#review37022
-----------------------------------------------------------



kdecore/services/kmimetype.cpp
<http://git.reviewboard.kde.org/r/111852/#comment27334>

    This will load the xml even when calling property("Name"), which is a bit of a \
waste.  
    Maybe the best solution is to check for "Comment" in this code rather than \
delegate it to KServiceTypePrivate::property, and implement it with return comment().



kdecore/services/kmimetype.cpp
<http://git.reviewboard.kde.org/r/111852/#comment27333>

    So this should just be return patterns(); instead.


- David Faure


On Aug. 3, 2013, 11:31 a.m., David Narváez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111852/
> -----------------------------------------------------------
> 
> (Updated Aug. 3, 2013, 11:31 a.m.)
> 
> 
> Review request for kdelibs and David Faure.
> 
> 
> Description
> -------
> 
> Comment information is found in the XML data so needs to be loaded before returning \
> property values. The same would apply for the Patterns property if you were to \
> query that from the property name instead of the KMimeType::patterns() method. 
> 
> This addresses bug 322578.
> http://bugs.kde.org/show_bug.cgi?id=322578
> 
> 
> Diffs
> -----
> 
> kdecore/services/kmimetype.cpp d748523 
> 
> Diff: http://git.reviewboard.kde.org/r/111852/diff/
> 
> 
> Testing
> -------
> 
> Executed the same code posted in the bug report, here's the output:
> 
> ("Name", "Comment", "Patterns", "Icon") 
> QVariant(QString, "PNG image") 
> 
> 
> Thanks,
> 
> David Narváez
> 
> 


[Attachment #3 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/111852/">http://git.reviewboard.kde.org/r/111852/</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="http://git.reviewboard.kde.org/r/111852/diff/1/?file=176033#file176033line438" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kdecore/services/kmimetype.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

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

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KMimeTypePrivate::save( QDataStream&amp; _str )</pre></td>

  </tr>
 </tbody>



 
 

 <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">438</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">ensureXmlDataLoaded</span><span class="p">();</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This will \
load the xml even when calling property(&quot;Name&quot;), which is a bit of a waste.

Maybe the best solution is to check for &quot;Comment&quot; in this code rather than \
delegate it to KServiceTypePrivate::property, and implement it with return \
comment().</pre> </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="http://git.reviewboard.kde.org/r/111852/diff/1/?file=176033#file176033line441" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kdecore/services/kmimetype.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

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

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KMimeTypePrivate::save( QDataStream&amp; _str )</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">439</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">return</span> <span class="n">QVariant</span><span class="p">(</span> <span \
class="n">m_lstPatterns</span> <span class="p">);</span></pre></td>  <th \
bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">441</font></th>  <td bgcolor="#ffffff" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">return</span> <span class="n">QVariant</span><span class="p">(</span> <span \
class="n">m_lstPatterns</span> <span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">So this \
should just be return patterns(); instead.</pre> </div>
<br />



<p>- David</p>


<br />
<p>On August 3rd, 2013, 11:31 a.m. UTC, David Narváez wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kdelibs and David Faure.</div>
<div>By David Narváez.</div>


<p style="color: grey;"><i>Updated Aug. 3, 2013, 11:31 a.m.</i></p>






<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;">Comment information is found in the XML data so needs to be loaded \
before returning property values. The same would apply for the Patterns property if \
you were to query that from the property name instead of the KMimeType::patterns() \
method.</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;">Executed the same code posted in the bug report, here&#39;s the output:

(&quot;Name&quot;, &quot;Comment&quot;, &quot;Patterns&quot;, &quot;Icon&quot;) 
QVariant(QString, &quot;PNG image&quot;) 
</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="http://bugs.kde.org/show_bug.cgi?id=322578">322578</a>


</div>


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

 <li>kdecore/services/kmimetype.cpp <span style="color: grey">(d748523)</span></li>

</ul>

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







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








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



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

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