Kgapi

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

KDE's Doxygen guidelines are available online.