Review Request 120460: [kio] Imported the filenamesearch ioslave from Dolphin

David Faure faure at kde.org
Mon Oct 20 00:28:32 BST 2014


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


OK this wasn't too long, I reviewed it directly. It's even better, I can complain about all the non-satisfactory code, whether it was just ported or it was that way already :-)


filenamesearch/kio_filenamesearch.cpp
<https://git.reviewboard.kde.org/r/120460/#comment48005>

    item.text() would probably be better, for these special cases where text != name (name is internal, text is what the user sees in a directory listing)



filenamesearch/kio_filenamesearch.cpp
<https://git.reviewboard.kde.org/r/120460/#comment47999>

    Can this url parameter be a local path?
    With its name I would expect a full URL - in which case QUrl(...) should be enough.



filenamesearch/kio_filenamesearch.cpp
<https://git.reviewboard.kde.org/r/120460/#comment48003>

    No, this should be toLocalFile()
    (it makes a difference on Windows)



filenamesearch/kio_filenamesearch.cpp
<https://git.reviewboard.kde.org/r/120460/#comment48001>

    Wow, won't this be really slow? which "remote" protocols is it typically used with? Any? Well, if it's an explicit request from the user I guess that's OK...



filenamesearch/kio_filenamesearch.cpp
<https://git.reviewboard.kde.org/r/120460/#comment48002>

    This code is keeping the filename of a file that is about to be deleted (by the QTemporaryFile destructor). So the reading will fail for sure. Sounds like this wasn't properly tested :-)
    
    For small files, KIO::get would even be better (contents in memory). But OK, if the files can be huge, I guess a tempfile is better.
    
    One easy solution is to move the QTemporaryFile to the method scope, so it keeps existing until the end of the method. Given that the ctor doesn't do much (only assembling the tempfile template name) the performance penalty would probably be not too bad. Alternatively, move the QFile+QTextStream code to a helper function and call it in each of the two cases (local or remote) separately. Would be better for performance.


- David Faure


On Oct. 13, 2014, 1:35 p.m., Emmanuel Pescosta wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/120460/
> -----------------------------------------------------------
> 
> (Updated Oct. 13, 2014, 1:35 p.m.)
> 
> 
> Review request for kde-workspace and David Faure.
> 
> 
> Repository: kio-extras
> 
> 
> Description
> -------
> 
> The filenamesearch ioslave lists all files/folders which match with the given search query.
> 
> Made some small adjustments:
> * Ported the ioslave to Qt5/KF5
> * Got rid of cleanup() and member variables
> * Use lambda function validators instead of some weird if + assert things in searchDirectory/contentContainsPattern
> * Immediately return when the search string is empty
>  
> https://projects.kde.org/projects/kde/applications/kde-baseapps/repository/revisions/frameworks/show/dolphin/src/search
> 
> 
> Diffs
> -----
> 
>   filenamesearch/kio_filenamesearch.h PRE-CREATION 
>   filenamesearch/kio_filenamesearch.cpp PRE-CREATION 
>   CMakeLists.txt 2036392 
>   filenamesearch/CMakeLists.txt PRE-CREATION 
>   filenamesearch/filenamesearch.protocol PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/120460/diff/
> 
> 
> Testing
> -------
> 
> Compiles.
> 
> 
> Thanks,
> 
> Emmanuel Pescosta
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20141019/23631c1f/attachment.htm>


More information about the kde-core-devel mailing list