[Kde-pim] Distribution Lists storage - is this correct?

Jonathan Marten jjm2 at keelhaul.demon.co.uk
Thu Sep 26 15:30:50 BST 2013


I've been trying to create and use email distribution lists (call them
contact groups if you wish :-), via the "Save List" function in the
KMail composer. There originally seemed to be a problem with storing
duplicates for which I raised bug 325303.  That may be a false alarm -
looking at the code this is one of those things that only work
properly if Nepomuk PIM indexing is enabled.  But there is something
else there that doesn't look quite right.

In kdepim/messagecomposer/recipient/distributionlistdialog.cpp, a
ContactSearchJob is done for each contact to be saved in the list.  If
the email address is not found (by Nepomuk) the item is considered
"transient".  Later on, when the list is being created, for a
"transient" entry a new contact entry is created via an ItemCreateJob
(and a nested event loop, urgh) and then added as a contact
reference. This results in a payload entry of the form

    <contactReference uid="493028"/>

where the UID is the Akonadi ID of the newly added contact. But for a
"non transient" entry (i.e. one that was found by Nepomuk), the email
address and name of the contact are stored:

    <contactData name="Foo Bar" email="email1 at somewhere.com"/>

Is this really the right thing to do?  Surely it would make more sense
to do things the other way round, i.e. store contactData for an
unknown contact which would eliminate the need for an ItemCreateJob
and a nested event loop, and keep the address book clean.  For a known
contact, storing a contactReference would ensure the distribution list
got automatically updated if the name or email of the contact changed.

The fix looks fairly obvious, but there may have been a reason why
things were originally done this way...

Regards,
-- 
Jonathan Marten                         http://www.keelhaul.demon.co.uk
Twickenham, UK                          jjm2 at keelhaul.demon.co.uk
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list