File indexing completed on 2024-11-24 04:50:42
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carlschwan@kde.org> 0002 // SPDX-License-Identifier: LGPL-2.1-or-later 0003 0004 #pragma once 0005 0006 #include <Akonadi/EntityTreeModel> 0007 #include <QSortFilterProxyModel> 0008 0009 /// Contacts model with an email addreess 0010 class ContactsModel : public QSortFilterProxyModel 0011 { 0012 Q_OBJECT 0013 public: 0014 enum ExtraRoles { 0015 EmailRole = Akonadi::EntityTreeModel::UserRole + 1, 0016 AllEmailsRole, 0017 GidRole, 0018 }; 0019 Q_ENUM(ExtraRoles) 0020 explicit ContactsModel(QObject *parent = nullptr); 0021 0022 QVariant data(const QModelIndex &idx, int role) const override; 0023 QHash<int, QByteArray> roleNames() const override; 0024 0025 protected: 0026 bool filterAcceptsRow(int row, const QModelIndex &sourceParent) const override; 0027 };