D6413: Use KIO::rename instead of KIO::moveAs in setData

Eike Hein noreply at phabricator.kde.org
Tue Jun 27 22:42:06 UTC 2017


hein created this revision.
Restricted Application added a project: Frameworks.

REVISION SUMMARY
  We've recently been plagued by issues where renaming via KDirModel would
  fail to call into the rename() implementation of kio_desktop (which is a
  KIO::ForwardingSlaveBase). Instead it would end up doing a copy job on
  its own, resulting in file removal + addition events, causing us to
  ultimately lose icon positions on the desktop.
  
  While I did work out why this happens through moveAs (it resolves to
  local URLs and then does a direct rename on them, bypassing SimpleJob
  calling into the slave), I failed to find anything wrong with it,
  leaving the reasons for the behavior change as a mystery for now: It's
  possible that fixes done to kio_desktop (e.g. https://phabricator.kde.org/R120:6911541421dc068cee531a5fd5f322c0db5d7492 in plasma-
  workspace) or porting away from kdelibs4support (https://phabricator.kde.org/R120:f81c843dcfb3b726358f4324f0c2790dfd387ff8, same
  repo) triggered it in some way in concert with KIO changes (super-
  ficial bisecting didn't yield anything, though).
  
  Meanwhile, this patch ports setData from moveAs to rename, which uses
  SimpleJob directly, successfully calling into the slave (which we
  really really want to do, as only the slave will trigger the right
  KDirNotify change signals, avoiding a row remove+insert transaction
  pair in the model).
  
  This makes sense to me regardless of the behavior issue with moveAs.
  While rename doesn't work across destination, setData operates on a
  single model index, and only on the file name, so this can't happen
  anyway, making rename the semantically correct call to make.
  BUG:380897
  BUG:380898

REPOSITORY
  R241 KIO

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D6413

AFFECTED FILES
  src/widgets/kdirmodel.cpp

To: hein, #frameworks, dfaure, davidedmundson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170627/299f7aa2/attachment.html>


More information about the Kde-frameworks-devel mailing list