Bug 383151 - No way to specify multiple filters for --getfileopen
Summary: No way to specify multiple filters for --getfileopen
Status: RESOLVED WORKSFORME
Alias: None
Product: kdialog
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Brad Hards
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-05 02:31 UTC by Kovid Goyal
Modified: 2017-08-06 02:30 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kovid Goyal 2017-08-05 02:31:37 UTC
There is no way to specify multiple filters to a file open dialog. This corresponds to the QFileDialog::setNameFilters function. 

Either add a option such as --file-filter that can be specified multiple times (this is how zenity does it) or allow specifying arbitrary number of arguments to the command. 

In either case, it would be nice if the output of kdialog --version actually output something useful instead of 1.0. That way it would be possible to detect if kdialog supports this feature easily.
Comment 1 Christoph Feck 2017-08-05 13:12:31 UTC
If the filters correspond with MIME types, you work around this and set multiple:

kdialog --getopenfilename ~/ 'text/plain image/png'
Comment 2 Christoph Feck 2017-08-05 13:14:57 UTC
This also works, but requires the user to select the filter:

kdialog --getopenfilename ~/ 'Text Files (*.txt)\nPNG Images (*.png)'

You maybe have to prepend a filter that includes all files to be useful.
Comment 3 Kovid Goyal 2017-08-05 15:28:25 UTC
The mimetypes wont works for what I need. But the \n will, so thanks for that. You might want to document it somewhere.