File indexing completed on 2024-05-19 05:11:14
0001 /* 0002 SPDX-FileCopyrightText: 2009, 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> 0003 SPDX-FileContributor: Frank Osterfeld <osterfeld@kde.org> 0004 SPDX-FileContributor: Andras Mantia <andras@kdab.com> 0005 SPDX-FileCopyrightText: 2010-2012 Sérgio Martins <iamsergio@gmail.com> 0006 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org> 0007 0008 SPDX-License-Identifier: LGPL-2.0-or-later 0009 */ 0010 0011 #pragma once 0012 0013 #include "akonadi-calendar_export.h" 0014 0015 #include <Akonadi/Item> 0016 0017 #include <KCalendarCore/Event> 0018 #include <KCalendarCore/Journal> 0019 #include <KCalendarCore/Todo> 0020 0021 class QMimeData; 0022 0023 namespace Akonadi 0024 { 0025 0026 class Collection; 0027 class ETMCalendar; 0028 class EntityTreeModel; 0029 class Item; 0030 0031 /** Utility methods for dealing with calendar content in Akonadi items. 0032 * @since 5.20.42 0033 */ 0034 namespace CalendarUtils 0035 { 0036 /** 0037 * Returns the incidence from an Akonadi item, or a null pointer if the item has no such payload. 0038 */ 0039 AKONADI_CALENDAR_EXPORT KCalendarCore::Incidence::Ptr incidence(const Akonadi::Item &item); 0040 0041 /** 0042 * Returns the event from an Akonadi item, or a null pointer if the item has no such payload. 0043 */ 0044 AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item); 0045 0046 /** 0047 * Returns the todo from an Akonadi item, or a null pointer if the item has no such payload. 0048 */ 0049 AKONADI_CALENDAR_EXPORT KCalendarCore::Todo::Ptr todo(const Akonadi::Item &item); 0050 0051 /** 0052 * Returns the journal from an Akonadi item, or a null pointer if the item has no such payload. 0053 */ 0054 AKONADI_CALENDAR_EXPORT KCalendarCore::Journal::Ptr journal(const Akonadi::Item &item); 0055 0056 /** 0057 * Returns a suitable display name for the calendar (or calendar folder) @p collection. 0058 * This takes backend-specific special cases into account. 0059 */ 0060 AKONADI_CALENDAR_EXPORT QString displayName(Akonadi::ETMCalendar *calendar, const Akonadi::Collection &collection); 0061 AKONADI_CALENDAR_EXPORT QString displayName(const Akonadi::EntityTreeModel *model, const Akonadi::Collection &collection); 0062 AKONADI_CALENDAR_EXPORT QString displayName(const Akonadi::Collection &collection); 0063 0064 /** 0065 * Creates a MIME data object for dragging Akonadi items containing calendar incidences. 0066 * @since 5.23.41 0067 */ 0068 AKONADI_CALENDAR_EXPORT QMimeData *createMimeData(const Akonadi::Item::List &items); 0069 } 0070 0071 }