File indexing completed on 2024-11-24 04:43:05

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "job/mergecontacts.h"
0010 #include "kaddressbookmergelib_export.h"
0011 #include <Akonadi/Item>
0012 #include <QIcon>
0013 #include <QWidget>
0014 class QLabel;
0015 class QListWidget;
0016 namespace KContacts
0017 {
0018 class Addressee;
0019 }
0020 namespace KABMergeContacts
0021 {
0022 class KADDRESSBOOKMERGELIB_EXPORT MergeContactSelectListWidget : public QWidget
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit MergeContactSelectListWidget(QWidget *parent = nullptr);
0027     ~MergeContactSelectListWidget() override;
0028 
0029     void setContacts(MergeContacts::ConflictInformation conflictType, const KContacts::Addressee::List &lst);
0030     [[nodiscard]] int selectedContact() const;
0031     MergeContacts::ConflictInformation conflictType() const;
0032     [[nodiscard]] bool verifySelectedInfo() const;
0033 
0034 private:
0035     void fillList(const KContacts::Addressee::List &lst);
0036     void updateTitle();
0037     void addItem(const QString &str, const QIcon &icon = QIcon());
0038     QLabel *mTitle = nullptr;
0039     QListWidget *const mSelectListWidget;
0040     MergeContacts::ConflictInformation mConflictType;
0041 };
0042 }