<table><tr><td style="">dfaure added a comment.
</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/D11649">View Revision</a></tr></table><br /><div><div><p>canResume is an "internal" signal, I don't think any apps can do anything meaningful with it, so I don't mind you connecting to it, except that I think this is the wrong layer...</p>
<p>BTW did you notice the section about resuming in docs/design.txt? It might help when thinking about all this.</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/D11649#inline-58684">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:421</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">void</span> <span class="n">JobTest</span><span style="color: #aa2211">::</span><span class="n">fileSlaveCrash</span><span class="p">()</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">That doesn't describe the behaviour anymore, after the fix ;)</p>
<p style="padding: 0; margin: 8px;">Can you find a more descriptive name for which case this is testing?</p>
<p style="padding: 0; margin: 8px;">E.g. I'm not sure why there are two storedPut jobs on the same data -- to test data available after start and data available before start?</p>
<p style="padding: 0; margin: 8px;">But then why not fill in putDataBuffer2 upfront, rather than after 200ms? For readability/clarity, I mean.</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/D11649#inline-58695">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:440</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 class="n">connect</span><span class="p">(</span><span class="n">job</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">KJob</span><span style="color: #aa2211">::</span><span class="n">finished</span><span class="p">,</span> <span class="p">[</span><span style="color: #aa2211">&</span><span class="n">job1Finished</span><span class="p">]</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">job1Finished</span> <span style="color: #aa2211">=</span> <span style="color: #304a96">true</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Apps (and unittests) are supposed to connect to <tt style="background: #ebebeb; font-size: 13px;">result</tt>, not <tt style="background: #ebebeb; font-size: 13px;">finished</tt> (which is only for progress information to go away)</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/D11649#inline-58696">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:462</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: #74777d">// Simulate the transfer is done</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QTimer</span><span style="color: #aa2211">::</span><span class="n">singleShot</span><span class="p">(</span><span style="color: #601200">400</span><span class="p">,</span> <span style="color: #aa4000">this</span><span class="p">,</span> <span class="p">[</span><span style="color: #aa2211">&</span><span class="n">putDataBuffer</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">putDataBuffer2</span><span class="p">](){</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">putDataBuffer</span><span class="p">.</span><span class="n">readChannelFinished</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Maybe do this inside the 200ms lambda, to 1) make sure it happens afterwards (200<400 but QTimer can decide to do both together), and 2) shorten the delay to make the test run faster?</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/D11649#inline-58694">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:467</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 class="n">QTRY_VERIFY</span><span class="p">(</span><span class="n">job1Finished</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QTRY_VERIFY</span><span class="p">(</span><span class="n">job2Finished</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">QVERIFY(job->exec()); would be shorter, removing the need for the first lambda, no?</p>
<p style="padding: 0; margin: 8px;">Or if you want to avoid an infinite hang if the job doesn't finish, QSignalSpy on result + QVERIFY(spy.wait()).</p>
<p style="padding: 0; margin: 8px;">I'm nitpicking, it's just that this form is a bit unusual and a bit more verbose.</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/D11649#inline-58692">View Inline</a><span style="color: #4b4d51; font-weight: bold;">storedtransferjob.cpp:98</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="n">SLOT</span><span class="p">(</span><span class="n">slotStoredDataReq</span><span class="p">(</span><span class="n">KIO</span><span style="color: #aa2211">::</span><span class="n">Job</span><span style="color: #aa2211">*</span><span class="p">,</span><span class="n">QByteArray</span><span style="color: #aa2211">&</span><span class="p">)));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">connect</span><span class="p">(</span><span style="color: #aa4000">this</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">TransferJob</span><span style="color: #aa2211">::</span><span class="n">canResume</span><span class="p">,</span> <span class="p">[</span><span style="color: #aa2211">&</span><span class="n">dd</span><span class="p">](</span><span class="n">KIO</span><span style="color: #aa2211">::</span><span class="n">Job</span><span style="color: #aa2211">*</span><span class="p">,</span> <span class="n">KIO</span><span style="color: #aa2211">::</span><span class="n">filesize_t</span> <span class="n">offset</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">offset</span> <span style="color: #aa2211">!=</span> <span style="color: #601200">0</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">The "Stored" in StoredTransferJob is just convenience (it stores the data for you), that should have no relation to the handling of resume. So I think this should be moved up to the base class TransferJob.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D11649">https://phabricator.kde.org/D11649</a></div></div><br /><div><strong>To: </strong>aacid, Frameworks, dfaure<br /><strong>Cc: </strong>KDE Connect, michaelh, ngraham<br /></div>