Add helper function to determine mime type based on content and extension
ClosedPublic

Authored by bruns on Mar 25 2019, 5:07 PM.

Details

Summary

The QMimeDatabase::MatchDefault only falls back to content matching
if the extension is not known. This fails for e.g. Matroska files, where
the content allows to distinguish between audio and video files.

CCBUG: 403902

Diff Detail

Repository
R286 KFileMetaData
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Mar 25 2019, 5:07 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptMar 25 2019, 5:07 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Mar 25 2019, 5:07 PM
ngraham accepted this revision.Mar 26 2019, 1:19 PM

Very nice.

This revision is now accepted and ready to land.Mar 26 2019, 1:19 PM
astippich accepted this revision.Mar 26 2019, 1:30 PM

Just two small nitpicks

src/mimeutils.cpp
40

That reads a little bit confusing. I think it is more clear to write something like "Check if extension based mime type is a specialized..."?

src/mimeutils.h
34

Please add documentation with "since" tag

bruns added inline comments.Mar 27 2019, 12:35 AM
src/mimeutils.cpp
40

that would be the wrong way round ...

bruns updated this revision to Diff 54908.Mar 27 2019, 1:47 AM

add documentation

This revision was automatically updated to reflect the committed changes.
bruns marked 3 inline comments as done.Mar 27 2019, 1:49 AM