QFileDialog provides functionality for several use-cases, the most typical ones being (I'm trying to sort them in descending order of popularity, as I estimate it):
- Choose an existing file
- Decide a (possibly new) filename to save to
- Choose an existing directory
- Choose existing files
I assume that we'll keep all the above functionality provided in a single component, but this might also be a subject for discussion.
So, here's my proposal: FileBrowser and FileDialog.
DESCRIPTION: a file browser widget. This is not a dialog, but a widget which can be embedded in any item, which could watch its filePath and filePaths properties and change its behaviour based on the selected files.
bool selectMultiple: whether multiple file selection is allowed.
QDir::Filters selectFilters: we might reuse QDir::Filters, or create a new Flags. The fundamental feature I'd like to achieve here is to be able to tell the component whether we want to select a file or a directory. Having additional flags for specifying permissions is nice, but I don't think it's so important. So, I would also be content with a simple bool selectFolder property (default: false).
string folder: the initial folder where the browser will open; if unset, the initial folder could be the user home. This property will be updated as the user browses through different directories.
string filePath: the full URL of the currently selected file
list<string> filePaths: if selectMultiple is true, a list of URLs holding the currently selected files
list<string> nameFilters: list of file name filters, analogue to the homonymous property of FolderListModel (http://qt-project.org/doc/qt-4.8/qml-folderlistmodel.html#nameFilters-prop).
DESCRIPTION: a file chooser dialog. It would be a Dialog subclass, and be based on the FileBrowser widget described above.
It would alias all the properties exposed by FileBrowser, plus:
bool selectExisting: if true, only existing objects can be chosen. Of course, more advanced versions of the FileBrowser component (the desktop version of it, for instance) could allow the user to create a file/directory on the fly, and pick them. I don't think we need an additional flag to control this.
I think that the API of the FileDialog component described above would be able to provide the main functionalities that QFileDialog is typically used for.