KDE PIM does not display one’s own email address and name, but instead replaces it with “me”.
This is certainly a feature appreciated by many users, however in a language like German this looks very awkward (for details see https://bugs.kde.org/show_bug.cgi?id=469713
). So it would be very desirable to be able to switch off that feature.
I dug through the code to find out that it is a feature implemented in messagecore’s stringutil.
It is quite easy to add a switch, e.g. like this to messagelib/messagecore/src/utils/stringutil.cpp
Change line 443 from
const bool foundMe = onlyOneIdentity && (im->identityForAddress(prettyAddressStr) != KIdentityManagementCore::Identity::null());
to
const bool foundMe = !(MessageCore::MessageCoreSettings::self()->displayOwnIdentity()) && onlyOneIdentity && (im->identityForAddress(prettyAddressStr) != KIdentityManagementCore::Identity::null());
and in messagelib/messagecore/src/settings/messagecore.kcfg add an item like this:
< entry name=“displayOwnIdentity” type=“Bool” >
< default >false< /default >
< /entry >
(sorry, I had to add extra spaces to make the code display in this forum).
I added it to the General group, but I’m unsure whether this is the correct approach. Moreover I’m not sure whether the messagecore settings is the right spot for such a switch.
To test it, I set the default to true and opened an email sent by me (or sent to me) in kmail2. Worked as expected.
There should also be an easy way to change the setting via the CLI, isn’t there?
In addition, it would be nice to have a UI to toggle this setting. There seems to be a convenient way in messageviewer/src/ui/settings.ui, but I could not come up with an equivalent for messagecore.
Or is having that setting in messagelib/messageviewer/src/settings/messageviewer.kcfg.in a better idea? (after all it’s about displaying a message’s header)
I guess the whole thing should be implementable with very few lines of code. The main functionality is one additional && item in the code above. Any advice where to best put that setting would be very much appreciated. A way to switch it from the CLI would certainly be helpful, but for sure a built-in GUI tickbox (as there is for other on/off settings) would be even nicer. Where would that best be put?
Implementing such a switch would also at least offer a workaround to issues like https://bugs.kde.org/show_bug.cgi?id=277622
Any suggestions are highly appreciated.