From 5443da6c2795255db55697471190b3eba16b28dc Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 9 May 2015 14:12:28 +0200 Subject: QFileDialog: add setSupportedSchemes and pass it along to the QPA. This also finishes the implementation of the static methods which were being passed a supportedSchemes argument but weren't using it. Now they can pass it along to the QFileDialog instance, which then passes it to the helper used by the QPA implementation of the file dialog. The default implementation only supports local files and can therefore ignore this, but other implementations can use this argument to restrict the protocols allowed to the user. [ChangeLog][Widgets][QFileDialog] Add supportedSchemes property. Change-Id: I5235f70e785da1c06866a8355ef98f571890c4a2 Reviewed-by: Kevin Ottens Reviewed-by: Friedemann Kleint --- src/gui/kernel/qplatformdialoghelper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gui/kernel/qplatformdialoghelper.cpp') diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index 2d0458f705..25894fd504 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -422,6 +422,7 @@ public: QUrl initialDirectory; QString initiallySelectedNameFilter; QList initiallySelectedFiles; + QStringList supportedSchemes; }; QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) @@ -613,6 +614,18 @@ void QFileDialogOptions::setInitiallySelectedFiles(const QList &files) d->initiallySelectedFiles = files; } +// Schemes supported by the application +void QFileDialogOptions::setSupportedSchemes(const QStringList &schemes) +{ + d->supportedSchemes = schemes; +} + +QStringList QFileDialogOptions::supportedSchemes() const +{ + return d->supportedSchemes; +} + +// Return true if the URL is supported by the filedialog implementation *and* by the application. bool QPlatformFileDialogHelper::isSupportedUrl(const QUrl &url) const { return url.isLocalFile(); -- cgit v1.2.3