<table><tr><td style="">dfaure requested changes to this revision.<br />dfaure added a comment.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D22105">View Revision</a></tr></table><br /><div><div><p>Almost there :-)</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D22105#inline-127770">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:406</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #304a96">#ifdef Q_OS_WIN</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #74777d">// TODO Check if this works for other OSes too.</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">fileType</span> <span style="color: #aa2211">=</span> <span class="n">QT_STAT_LNK</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Yes, QT_STAT_LNK works on Unix too, we use it in many places in KIO<br />
(and it has the value S_IFLNK)</p>
<p style="padding: 0; margin: 8px;">So I'm pretty sure you can remove this ifdef.</p>
<p style="padding: 0; margin: 8px;">You could also replace S_IFREG with QT_STAT_REG and S_IFDIR with QT_STAT_DIR, for consistency.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D22105#inline-127773">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:2032</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span class="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span style="color: #aa4000">else</span> <span style="color: #aa4000">if</span> <span class="p">(<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">QT_STAT</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"> </span><span class="n"><span class="bright">Q</span>File<span class="bright"></span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="bright"></span><span class="n"><span class="bright">encodeName</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">sPart</span></span><span class="bright"></span><span class="p"><span class="bright">),</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"></span><span class="n"><span class="bright">buff</span></span><span class="bright"> </span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">==</span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">0</span></span><span class="p">)</span> <span class="p">{</span> <span style="color: #74777d">// should a very small ".part" be deleted?</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">else</span> <span style="color: #aa4000">if</span> <span class="p">(<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">part</span>File<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">exists</span></span><span class="bright"></span><span class="p"><span class="bright">()</span>)</span> <span class="p">{</span> <span style="color: #74777d">// should a very small ".part" be deleted?</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa4000">const</span> <span style="color: #aa4000">int</span> <span class="n">size</span> <span style="color: #aa2211">=</span> <span class="n">config</span><span class="p">()</span><span style="color: #aa2211">-></span><span class="n">readEntry</span><span class="p">(</span><span style="color: #766510">"MinimumKeepSize"</span><span class="p">,</span> <span class="n">DEFAULT_MINIMUM_KEEP_SIZE</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">At this point we were doing another stat() in order to see how big the part file is *after* sftpGet.<br />
You're reusing the old QFileInfo so that won't contain updated data.</p>
<p style="padding: 0; margin: 8px;">You need to call QFileInfo::refresh() first.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D22105#inline-127775">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:2050</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">receivedFile</span><span class="p">.</span><span class="n">setFileTime</span><span class="p">(</span><span class="n">partFile</span><span class="p">.</span><span class="n">fileTime</span><span class="p">(</span><span class="n">QFileDevice</span><span style="color: #aa2211">::</span><span class="n">FileAccessTime</span><span class="p">),</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QFileDevice</span><span style="color: #aa2211">::</span><span class="n">FileAccessTime</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Sorry I gave wrong advice.<br />
The old code was preserving the atime just because the utime() API forces us to specify an atime.<br />
But what we want to do here is set the modification time, nothing else.<br />
We don't care about the access time at all.<br />
Please just remove this line.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D22105#inline-125697">View Inline</a><span style="color: #4b4d51; font-weight: bold;">albertvaka</span> wrote in <span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:2257</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">You can keep QT_STAT_LNK on every platform and remove the ifdef. That's the point of the abstraction Qt provides.</p>
<p style="padding: 0; margin: 8px;">For consistency, I would also change the other (S_IFDIR, etc.) to their Qt counterparts.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This is marked as Done, but it's not Done. In fact it matches my own suggestion above, so I agree with Albert ;-)</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R320 KIO Extras</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22105">https://phabricator.kde.org/D22105</a></div></div><br /><div><strong>To: </strong>brute4s99, albertvaka, vonreth, sredman, sitter, dfaure<br /><strong>Cc: </strong>pino, andriusr, kde-frameworks-devel, kfm-devel, aprcela, fprice, LeGast00n, sbergeron, fbampaloukas, alexde, feverfew, meven, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, mikesomov<br /></div>