1 | /* |
---|---|
2 | Copyright 2009 Constantin Berzan <exit3219@gmail.com> |
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_p.h" |
21 | |
22 | #include <KDebug> |
23 | |
24 | #include <akonadi/attributefactory.h> |
25 | |
26 | using namespace Akonadi; |
27 | |
28 | /** |
29 | @internal |
30 | */ |
31 | class SpecialCollectionAttribute::Private |
32 | { |
33 | public: |
34 | QByteArray mType; |
35 | }; |
36 | |
37 | SpecialCollectionAttribute::SpecialCollectionAttribute(const QByteArray &type) |
38 | : d(new Private) |
39 | { |
40 | d->mType = type; |
41 | } |
42 | |
43 | SpecialCollectionAttribute::~SpecialCollectionAttribute() |
44 | { |
45 | delete d; |
46 | } |
47 | |
48 | SpecialCollectionAttribute *SpecialCollectionAttribute::clone() const |
49 | { |
50 | return new SpecialCollectionAttribute(d->mType); |
51 | } |
52 | |
53 | QByteArray SpecialCollectionAttribute::type() const |
54 | { |
55 | static const QByteArray sType("SpecialCollectionAttribute"); |
56 | return sType; |
57 | } |
58 | |
59 | QByteArray SpecialCollectionAttribute::serialized() const |
60 | { |
61 | return d->mType; |
62 | } |
63 | |
64 | void SpecialCollectionAttribute::deserialize(const QByteArray &data) |
65 | { |
66 | d->mType = data; |
67 | } |
68 | |
69 | void SpecialCollectionAttribute::setCollectionType(const QByteArray &type) |
70 | { |
71 | d->mType = type; |
72 | } |
73 | |
74 | QByteArray SpecialCollectionAttribute::collectionType() const |
75 | { |
76 | return d->mType; |
77 | } |
78 | |
79 | // Register the attribute when the library is loaded. |
80 | namespace { |
81 | |
82 | bool dummySpecialCollectionAttribute() |
83 | { |
84 | using namespace Akonadi; |
85 | AttributeFactory::registerAttribute<SpecialCollectionAttribute>(); |
86 | return true; |
87 | } |
88 | |
89 | const bool registeredSpecialCollectionAttribute = dummySpecialCollectionAttribute(); |
90 | |
91 | } |
92 |