Created attachment 120238 [details] Sample program to reproduce the issue SUMMARY (This is a follow-up for bug 407642.) If your filter list has two matching filters for an extension, KFileWidget will return the name of the first filter when calling QFileDialog::selectedNameFilter(), even if the second filter was selected in the dialog. STEPS TO REPRODUCE 1. Compile and run the attached program 2. Make sure that "auto extension" checkbox is enabled 3. Select the last file filter (DocBook (.xml)) via dropdown list 4. Click "Save" 5. Check program output OBSERVED RESULT The output is "Word 2003 XML (.xml) (*.xml)" EXPECTED RESULT The output should be "DocBook (.xml) (*.xml)", since this was selected in the file dialog. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Operating System: Debian GNU/Linux 10 KDE Plasma Version: 5.14.5 Qt Version: 5.11.3 KDE Frameworks Version: 5.54.0 (+ backported fix for bug 407642 on top of kio package) Kernel Version: 4.19.0-5-amd64 OS Type: 64-bit Processors: 4 × Intel® Core™ i7-6500U CPU @ 2.50GHz Memory: 31.3 GiB of RAM ADDITIONAL INFORMATION I used the "kio" version from Debian testing (version 5.54.1-1) and added the fix for bug 407642 on top for testing.
Pending chnage on Phabricator: https://phabricator.kde.org/D21959
Git commit 0f529bca29ba020820b0702ec5e28e9346d1e76d by David Faure, on behalf of Robert Hoffmann. Committed on 27/06/2019 at 19:18. Pushed by dfaure into branch 'Plasma/5.16'. Fix selectedNameFilter() multiple matches Summary: If your filter list has two matching filters for an extension, KFileWidget will return the name of the first filter when calling QFileDialog::selectedNameFilter(), even if the second filter was selected in the dialog. This is a follow-up for https://phabricator.kde.org/D21249 Test Plan: 1. Compile and run the attached program to the bug report 407819 2. Make sure that "auto extension" checkbox is enabled 3. Select the last file filter (DocBook (.xml)) via dropdown list 4. Click "Save" 5. Check program output Result without this patch: The output is "Word 2003 XML (.xml) (*.xml)" Result with this patch applied: The output should be "DocBook (.xml) (*.xml)", since this was selected in the file dialog. Reviewers: #frameworks, apol, dfaure Reviewed By: dfaure Subscribers: michaelweghorn, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D21959 M +17 -0 autotests/kfiledialog_unittest.cpp M +1 -0 src/platformtheme/kdeplatformfiledialogbase_p.h M +9 -3 src/platformtheme/kdeplatformfiledialoghelper.cpp M +1 -0 src/platformtheme/kdeplatformfiledialoghelper.h M +5 -0 src/platformtheme/kdirselectdialog.cpp M +1 -0 src/platformtheme/kdirselectdialog_p.h https://commits.kde.org/plasma-integration/0f529bca29ba020820b0702ec5e28e9346d1e76d