Messagelib

storagemodel.h
1/*
2 SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "messagelist/storagemodelbase.h"
10#include "messagelist_export.h"
11
12#include <Akonadi/Collection>
13#include <Akonadi/Item>
14#include <KMime/Message>
15#include <QList>
16
19
20namespace Akonadi
21{
22class Item;
23}
24
25namespace MessageList
26{
27namespace Core
28{
29class MessageItem;
30}
31
32/**
33 * The Akonadi specific implementation of the Core::StorageModel.
34 */
35class MESSAGELIST_EXPORT StorageModel : public MessageList::Core::StorageModel
36{
37 Q_OBJECT
38
39public:
40 /**
41 * Create a StorageModel wrapping the specified folder.
42 */
43 explicit StorageModel(QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent = nullptr);
44 ~StorageModel() override;
45
46 [[nodiscard]] Akonadi::Collection::List displayedCollections() const;
47
48 [[nodiscard]] QString id() const override;
49 [[nodiscard]] bool containsOutboundMessages() const override;
50
51 [[nodiscard]] virtual bool isOutBoundFolder(const Akonadi::Collection &c) const;
52
53 [[nodiscard]] int initialUnreadRowCountGuess() const override;
54 [[nodiscard]] bool initializeMessageItem(MessageList::Core::MessageItem *mi, int row, bool bUseReceiver) const override;
55 void fillMessageItemThreadingData(MessageList::Core::MessageItem *mi, int row, ThreadingDataSubset subset) const override;
56 void updateMessageItemData(MessageList::Core::MessageItem *mi, int row) const override;
57 void setMessageItemStatus(MessageList::Core::MessageItem *mi, int row, Akonadi::MessageStatus status) override;
58
59 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
60 [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
61 [[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
62 [[nodiscard]] QModelIndex parent(const QModelIndex &index) const override;
63 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
64
65 QMimeData *mimeData(const QList<MessageList::Core::MessageItem *> &) const override;
67
68 [[nodiscard]] Akonadi::Item itemForRow(int row) const;
69 [[nodiscard]] Akonadi::Collection parentCollectionForRow(int row) const;
70 [[nodiscard]] KMime::Message::Ptr messageForRow(int row) const;
71
72 [[nodiscard]] Akonadi::Collection collectionForId(Akonadi::Collection::Id colId) const;
73
74 void resetModelStorage();
75
76private:
77 class StorageModelPrivate;
78 std::unique_ptr<StorageModelPrivate> const d;
79};
80} // namespace MessageList
The MessageItem class.
Definition messageitem.h:36
The QAbstractItemModel based interface that you need to provide for your storage to work with Message...
virtual QMimeData * mimeData(const QList< MessageItem * > &) const =0
The implementation-specific mime data for this list of items.
The Akonadi specific implementation of the Core::StorageModel.
Q_SCRIPTABLE CaptureState status()
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.