Improve render plugin selection
ClosedPublic

Authored by vkrause on Oct 8 2017, 12:59 PM.

Details

Summary

This now considers two additional attributes:

  • the message mimetype, with the most specific matching one considered first
  • a plugin priority to disambiguate as a last resort

This became necessary with the fairly aggressive syntax highlighting
plugin also triggering on vcard or ical attachments. Their plugins now
have priority, as their mimetypes are more specific than text/plain the
highlighting plugin is registered for.

Diff Detail

Repository
R94 PIM: Message Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
vkrause created this revision.Oct 8 2017, 12:59 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptOct 8 2017, 12:59 PM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
knauss added inline comments.Oct 9 2017, 10:20 AM
messageviewer/src/messagepartthemes/default/messagepartrendererfactory.cpp
157

return true, because, if this is empty there is no mimetype set.

vkrause added inline comments.Oct 9 2017, 7:06 PM
messageviewer/src/messagepartthemes/default/messagepartrendererfactory.cpp
157

That would require all plugins (and all internal renderers) to actually specify a mimetype. That is not currently the case, so we treat that as a renderer that can handle any mimetype, and thus also with the lowest priority, as its most generic. For those having a 1:1 mapping to custom part types that is perfectly fine, no need for a mimetype there anyway.

knauss accepted this revision.Oct 10 2017, 8:05 AM
knauss added inline comments.
messageviewer/src/messagepartthemes/default/messagepartrendererfactory.cpp
157

ah okay this loop kicks out all elements that result with true. I first read it like, only elementents that result true will be keeped in the list.

This revision is now accepted and ready to land.Oct 10 2017, 8:05 AM
This revision was automatically updated to reflect the committed changes.