| Summary: | kde-open5 ignores default configured mail client | ||
|---|---|---|---|
| Product: | [Plasma] kde-cli-tools | Reporter: | Konstantin Kharlamov <Hi-Angel> |
| Component: | general | Assignee: | Aleix Pol <aleixpol> |
| Status: | REOPENED --- | ||
| Severity: | normal | CC: | nate, rdieter |
| Priority: | NOR | Keywords: | junior-jobs |
| Version First Reported In: | 5.18.4 | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Konstantin Kharlamov
2020-04-24 13:43:55 UTC
FWIW I tried building it, but last two commits whose build configuration succeeds on my system are bb7e91e and da969d6, they're somewhat away from the master, and building for both of them ends up with same error:
../keditfiletype/mimetypedata.cpp: In member function ‘QStringList MimeTypeData::getAppOffers() const’:
../keditfiletype/mimetypedata.cpp:217:20: error: ‘class KService’ has no member named ‘allowAsDefault’
217 | if ((*it)->allowAsDefault())
| ^~~~~~~~~~~~~~
Oh, well. I figured that kde-open5 consists of a single cpp file "kioclient.cpp", and that likely opening of a email/url happens at `ClientApp::kde_open()`. I am not completely sure though as I didn't manage to check it out. But if anybody is interested, that looks like nice starting point.
Okay, so I debugged that a bit (I made use of latest release), turns out I was right about `kde_open()`. On this line `KRun * run = new KRun( info.url, nullptr );`, the `url` is the `mailto:` string. Whole magic of finding the mail client happens inside `KRun` class. The docs for KRun are here https://api.kde.org/frameworks/kio/html/classKRun.html they say it will run the app that is bound to a protocol given, but there's nothing about how that gets determined. Okay, so, I managed to find out how KRun apparently figures that out.
The "mailto:" as well as any url like "foo:" is a part of shared-mime-info-spec specification that is called "x-scheme-handler". For "mailto:" that would be "x-scheme-handler/mailto".
This means I could try setting the type with xdg-utils. And this is where the problem turns up:
$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default x-scheme-handler/mailto
Running KDE trader query "x-scheme-handler/mailto" mimetype and "Application" servicetype
kmailservice.desktop
$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime default thunderbird.desktop x-scheme-handler/mailto
make_default_kde: No kde runtime detected
make_default_generic thunderbird.desktop x-scheme-handler/mailto
Updating /home/constantine/.config/mimeapps.list
$ grep mail /home/constantine/.config/mimeapps.list
x-scheme-handler/mailto=thunderbird.desktop
$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default x-scheme-handler/mailto
Running KDE trader query "x-scheme-handler/mailto" mimetype and "Application" servicetype
kmailservice.desktop
So apparently the bug is not in kde-open5 (which simply tries default app), nor in systemsettings5 (which same as xdg-mime is sure that it successfully changed the default client), but instead in xdg-utils which does not use the default mail client.
Hence, closing this as invalid.
I would argue there is a bug... in systemsettings->default applications When one sets a default email client there, part of that implementation should also set the synthetic x-scheme-handler/mailto mimetype (Same argument can be applied for when setting a default web browser too) |