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
38
40{
41 return mColor.isValid() ? mColor.name(QColor::HexArgb).toUtf8() : "";
42}
43
45{
46 mColor = QColor(QString::fromUtf8(data));
47}
Attribute that stores colors of a collection.
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.
bool isValid() const const
QString name(NameFormat format) const const
QString fromUtf8(QByteArrayView str)
QByteArray toUtf8() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.