Hi, I've read QTBUG-47703 very carefully and I think that adding some file managers is overkill in this particular case. I would suggest the following changes:
1. Extract an abstract class (i.e., interface) for common file operations 2. Both QFile and QDir should implement this interface 3. Unify QDir API, e.g., QDir::remove -> QDir::removeFile, in order to match newly-extracted interface 4. Add a separate class which represents system trash bin and contains appropriate methods (e.g., functionality to check files inside, restore files, empty trash etc.) Also in my point of view, it's not necessary to introduce a new method like "moveToTrash". We can extend method "remove" adding a new parameter that might be either a bool flag or some enum. On 2/7/19 5:03 PM, Volker Hilsheimer wrote: Hi all, TL;DR; we are considering moving file system operations from QFile into a seperate class (or set of classes) for a more consistent and flexible way of moving, copying etc files and directories. The conversation around the design and implementation of an API to move file or directory to the trash in https://bugreports.qt.io/browse/QTBUG-47703 has during the last days moved somewhat beyond that rather straight-forward task, and has become a broader discussion around making file operations accessible outside of the existing set of classes. The relevant disussion starts here: https://bugreports.qt.io/browse/QTBUG-47703?focusedCommentId=445952&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-445952 and I’d like to have a few more eyeballs on that (that ticket is already being watched by 30+ people, so I do anticipate some interest). I’d like to strike the balance between an API that’s easy to use, can deal with both atomic (delete a file) and complex operations (such as copying a file, or moving files between file systems), but that at the same time allows Qt users to control how operations are performed (batching jobs, executing synchronously, or asynchronously with progress updates, perhaps the ability to cancel, rate limit in case of network traffic being involved etc). Thoughts, ideas, and pointers to other frameworks that you believe provide a good API are welcome here in this email thread before moving to a dedicated JIRA ticket. Thiago mentioned the KIO framework as a source for inspiration; I had to deal with IFileManager when implementing moving to trash on Windows. Would be great if we can come up with something that allows us to include the move-to-trash functionality in Qt 5.14. Cheers, Volker _______________________________________________ Development mailing list Development@qt-project.org<mailto:Development@qt-project.org> https://lists.qt-project.org/listinfo/development -- Best Regards, Fanaskov Vitaly Senior Software Engineer The Qt Company / Qt Quick and Widgets Team
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development