Review Request: new kded daemon to check .thumbnail directory space usage

David Faure faure at kde.org
Sun Oct 16 11:39:59 BST 2011


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



directoryusagenotifier/cleanupdirectory.h
<http://git.reviewboard.kde.org/r/102083/#comment6440>

    const KUrl &



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6441>

    Which docu is wrong? I see 0, 1, and 2 being mentionned both in KIO::stat and in StatJob::setDetails.
    
    OK actually that's for stat(), I don't see any docu for the metadata "details" used by ListJob. Where did you see one?



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6442>

    OUCH, nested event loops are evil, and even more so in kded. Please don't use KJob::exec here. Just let the job run.
    It will autodelete itself, so no need for kill either.



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6443>

    Q_FOREACH would make this simpler and faster (no need to call .at(i) twice)
    
    Also, there's a KFileItem constructor that takes a UDSEntry as input. This way it won't have to stat() again every file, to get its attributes and size.



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6444>

    It would be much faster to sort mEntriesToSort itself, rather than copying into a different container.
    Just use qSort(begin, end, predicate) and write a predicate function which sorts two kfileitems the way you want them sorted.



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6445>

    The comment is wrong, this code is sorting by size [use a different predicate function]



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6446>

    ... :)



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6447>

    what's the todo? implementing "deleting the oldest"? (better put the TODO inside the method then ;)



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6448>

    Probably due to double encoding. Might be fixed by my suggestion of using KFileItem(UDSEntry).



directoryusagenotifier/cleanupdirectory.cpp
<http://git.reviewboard.kde.org/r/102083/#comment6449>

    Don't use exec. Since these are always local files, I would suggest simply QFile::remove(itemToDelete.localPath());


- David Faure


On Sept. 21, 2011, 7:37 p.m., Jaime Torres Amate wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102083/
> -----------------------------------------------------------
> 
> (Updated Sept. 21, 2011, 7:37 p.m.)
> 
> 
> Review request for kdelibs.
> 
> 
> Description
> -------
> 
> Checks the head of a queue of directories every x minutes (default 30) to see if this directory (and children) use more space than the allowed (default 512 Mib). If so, it shows a notification allowing the user to clean the oldest files, open the file manager, or configure the daemon (time to wait for the next directory, delete automatically...).
> 
> 
> This addresses bug 79943.
>     http://bugs.kde.org/show_bug.cgi?id=79943
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt 1d7c637 
>   directoryusagenotifier/CMakeLists.txt PRE-CREATION 
>   directoryusagenotifier/COPYING PRE-CREATION 
>   directoryusagenotifier/Messages.sh PRE-CREATION 
>   directoryusagenotifier/README PRE-CREATION 
>   directoryusagenotifier/cleanupdirectory.h PRE-CREATION 
>   directoryusagenotifier/cleanupdirectory.cpp PRE-CREATION 
>   directoryusagenotifier/directoryusagenotifier.h PRE-CREATION 
>   directoryusagenotifier/directoryusagenotifier.cpp PRE-CREATION 
>   directoryusagenotifier/directoryusagenotifier.desktop PRE-CREATION 
>   directoryusagenotifier/directoryusagenotifier.kcfg PRE-CREATION 
>   directoryusagenotifier/directoryusagenotifier.notifyrc PRE-CREATION 
>   directoryusagenotifier/directoryusagenotifier_config.cpp PRE-CREATION 
>   directoryusagenotifier/directoryusagenotifier_prefs_base.ui PRE-CREATION 
>   directoryusagenotifier/module.h PRE-CREATION 
>   directoryusagenotifier/module.cpp PRE-CREATION 
>   directoryusagenotifier/settings.kcfgc PRE-CREATION 
>   directoryusagenotifier/tests/CMakeLists.txt PRE-CREATION 
>   directoryusagenotifier/tests/cleanupunittest.cpp PRE-CREATION 
> 
> Diff: http://git.reviewboard.kde.org/r/102083/diff/diff
> 
> 
> Testing
> -------
> 
> It works as expected.
> It shows the notification, and deletes the oldest files in the .thumbnail directory until the files left use less or equal space than the specified.
> 
> 
> Thanks,
> 
> Jaime Torres Amate
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20111016/0cb1dbac/attachment.htm>


More information about the kde-core-devel mailing list