File indexing completed on 2024-05-12 05:10:41
0001 /* 0002 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> 0003 SPDX-FileContributor: Tobias Koenig <tokoe@kdab.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "akonadi-calendar_export.h" 0011 #include <KCalendarCore/Alarm> 0012 0013 #include <Akonadi/Attribute> 0014 0015 #include <memory> 0016 0017 namespace Akonadi 0018 { 0019 class BlockAlarmsAttributePrivate; 0020 0021 /** 0022 * @short An Attribute that marks that alarms from a calendar collection are blocked. 0023 * 0024 * A calendar collection which has this attribute set won't be evaluated by korgac and 0025 * therefore it's alarms won't be used, unless explicitly unblocked in blockAlarmType(). 0026 * 0027 * @author Tobias Koenig <tokoe@kdab.com> 0028 * @see Akonadi::Attribute 0029 * @since 4.11 0030 */ 0031 class AKONADI_CALENDAR_EXPORT BlockAlarmsAttribute : public Akonadi::Attribute 0032 { 0033 public: 0034 /** 0035 * Creates a new block alarms attribute. 0036 */ 0037 BlockAlarmsAttribute(); 0038 0039 /** 0040 * Destroys the block alarms attribute. 0041 */ 0042 ~BlockAlarmsAttribute() override; 0043 0044 /** 0045 * Blocks or unblocks given alarm type. 0046 * 0047 * By default, all alarm types are blocked. 0048 * 0049 * @since 4.11 0050 */ 0051 void blockAlarmType(KCalendarCore::Alarm::Type type, bool block = true); 0052 0053 /** 0054 * Blocks or unblocks every alarm type. 0055 * 0056 * By default, all alarm types are blocked. 0057 * 0058 * @since 5.0 0059 */ 0060 void blockEverything(bool block = true); 0061 0062 /** 0063 * Returns whether given alarm type is blocked or not. 0064 * 0065 * @since 4.11 0066 */ 0067 bool isAlarmTypeBlocked(KCalendarCore::Alarm::Type type) const; 0068 0069 /** 0070 * Returns whether all alarms are blocked or not. 0071 * 0072 * @since 5.0 0073 */ 0074 0075 bool isEverythingBlocked() const; 0076 0077 QByteArray type() const override; 0078 BlockAlarmsAttribute *clone() const override; 0079 QByteArray serialized() const override; 0080 void deserialize(const QByteArray &data) override; 0081 0082 private: 0083 Q_DISABLE_COPY(BlockAlarmsAttribute) 0084 std::unique_ptr<BlockAlarmsAttributePrivate> const d; 0085 }; 0086 }