MailCommon::EntityCollectionOrderProxyModel Class
class MailCommon::EntityCollectionOrderProxyModelThe EntityCollectionOrderProxyModel class implements ordering of mail collections. It supports two modes: manual sorting and automatic sorting. More...
| Header: | #include <MailCommon/EntityCollectionOrderProxyModel> |
| CMake: | find_package(KPim6MailCommon REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::MailCommon) |
| In QML: | EntityCollectionOrderProxyModel |
Public Functions
| EntityCollectionOrderProxyModel(QObject *parent = nullptr) | |
| virtual | ~EntityCollectionOrderProxyModel() override |
| void | clearRanks() |
| bool | isManualSortingActive() const |
| void | setFolderMatcher(const MailCommon::HierarchicalFolderMatcher &matcher) |
| void | setManualSortingActive(bool active) |
| void | setTopLevelOrder(const QStringList &list) |
Reimplemented Public Functions
| virtual bool | lessThan(const QModelIndex &left, const QModelIndex &right) const override |
Public Slots
Detailed Description
The manual sorting (which has to be activated explicitly by the user) allows the user to reorder the collections (both toplevel resources and folders within the resource) by drag-n-drop, and is implemented by the base class EntityOrderProxyModel.
The automatic sorting is implemented by this class itself, and consists of assigning ranks to various special folders (outbox, drafts, sent etc.) and then having the other folders sorted by name (or another column), i.e. the default behaviour from QSortFilterProxyModel. In that mode, the order of the toplevel folders can be controlled with setTopLevelOrder().
Member Function Documentation
[explicit] EntityCollectionOrderProxyModel::EntityCollectionOrderProxyModel(QObject *parent = nullptr)
Constructs a collection order proxy model with the given parent.
[override virtual noexcept] EntityCollectionOrderProxyModel::~EntityCollectionOrderProxyModel()
Destroys the model. The manual order is saved if manual sorting is active.
void EntityCollectionOrderProxyModel::clearRanks()
Clears the cached ranks of the collections and re-sorts the model.
bool EntityCollectionOrderProxyModel::isManualSortingActive() const
Returns true if manual sorting is active.
[override virtual] bool EntityCollectionOrderProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
Returns true if the collection at left must be sorted before the collection at right.
void EntityCollectionOrderProxyModel::setFolderMatcher(const MailCommon::HierarchicalFolderMatcher &matcher)
Sets the matcher used to filter the folders.
void EntityCollectionOrderProxyModel::setManualSortingActive(bool active)
Enables manual sorting (by drag-n-drop) if active is true, otherwise automatic sorting is used.
See also isManualSortingActive().
void EntityCollectionOrderProxyModel::setTopLevelOrder(const QStringList &list)
Sets the order of the toplevel collections to list, a list of resource identifiers.
[slot] void EntityCollectionOrderProxyModel::slotSpecialCollectionsChanged()
Updates the ranks when the special collections change.