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

List:       kde-core-devel
Subject:    Re: Review Request: Add direct support for remote URLs to previewjob
From:       "David Faure" <faure () kde ! org>
Date:       2011-10-21 11:41:20
Message-ID: 20111021114120.25168.60879 () vidsolbach ! de
[Download RAW message or body]

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



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6510>

    const QStringList protocols = ...



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6508>

    Good point, there should be a KService::mimeTypes(). Feel free to add a KDE5 TODO \
to that effect in kservice.h.



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6501>

    ThumbCreator is so that the above servicetype trader query works ;-) The services \
are associated with the "ThumbCreator" servicetype, that's how they get selected.



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6502>

    Remove this if( contains()) line, value() will return an empty list if it's not \
in the hash anyway.



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6509>

    value + modification + insert can be done much simpler.
    You want "find or create", that's what operator[] is for.
    
    QStringList &ms = m_remoteProtocolPlugins[protocol]; // find or create
    
    foreach(...) { ... }
    
    // No need to .insert() afterwards, you have modified the stringlist "in place" \
already.



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6503>

    Where is 'u' used?



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6511>

    Move inside the else().



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6504>

    Ouch, why is there a QUrl here? Make that a KUrl -- and then you don't need 'u' \
indeed.  
    And move it inside the else, you don't need it in the local-path case.



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6507>

    Here again, no reason for a double lookup, contains+value.
    value is enough. If not found, empty stringlist, so contains(mimetype) will say \
false as expected.  => remove the if().



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6506>

    You have a local var "mimeType", why not use it? ;)



kio/kio/previewjob.cpp
<http://git.reviewboard.kde.org/r/102929/#comment6505>

    And this is why you shouldn't use QUrl. As documented in KUrl, QUrl::toString() \
is terribly wrong (gives wrong results when a filename contains a '#' for instance).  \
  Make localUrl a KUrl, and use .url() here.


- David Faure


On Oct. 21, 2011, 11:20 a.m., Sebastian Kügler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102929/
> -----------------------------------------------------------
> 
> (Updated Oct. 21, 2011, 11:20 a.m.)
> 
> 
> Review request for kdelibs.
> 
> 
> Description
> -------
> 
> This patch allows previewjobs to take a URL in case they understand how to deal \
> with that. preview plugis can specify a list of protocols which they support, this \
> is then matched with the scheme of the URL and if supported the URL is passed \
> directly into the plugin. Otherwise, the file is downloaded and passed as local \
> file (this part hasn't changed). 
> A suitable preview plugin that does the job will be submitted separately to \
> kde-runtime. 
> Is this definitively Frameworks 5 material, or would you be OK with adding it to \
> the 4.7 branch? (The latter would mean, we could use vanilla kdelibs for Plasma \
> Active 2 in december.) 
> 
> Diffs
> -----
> 
> kio/kio/previewjob.cpp ff6d340 
> 
> Diff: http://git.reviewboard.kde.org/r/102929/diff/diff
> 
> 
> Testing
> -------
> 
> Generating preview for HTTP URLs, for local files and for remote files without a \
> suitable plugin. 
> 
> Thanks,
> 
> Sebastian Kügler
> 
> 


[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/102929/">http://git.reviewboard.kde.org/r/102929/</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/102929/diff/1/?file=39461#file39461line276" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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 \
PreviewJobPrivate::startPreview()</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">276</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">QStringList</span> <span class="n">p</span> <span class="o">=</span> <span \
class="p">(</span><span class="o">*</span><span class="n">it</span><span \
class="p">)</span><span class="o">-&gt;</span><span class="n">property</span><span \
class="p">(</span><span class="s">&quot;X-KDE-Protocol&quot;</span><span \
class="p">).</span><span class="n">toStringList</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;">const \
QStringList protocols = ...</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/102929/diff/1/?file=39461#file39461line280" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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 \
PreviewJobPrivate::startPreview()</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">280</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="c1">// Filter out non-mimetype servicetypes</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;">Good point, \
there should be a KService::mimeTypes(). Feel free to add a KDE5 TODO to that effect \
in kservice.h.</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/102929/diff/1/?file=39461#file39461line286" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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 \
PreviewJobPrivate::startPreview()</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">286</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="c1">// Not sure &quot;ThumbCreator&quot; does in here, but we don&#39;t \
want it.</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;">ThumbCreator is so that the above servicetype trader query works ;-) The \
services are associated with the &quot;ThumbCreator&quot; servicetype, that&#39;s how \
they get selected.</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/102929/diff/1/?file=39461#file39461line289" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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 \
PreviewJobPrivate::startPreview()</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">289</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="k">if</span> <span class="p">(</span><span \
class="n">m_remoteProtocolPlugins</span><span class="p">.</span><span \
class="n">contains</span><span class="p">(</span><span class="n">protocol</span><span \
class="p">))</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;">Remove this \
if( contains()) line, value() will return an empty list if it&#39;s not in the hash \
anyway.</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/102929/diff/1/?file=39461#file39461line298" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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 \
PreviewJobPrivate::startPreview()</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">298</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">              \
<span class="n">m_remoteProtocolPlugins</span><span class="p">.</span><span \
class="n">insert</span><span class="p">(</span><span class="n">protocol</span><span \
class="p">,</span> <span class="n">mtypes</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;">value + \
modification + insert can be done much simpler. You want &quot;find or create&quot;, \
that&#39;s what operator[] is for.

QStringList &amp;ms = m_remoteProtocolPlugins[protocol]; // find or create

foreach(...) { ... }

// No need to .insert() afterwards, you have modified the stringlist &quot;in \
place&quot; already.</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/102929/diff/1/?file=39461#file39461line597" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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; ">bool \
PreviewJobPrivate::statResultThumbnail()</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">596</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">KUrl</span> <span class="n">u</span> <span class="o">=</span> <span \
class="n">item</span><span class="p">.</span><span class="n">url</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;">Where is \
&#39;u&#39; used?</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/102929/diff/1/?file=39461#file39461line598" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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; ">bool \
PreviewJobPrivate::statResultThumbnail()</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">597</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="k">const</span> <span class="n">QString</span> <span class="n">mimeType</span> \
<span class="o">=</span> <span class="n">item</span><span class="p">.</span><span \
class="n">mimetype</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;">Move inside \
the else().</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/102929/diff/1/?file=39461#file39461line600" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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; ">bool \
PreviewJobPrivate::statResultThumbnail()</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">569</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="k">if</span> \
<span class="p">(</span> <span class="o">!</span><span \
class="n">localPath</span><span class="p">.</span><span class="n">isEmpty</span><span \
class="p">()</span> <span class="p">)</span></pre></td>  <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">599</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="k">const</span> <span class="n">QUrl</span> <span class="n">localUrl</span> \
<span class="o">=</span> <span class="n">QUrl</span><span class="p">(</span><span \
class="n">item</span><span class="p">.</span><span class="n">url</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;">Ouch, why \
is there a QUrl here? Make that a KUrl -- and then you don&#39;t need &#39;u&#39; \
indeed.

And move it inside the else, you don&#39;t need it in the local-path case.</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/102929/diff/1/?file=39461#file39461line607" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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; ">bool \
PreviewJobPrivate::statResultThumbnail()</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">606</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">if</span> <span class="p">(</span><span \
class="n">m_remoteProtocolPlugins</span><span class="p">.</span><span \
class="n">contains</span><span class="p">(</span><span class="n">localUrl</span><span \
class="p">.</span><span class="n">scheme</span><span class="p">()))</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;">Here again, \
no reason for a double lookup, contains+value. value is enough. If not found, empty \
stringlist, so contains(mimetype) will say false as expected. =&gt; remove the \
if().</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/102929/diff/1/?file=39461#file39461line610" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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; ">bool \
PreviewJobPrivate::statResultThumbnail()</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">609</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            \
<span class="k">if</span> <span class="p">(</span><span \
class="n">m_remoteProtocolPlugins</span><span class="p">.</span><span \
class="n">value</span><span class="p">(</span><span class="n">localUrl</span><span \
class="p">.</span><span class="n">scheme</span><span class="p">()).</span><span \
class="n">contains</span><span class="p">(</span><span class="n">item</span><span \
class="p">.</span><span class="n">mimetype</span><span class="p">()))</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;">You have a \
local var &quot;mimeType&quot;, why not use it? ;)</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/102929/diff/1/?file=39461#file39461line619" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/previewjob.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; ">bool \
PreviewJobPrivate::statResultThumbnail()</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">618</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            \
<span class="n">createThumbnail</span><span class="p">(</span><span \
class="n">localUrl</span><span class="p">.</span><span class="n">toString</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;">And this is \
why you shouldn&#39;t use QUrl. As documented in KUrl, QUrl::toString() is terribly \
wrong (gives wrong results when a filename contains a &#39;#&#39; for instance).

Make localUrl a KUrl, and use .url() here.</pre>
</div>
<br />



<p>- David</p>


<br />
<p>On October 21st, 2011, 11:20 a.m., Sebastian Kügler wrote:</p>






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

<div>Review request for kdelibs.</div>
<div>By Sebastian Kügler.</div>


<p style="color: grey;"><i>Updated Oct. 21, 2011, 11:20 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;">This patch allows previewjobs to take a URL in case they understand how \
to deal with that. preview plugis can specify a list of protocols which they support, \
this is then matched with the scheme of the URL and if supported the URL is passed \
directly into the plugin. Otherwise, the file is downloaded and passed as local file \
(this part hasn&#39;t changed).

A suitable preview plugin that does the job will be submitted separately to \
kde-runtime.

Is this definitively Frameworks 5 material, or would you be OK with adding it to the \
4.7 branch? (The latter would mean, we could use vanilla kdelibs for Plasma Active 2 \
in december.)</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;">Generating preview for HTTP URLs, for local files and for remote files \
without a suitable plugin.</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>kio/kio/previewjob.cpp <span style="color: grey">(ff6d340)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/102929/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