Some themes for the header of the messageviewer show a photo of the sender inside the message viewer if the contact is known to akonadi. This does not work, if the address in the From: field of the email has other spelling in terms of upper and lower case characters than the email in akonadi's contacts. E.g. akonadi knows email@example.com and the From: field contains John.Doe@example.com ==> no photo is shown.
This is easy to fix, just modify line 33 in kdepim-4.11.4/messageviewer/header/contactdisplaymessagememento.cpp:
- searchJob->setQuery( Akonadi::ContactSearchJob::Email, emailAddress )
+ searchJob->setQuery( Akonadi::ContactSearchJob::Email, emailAddress, Akonadi::ContactSearchJob::StartsWithMatch );
However, the default behavior of this function, i.e. using Match::ExactMatch to find contacts based on emails is strange at all.
Might be the reason for https://bugs.kde.org/show_bug.cgi?id=316029 as well.
StartsWithMatch, ///< The result must start with the pattern (case insensitive).
ContainsMatch, ///< The result must contain the pattern (case insensitive).
no we must use ContainsMatch
startWithMatch will return Joesdfsdfsfsdf, Joe, joeqsss etc.
but it's right ContainsMatch not perfect too...
It will return not correct value...
But by default we store in akonadi emails has lowcase.
Not sure that we must change search attribute we will break a lot.
Okay, StartsWithMatch was reasonable for me. If emails are stored lower case, the email being searched can be converted to lower case in advance, or?
searchJob->setQuery( Akonadi::ContactSearchJob::Email, emailAddress.toLower() )
Thanks for taking care of the bug!
Git commit 531f1fdf306aa179b6ee8bf5bd9659f47d1bc07b by Montel Laurent.
Committed on 22/12/2013 at 06:25.
Pushed by mlaurent into branch 'KDE/4.12'.
Fix Bug 328777 - Photo search for contact email should be case-insensitive
M +1 -1 libkdepim/job/addcontactjob.cpp
M +1 -1 libkdepim/job/addemailaddressjob.cpp
M +1 -1 libkdepim/job/addemaildisplayjob.cpp
M +1 -1 libkdepim/job/openemailaddressjob.cpp
M +4 -4 mailcommon/search/searchpattern.cpp
M +1 -1 messagecomposer/recipient/distributionlistdialog.cpp
M +1 -1 messageviewer/header/contactdisplaymessagememento.cpp