Implement deduplication without three copies
Summary:
This also avoids the use of QSet::fromList which is deprecated in latest
Qt 5.14 and thus breaks the build.
Reviewers: dvratil
Reviewed By: dvratil
Subscribers: kde-pim
Tags: KDE PIM
Differential Revision: https://phabricator.kde.org/D27744