~ubuntu-branches/ubuntu/quantal/kdepim/quantal

« back to all changes in this revision

Viewing changes to kalarm/cal/collectionattribute.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:51 UTC
  • mto: This revision was merged to the branch mainline in revision 193.
  • Revision ID: package-import@ubuntu.com-20111215141751-bmhdpiwl23wd9w26
Tags: upstream-4.7.90
Import upstream version 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  collectionattribute.h  -  Akonadi attribute holding Collection characteristics
3
 
 *  Program:  kalarm
4
 
 *  Copyright © 2010-2011 by David Jarvie <djarvie@kde.org>
5
 
 *
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.
10
 
 *
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.
15
 
 *
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.
19
 
 */
20
 
 
21
 
#ifndef COLLECTION_ATTRIBUTE_H
22
 
#define COLLECTION_ATTRIBUTE_H
23
 
 
24
 
#include "kalarm_cal_export.h"
25
 
 
26
 
#include "kacalendar.h"
27
 
 
28
 
#include <akonadi/attribute.h>
29
 
 
30
 
#include <QColor>
31
 
 
32
 
namespace KAlarm
33
 
{
34
 
 
35
 
/*=============================================================================
36
 
= Class: CollectionAttribute
37
 
= User-specific attributes of a KAlarm collection.
38
 
=============================================================================*/
39
 
 
40
 
class KALARM_CAL_EXPORT CollectionAttribute : public Akonadi::Attribute
41
 
{
42
 
    public:
43
 
        CollectionAttribute()
44
 
                : mEnabled(KAlarm::CalEvent::EMPTY),
45
 
                  mStandard(KAlarm::CalEvent::EMPTY)  {}
46
 
 
47
 
        bool isEnabled(KAlarm::CalEvent::Type type) const   { return mEnabled & type; }
48
 
 
49
 
        /** Return which mime types the collection is enabled for. */
50
 
        KAlarm::CalEvent::Types enabled() const     { return mEnabled; }
51
 
 
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
54
 
         *  is not affected.
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.
58
 
         */
59
 
        void setEnabled(KAlarm::CalEvent::Type, bool enabled);
60
 
 
61
 
        /** Set which mime types the collection enabled for. */
62
 
        void setEnabled(KAlarm::CalEvent::Types);
63
 
 
64
 
        /** Return whether the collection is the standard collection for a specified
65
 
         *  mime type. */
66
 
        bool isStandard(KAlarm::CalEvent::Type) const;
67
 
 
68
 
        /** Set or clear the collection as the standard collection for a specified
69
 
         *  mime type. */
70
 
        void setStandard(KAlarm::CalEvent::Type, bool standard);
71
 
 
72
 
        /** Return which mime types the collection is standard for. */
73
 
        KAlarm::CalEvent::Types standard() const     { return mStandard; }
74
 
 
75
 
        /** Set which mime types the collection is the standard collection for. */
76
 
        void setStandard(KAlarm::CalEvent::Types);
77
 
 
78
 
        /** Return the background color to display this collection and its alarms,
79
 
         *  or invalid color if none is set.
80
 
         */
81
 
        QColor backgroundColor() const     { return mBackgroundColour; }
82
 
 
83
 
        /** Set the background color for this collection and its alarms. */
84
 
        void   setBackgroundColor(const QColor& c)  { mBackgroundColour = c; }
85
 
 
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"; }
91
 
 
92
 
    private:
93
 
        CollectionAttribute(const CollectionAttribute&);
94
 
 
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
98
 
};
99
 
 
100
 
} // namespace KAlarm
101
 
 
102
 
#endif // COLLECTION_ATTRIBUTE_H
103
 
 
104
 
// vim: et sw=4: