File indexing completed on 2024-11-10 04:40:28
0001 /* 0002 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "specialcollectionattribute.h" 0008 #include "attributefactory.h" 0009 0010 using namespace Akonadi; 0011 0012 /** 0013 @internal 0014 */ 0015 class Akonadi::SpecialCollectionAttributePrivate 0016 { 0017 public: 0018 QByteArray mType; 0019 }; 0020 0021 SpecialCollectionAttribute::SpecialCollectionAttribute(const QByteArray &type) 0022 : d(new SpecialCollectionAttributePrivate()) 0023 { 0024 d->mType = type; 0025 } 0026 0027 SpecialCollectionAttribute::~SpecialCollectionAttribute() = default; 0028 0029 SpecialCollectionAttribute *SpecialCollectionAttribute::clone() const 0030 { 0031 return new SpecialCollectionAttribute(d->mType); 0032 } 0033 0034 QByteArray SpecialCollectionAttribute::type() const 0035 { 0036 static const QByteArray sType("SpecialCollectionAttribute"); 0037 return sType; 0038 } 0039 0040 QByteArray SpecialCollectionAttribute::serialized() const 0041 { 0042 return d->mType; 0043 } 0044 0045 void SpecialCollectionAttribute::deserialize(const QByteArray &data) 0046 { 0047 d->mType = data; 0048 } 0049 0050 void SpecialCollectionAttribute::setCollectionType(const QByteArray &type) 0051 { 0052 d->mType = type; 0053 } 0054 0055 QByteArray SpecialCollectionAttribute::collectionType() const 0056 { 0057 return d->mType; 0058 } 0059 0060 // Register the attribute when the library is loaded. 0061 namespace 0062 { 0063 bool dummySpecialCollectionAttribute() 0064 { 0065 using namespace Akonadi; 0066 AttributeFactory::registerAttribute<SpecialCollectionAttribute>(); 0067 return true; 0068 } 0069 0070 const bool registeredSpecialCollectionAttribute = dummySpecialCollectionAttribute(); 0071 0072 } // namespace