File indexing completed on 2024-11-24 04:39:30

0001 /*
0002     This file is part of Contact Editor.
0003 
0004     SPDX-FileCopyrightText: 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
0005     SPDX-FileCopyrightText: 2016-2020 Laurent Montel <montel.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "customfieldsmodel.h"
0013 #include <QWidget>
0014 class QTreeView;
0015 namespace KContacts
0016 {
0017 class Addressee;
0018 }
0019 class CustomFieldsModel;
0020 namespace Akonadi
0021 {
0022 class CustomFieldsListWidget : public QWidget
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit CustomFieldsListWidget(QWidget *parent = nullptr);
0027     ~CustomFieldsListWidget() override;
0028     void storeContact(KContacts::Addressee &contact) const;
0029     void loadContact(const KContacts::Addressee &contact);
0030     void setReadOnly(bool readOnly);
0031 
0032     void setLocalCustomFieldDescriptions(const QVariantList &descriptions);
0033     [[nodiscard]] QVariantList localCustomFieldDescriptions() const;
0034 public Q_SLOTS:
0035     void slotAddNewField(const CustomField &field);
0036 
0037 private:
0038     CustomField::List mLocalCustomFields;
0039     QTreeView *mCustomFieldList = nullptr;
0040     CustomFieldsModel *mModel = nullptr;
0041 };
0042 }