Akonadi

tagcache.h
1/*
2 SPDX-FileCopyrightText: 2015 Sandro Knauß <knauss@kolabsys.com>
3 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadicore_export.h"
10
11#include <QObject>
12
13#include <Akonadi/Tag>
14
15#include <memory>
16
17class QColor;
18
19namespace Akonadi
20{
21
22class TagCachePrivate;
23
24/**
25 * Client-side cache of all exist tags.
26 *
27 * This can be instantiated explicitly or used as a singleton for
28 * process-wide sharing.
29 *
30 * @since 5.20.43
31 */
32class AKONADICORE_EXPORT TagCache : public QObject
33{
34 Q_OBJECT
35public:
36 explicit TagCache(QObject *parent = nullptr);
37 ~TagCache() override;
38
39 /** Returns the tag with the GID @p gid, if available. */
40 [[nodiscard]] Akonadi::Tag tagByGid(const QByteArray &gid) const;
41 /** Returns the tag with the name @p name, if available. */
42 [[nodiscard]] Akonadi::Tag tagByName(const QString &name) const;
43
44 /** Returns the (background) color of the tag named @p tagName.
45 * If there is no such tag, or the tag has no color associated,
46 * an invalid QColor value is returned.
47 */
48 [[nodiscard]] QColor tagColor(const QString &tagName) const;
49
50 /** Sets the (background) color of the tag named @p tagName to @p color. */
51 void setTagColor(const QString &tagName, const QColor &color);
52
53 /** Returns the singleton instance. */
54 static TagCache *instance();
55
56private:
57 std::unique_ptr<TagCachePrivate> d;
58};
59}
Client-side cache of all exist tags.
Definition tagcache.h:33
An Akonadi Tag.
Definition tag.h:26
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 1 2024 18:51:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.