https://bugs.kde.org/show_bug.cgi?id=483350

            Bug ID: 483350
           Summary: Name filters with parenthesis in name are truncated
                    with native KF6 file dialog
    Classification: Frameworks and Libraries
           Product: frameworks-kio
           Version: git master
          Platform: Neon
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Open/save dialogs
          Assignee: kio-bugs-n...@kde.org
          Reporter: m.wegh...@posteo.de
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

Created attachment 167044
  --> https://bugs.kde.org/attachment.cgi?id=167044&action=edit
Sample program to reproduce the bug

SUMMARY
QFileDialog allows the use of named filters, e.g. QFileDialog::setNameFilters
to set filters and QFileDialog::selectedNameFilter to retrieve the currently
selected filter.

However, QFileDialog::selectedNameFilter currently doesn't return the full name
of the actually selected filter when that one contains text in parenthesis in
addition to the file extensions when using the KF6 version.
The KF5 one works or non-native Qt one works as expected.

STEPS TO REPRODUCE
1. create a dummy file to select: `mkdir dummy.ods`
2. compile attached sample program main.cpp with Qt 6 and run it on KDE Plasma
6
3. select the "ODF Spreadsheet" filter in the file dialog
4. select the dummy file created in step 1
5. click "Open"
6. check the output on stderr

OBSERVED RESULT

The returned filter lacks the " (.ods") part that was set in parenthesis before
using QFileDialog::setNameFilters: 

> selected filter:  "ODF Spreadsheet (*.ods)"

EXPECTED RESULT

The actually selected filter should be returned including the text in brackets:

> selected filter:  "ODF Spreadsheet (.ods) (*.ods)"

This works as expected when building against Qt 5 instead (so that the KF 5
version is used) or explicitly disabling the use of the native KF 6
implementation by setting the QFileDialog::DontUseNativeDialog option on the
dialog (s. line 17 in the sample program, recompile with that line uncommented
to make it work).

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.5.0-25-generic (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i7-8850H CPU @ 2.60GHz
Memory: 11,4 GiB of RAM
Graphics Processor: llvmpipe
Manufacturer: QEMU
Product Name: Standard PC (Q35 + ICH9, 2009)
System Version: pc-q35-7.2

ADDITIONAL INFORMATION

This bug breaks saving files in LibreOffice when using the kf6 integration and
was originally reported there:
https://bugs.documentfoundation.org/show_bug.cgi?id=159701
This is a follow-up for bug 481287, which solved part of the problem.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to