Akonadi

entitydisplayattribute.h
1/*
2 SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadicore_export.h"
10#include "attribute.h"
11
12#include <QColor>
13#include <QIcon>
14
15#include <memory>
16
17namespace Akonadi
18{
19class EntityDisplayAttributePrivate;
20
21/**
22 * @short Attribute that stores the properties that are used to display an entity.
23 *
24 * Display properties of a collection or item, such as translated names and icons.
25 *
26 * @author Volker Krause <vkrause@kde.org>
27 * @since 4.2
28 */
29class AKONADICORE_EXPORT EntityDisplayAttribute : public Attribute
30{
31public:
32 /**
33 * Creates a new entity display attribute.
34 */
35 explicit EntityDisplayAttribute();
36
37 /**
38 * Destroys the entity display attribute.
39 */
41
42 /**
43 * Sets the @p name that should be used for display.
44 */
45 void setDisplayName(const QString &name);
46
47 /**
48 * Returns the name that should be used for display.
49 * Users of this should fall back to Collection::name() if this is empty.
50 */
51 [[nodiscard]] QString displayName() const;
52
53 /**
54 * Sets the icon @p name for the default icon.
55 */
56 void setIconName(const QString &name);
57
58 /**
59 * Returns the icon that should be used for this collection or item.
60 */
61 [[nodiscard]] QIcon icon() const;
62
63 /**
64 * Returns the icon name of the icon returned by icon().
65 */
66 [[nodiscard]] QString iconName() const;
67
68 /**
69 * Sets the icon @p name for the active icon.
70 * @param name the icon name to use
71 * @since 4.4
72 */
73 void setActiveIconName(const QString &name);
74
75 /**
76 * Returns the icon that should be used for this collection or item when active.
77 * @since 4.4
78 */
79 [[nodiscard]] QIcon activeIcon() const;
80
81 /**
82 * Returns the icon name of an active item.
83 * @since 4.4
84 */
85 [[nodiscard]] QString activeIconName() const;
86
87 /**
88 * Returns the backgroundColor or an invalid color if none is set.
89 * @since 4.4
90 */
91 [[nodiscard]] QColor backgroundColor() const;
92
93 /**
94 * Sets the backgroundColor to @p color.
95 * @param color the background color to use
96 * @since 4.4
97 */
98 void setBackgroundColor(const QColor &color);
99
100 /* reimpl */
101 [[nodiscard]] QByteArray type() const override;
102 EntityDisplayAttribute *clone() const override;
103 [[nodiscard]] QByteArray serialized() const override;
104 void deserialize(const QByteArray &data) override;
105
106private:
107 /// @cond PRIVATE
108 const std::unique_ptr<EntityDisplayAttributePrivate> d;
109 /// @endcond
110};
111
112} // namespace Akonadi
void setIconName(const QString &name)
Sets the icon name for the default icon.
QIcon activeIcon() const
Returns the icon that should be used for this collection or item when active.
void setBackgroundColor(const QColor &color)
Sets the backgroundColor to color.
void setActiveIconName(const QString &name)
Sets the icon name for the active icon.
~EntityDisplayAttribute() override
Destroys the entity display attribute.
QIcon icon() const
Returns the icon that should be used for this collection or item.
QByteArray type() const override
Returns the type of the attribute.
EntityDisplayAttribute()
Creates a new entity display attribute.
QByteArray serialized() const override
Returns a QByteArray representation of the attribute which will be storaged.
QColor backgroundColor() const
Returns the backgroundColor or an invalid color if none is set.
QString displayName() const
Returns the name that should be used for display.
void setDisplayName(const QString &name)
Sets the name that should be used for display.
QString activeIconName() const
Returns the icon name of an active item.
void deserialize(const QByteArray &data) override
Sets the data of this attribute, using the same encoding as returned by toByteArray().
EntityDisplayAttribute * clone() const override
Creates a copy of this attribute.
QString iconName() const
Returns the icon name of the icon returned by icon().
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:56 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.