File indexing completed on 2024-05-12 05:22:14

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #pragma once
0010 
0011 #include "kgapicalendar_export.h"
0012 #include "object.h"
0013 #include "types.h"
0014 
0015 #include <KCalendarCore/Alarm>
0016 #include <KCalendarCore/Incidence>
0017 
0018 #include <QScopedPointer>
0019 
0020 namespace KGAPI2
0021 {
0022 
0023 /**
0024  * @brief Represents a default calendar reminder.
0025  *
0026  * @author Daniel Vrátil <dvratil@redhat.com>
0027  * @since 0.4
0028  */
0029 class KGAPICALENDAR_EXPORT Reminder
0030 {
0031 public:
0032     /**
0033      * @brief Constructor
0034      */
0035     explicit Reminder();
0036 
0037     /**
0038      * @brief Constructor
0039      *
0040      * @param type Type of the reminder (email, notification, etc.)
0041      * @param startOffset How long before the event should the reminder be shown
0042      */
0043     explicit Reminder(KCalendarCore::Alarm::Type type, const KCalendarCore::Duration &startOffset = KCalendarCore::Duration(0));
0044 
0045     /**
0046      * @brief Copy constructor
0047      */
0048     Reminder(const Reminder &other);
0049 
0050     /**
0051      * @brief Destructor
0052      */
0053     virtual ~Reminder();
0054 
0055     bool operator==(const Reminder &other) const;
0056 
0057     /**
0058      * @brief Returns type of the reminder
0059      */
0060     [[nodiscard]] KCalendarCore::Alarm::Type type() const;
0061 
0062     /**
0063      * @brief Sets type of the reminder
0064      *
0065      * @param type
0066      */
0067     void setType(KCalendarCore::Alarm::Type type);
0068 
0069     /**
0070      * @brief Returns how long before the event should reminder be shown
0071      */
0072     [[nodiscard]] KCalendarCore::Duration startOffset() const;
0073 
0074     /**
0075      * @brief Sets how long before the event should reminder be shown
0076      */
0077     void setStartOffset(const KCalendarCore::Duration &startOffset);
0078 
0079     /**
0080      * @brief Converts the reminder to a KCalendarCore::Alarm
0081      *
0082      * @param incidence An incidence on which the reminder should be applied
0083      * @return Returns a new KCalendarCore::Alarm
0084      */
0085     [[nodiscard]] KCalendarCore::Alarm *toAlarm(KCalendarCore::Incidence *incidence) const;
0086 
0087 private:
0088     class Private;
0089     QScopedPointer<Private> const d;
0090 };
0091 
0092 } // namespace KGAPI2