Kgapi

reminder.cpp
1 /*
2  * This file is part of LibKGAPI library
3  *
4  * Copyright (C) 2013 Daniel Vrátil <[email protected]>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) version 3, or any
10  * later version accepted by the membership of KDE e.V. (or its
11  * successor approved by the membership of KDE e.V.), which shall
12  * act as a proxy defined in Section 6 of version 3 of the license.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
23 
24 #include "reminder.h"
25 #include "../debug.h"
26 
27 using namespace KGAPI2;
28 using namespace KCalendarCore;
29 
30 class Q_DECL_HIDDEN Reminder::Private
31 {
32 public:
33  Alarm::Type type = Alarm::Invalid;
34  Duration offset;
35 };
36 
38  d(new Private)
39 {
40 }
41 
43  d(new Private)
44 {
45  d->type = type;
46  d->offset = startOffset;
47 }
48 
50  d(new Private(*(other.d)))
51 {
52 }
53 
54 Reminder::~Reminder() = default;
55 
56 bool Reminder::operator==(const Reminder &other) const
57 {
58  if (d->type != other.d->type) {
59  qCDebug(KGAPIDebug) << "Types don't match";
60  return false;
61  }
62  if (d->offset != other.d->offset) {
63  qCDebug(KGAPIDebug) << "Offsets don't match";
64  return false;
65  }
66  return true;
67 }
68 
70 {
71  d->type = type;
72 }
73 
75 {
76  return d->type;
77 }
78 
80 {
81  d->offset = startOffset;
82 }
83 
85 {
86  return d->offset;
87 }
88 
89 // In LibKGAPI1 we return AlarmPtr
90 Alarm *Reminder::toAlarm(Incidence *incidence) const
91 {
92  auto alarm = new Alarm(incidence);
93  alarm->setType(d->type);
94  alarm->setStartOffset(d->offset);
95  return alarm;
96 }
97 
KCalendarCore::Alarm * toAlarm(KCalendarCore::Incidence *incidence) const
Converts the reminder to a KCalendarCore::Alarm.
Definition: reminder.cpp:90
virtual ~Reminder()
Destructor.
Reminder()
Constructor.
Definition: reminder.cpp:37
Type type(const QSqlDatabase &db)
A job to fetch a single map tile described by a StaticMapUrl.
Definition: blog.h:30
Represents a default calendar reminder.
Definition: reminder.h:44
KCalendarCore::Alarm::Type type() const
Returns type of the reminder.
Definition: reminder.cpp:74
void setType(KCalendarCore::Alarm::Type type)
Sets type of the reminder.
Definition: reminder.cpp:69
KCalendarCore::Duration startOffset() const
Returns how long before the event should reminder be shown.
Definition: reminder.cpp:84
void setStartOffset(const KCalendarCore::Duration &startOffset)
Sets how long before the event should reminder be shown.
Definition: reminder.cpp:79
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed May 27 2020 22:36:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.