File indexing completed on 2024-11-24 04:50:42
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.1-or-later 0003 0004 #pragma once 0005 0006 #include <KContacts/Addressee> 0007 #include <QAbstractListModel> 0008 0009 class ImppModel : public QAbstractListModel 0010 { 0011 Q_OBJECT 0012 0013 public: 0014 enum ExtraRole { 0015 UrlRole = Qt::UserRole, 0016 TypeRole, 0017 TypeLabelRole, 0018 TypeIconRole, 0019 }; 0020 0021 ImppModel(QObject *parent = nullptr); 0022 0023 int rowCount(const QModelIndex &parent = {}) const override; 0024 QVariant data(const QModelIndex &idx, int role) const override; 0025 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; 0026 QHash<int, QByteArray> roleNames() const override; 0027 0028 void loadContact(const KContacts::Addressee &contact); 0029 void storeContact(KContacts::Addressee &contact) const; 0030 0031 Q_INVOKABLE void addImpp(const QUrl &address); 0032 Q_INVOKABLE void deleteImpp(const int row); 0033 0034 Q_SIGNALS: 0035 void changed(const KContacts::Impp::List &impps); 0036 0037 private: 0038 KContacts::Impp::List m_impps; 0039 };