Android: fix mimetype/namefilters handling for FileDialog

Android file dialog uses setType() to set the main mimetype for the
dialog if no mimetype or multiple (+1) mimetypes are provided, then
the additional mimetypes can be provided via EXTRA_MIME_TYPES flag.
The problem was that the mimetypes deduction from the namefilters was:

* the namefilter used was empty, now we take the first item
nameFilters(), because mimetypes cannot be changed once the dialog is
open anyway.
* The regex extraction was getting a namefilter ending with an empty
char and that was giving a mimetype of any format thus making it show
all possible files.

Fixes: QTBUG-83089
Change-Id: Ifaef40c2186732ad3a604d28e086409c35dafacf
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit ed431caa27672427d28f8ecde667a3a064ddda7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Assam Boudjelthia 2021-05-18 17:27:40 +03:00 committed by Qt Cherry-pick Bot
parent 45b569071a
commit c55ff0fa0b

Diff Content Not Available