Akonadi

collectioncolorattribute.cpp
1 /*
2  * SPDX-FileCopyrightText: 2015 Sandro Knauß <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 #include "collectioncolorattribute.h"
8 #include "attributefactory.h"
9 
10 #include <QByteArray>
11 #include <QString>
12 
13 using namespace Akonadi;
14 
15 CollectionColorAttribute::CollectionColorAttribute(const QColor &color)
16  : mColor(color)
17 {
18 }
19 
20 void CollectionColorAttribute::setColor(const QColor &color)
21 {
22  mColor = color;
23 }
24 
25 QColor CollectionColorAttribute::color() const
26 {
27  return mColor;
28 }
29 
31 {
32  return QByteArrayLiteral("collectioncolor");
33 }
34 
36 {
37  return new CollectionColorAttribute(mColor);
38 }
39 
41 {
42  return mColor.isValid() ? mColor.name(QColor::HexArgb).toUtf8() : "";
43 }
44 
46 {
47  mColor = QColor(QString::fromUtf8(data));
48 }
QString fromUtf8(const char *str, int size)
QByteArray serialized() const override
Returns a QByteArray representation of the attribute which will be storaged.
CollectionColorAttribute * clone() const override
Creates a copy of this attribute.
QByteArray type() const override
Returns the type of the attribute.
Helper integration between Akonadi and Qt.
void deserialize(const QByteArray &data) override
Sets the data of this attribute, using the same encoding as returned by toByteArray().
Attribute that stores colors of a collection.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 12 2020 23:16:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.