Akonadi

collectioncolorattribute.cpp
1/*
2 * SPDX-FileCopyrightText: 2015 Sandro Knauß <knauss@kolabsys.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "collectioncolorattribute.h"
8
9#include <QByteArray>
10#include <QString>
11
12using namespace Akonadi;
13
14CollectionColorAttribute::CollectionColorAttribute(const QColor &color)
15 : mColor(color)
16{
17}
18
19void CollectionColorAttribute::setColor(const QColor &color)
20{
21 mColor = color;
22}
23
24QColor CollectionColorAttribute::color() const
25{
26 return mColor;
27}
28
30{
31 return QByteArrayLiteral("collectioncolor");
32}
33
34CollectionColorAttribute *CollectionColorAttribute::clone() const
35{
36 return new CollectionColorAttribute(mColor);
37}
38
40{
41 return mColor.isValid() ? mColor.name(QColor::HexArgb).toUtf8() : "";
42}
43
45{
46 mColor = QColor(QString::fromUtf8(data));
47}
QByteArray type() const override
Returns the type of the attribute.
CollectionColorAttribute * clone() const override
Creates a copy of this attribute.
void deserialize(const QByteArray &data) override
Sets the data of this attribute, using the same encoding as returned by toByteArray().
QByteArray serialized() const override
Returns a QByteArray representation of the attribute which will be storaged.
Helper integration between Akonadi and Qt.
QString fromUtf8(QByteArrayView str)
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.