Bug 247229 - gpg key search allways empty result
Summary: gpg key search allways empty result
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: Contacts resource (show other bugs)
Version: 4.4
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Tobias Koenig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-10 13:08 UTC by Martin Albrecht
Modified: 2012-05-31 07:46 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Albrecht 2010-08-10 13:08:25 UTC
Version:           4.4 (using KDE 4.4.5) 
OS:                Linux

I have several contacts in my address book which have GnuPG keys attached to them which do not match the e-mail address of the contact; thus, I rely on the feature to set the right GnuPG key in KAddressbook. However, when sending encrypted mail to these contacts using KMail it never picks up on the selected key but reports that no key were found. I am then presented with a list of my GnuPG keys to select who to encrypt to.

Reproducible: Always

Steps to Reproduce:
1) Add a new contact
2) Add several GnuPG Keys to that contact
3) Write an e-mail to that contact and select encryption and click send.

Actual Results:  
The selected GnuPG keys are not used but one has to select them again by hand.

Expected Results:  
KMail picks up on my choice in the KAddressbook and encrypts to the specified keys.
Comment 1 Martin Albrecht 2010-08-20 13:01:12 UTC
Here's an easier way to reproduce the problem:

SETUP:

a) Send an e-mail to some made-up contact, e.g. x@y.com; select GnuPG encryption
b) KMail will ask you what key to choose, pick one and check "Remember choice"
c) KMail will ask you for a name for the new contact, pick one e.g. "XY"
d) KMail will ask you where to store the contact, pick your default address book

CHECK:

g) Observe that your default address book now indeed contains a contact XY for the e-mail address x@y.com with the GnuPG key assigned you just picked

MAKE IT FAIL:

g) Repeat a)

EXPECTED BEHAVIOUR:

KMail knows which key to chose and will do so automatically

OBSERVED BEHAVIOUR:

Kmail performs the steps mentioned in b)-d)

PS: I can try to gather debug logs from akonadi if that'd be of any use.
Comment 2 Martin Albrecht 2010-08-23 21:15:35 UTC
My attempts to debug this came this far, the function which does the Akonadi call is Kleo::KeyResolver::ContactPreferences Kleo::KeyResolver::lookupContactPreferences( const QString& address ) const in keyresolver.cpp. The Akonadi query which comes back empty looks as follows:

SEARCH "prefix nco:<http://www.semanticdesktop.org/ontologies/2007/03/22/nco#>SELECT DISTINCT ?person WHERE { graph ?g { ?person a nco:PersonContact ; ?person <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?itemId . nco:hasEmailAddress ?email . ?email nco:emailAddress \"x@y.com\"^^<http://www.w3.org/2001/XMLSchema#string> . } } LIMIT 1" FULLPAYLOAD EXTERNALPAYLOAD (UID REMOTEID COLLECTIONID FLAGS SIZE DATETIME) 

I don't speak enough SPARQL to judge whether this is correct. I noticed the ";" which is a different construction from the other queries in that file. 

However, if I replace the call to 

 job->setQuery( Akonadi::ContactSearchJob::Email, address );

with

 job->setQuery( Akonadi::ContactSearchJob::Name, address );

(which of course is wrong) and replace the name of my contact with its e-mail address, KMail shows the correct behaviour, implying that indeed the search query for Email is wrong in 4.4.5
Comment 3 Hauke Lathus 2010-12-09 10:25:04 UTC
I can confirm this bug. Remembering the preferred key for a recipient does not work at all. I am always forced to choose a key because of the failed lookup.

I am using kmail 1.13.5 (KDE 4.4.5) from Debian's testing distribution.
Comment 4 Martin Albrecht 2011-04-08 13:29:31 UTC
This discussion looks relevant: http://lists.kde.org/?l=kde-pim&m=129923342305966&w=2
Comment 5 Jannis Menn 2011-04-09 01:15:56 UTC
The bug affects me too using kmail 1.13.5. with kubuntu 10.10. The problem does not occur with kmail 1.13.6. tested with the beta-release of kubuntu 11.04.
Comment 6 Jannis Menn 2011-05-09 16:36:43 UTC
After updating to the final version of Kubuntu 11.04 (kmail 1.13.6), I am experiencing the same problem. Maybe I did some mistake in reproducing the bug back then, or something changed, or it has something to do with the configuration... hope very much this will be fixed soon.
Comment 7 Martin Albrecht 2011-06-28 14:13:55 UTC
With KMail 1.13.7 from Debian the problem seems to be fixed.
Comment 8 Martin Albrecht 2012-05-31 07:46:37 UTC
It seems the bug is back. It is still KMail 1.13.7 in Debian testing. Akonadi was recently updated to 1.7.2 from 1.6.2.