diff options
author | Elvis Angelaccio <elvis.angelaccio@kde.org> | 2016-09-05 12:32:35 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2017-01-06 16:27:41 +0000 |
commit | 34f82b8abcb279542b6350e70609c549e39caafb (patch) | |
tree | ad66121fcdd09f6e1278e1142f9e17a264863373 /src/widgets/dialogs/qfiledialog_p.h | |
parent | bc80cef1d4bb07605cba81de082625f07fc4136b (diff) |
Improve mime type filters in QFileDialog
This patch improves the handling of mime type filters in QFileDialog.
The main change is in selectMimeTypeFilter(), which was just falling back
unconditionally on selectNameFilter(). Instead, mime type filters should
have an higher priority than name filters.
This patch also adds a new selectedMimeTypeFilter() method, which is used in the unit test.
Change-Id: Ice8bb08f5ff46e4a942d539f6001424eca878f74
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/widgets/dialogs/qfiledialog_p.h')
-rw-r--r-- | src/widgets/dialogs/qfiledialog_p.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index afebad4457..b665b54a9b 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -258,6 +258,8 @@ public: void selectFile_sys(const QUrl &filename); QList<QUrl> selectedFiles_sys() const; void setFilter_sys(); + void selectMimeTypeFilter_sys(const QString &filter); + QString selectedMimeTypeFilter_sys() const; void selectNameFilter_sys(const QString &filter); QString selectedNameFilter_sys() const; ////////////////////////////////////////////// @@ -400,6 +402,20 @@ inline void QFileDialogPrivate::setFilter_sys() helper->setFilter(); } +inline void QFileDialogPrivate::selectMimeTypeFilter_sys(const QString &filter) +{ + if (QPlatformFileDialogHelper *helper = platformFileDialogHelper()) + helper->selectMimeTypeFilter(filter); +} + +QString QFileDialogPrivate::selectedMimeTypeFilter_sys() const +{ + if (QPlatformFileDialogHelper *helper = platformFileDialogHelper()) + return helper->selectedMimeTypeFilter(); + + return QString(); +} + inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter) { if (QPlatformFileDialogHelper *helper = platformFileDialogHelper()) |