Bug 357865 - The QPA file dialog does not respect mime type filters
Summary: The QPA file dialog does not respect mime type filters
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-frameworkintegration
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks: 363672
  Show dependency treegraph
 
Reported: 2016-01-11 19:50 UTC by Boudhayan Gupta
Modified: 2020-03-27 04:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boudhayan Gupta 2016-01-11 19:50:49 UTC
Here's a case description:

1. I obtain a list of mimetypes
    QStringList mimeTypes = {"image/bmp", "image/png" ...};

2. I set this on a QFileDialog
    QFileDialog::setMimeTypeFilters(mimeTypes);

3. Now I explicitly set my selected mimeType to be PNG
    QFileDialog::selectMimeTypeFilter("image/png");

4. I select a nonexistent filename (I intend to save file as this name)
    QFileDialog::selectFile("Something.png");

What is supposed to happen is that the file name field shows "Something.png" and the mimetype field shows "image/png".

What does happen is that the filename field shows "Something.bmp" and the mimetype field shows "image/bmp". BMP is the first element in the list of mimetypes. Omitting the call to selectMimeTypeFilter causes the mimetype field stays empty, but the filename still ends in ".bmp"

AcceptMode is AcceptSave and FileMode is AnyFile.

With the Qt file dialog (QFileDialog::setOption(QFileDialog::DontUseNativeDialog)), the correct behaviour is seen.

Reproducible: Always
Comment 1 Nicolas F. 2016-08-22 14:35:14 UTC
If I comment out dialog.setOption(QFileDialog::DontUseNativeDialog); in spectacle for the native dialog, I see that the Save As mimetype filter is not set to "image/png", but it's not set to image/bmp like the original report appears to imply. Was the behaviour of this changed at some point without the ticket being mentioned in the commit?

Also, arguably this makes this bug quite a bit less severe. The image now properly is a PNG, it's just not filtered for image/png.
Comment 2 Ahmad Samir 2020-02-26 14:11:59 UTC
Can you still reproduce this issue?
Comment 3 Bug Janitor Service 2020-03-12 04:33:13 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2020-03-27 04:33:12 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!