Akonadi

entitydisplayattribute.h
1 /*
2  SPDX-FileCopyrightText: 2008 Volker Krause <[email protected]>
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 
17 namespace Akonadi
18 {
19 class 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 <[email protected]>
27  * @since 4.2
28  */
29 class AKONADICORE_EXPORT EntityDisplayAttribute : public Attribute
30 {
31 public:
32  /**
33  * Creates a new entity display attribute.
34  */
35  explicit EntityDisplayAttribute();
36 
37  /**
38  * Destroys the entity display attribute.
39  */
40  ~EntityDisplayAttribute() override;
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  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  QIcon icon() const;
62 
63  /**
64  * Returns the icon name of the icon returned by icon().
65  */
66  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  QIcon activeIcon() const;
80 
81  /**
82  * Returns the icon name of an active item.
83  * @since 4.4
84  */
85  QString activeIconName() const;
86 
87  /**
88  * Returns the backgroundColor or an invalid color if none is set.
89  * @since 4.4
90  */
91  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  QByteArray type() const override;
102  EntityDisplayAttribute *clone() const override;
103  QByteArray serialized() const override;
104  void deserialize(const QByteArray &data) override;
105 
106 private:
107  /// @cond PRIVATE
108  const std::unique_ptr<EntityDisplayAttributePrivate> d;
109  /// @endcond
110 };
111 
112 } // namespace Akonadi
113 
Provides interface for custom attributes for Entity.
Definition: attribute.h:124
Attribute that stores the properties that are used to display an entity.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.