[KAddressbook] Improve the contacts list
Open, Needs TriagePublic

Description

During a discussion at Akademy we got a few ideas how to make KAddressbook slightly prettier - one of them was to improve the looks of the main contact list by improving the list delegates.

Right now each contact row looks like this

[picture] Firstname Lastname

Our idea is to go for a more modern, two-row look:

[ pic ] Firstname Lastname
[ pic ] email@address.cz, phone number

With the name being more prominent (bigger, maybe bold), the email address and phone number less so.

The picture could be rounded, instead of rectangular, maybe generating an icon with initials (like DV for Dan Vratil) when no photo is available in the contact.

This requires only implementing a new delegate for the listview, no knowledge of Akonadi or even contacts is needed.

dvratil created this task.Aug 16 2018, 7:39 PM

Daniel, I want to prepare a solution for this task, but I can't find a way to get an email address in added delegate inside paint event when the email address column is hidden. I tried to get it from the model but it only contains the columns that are visible in the GUI. Can you help me with this?

dvratil added a comment.EditedMar 31 2020, 11:58 AM

Hi! Sure :) The underlying data model is Akonadi::ContactsTreeModel which is subclass of Akonadi::EntityTreeModel. Thus, if you have a QModelIndex, you can use the data() function to retrieve data for the Akonadi::EntityTreeModel::ItemRole, which gives you the Akonadi::Item which holds the contact itself: KContacts::Addressee

const auto item = index.data(Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
if (!item.hasPayload<KContacts::Addressee>()) {
    // error handling
    return;
}
const auto contact = item.payload<KContacts::Addressee>();

Now you have the contact itself and you can access any data that are stored in there.

kondzio claimed this task.Apr 10 2020, 9:24 PM

Hello Daniel. Could you tell me what photo or description should we display for a group contact ? Which phone number and email address should be displayed for single contact ? home or preferred ?
See the screenshot in the attachment, I prepared an example solution. Are you sure that we want to display two smaller pictures one below the other? or the appearance on the screen is acceptable in your opinion?


Thanks,
Konrad.

kondzio reassigned this task from kondzio to dvratil.Apr 10 2020, 9:43 PM

Hi, sorry, I mussed have missed the notification.

For Group Contacts there cannot be a picture AFAIK, so I would just create an avatar from the initial letters of the group name for now. As a description, you could concatenate the first several names/emails in the group and add three dots at the end.

You should definitely used the one marked as preferred, if there's none such just take the first one.

I think the appearance on the screenshot is OK, but it's of course not just up to me to decide. We can discuss some spacing/colors etc. but in general I think this is already a big improvement over the current dense list :)

kondzio removed dvratil as the assignee of this task.Apr 29 2020, 6:18 PM

Daniel, I think I have finished preparing my changes. How will we process this further? Should I send my changes someone to review?

Thanks,
Konrad.

Daniel, I think I have finished preparing my changes. How will we process this further? Should I send my changes someone to review?

Thanks,
Konrad.

Hi, Konrad!
The next step would be to open a Phabricator Differential Revision (you can do it either using web interface, or you can proceed using the arcanist tool, which is probably preferred and more handy). You could probably also add some VDG people to the review (@ngraham?), they might have some useful feedback.