D26690: [WIP] Add KMimeTypeTrader::defaultSchemaHandler to return default service associated with scheme

Méven Car noreply at phabricator.kde.org
Thu Jan 16 08:50:31 GMT 2020


meven added a comment.


  In D26690#595221 <https://phabricator.kde.org/D26690#595221>, @dfaure wrote:
  
  > s/Schema/Scheme/ everywhere (method name, commit log)
  >
  > I want to deprecate KMimeTypeTrader, this should rather go into the upcoming KApplicationTrader D25698 <https://phabricator.kde.org/D25698>, if new API is needed.
  >
  > I'm pretty sure you can use KMimeTypeTrader::query(mimeHandler) instead of parsing mimeapps.list. And then I wonder if you really need new API :)
  
  
  Let me be clearer about my intend.
  
  Basically it is about fixing the TODO in kmimeassociation.cpp added in 3116911fa0d02dc4c5f05923cc6d7bf490a580e5 <https://phabricator.kde.org/R309:3116911fa0d02dc4c5f05923cc6d7bf490a580e5>
  
    // TODO "Default Applications" is a separate query and a separate algorithm, says the spec.
    // For now this is better than nothing though.
    parseAddedAssociations(KConfigGroup(&profile, "Default Applications"), file, basePreference);
  
  For instance say, I have in  ~/.config/mimeapps.list :
  
    [Added Associations]
    x-scheme-handler/mailto=org.kde.kate.org;thunderbird.desktop
    
    [Default Applications]
    x-scheme-handler/mailto=thunderbird.desktop;
  
  Thunderbird will think it is the default email client (according to the spec) but `KMimeTypeTrader::preferredService("x-scheme-handler/mailto")` `KApplicationTrader::preferredService("x-scheme-handler/mailto")` will return "org.kde.kate.org".
  And in general we have no alternative way to find default association to mimetype according to the xdg specs. It may work as long as we don't have any "Added Associations", or when they match "Default Applications" but non-kde apps are not expected to deviate from the spec for our limitations.
  
  Perhaps all we need is to improve parsing of "Default Applications" so that it is returned by `KMimeTypeTrader::preferredService`, that is prepend default apps to the list of apps associated with mimetypes.
  I will update this PR soonish to implement this idea.

REPOSITORY
  R309 KService

REVISION DETAIL
  https://phabricator.kde.org/D26690

To: meven, dfaure, dvratil, ervin
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200116/0b157f9d/attachment.html>


More information about the Kde-frameworks-devel mailing list