Commit b807e035 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to exclude unified folder

parent 13924fd2
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.17.41")
set(PIM_VERSION "5.17.42")
project(Akonadi VERSION ${PIM_VERSION})
set(CMAKE_CXX_STANDARD 17)
......
......@@ -7,6 +7,7 @@
#include "recursivecollectionfilterproxymodel.h"
#include "collectionutils.h"
#include "entitytreemodel.h"
#include "mimetypechecker.h"
......@@ -29,6 +30,7 @@ public:
Akonadi::MimeTypeChecker checker;
QString pattern;
bool checkOnlyChecked = false;
bool excludeUnifiedMailBox = false;
};
} // namespace Akonadi
......@@ -54,6 +56,9 @@ bool RecursiveCollectionFilterProxyModel::filterAcceptsRow(int sourceRow, const
if (!collection.isValid()) {
return false;
}
if (CollectionUtils::isUnifiedMailbox(collection)) {
return false;
}
const bool checked = (rowIndex.data(Qt::CheckStateRole).toInt() == Qt::Checked);
const bool isCheckable = sourceModel()->flags(rowIndex) & Qt::ItemIsUserCheckable;
if (isCheckable && (d->checkOnlyChecked && !checked)) {
......@@ -131,3 +136,12 @@ void Akonadi::RecursiveCollectionFilterProxyModel::setIncludeCheckedOnly(bool ch
invalidate();
}
}
void RecursiveCollectionFilterProxyModel::setExcludeUnifiedMailBox(bool exclude)
{
Q_D(RecursiveCollectionFilterProxyModel);
if (d->excludeUnifiedMailBox != exclude) {
d->excludeUnifiedMailBox = exclude;
invalidate();
}
}
......@@ -83,6 +83,12 @@ public:
*/
void setIncludeCheckedOnly(bool checked);
/**
* Don't show unified mailbox
* @since 5.18.0
*/
void setExcludeUnifiedMailBox(bool exclude);
protected:
int columnCount(const QModelIndex &index) const override;
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
......
......@@ -57,6 +57,7 @@ public:
filterRecursiveCollectionFilter.setSortRole(Qt::DisplayRole);
filterRecursiveCollectionFilter.setSortCaseSensitivity(Qt::CaseSensitive);
filterRecursiveCollectionFilter.setSortLocaleAware(true);
filterRecursiveCollectionFilter.setExcludeUnifiedMailBox(true);
ui.collectionView->setModel(&filterRecursiveCollectionFilter);
ui.searchLineEdit->setFocus();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment