1 | /* |
2 | Copyright (c) 2008 Volker Krause <vkrause@kde.org> |
3 | Copyright (c) 2014 Christian Mollekopf <mollekopf@kolabsys.com> |
4 | |
5 | This library is free software; you can redistribute it and/or modify it |
6 | under the terms of the GNU Library General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or (at your |
8 | option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, but WITHOUT |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
13 | License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to the |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef AKONADI_TAGATTRIBUTE_H |
22 | #define AKONADI_TAGATTRIBUTE_H |
23 | |
24 | #include <QColor> |
25 | #include <QFont> |
26 | |
27 | #include <akonadi/attribute.h> |
28 | |
29 | class KIcon; |
30 | |
31 | namespace Akonadi { |
32 | |
33 | /** |
34 | * @short Attribute that stores the properties that are used to display a tag. |
35 | * |
36 | * @since 4.13 |
37 | */ |
38 | class AKONADI_EXPORT TagAttribute : public Attribute |
39 | { |
40 | public: |
41 | TagAttribute(); |
42 | |
43 | ~TagAttribute(); |
44 | |
45 | /** |
46 | * Sets the @p name that should be used for display. |
47 | */ |
48 | void setDisplayName(const QString &name); |
49 | |
50 | /** |
51 | * Returns the name that should be used for display. |
52 | * Users of this should fall back to Collection::name() if this is empty. |
53 | */ |
54 | QString displayName() const; |
55 | |
56 | /** |
57 | * Sets the icon @p name for the default icon. |
58 | */ |
59 | void setIconName(const QString &name); |
60 | |
61 | /** |
62 | * Returns the icon name of the icon returned by icon(). |
63 | */ |
64 | QString iconName() const; |
65 | |
66 | void setBackgroundColor(const QColor &color); |
67 | QColor backgroundColor() const; |
68 | void setTextColor(const QColor &color); |
69 | QColor textColor() const; |
70 | void setFont(const QString &fontKey); |
71 | QString font() const; |
72 | void setInToolbar(bool); |
73 | bool inToolbar() const; |
74 | void setShortcut(const QString &); |
75 | QString shortcut() const; |
76 | |
77 | /** |
78 | * Sets the priority of the tag. |
79 | * The priority is primarily used for presentation, e.g. for sorting. |
80 | * If only one tag can be displayed for a given item, the one with the highest |
81 | * priority should be shown. |
82 | */ |
83 | void setPriority(int priority); |
84 | |
85 | /** |
86 | * Returns the priority of the tag. |
87 | * The default value is -1 |
88 | */ |
89 | int priority() const; |
90 | |
91 | /* reimpl */ |
92 | QByteArray type() const; |
93 | TagAttribute *clone() const; |
94 | QByteArray serialized() const; |
95 | void deserialize(const QByteArray &data); |
96 | |
97 | private: |
98 | TagAttribute(const TagAttribute &); |
99 | TagAttribute &operator=(const TagAttribute &); |
100 | //@cond PRIVATE |
101 | class Private; |
102 | Private *const d; |
103 | //@endcond |
104 | }; |
105 | |
106 | } |
107 | |
108 | #endif |
109 | |