1/*
2 Copyright (c) 2008 Volker Krause <vkrause@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef AKONADI_ENTITYDISPLAYATTRIBUTE_H
21#define AKONADI_ENTITYDISPLAYATTRIBUTE_H
22
23#include <QColor>
24
25#include <akonadi/attribute.h>
26
27class KIcon;
28
29namespace Akonadi {
30
31/**
32 * @short Attribute that stores the properties that are used to display an entity.
33 *
34 * Display properties of a collection or item, such as translated names and icons.
35 *
36 * @author Volker Krause <vkrause@kde.org>
37 * @since 4.2
38 */
39class AKONADI_EXPORT EntityDisplayAttribute : public Attribute
40{
41public:
42 /**
43 * Creates a new entity display attribute.
44 */
45 EntityDisplayAttribute();
46
47 /**
48 * Destroys the entity display attribute.
49 */
50 ~EntityDisplayAttribute();
51
52 /**
53 * Sets the @p name that should be used for display.
54 */
55 void setDisplayName(const QString &name);
56
57 /**
58 * Returns the name that should be used for display.
59 * Users of this should fall back to Collection::name() if this is empty.
60 */
61 QString displayName() const;
62
63 /**
64 * Sets the icon @p name for the default icon.
65 */
66 void setIconName(const QString &name);
67
68 /**
69 * Returns the icon that should be used for this collection or item.
70 */
71 KIcon icon() const;
72
73 /**
74 * Returns the icon name of the icon returned by icon().
75 */
76 QString iconName() const;
77
78 /**
79 * Sets the icon @p name for the active icon.
80 * @param name the icon name to use
81 * @since 4.4
82 */
83 void setActiveIconName(const QString &name);
84
85 /**
86 * Returns the icon that should be used for this collection or item when active.
87 * @since 4.4
88 */
89 KIcon activeIcon() const;
90
91 /**
92 * Returns the icon name of an active item.
93 * @since 4.4
94 */
95 QString activeIconName() const;
96
97 /**
98 * Returns the backgroundColor or an invalid color if none is set.
99 * @since 4.4
100 */
101 QColor backgroundColor() const;
102
103 /**
104 * Sets the backgroundColor to @p color.
105 * @param color the background color to use
106 * @since 4.4
107 */
108 void setBackgroundColor(const QColor &color);
109
110 /* reimpl */
111 QByteArray type() const;
112 EntityDisplayAttribute *clone() const;
113 QByteArray serialized() const;
114 void deserialize(const QByteArray &data);
115
116private:
117 //@cond PRIVATE
118 class Private;
119 Private *const d;
120 //@endcond
121};
122
123}
124
125#endif
126