Mailcommon

entitycollectionorderproxymodel.h
1 /*
2 
3  SPDX-FileCopyrightText: 2009-2022 Laurent Montel <[email protected]>
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 
13 namespace MailCommon
14 {
15 class 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
33 public:
34  explicit EntityCollectionOrderProxyModel(QObject *parent = nullptr);
35 
37 
38  Q_REQUIRED_RESULT bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
39 
40  void setManualSortingActive(bool active);
41  Q_REQUIRED_RESULT bool isManualSortingActive() const;
42 
43  void clearRanks();
44  void setTopLevelOrder(const QStringList &list);
45 
46  void setFolderMatcher(const HierarchicalFolderMatcher &matcher);
47 
48 public Q_SLOTS:
49  void slotSpecialCollectionsChanged();
50 
51 protected:
52  bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
53 
54 private:
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-2022 The KDE developers.
Generated on Sat Oct 1 2022 04:00:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.