emateli added a comment.

  In D14631#499038 <https://phabricator.kde.org/D14631#499038>, @dfaure wrote:
  > KIO::move (implemented by CopyJob) can move N files to a single destination 
directory, but they get the same name at that dest.
  >  KIO::moveAs (implemented by CopyJob too) can move/rename a single file to 
a specific filename at destination.
  > What you're suggesting is a new job that can move N files to a destination 
directory (to make this generic it doesn't have to be in-place renames, 
right?), but you're providing the filename at destination for each file, right?
  More or less but they don't have to be in the same directory. Think of it as 
a sequence of `KIO::moveAs` operations. Any N files can be moved anywhere.
  > I could imagine a KIO::moveAs that takes two QList<QUrl> and then this 
information is fetched from there rather than using m_dest.
  >  In fact, if the existing moveAs() method is ported to call the two-QLists 
one, that will mean less special casing in the code (which wouldn't use m_dest 
anymore in slotResultStating, when m_asMethod).
  The two list version could work, but I was thinking of one 
`QList<QSomeStruct>` that contains src and dest names. Looks less error prone 
IMO. Also yes, moveAs can be implemented as a special case of this with just 
one item to move. The option of adapting move to accept a list of dest also 
involves modifying CopyJobPrivate's dest which will lead to a larger 
refactoring needed than the proposal below, right?
  I was thinking of implementing this as a new subclass of Job where it will 
create the new Job and add a subjob for each of the files to be moved. In the 
same fashion that the current `BatchRenameJob` works. Otherwise if overloading 
will not break binary compatibility then this can be an overloaded 
`KIO::moveAs(QList<SomeStruct>)` which again does the same thing, a series of 
the current `moveAs`. It also has to remain as a single job so that it can be 
undone in one go instead of undoing for each item that was renamed.
    auto items = {
            KioRenameItem{QUrl("~/a.doc"), QUrl("~/Documents/a.doc")},
            KioRenameItem{QUrl("~/dir/file"), QUrl("~/Documents/file-2019")},
  If this looks OK then I'll just get started with this and continue this part 
of the work in another patch.

  R241 KIO


To: emateli, #frameworks, dfaure, mlaurent
Cc: anthonyfieroni, chinmoyr, mlaurent, asensi, rkflx, dfaure, aacid, ngraham, 
kde-frameworks-devel, LeGast00n, sbergeron, michaelh, bruns

Reply via email to