Bug 197195 - KFileDialog: Slashes corrupt filter when converting from Qt
Summary: KFileDialog: Slashes corrupt filter when converting from Qt
Status: RESOLVED FIXED
Alias: None
Product: kfile
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-19 22:07 UTC by Felix Geyer
Modified: 2009-07-23 03:34 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Replace "/" with "\\/" in qt2KdeFilter() (675 bytes, patch)
2009-06-21 12:37 UTC, Felix Geyer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Geyer 2009-06-19 22:07:01 UTC
Version:            (using KDE 4.2.4)
OS:                Linux
Installed from:    Ubuntu Packages

When KFileDialog converts a Qt filter that contains slashes ('/') the resulting filter doesn't match any files.
This happens when using Qt applications with the style set to Oxygen or QtCurve.

Example:
The VirtualBox frontend (written in Qt) uses the following filter: "CD/DVD-ROM images (*.iso);;All files (*)".
When using the Oxygen style the displayed filter is ", , , " and it doesn't match any files.
Other styles such as Plastique and GTK work fine.

I suspect that slash have to be escaped to "\\/" (in qt2KdeFilter() ?).
Comment 1 Michael Pyne 2009-06-20 03:15:33 UTC
I can confirm the proximate bug, but it's not caused by the style directly.  When using a KDE style Qt tries to use the native KDE file dialogs as well, which handles the filters differently, assuming the the slash represents a mimetype (so the cause is Qt "upgrading" VirtualBox's QFileDialog to a KFileDialog, but it's still a KDE bug).

If you were to do this with a KDE application the filters would never work (the API docs for KFileDialog do refer to the mimetype filter assumption).

I think it would be best to make the mimetype filter handling only take effect for valid mimetypes instead of just detecting "/".
Comment 2 Felix Geyer 2009-06-21 12:37:52 UTC
Created attachment 34711 [details]
Replace "/" with "\\/" in qt2KdeFilter()

Replacing "/" with "\\/" in qt2KdeFilter() fixes the bug.
Comment 3 Anne-Marie Mahfouf 2009-06-21 13:39:53 UTC
Comment on attachment 34711 [details]
Replace "/" with "\\/" in qt2KdeFilter()

patch
Comment 4 Felix Geyer 2009-07-03 19:22:22 UTC
Comment on attachment 34711 [details]
Replace "/" with "\\/" in qt2KdeFilter()

Submitted to Review Board:
http://reviewboard.kde.org/r/934/
Comment 5 Dario Andres 2009-07-22 17:24:41 UTC
@Michael: any possibility of reviewing the patch before commiting ?
Comment 6 Christoph Feck 2009-07-22 23:30:11 UTC
SVN commit 1001314 by cfeck:

Correctly handle slashes when converting filters from Qt

Patch by Felix Geyer, reviewed by Albert Astals Cid
See http://reviewboard.kde.org/r/934/

BUG: 197195


 M  +1 -1      kfiledialog.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1001314
Comment 7 Christoph Feck 2009-07-22 23:31:33 UTC
SVN commit 1001316 by cfeck:

Correctly handle slashes when converting filters from Qt (backport r1001314)

CCBUG: 197195


 M  +1 -1      kfiledialog.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1001316
Comment 8 Michael Pyne 2009-07-23 03:34:08 UTC
I'm late to the party but the patch looks good IMO.