Add functions returning all definitions for a mimetype or file name
ClosedPublic

Authored by davschul on Feb 14 2019, 7:20 AM.

Details

Summary

This can be used to show UI controls to let the user decide which definition should be used
for a specific file.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
davschul created this revision.Feb 14 2019, 7:20 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptFeb 14 2019, 7:20 AM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
davschul requested review of this revision.Feb 14 2019, 7:20 AM
cullmann requested changes to this revision.Feb 14 2019, 7:23 AM
cullmann added a subscriber: cullmann.

Makes sense.

Could you add a @since 5.56 to the doxygen?

Otherwise this seems fine.

This revision now requires changes to proceed.Feb 14 2019, 7:23 AM
davschul updated this revision to Diff 51649.Feb 14 2019, 8:17 AM
cullmann accepted this revision.Feb 14 2019, 8:45 AM

Thanks => will push that.

This revision is now accepted and ready to land.Feb 14 2019, 8:45 AM
This revision was automatically updated to reflect the committed changes.

Nice respond times here, and thanks for the reviews :)

Thanks.

Nice that we get the patches, then all can benefit from the improvements.

dhaumann added inline comments.
src/lib/repository.h
176

As I understand, this currently is unsorted. Wouldn't it make sense to sort the returned vector by priority?

This information is also missing currently in the API documentation: I had to read the code to understand whether the Definitions in the QVector are sorted or not. Same for definitionsForMimeType().

Any comments?

cullmann reopened this revision.Feb 17 2019, 10:51 AM

I would propose:

Use the m_sortedDefs as base for the searching.
Return the vector after the bestCandidate did the sort.

That would yield in my eyes the most useful sorting: all things with the same priority that match have the original sort as in definitions() and you get best candidates first.

This revision is now accepted and ready to land.Feb 17 2019, 10:51 AM

Created https://phabricator.kde.org/D19200
That should implement all the latest suggestions/comments