File indexing completed on 2024-11-24 04:43:04
0001 /* 0002 SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/Item> 0010 #include <KContacts/Addressee> 0011 0012 namespace KABMergeContacts 0013 { 0014 class MergeContacts 0015 { 0016 public: 0017 explicit MergeContacts(const Akonadi::Item::List &items = Akonadi::Item::List()); 0018 ~MergeContacts(); 0019 0020 enum ConflictInformation { 0021 None = 0, 0022 Birthday = 1, 0023 Geo = 2, 0024 Photo = 4, 0025 Logo = 8, 0026 Anniversary = 16, 0027 Name = 32, 0028 NickName = 64, 0029 Blog = 128, 0030 HomePage = 256, 0031 Organization = 512, 0032 Profession = 1024, 0033 Title = 2056, 0034 Departement = 4096, 0035 Office = 8192, 0036 ManagerName = 16384, 0037 Assistant = 32768, 0038 FreeBusy = 65536, 0039 FamilyName = 131072, 0040 PartnerName = 262144, 0041 Keys = 524288, 0042 }; 0043 Q_ENUMS(ConflictInformation) 0044 Q_DECLARE_FLAGS(ConflictInformations, ConflictInformation) 0045 0046 [[nodiscard]] KContacts::Addressee mergedContact(bool excludeConflictPart = false); 0047 0048 [[nodiscard]] MergeContacts::ConflictInformations requiresManualSelectionOfInformation(); 0049 0050 void setItems(const Akonadi::Item::List &items); 0051 0052 private: 0053 void mergeToContact(KContacts::Addressee &newAddress, const KContacts::Addressee &fromContact, bool excludeConflictPart); 0054 void checkCustomValue(const KContacts::Addressee &address, 0055 const QString &variable, 0056 KContacts::Addressee &newContact, 0057 MergeContacts::ConflictInformations &result, 0058 MergeContacts::ConflictInformation conflict); 0059 void mergeCustomValue(const KContacts::Addressee &fromContact, const QString &variable, KContacts::Addressee &newContact); 0060 Akonadi::Item::List mListItem; 0061 }; 0062 }