File indexing completed on 2024-11-24 04:43:04
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kaddressbookmergelib_export.h" 0010 #include <Akonadi/Item> 0011 #include <QTreeWidget> 0012 namespace KContacts 0013 { 0014 class Addressee; 0015 } 0016 namespace KABMergeContacts 0017 { 0018 class KADDRESSBOOKMERGELIB_EXPORT ResultDuplicateTreeWidgetItem : public QTreeWidgetItem 0019 { 0020 public: 0021 explicit ResultDuplicateTreeWidgetItem(QTreeWidget *parent = nullptr); 0022 ~ResultDuplicateTreeWidgetItem() override; 0023 0024 [[nodiscard]] Akonadi::Item item() const; 0025 void setItem(const Akonadi::Item &item); 0026 0027 [[nodiscard]] static QString displayName(const Akonadi::Item &item); 0028 0029 private: 0030 void setDisplayName(); 0031 [[nodiscard]] static QString contactName(const KContacts::Addressee &address); 0032 Akonadi::Item mItem; 0033 }; 0034 0035 class KADDRESSBOOKMERGELIB_EXPORT ResultDuplicateTreeWidget : public QTreeWidget 0036 { 0037 Q_OBJECT 0038 public: 0039 explicit ResultDuplicateTreeWidget(QWidget *parent = nullptr); 0040 ~ResultDuplicateTreeWidget() override; 0041 void setContacts(const QList<Akonadi::Item::List> &lstItem); 0042 0043 [[nodiscard]] QList<Akonadi::Item::List> selectedContactsToMerge() const; 0044 0045 void checkAllItems(); 0046 void uncheckAllItems(); 0047 Q_SIGNALS: 0048 void showContactPreview(const Akonadi::Item &item); 0049 0050 private: 0051 void slotItemSelectionChanged(); 0052 void slotItemChanged(QTreeWidgetItem *item, int column); 0053 void changeState(QTreeWidgetItem *item, bool b); 0054 }; 0055 }