Commit adbde5d6 authored by Volker Krause's avatar Volker Krause
Browse files

Add CollectionUtils::fromIndex()

This exists as internal API in akonadi-calendar and as public API in
calendarsupport, and is used in multiple other locations. It's unrelated
to calendaring though, so move it here instead.
parent acca976f
Pipeline #174756 passed with stage
in 14 minutes and 42 seconds
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.20.40")
set(PIM_VERSION "5.20.41")
project(Akonadi VERSION ${PIM_VERSION})
......
......@@ -37,6 +37,7 @@ set(akonadicore_base_SRCS
collectionpathresolver.cpp
collectionstatistics.cpp
collectionsync.cpp
collectionutils.cpp
conflicthandler.cpp
control.cpp
entitycache.cpp
......
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "collectionutils.h"
#include "entitytreemodel.h"
using namespace Akonadi;
Collection CollectionUtils::fromIndex(const QModelIndex &index)
{
return index.data(EntityTreeModel::CollectionRole).value<Collection>();
}
......@@ -116,6 +116,11 @@ Q_REQUIRED_RESULT inline bool hasValidHierarchicalRID(const Item &item)
{
return !item.remoteId().isEmpty() && hasValidHierarchicalRID(item.parentCollection());
}
/** Returns the collection represented by @p index.
* @param index has to be provided by an EntityTreeModel instance or a proxy model on top of one.
*/
AKONADICORE_EXPORT Q_REQUIRED_RESULT Collection fromIndex(const QModelIndex &index);
}
}
......
Supports Markdown
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