Kgapi

reminder.cpp
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "reminder.h"
10#include "debug.h"
11
12using namespace KGAPI2;
13using namespace KCalendarCore;
14
15class Q_DECL_HIDDEN Reminder::Private
16{
17public:
19 Duration offset;
20};
21
23 : d(new Private)
24{
25}
26
27Reminder::Reminder(Alarm::Type type, const Duration &startOffset)
28 : d(new Private)
29{
30 d->type = type;
31 d->offset = startOffset;
32}
33
35 : d(new Private(*(other.d)))
36{
37}
38
39Reminder::~Reminder() = default;
40
41bool Reminder::operator==(const Reminder &other) const
42{
43 if (d->type != other.d->type) {
44 qCDebug(KGAPIDebug) << "Types don't match";
45 return false;
46 }
47 if (d->offset != other.d->offset) {
48 qCDebug(KGAPIDebug) << "Offsets don't match";
49 return false;
50 }
51 return true;
52}
53
55{
56 d->type = type;
57}
58
60{
61 return d->type;
62}
63
64void Reminder::setStartOffset(const Duration &startOffset)
65{
66 d->offset = startOffset;
67}
68
70{
71 return d->offset;
72}
73
74// In LibKGAPI1 we return AlarmPtr
76{
77 auto alarm = new Alarm(incidence);
78 alarm->setType(d->type);
79 alarm->setStartOffset(d->offset);
80 return alarm;
81}
Represents a default calendar reminder.
Definition reminder.h:30
void setStartOffset(const KCalendarCore::Duration &startOffset)
Sets how long before the event should reminder be shown.
Definition reminder.cpp:64
virtual ~Reminder()
Destructor.
Reminder()
Constructor.
Definition reminder.cpp:22
KCalendarCore::Alarm::Type type() const
Returns type of the reminder.
Definition reminder.cpp:59
void setType(KCalendarCore::Alarm::Type type)
Sets type of the reminder.
Definition reminder.cpp:54
KCalendarCore::Duration startOffset() const
Returns how long before the event should reminder be shown.
Definition reminder.cpp:69
KCalendarCore::Alarm * toAlarm(KCalendarCore::Incidence *incidence) const
Converts the reminder to a KCalendarCore::Alarm.
Definition reminder.cpp:75
Type type(const QSqlDatabase &db)
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:11:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.