File indexing completed on 2024-11-24 04:39:27
0001 /* 0002 This file is part of Akonadi Contact. 0003 0004 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include "akonadi-contact-core_export.h" 0012 #include <Akonadi/EntityTreeModel> 0013 0014 namespace Akonadi 0015 { 0016 class AKONADI_CONTACT_CORE_EXPORT ContactCompletionModel : public EntityTreeModel 0017 { 0018 Q_OBJECT 0019 0020 public: 0021 enum Columns { 0022 NameColumn, ///< The name of the contact. 0023 NameAndEmailColumn, ///< The name and the email of the contact. 0024 EmailColumn ///< The preferred email of the contact. 0025 }; 0026 0027 explicit ContactCompletionModel(Monitor *monitor, QObject *parent = nullptr); 0028 ~ContactCompletionModel() override; 0029 0030 [[nodiscard]] QVariant entityData(const Item &item, int column, int role = Qt::DisplayRole) const override; 0031 [[nodiscard]] QVariant entityData(const Collection &collection, int column, int role = Qt::DisplayRole) const override; 0032 [[nodiscard]] int columnCount(const QModelIndex &parent) const override; 0033 [[nodiscard]] int entityColumnCount(HeaderGroup) const override; 0034 0035 static QAbstractItemModel *self(); 0036 0037 private: 0038 static QAbstractItemModel *mSelf; 0039 }; 0040 }