Importer: convert all file operations to allow remote URLs

Authored by bdevries on Dec 3 2019, 6:34 PM.

Description

Importer: convert all file operations to allow remote URLs

Summary:
All file operations are updated to allow remote URLs, both on the source
and destination side. This consists mainly of converting local file/dir
operations to KIO calls.
Remote source was already mostly covered.
To support remote destinations, a few adaptations were needed:

  • If destination is remote or a remote server mounted locally, then do not create the temporary directory as a subdir of the destination, but create it locally using default QTemporaryDir().
  • When comparing file contents, if destination is remote, use KIO::storedGet to get the file contents in one go. This is much simpler and more robust than using asynchronous KIO::open calls, but has the drawback that the file is read in one go instead of in chunks.

Test Plan:
Added unit tests for remote source and destination.
Also tested manually by running gwenview_importer with a combination
of remote and local destinations, covering smb and sftp protocols, as
well as remote server mounted locally (e.g. cifs mount).
Also tested on multiple files with the same name existing in source
directory; both identical and different in content.

Reviewers: Gwenview, ngraham

Reviewed By: Gwenview, ngraham

Subscribers: ngraham, Gwenview

Tags: Gwenview

Differential Revision: https://phabricator.kde.org/D24875