<table><tr><td style="">hein created this revision.<br />Restricted Application added a project: Frameworks.
</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/D6413" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>We've recently been plagued by issues where renaming via KDirModel would<br />
fail to call into the rename() implementation of kio_desktop (which is a<br />
KIO::ForwardingSlaveBase). Instead it would end up doing a copy job on<br />
its own, resulting in file removal + addition events, causing us to<br />
ultimately lose icon positions on the desktop.</p>

<p>While I did work out why this happens through moveAs (it resolves to<br />
local URLs and then does a direct rename on them, bypassing SimpleJob<br />
calling into the slave), I failed to find anything wrong with it,<br />
leaving the reasons for the behavior change as a mystery for now: It's<br />
possible that fixes done to kio_desktop (e.g. <a href="https://phabricator.kde.org/R120:6911541421dc068cee531a5fd5f322c0db5d7492" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">6911541421dc</a> in plasma-<br />
workspace) or porting away from kdelibs4support (<a href="https://phabricator.kde.org/R120:f81c843dcfb3b726358f4324f0c2790dfd387ff8" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">f81c843dcfb3</a>, same<br />
repo) triggered it in some way in concert with KIO changes (super-<br />
ficial bisecting didn't yield anything, though).</p>

<p>Meanwhile, this patch ports setData from moveAs to rename, which uses<br />
SimpleJob directly, successfully calling into the slave (which we<br />
really really want to do, as only the slave will trigger the right<br />
KDirNotify change signals, avoiding a row remove+insert transaction<br />
pair in the model).</p>

<p>This makes sense to me regardless of the behavior issue with moveAs.<br />
While rename doesn't work across destination, setData operates on a<br />
single model index, and only on the file name, so this can't happen<br />
anyway, making rename the semantically correct call to make.<br />
BUG:380897<br />
BUG:380898</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D6413" rel="noreferrer">https://phabricator.kde.org/D6413</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/widgets/kdirmodel.cpp</div></div></div><br /><div><strong>To: </strong>hein, Frameworks, dfaure, davidedmundson<br /></div>