<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/102388/">http://git.reviewboard.kde.org/r/102388/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 22nd, 2011, 4:06 p.m., <b>David Faure</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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/102388/diff/2/?file=32528#file32528line624" style="color: black; font-weight: bold; text-decoration: underline;">kio/kio/copyjob.cpp</a>
<span style="font-weight: normal;">
(Diff revision 2)
</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 CopyJobPrivate::slotExistingFile(int id)</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">621</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">time_t</span> <span class="n">destmtime</span> <span class="o">=</span> <span class="p">(</span><span class="n">time_t</span><span class="p">)</span> <span class="n">entry</span><span class="p">.</span><span class="n">numberValue</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_MODIFICATION_TIME</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span> <span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">No C-style casts please. Use static_cast<time_t>(foo) or constructor-syntax like time_t(foo).</pre>
</blockquote>
<p>On August 22nd, 2011, 10:37 p.m., <b>Cyril Oblikov</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">But it is very common in copyjob.cpp:
`grep "(time_t)" copyjob.cpp | wc -l` says 17.
Should I replace them all?</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">OK, old code shows bad example :-)
Leave it as is for now, and fix them all in a separate commit later.</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 22nd, 2011, 4:06 p.m., <b>David Faure</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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/102388/diff/2/?file=32532#file32532line47" style="color: black; font-weight: bold; text-decoration: underline;">kio/kio/interactiondialog/allinteractionitem.h</a>
<span style="font-weight: normal;">
(Diff revision 2)
</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; ">public:</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">47</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="n">QVariantList</span> <span class="n">AllInteractionItem</span><span class="o">::</span><span class="n">header</span> <span class="o">=</span> <span class="n">QVariantList</span><span class="p">()</span> <span class="o"><<</span> <span class="n">i18n</span><span class="p">(</span><span class="s">"File"</span><span class="p">)</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">You can't use i18n in a header file, nor in a static object. Instead, fill the list on demand when needed for the first time (if empty then append...).
It's either that or I18N_NOOP, but in this case I think on demand is simpler.
No static objects in libraries, too, so this should be a function-static (e.g. make a file-static function that has the function-static object, fills it on demand, and returns it).</pre>
</blockquote>
<p>On August 22nd, 2011, 10:39 p.m., <b>Cyril Oblikov</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Hmm... what is file-static and function-static?</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">File-static is a C-style function in a .cpp file. Marked "static" so that it's only visible inside the .cpp file.
A function-static object is "static Foo bar;" inside of a function/method. "Safe" because it's only created when entering the function/method for the first time.
In clear:
static QStringList allInteractionItemHeaders() {
static QStringList s_headers;
if (s_headers.isEmpty()) {
s_headers << i18n("...") << ...;
}
return s_headers;
}
In a CPP file, not in a header file :)</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 22nd, 2011, 4:06 p.m., <b>David Faure</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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/102388/diff/2/?file=32541#file32541line73" style="color: black; font-weight: bold; text-decoration: underline;">kio/kio/interactiondialog/interactiondialogtab.cpp</a>
<span style="font-weight: normal;">
(Diff revision 2)
</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 InteractionDialogTab::relayout()</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">73</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">while</span> <span class="p">((</span><span class="n">child</span> <span class="o">=</span> <span class="n">m_buttonsLayout</span><span class="o">-></span><span class="n">takeAt</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This looks convoluted.
In fact I'm not sure what this code does; it de-layouts without deleting the widgets? Then it would be simpler to just delete (and recreate) m_buttonsLayout, no?</pre>
</blockquote>
<p>On August 22nd, 2011, 10:37 p.m., <b>Cyril Oblikov</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This is an example from qt doc. It removes all items from a layout. Anyway we need to iterate over all layout items, because it is required to hide old buttons. So I guess deleting and recreating layout would not reduce the code.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well, a simple loop could be used to hide all buttons, but OK. I drop the charges :)</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 22nd, 2011, 4:06 p.m., <b>David Faure</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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/102388/diff/2/?file=32549#file32549line107" style="color: black; font-weight: bold; text-decoration: underline;">kio/kio/jobuidelegate.h</a>
<span style="font-weight: normal;">
(Diff revision 2)
</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; ">public:</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">107</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">virtual</span> <span class="n">InteractionDialog</span> <span class="o">*</span><span class="n">createInteractionDialog</span><span class="p">(</span><span class="n">KJob</span> <span class="o">*</span> <span class="n">job</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This is a BIC change (new virtual method in a public class). However, this patch is for kdelibs-frameworks (future 5.0), so in fact it's the right timing for making such a change. So, no objection, I just wanted to point this out for clarity :)</pre>
</blockquote>
<p>On August 22nd, 2011, 10:37 p.m., <b>Cyril Oblikov</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm not sure this method should be virtual.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Actually it could be useful. E.g. for unittests, which could test that the interactiondialog is called, without actually showing a dialog.
If you had more time for your SOC I would strongly recommend to add unit tests as the next step, BTW...
But did you at least run jobtest (in kdelibs/kio/tests) to make sure that the new code doesn't break it? E.g. the creation of a dialog for sure broke it, but now you've fixed that bit.</pre>
<br />
<p>- David</p>
<br />
<p>On August 22nd, 2011, 11:12 p.m., Cyril Oblikov 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 and David Faure.</div>
<div>By Cyril Oblikov.</div>
<p style="color: grey;"><i>Updated Aug. 22, 2011, 11:12 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;">Modeless dialog to handle interactions and modifications in CopyJob.</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/CMakeLists.txt <span style="color: grey">(b517621)</span></li>
<li>kio/kio/copyjob.h <span style="color: grey">(eb88c7a)</span></li>
<li>kio/kio/copyjob.cpp <span style="color: grey">(eff7825)</span></li>
<li>kio/kio/interactiondialog/abstractinteractionitem_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/abstractinteractionmodel.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/abstractinteractionmodel_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/allinteractionitem.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/allinteractionitem_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/allinteractionmodel.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/allinteractionmodel_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/existinginteractionitem.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/existinginteractionitem_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/existinginteractionmodel.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/existinginteractionmodel_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/interactiondialog.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/interactiondialog.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/interactiondialogtab.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/interactiondialogtab_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/renameinteractionwidget.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/renameinteractionwidget.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/requestitemmodel.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/requestitemmodel_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/unreadableinteractionitem.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/unreadableinteractionitem_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/unreadableinteractionmodel.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/interactiondialog/unreadableinteractionmodel_p.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kio/kio/jobuidelegate.h <span style="color: grey">(25e0728)</span></li>
<li>kio/kio/jobuidelegate.cpp <span style="color: grey">(85679c2)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/102388/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>