Add mimetype filtering capabilities to KUrlCompletion

Authored by mwolff on Aug 24 2017, 8:43 PM.



This feature already exists in QFileDialog, but is so far missing
from KCompletion. This in turn makes KUrlRequester's mimetype filter
look broken, as it "only" works for the dialog but not the lineedit!

Setting a mimetype filter list will exclude any files with a mime-
type name that is not contained in the filter list. Note that
directories are never matched against the mimetype filter.

With this patch applied, the filter is also properly applied via
KCompletion to the lineedit of a KUrlRequester.

Diff Detail

R241 KIO
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
mwolff created this revision.Aug 24 2017, 8:43 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 24 2017, 8:43 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
mwolff added a comment.EditedAug 24 2017, 8:45 PM

Note that the test passes, but I noticed that the KURLCOMPLETION_LOCAL_KIO branch is not covered by unit tests. Setting it even shows that the test is then broken (even without this patch).

Also, creating a new thread for every completion request is not a good idea. This code severly needs a cleanup to use QThreadPool (e.g. via QtConcurrent or ThreadWeaver)

dfaure requested changes to this revision.Aug 24 2017, 9:03 PM

Almost perfect ;-)


Please revert -- and use kdebugsettings next time, to enable categorized debug output ;)


This revision now requires changes to proceed.Aug 24 2017, 9:03 PM
This revision was automatically updated to reflect the committed changes.

Almost perfect ;-)

Indeed, should have reviewed it closer myself. Fixed and pushed - thanks for the review David!