[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Review Request: new kded daemon to check .thumbnail directory
From: "David Faure" <faure () kde ! org>
Date: 2011-10-16 10:39:59
Message-ID: 20111016103959.30785.73319 () vidsolbach ! de
[Download RAW message or body]
-----------------------------------------------------------
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
>
>
[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/102083/">http://git.reviewboard.kde.org/r/102083/</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/102083/diff/4/?file=36621#file36621line56" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.h</a> <span style="font-weight: \
normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">private:</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">56</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">bool</span> <span class="n">rm</span><span class="p">(</span><span \
class="n">KUrl</span> <span class="n">itemToDelete</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 KUrl \
&</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/102083/diff/4/?file=36622#file36622line50" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">50</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="c1">// The documentation sais it should be 1 or 2. But actually it only works \
with 0.</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;">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?</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/102083/diff/4/?file=36622#file36622line56" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">56</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">entriesJob</span><span class="o">-></span><span \
class="n">exec</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, \
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.</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/102083/diff/4/?file=36622#file36622line65" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">65</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">KFileItem</span> <span class="n">file</span><span class="p">(</span><span \
class="n">entryList</span><span class="p">.</span><span class="n">at</span><span \
class="p">(</span><span class="n">i</span><span class="p">),</span> <span \
class="n">KUrl</span><span class="p">(</span><span class="n">mCurrentURL</span><span \
class="p">,</span> <span class="n">entryList</span><span class="p">.</span><span \
class="n">at</span><span class="p">(</span><span class="n">i</span><span \
class="p">).</span><span class="n">stringValue</span><span class="p">(</span><span \
class="n">KIO</span><span class="o">::</span><span class="n">UDSEntry</span><span \
class="o">::</span><span class="n">UDS_NAME</span><span class="p">)),</span> <span \
class="kc">true</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;">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.</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/102083/diff/4/?file=36622#file36622line81" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">81</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">sorted</span><span class="p">.</span><span class="n">insert</span><span \
class="p">(</span><span class="n">mEntriesToSort</span><span class="p">.</span><span \
class="n">at</span><span class="p">(</span><span class="n">i</span><span \
class="p">).</span><span class="n">time</span><span class="p">(</span><span \
class="n">KFileItem</span><span class="o">::</span><span \
class="n">ModificationTime</span><span class="p">)</span> <span class="p">,</span> \
<span class="n">mEntriesToSort</span><span class="p">.</span><span \
class="n">at</span><span class="p">(</span><span class="n">i</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;">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.</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/102083/diff/4/?file=36622#file36622line101" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">101</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="c1">// sort the entries by ModificationTime</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;">The comment \
is wrong, this code is sorting by size [use a different predicate function]</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/102083/diff/4/?file=36622#file36622line123" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">123</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="c1">// sort the entries by ModificationTime</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;">... \
:)</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/102083/diff/4/?file=36622#file36622line143" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">143</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="c1">// </span><span class="cs">TODO</span><span class="c1">:</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;">what's \
the todo? implementing "deleting the oldest"? (better put the TODO inside \
the method then ;)</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/102083/diff/4/?file=36622#file36622line151" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">151</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="c1">// FIXME: Can not delete files with %20 in the filename</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;">Probably \
due to double encoding. Might be fixed by my suggestion of using \
KFileItem(UDSEntry).</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/102083/diff/4/?file=36622#file36622line156" \
style="color: black; font-weight: bold; text-decoration: \
underline;">directoryusagenotifier/cleanupdirectory.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 4)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">void CleanUpDirectory::setupDirectories()</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">156</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">delJob</span><span class="o">-></span><span class="n">exec</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;">Don't \
use exec. Since these are always local files, I would suggest simply \
QFile::remove(itemToDelete.localPath());</pre> </div>
<br />
<p>- David</p>
<br />
<p>On September 21st, 2011, 7:37 p.m., Jaime Torres Amate 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 Jaime Torres Amate.</div>
<p style="color: grey;"><i>Updated Sept. 21, 2011, 7:37 p.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;">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...).</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;">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.</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=79943">79943</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>CMakeLists.txt <span style="color: grey">(1d7c637)</span></li>
<li>directoryusagenotifier/CMakeLists.txt <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/COPYING <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/Messages.sh <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/README <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/cleanupdirectory.h <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/cleanupdirectory.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/directoryusagenotifier.h <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/directoryusagenotifier.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/directoryusagenotifier.desktop <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/directoryusagenotifier.kcfg <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/directoryusagenotifier.notifyrc <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/directoryusagenotifier_config.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/directoryusagenotifier_prefs_base.ui <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/module.h <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/module.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/settings.kcfgc <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/tests/CMakeLists.txt <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>directoryusagenotifier/tests/cleanupunittest.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/102083/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