File indexing completed on 2024-12-22 05:01:14
0001 /* 0002 * SPDX-FileCopyrightText: 2011-2024 Laurent Montel <montel@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only 0005 */ 0006 #pragma once 0007 0008 #include <Akonadi/MessageModel> 0009 #include <QHash> 0010 0011 class KMSearchMessageModel : public Akonadi::MessageModel 0012 { 0013 Q_OBJECT 0014 0015 public: 0016 enum Column { 0017 Collection, 0018 Subject, 0019 Sender, 0020 Receiver, 0021 Date, 0022 Size, 0023 }; 0024 explicit KMSearchMessageModel(Akonadi::Monitor *monitor, QObject *parent = nullptr); 0025 ~KMSearchMessageModel() override; 0026 0027 protected: 0028 int entityColumnCount(HeaderGroup headerGroup) const override; 0029 QVariant entityData(const Akonadi::Item &item, int column, int role = Qt::DisplayRole) const override; 0030 QVariant entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const override; 0031 0032 private: 0033 [[nodiscard]] QString fullCollectionPath(Akonadi::Collection::Id id) const; 0034 0035 mutable QHash<Akonadi::Collection::Id, QString> m_collectionFullPathCache; 0036 };