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 #include <QListWidget>
0012 
0013 namespace KABMergeContacts
0014 {
0015 class MergeContactWidgetListItem : public QListWidgetItem
0016 {
0017 public:
0018     explicit MergeContactWidgetListItem(const Akonadi::Item &item, QListWidget *parent = nullptr);
0019     [[nodiscard]] Akonadi::Item item() const;
0020 
0021 private:
0022     const Akonadi::Item mItem;
0023 };
0024 
0025 class MergeContactWidgetList : public QListWidget
0026 {
0027     Q_OBJECT
0028 public:
0029     explicit MergeContactWidgetList(QWidget *parent = nullptr);
0030     ~MergeContactWidgetList() override;
0031 
0032     void fillListContact(const Akonadi::Item::List &items);
0033     [[nodiscard]] Akonadi::Item::List listSelectedContacts() const;
0034     [[nodiscard]] Akonadi::Item currentAkonadiItem() const;
0035 
0036 private:
0037     [[nodiscard]] QString itemName(const KContacts::Addressee &address) const;
0038     void slotCustomContextMenuRequested(const QPoint &);
0039     void slotSelectAll();
0040     void slotDeselectAll();
0041 };
0042 }