2
* collectionattribute.h - Akonadi attribute holding Collection characteristics
4
* Copyright © 2010-2011 by David Jarvie <djarvie@kde.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License along
17
* with this program; if not, write to the Free Software Foundation, Inc.,
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#ifndef COLLECTION_ATTRIBUTE_H
22
#define COLLECTION_ATTRIBUTE_H
24
#include "kalarm_cal_export.h"
26
#include "kacalendar.h"
28
#include <akonadi/attribute.h>
35
/*=============================================================================
36
= Class: CollectionAttribute
37
= User-specific attributes of a KAlarm collection.
38
=============================================================================*/
40
class KALARM_CAL_EXPORT CollectionAttribute : public Akonadi::Attribute
44
: mEnabled(KAlarm::CalEvent::EMPTY),
45
mStandard(KAlarm::CalEvent::EMPTY) {}
47
bool isEnabled(KAlarm::CalEvent::Type type) const { return mEnabled & type; }
49
/** Return which mime types the collection is enabled for. */
50
KAlarm::CalEvent::Types enabled() const { return mEnabled; }
52
/** Set the enabled/disabled state of the collection and its alarms, for a
53
* specified alarm type. The enabled/disabled state for other alarm types
55
* The alarms of that type in a disabled collection are ignored, and not
56
* displayed in the alarm list. The standard status for that type for
57
* a disabled collection is automatically cleared.
59
void setEnabled(KAlarm::CalEvent::Type, bool enabled);
61
/** Set which mime types the collection enabled for. */
62
void setEnabled(KAlarm::CalEvent::Types);
64
/** Return whether the collection is the standard collection for a specified
66
bool isStandard(KAlarm::CalEvent::Type) const;
68
/** Set or clear the collection as the standard collection for a specified
70
void setStandard(KAlarm::CalEvent::Type, bool standard);
72
/** Return which mime types the collection is standard for. */
73
KAlarm::CalEvent::Types standard() const { return mStandard; }
75
/** Set which mime types the collection is the standard collection for. */
76
void setStandard(KAlarm::CalEvent::Types);
78
/** Return the background color to display this collection and its alarms,
79
* or invalid color if none is set.
81
QColor backgroundColor() const { return mBackgroundColour; }
83
/** Set the background color for this collection and its alarms. */
84
void setBackgroundColor(const QColor& c) { mBackgroundColour = c; }
86
virtual QByteArray type() const { return name(); }
87
virtual CollectionAttribute* clone() const;
88
virtual QByteArray serialized() const;
89
virtual void deserialize(const QByteArray& data);
90
static QByteArray name() { return "KAlarmCollection"; }
93
CollectionAttribute(const CollectionAttribute&);
95
QColor mBackgroundColour; // background color for collection and its alarms
96
KAlarm::CalEvent::Types mEnabled; // which alarm types the collection is enabled for
97
KAlarm::CalEvent::Types mStandard; // whether the collection is a standard collection
100
} // namespace KAlarm
102
#endif // COLLECTION_ATTRIBUTE_H