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

0001 /*
0002     This file is part of Contact Editor.
0003 
0004     SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QAbstractListModel>
0012 
0013 #include <KContacts/Address>
0014 
0015 namespace Akonadi
0016 {
0017 class AddressModel : public QAbstractListModel
0018 {
0019     Q_OBJECT
0020 public:
0021     explicit AddressModel(QObject *parent = nullptr);
0022     ~AddressModel() override;
0023 
0024     KContacts::Address::List addresses() const;
0025     void setAddresses(const KContacts::Address::List &addresses);
0026     void addAddress(const KContacts::Address &address);
0027     void replaceAddress(const KContacts::Address &address, int row);
0028     void removeAddress(int row);
0029 
0030     int rowCount(const QModelIndex &parent) const override;
0031     QVariant data(const QModelIndex &index, int role) const override;
0032 
0033 private:
0034     KContacts::Address::List mAddresses;
0035 };
0036 
0037 }