From a37cf79cc09a9525ab9e2d9e06b21beb28144844 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Thu, 14 Oct 2021 19:27:30 +0200 Subject: [PATCH] Allow to not expand treewidget --- CMakeLists.txt | 2 +- src/folder/foldertreewidget.cpp | 6 ++++-- src/folder/foldertreewidget.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa1f904..2e41499 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -set(PIM_VERSION "5.18.40") +set(PIM_VERSION "5.18.41") project(mailcommon VERSION ${PIM_VERSION}) diff --git a/src/folder/foldertreewidget.cpp b/src/folder/foldertreewidget.cpp index dc79921..c25dac3 100644 --- a/src/folder/foldertreewidget.cpp +++ b/src/folder/foldertreewidget.cpp @@ -162,12 +162,14 @@ void FolderTreeWidget::disableContextMenuAndExtraColumn() d->folderTreeView->disableContextMenuAndExtraColumn(); } -void FolderTreeWidget::selectCollectionFolder(const Akonadi::Collection &collection) +void FolderTreeWidget::selectCollectionFolder(const Akonadi::Collection &collection, bool expand) { const QModelIndex index = Akonadi::EntityTreeModel::modelIndexForCollection(d->folderTreeView->model(), collection); d->folderTreeView->setCurrentIndex(index); - d->folderTreeView->setExpanded(index, true); + if (expand) { + d->folderTreeView->setExpanded(index, true); + } d->folderTreeView->scrollTo(index); } diff --git a/src/folder/foldertreewidget.h b/src/folder/foldertreewidget.h index 8a79d12..bfc75d2 100644 --- a/src/folder/foldertreewidget.h +++ b/src/folder/foldertreewidget.h @@ -76,7 +76,7 @@ public: SortByDragAndDropKey ///< Columns are NOT clickable, sorting is done by drag and drop }; - void selectCollectionFolder(const Akonadi::Collection &col); + void selectCollectionFolder(const Akonadi::Collection &col, bool expand = true); void setSelectionMode(QAbstractItemView::SelectionMode mode);