Bug 383151

Summary: No way to specify multiple filters for --getfileopen
Product: [Applications] kdialog Reporter: Kovid Goyal <kovid>
Component: generalAssignee: Brad Hards <bradh>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

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.