Akonadi

specialcollectionattribute.cpp
1 /*
2  Copyright 2009 Constantin Berzan <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "specialcollectionattribute.h"
21 #include "attributefactory.h"
22 
23 using namespace Akonadi;
24 
28 class Q_DECL_HIDDEN SpecialCollectionAttribute::Private
29 {
30 public:
31  QByteArray mType;
32 };
33 
35  : d(new Private)
36 {
37  d->mType = type;
38 }
39 
41 {
42  delete d;
43 }
44 
46 {
47  return new SpecialCollectionAttribute(d->mType);
48 }
49 
51 {
52  static const QByteArray sType("SpecialCollectionAttribute");
53  return sType;
54 }
55 
57 {
58  return d->mType;
59 }
60 
62 {
63  d->mType = data;
64 }
65 
67 {
68  d->mType = type;
69 }
70 
72 {
73  return d->mType;
74 }
75 
76 // Register the attribute when the library is loaded.
77 namespace
78 {
79 
80 bool dummySpecialCollectionAttribute()
81 {
82  using namespace Akonadi;
83  AttributeFactory::registerAttribute<SpecialCollectionAttribute>();
84  return true;
85 }
86 
87 const bool registeredSpecialCollectionAttribute = dummySpecialCollectionAttribute();
88 
89 } // namespace
An Attribute that stores the special collection type of a collection.
~SpecialCollectionAttribute() override
Destroys the special collection 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.
QByteArray type() const override
Returns the type of the attribute.
void setCollectionType(const QByteArray &type)
Sets the special collections type of the collection.
Helper integration between Akonadi and Qt.
SpecialCollectionAttribute(const QByteArray &type=QByteArray())
Creates a new special collection attribute.
QByteArray collectionType() const
Returns the special collections type of the collection.
SpecialCollectionAttribute * clone() const override
Creates a copy of this attribute.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 1 2020 23:14:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.