Akonadi

tagattribute.h
1 /*
2  SPDX-FileCopyrightText: 2008 Volker Krause <[email protected]>
3  SPDX-FileCopyrightText: 2014 Christian Mollekopf <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #pragma once
9 
10 #include "akonadicore_export.h"
11 #include "attribute.h"
12 
13 #include <QColor>
14 
15 #include <memory>
16 
17 namespace Akonadi
18 {
19 class TagAttributePrivate;
20 
21 /**
22  * @short Attribute that stores the properties that are used to display a tag.
23  *
24  * @since 4.13
25  */
26 class AKONADICORE_EXPORT TagAttribute : public Attribute
27 {
28 public:
29  explicit TagAttribute();
30 
31  ~TagAttribute() override;
32 
33  /**
34  * Sets the @p name that should be used for display.
35  */
36  void setDisplayName(const QString &name);
37 
38  /**
39  * Returns the name that should be used for display.
40  * Users of this should fall back to Collection::name() if this is empty.
41  */
42  QString displayName() const;
43 
44  /**
45  * Sets the icon @p name for the default icon.
46  */
47  void setIconName(const QString &name);
48 
49  /**
50  * Returns the icon name of the icon returned by icon().
51  */
52  QString iconName() const;
53 
54  void setBackgroundColor(const QColor &color);
55  QColor backgroundColor() const;
56  void setTextColor(const QColor &color);
57  QColor textColor() const;
58  void setFont(const QString &fontKey);
59  QString font() const;
60  void setInToolbar(bool inToolbar);
61  bool inToolbar() const;
62  void setShortcut(const QString &shortcut);
63  QString shortcut() const;
64 
65  /**
66  * Sets the priority of the tag.
67  * The priority is primarily used for presentation, e.g. for sorting.
68  * If only one tag can be displayed for a given item, the one with the highest
69  * priority should be shown.
70  */
71  void setPriority(int priority);
72 
73  /**
74  * Returns the priority of the tag.
75  * The default value is -1
76  */
77  int priority() const;
78 
79  /* reimpl */
80  QByteArray type() const override;
81  TagAttribute *clone() const override;
82  QByteArray serialized() const override;
83  void deserialize(const QByteArray &data) override;
84 
85 private:
86  TagAttribute(const TagAttribute &other);
87  TagAttribute &operator=(const TagAttribute &other);
88  /// @cond PRIVATE
89  const std::unique_ptr<TagAttributePrivate> d;
90  /// @endcond
91 };
92 
93 } // namespace Akonadi
94 
Provides interface for custom attributes for Entity.
Definition: attribute.h:124
Attribute that stores the properties that are used to display a tag.
Definition: tagattribute.h:26
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.