Igor has reached out to me with a great idea how to solve the duplication issues in KAddressbook when using Google Contacts (where the same contact may be in multiple groups (not vcard groups), which are represented as collections) or even when using having multiple sources, like Google and NextCloud where contacts may overlap.
KPeople was created to solve exactly this kind of problems by supporting merging of multiple entities from the source providers into a single "Person". Although it was never really used outside of KTp, it should work for our purposes as well (and we can extend it if needed). There's even a (disabled-by-default) Akonadi backend inside the KPeople repository that can be used for inspiration.
There was apparently a GSOC back in the KDE4 days to port KAB to KPeople, but did not get very far. Igor found some git repos, so he'll look if anything from there can be used.
The whole task consists of two main parts:
- Writing a proper Akonadi AbstractDataSource for the KPeople model based on the ETM and put it to Akonadi Contacts
- Swap the ETM for KPeople model in KAB
Along the way we can probably remove the existing Akonadi DataSource from KPeople as that can never be built anyway as that would make Frameworks depend on Applications.
As a result, KAddressBook will be able to merge duplicated contacts, which should improve the user experience quite a bit.