Mailcommon

entitycollectionorderproxymodel.h
1/*
2
3 SPDX-FileCopyrightText: 2009-2024 Laurent Montel <montel@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "mailcommon_export.h"
11#include <Akonadi/EntityOrderProxyModel>
12
13namespace MailCommon
14{
15class HierarchicalFolderMatcher;
16
17/**
18 * @brief The EntityCollectionOrderProxyModel class implements ordering of mail collections.
19 * It supports two modes: manual sorting and automatic sorting.
20 *
21 * The manual sorting (which has to be activated explicitly by the user) allows the user to
22 * reorder the collections (both toplevel resources and folders within the resource) by drag-n-drop,
23 * and is implemented by the base class EntityOrderProxyModel.
24 *
25 * The automatic sorting is implemented by this class itself, and consists of assigning ranks
26 * to various special folders (outbox, drafts, sent etc.) and then having the other folders sorted
27 * by name (or another column), i.e. the default behaviour from QSortFilterProxyModel.
28 * In that mode, the order of the toplevel folders can be controlled with setTopLevelOrder().
29 */
31{
32 Q_OBJECT
33public:
34 explicit EntityCollectionOrderProxyModel(QObject *parent = nullptr);
35
37
38 [[nodiscard]] bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
39
40 void setManualSortingActive(bool active);
41 [[nodiscard]] bool isManualSortingActive() const;
42
43 void clearRanks();
44 void setTopLevelOrder(const QStringList &list);
45
46 void setFolderMatcher(const HierarchicalFolderMatcher &matcher);
47
48public Q_SLOTS:
49 void slotSpecialCollectionsChanged();
50
51protected:
52 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
53
54private:
55 class EntityCollectionOrderProxyModelPrivate;
56 std::unique_ptr<EntityCollectionOrderProxyModelPrivate> const d;
57};
58}
The EntityCollectionOrderProxyModel class implements ordering of mail collections.
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:01 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.