Akonadi

tagattribute.h
1/*
2 SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
3 SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
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
17namespace Akonadi
18{
19class TagAttributePrivate;
20
21/**
22 * @short Attribute that stores the properties that are used to display a tag.
23 *
24 * @since 4.13
25 */
26class AKONADICORE_EXPORT TagAttribute : public Attribute
27{
28public:
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 [[nodiscard]] 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 [[nodiscard]] QString iconName() const;
53
54 void setBackgroundColor(const QColor &color);
55 [[nodiscard]] QColor backgroundColor() const;
56 void setTextColor(const QColor &color);
57 [[nodiscard]] QColor textColor() const;
58 void setFont(const QString &fontKey);
59 [[nodiscard]] QString font() const;
60 void setInToolbar(bool inToolbar);
61 [[nodiscard]] bool inToolbar() const;
62 void setShortcut(const QString &shortcut);
63 [[nodiscard]] 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 [[nodiscard]] int priority() const;
78
79 /* reimpl */
80 [[nodiscard]] QByteArray type() const override;
81 TagAttribute *clone() const override;
82 [[nodiscard]] QByteArray serialized() const override;
83 void deserialize(const QByteArray &data) override;
84
85private:
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
Provides interface for custom attributes for Entity.
Definition attribute.h:132
Attribute that stores the properties that are used to display a tag.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:51:45 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.