Eventviews

viewcalendar.h
1/*
2 * SPDX-FileCopyrightText: 2014 Sandro Knauß <knauss@kolabsys.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
5 */
6
7#pragma once
8
9#include "eventviews_export.h"
10
11#include <Akonadi/CollectionCalendar>
12#include <Akonadi/Item>
13#include <KCalendarCore/Incidence>
14
15#include <QColor>
16#include <QList>
17
18namespace EventViews
19{
20class AgendaView;
21
22class EVENTVIEWS_EXPORT ViewCalendar
23{
24public:
26
27 virtual ~ViewCalendar();
28 virtual bool isValid(const KCalendarCore::Incidence::Ptr &incidence) const = 0;
29 virtual bool isValid(const QString &incidenceIdentifier) const = 0;
30 virtual QString displayName(const KCalendarCore::Incidence::Ptr &incidence) const = 0;
31
32 virtual QColor resourceColor(const KCalendarCore::Incidence::Ptr &incidence) const = 0;
33 virtual QString iconForIncidence(const KCalendarCore::Incidence::Ptr &incidence) const = 0;
34
35 virtual KCalendarCore::Calendar::Ptr getCalendar() const = 0;
36};
37
38class AkonadiViewCalendar : public ViewCalendar
39{
40public:
42
43 ~AkonadiViewCalendar() override;
44 bool isValid(const KCalendarCore::Incidence::Ptr &incidence) const override;
45 bool isValid(const QString &incidenceIdentifier) const override;
46 [[nodiscard]] QString displayName(const KCalendarCore::Incidence::Ptr &incidence) const override;
47
48 [[nodiscard]] QColor resourceColor(const KCalendarCore::Incidence::Ptr &incidence) const override;
49 [[nodiscard]] QString iconForIncidence(const KCalendarCore::Incidence::Ptr &incidence) const override;
50
51 [[nodiscard]] Akonadi::Item item(const KCalendarCore::Incidence::Ptr &incidence) const;
52
53 KCalendarCore::Calendar::Ptr getCalendar() const override;
54
56 AgendaView *mAgendaView = nullptr;
57};
58
59class MultiViewCalendar : public ViewCalendar
60{
61public:
63
64 ~MultiViewCalendar() override;
65 ViewCalendar::Ptr findCalendar(const KCalendarCore::Incidence::Ptr &incidence) const;
66 ViewCalendar::Ptr findCalendar(const QString &incidenceIdentifier) const;
67 [[nodiscard]] bool isValid(const KCalendarCore::Incidence::Ptr &incidence) const override;
68 [[nodiscard]] bool isValid(const QString &incidenceIdentifier) const override;
69 [[nodiscard]] QString displayName(const KCalendarCore::Incidence::Ptr &incidence) const override;
70
71 [[nodiscard]] QColor resourceColor(const KCalendarCore::Incidence::Ptr &incidence) const override;
72 [[nodiscard]] QString iconForIncidence(const KCalendarCore::Incidence::Ptr &incidence) const override;
73
74 [[nodiscard]] Akonadi::Item item(const KCalendarCore::Incidence::Ptr &incidence) const;
75
76 void addCalendar(const ViewCalendar::Ptr &calendar);
77 void removeCalendar(const ViewCalendar::Ptr &calendar);
78 [[nodiscard]] int calendarCount() const;
79
80 [[nodiscard]] Akonadi::CollectionCalendar::Ptr calendarForCollection(const Akonadi::Collection &col) const;
81 [[nodiscard]] Akonadi::CollectionCalendar::Ptr calendarForCollection(Akonadi::Collection::Id id) const;
82
83 [[nodiscard]] KCalendarCore::Calendar::Ptr getCalendar() const override;
84 [[nodiscard]] KCalendarCore::Incidence::List incidences() const;
85
86 AgendaView *mAgendaView = nullptr;
87 QList<ViewCalendar::Ptr> mSubCalendars;
88};
89}
AKONADI_CALENDAR_EXPORT QString displayName(Akonadi::ETMCalendar *calendar, const Akonadi::Collection &collection)
Namespace EventViews provides facilities for displaying incidences, including events,...
Definition agenda.h:33
EVENTVIEWS_EXPORT QColor resourceColor(const Akonadi::Collection &collection, const PrefsPtr &preferences)
This method returns the proper resource / subresource color for the view.
Definition helper.cpp:56
bool isValid(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.