MailCommon::FolderTreeWidget Class

class MailCommon::FolderTreeWidget
Header: #include <MailCommon/FolderTreeWidget>
CMake: find_package(KPim6MailCommon REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::MailCommon)
Inherits: QWidget

Public Types

enum SortingPolicy { SortByCurrentColumn, SortByDragAndDropKey }
enum ToolTipDisplayPolicy { DisplayAlways, DisplayWhenTextElided, DisplayNever }

Public Functions

FolderTreeWidget(QWidget *parent = nullptr, KXMLGUIClient *xmlGuiClient = nullptr, MailCommon::FolderTreeWidget::TreeViewOptions options = (TreeViewOptions)(ShowUnreadCount | ShowCollectionStatisticAnimation), FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy = FolderTreeWidgetProxyModel::None)
void applyFilter(const QString &)
void clearFilter()
void collapseAll()
QModelIndex currentIndex() const
void disableContextMenuAndExtraColumn()
MailCommon::EntityCollectionOrderProxyModel *entityOrderProxy() const
void expandAll()
QLineEdit *filterFolderLineEdit() const
MailCommon::FolderTreeView *folderTreeView() const
MailCommon::FolderTreeWidgetProxyModel *folderTreeWidgetProxyModel() const
void readConfig()
void restoreHeaderState(const QByteArray &data)
void selectCollectionFolder(const Akonadi::Collection &col, bool expand = true)
Akonadi::Collection selectedCollection() const
Akonadi::Collection::List selectedCollections() const
QAbstractItemView::SelectionMode selectionMode() const
QItemSelectionModel *selectionModel() const
void setAccountActivities(Akonadi::AccountActivitiesAbstract *accountActivities)
void setSelectionMode(QAbstractItemView::SelectionMode mode)
Akonadi::StatisticsProxyModel *statisticsProxyModel() const

Protected Functions

void changeToolTipsPolicyConfig(MailCommon::FolderTreeWidget::ToolTipDisplayPolicy)

Reimplemented Protected Functions

virtual bool event(QEvent *e) override

Protected Slots

void slotChangeTooltipsPolicy(MailCommon::FolderTreeWidget::ToolTipDisplayPolicy)
void slotFilterFixedString(const QString &)
void slotGeneralFontChanged()
void slotGeneralPaletteChanged()
void slotManualSortingChanged(bool)

Detailed Description

This is the widget that shows the main folder tree.

It consists of the view (FolderTreeView) and a search line. Internally, several proxy models are used on top of a entity tree model.

Member Type Documentation

enum FolderTreeWidget::SortingPolicy

The available sorting policies.

ConstantValueDescription
MailCommon::FolderTreeWidget::SortByCurrentColumn0Columns are clickable, sorting is by the current column
MailCommon::FolderTreeWidget::SortByDragAndDropKey1Columns are NOT clickable, sorting is done by drag and drop

enum FolderTreeWidget::ToolTipDisplayPolicy

The possible tooltip display policies.

ConstantValueDescription
MailCommon::FolderTreeWidget::DisplayAlways0Always display a tooltip when hovering over an item
MailCommon::FolderTreeWidget::DisplayWhenTextElided1Display the tooltip if the item text is actually elided
MailCommon::FolderTreeWidget::DisplayNever2Never display tooltips

Member Function Documentation

[explicit] FolderTreeWidget::FolderTreeWidget(QWidget *parent = nullptr, KXMLGUIClient *xmlGuiClient = nullptr, MailCommon::FolderTreeWidget::TreeViewOptions options = (TreeViewOptions)(ShowUnreadCount | ShowCollectionStatisticAnimation), FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy = FolderTreeWidgetProxyModel::None)

Constructs a folder tree widget with the given parent, using xmlGuiClient for its actions. The widget is configured with options and the folder proxy model with optReadableProxy.

void FolderTreeWidget::applyFilter(const QString &)

Filters the folders with the given text.

[protected] void FolderTreeWidget::changeToolTipsPolicyConfig(MailCommon::FolderTreeWidget::ToolTipDisplayPolicy)

Changes the tooltip display policy.

void FolderTreeWidget::clearFilter()

Clears the folder filter.

void FolderTreeWidget::collapseAll()

Collapses all the folders.

QModelIndex FolderTreeWidget::currentIndex() const

Returns the current index of the folder tree view.

void FolderTreeWidget::disableContextMenuAndExtraColumn()

Disables the context menu and hides all the columns except the first one.

MailCommon::EntityCollectionOrderProxyModel *FolderTreeWidget::entityOrderProxy() const

Returns the proxy model used to order the collections.

[override virtual protected] bool FolderTreeWidget::event(QEvent *e)

Reimplements: QWidget::event(QEvent *event).

Reimplemented to update the palette when the application palette changes. Returns true if the event e was recognized.

void FolderTreeWidget::expandAll()

Expands all the folders.

QLineEdit *FolderTreeWidget::filterFolderLineEdit() const

Returns the line edit used to filter the folders.

MailCommon::FolderTreeView *FolderTreeWidget::folderTreeView() const

Returns the folder tree view.

MailCommon::FolderTreeWidgetProxyModel *FolderTreeWidget::folderTreeWidgetProxyModel() const

Returns the folder tree widget proxy model.

void FolderTreeWidget::readConfig()

Reads the configuration of the widget.

void FolderTreeWidget::restoreHeaderState(const QByteArray &data)

Restores the header state from data.

void FolderTreeWidget::selectCollectionFolder(const Akonadi::Collection &col, bool expand = true)

Selects the folder of the collection col, expanding it if expand is true.

Akonadi::Collection FolderTreeWidget::selectedCollection() const

Returns the selected collection.

Akonadi::Collection::List FolderTreeWidget::selectedCollections() const

Returns the selected collections.

QAbstractItemView::SelectionMode FolderTreeWidget::selectionMode() const

Returns the selection mode of the folder tree view.

See also setSelectionMode().

QItemSelectionModel *FolderTreeWidget::selectionModel() const

Returns the selection model of the folder tree view.

void FolderTreeWidget::setAccountActivities(Akonadi::AccountActivitiesAbstract *accountActivities)

Sets accountActivities, used to filter the folders by activity.

void FolderTreeWidget::setSelectionMode(QAbstractItemView::SelectionMode mode)

Sets the selection mode of the folder tree view.

See also selectionMode().

[protected slot] void FolderTreeWidget::slotChangeTooltipsPolicy(MailCommon::FolderTreeWidget::ToolTipDisplayPolicy)

Changes the tooltip display policy.

[protected slot] void FolderTreeWidget::slotFilterFixedString(const QString &)

Filters the folders with the given text.

[protected slot] void FolderTreeWidget::slotGeneralFontChanged()

Updates the font when the general font changes.

[protected slot] void FolderTreeWidget::slotGeneralPaletteChanged()

Updates the palette when the general palette changes.

[protected slot] void FolderTreeWidget::slotManualSortingChanged(bool)

Enables or disables manual sorting.

Akonadi::StatisticsProxyModel *FolderTreeWidget::statisticsProxyModel() const

Returns the statistics proxy model.