specialcollectionattribute.cpp
00001 /* 00002 Copyright 2009 Constantin Berzan <exit3219@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #include "specialcollectionattribute_p.h" 00021 00022 #include <KDebug> 00023 00024 #include <akonadi/attributefactory.h> 00025 00026 using namespace Akonadi; 00027 00031 class SpecialCollectionAttribute::Private 00032 { 00033 public: 00034 QByteArray mType; 00035 }; 00036 00037 SpecialCollectionAttribute::SpecialCollectionAttribute( const QByteArray &type ) 00038 : d( new Private ) 00039 { 00040 d->mType = type; 00041 } 00042 00043 SpecialCollectionAttribute::~SpecialCollectionAttribute() 00044 { 00045 delete d; 00046 } 00047 00048 SpecialCollectionAttribute* SpecialCollectionAttribute::clone() const 00049 { 00050 return new SpecialCollectionAttribute( d->mType ); 00051 } 00052 00053 QByteArray SpecialCollectionAttribute::type() const 00054 { 00055 static const QByteArray sType( "SpecialCollectionAttribute" ); 00056 return sType; 00057 } 00058 00059 QByteArray SpecialCollectionAttribute::serialized() const 00060 { 00061 return d->mType; 00062 } 00063 00064 void SpecialCollectionAttribute::deserialize( const QByteArray &data ) 00065 { 00066 d->mType = data; 00067 } 00068 00069 void SpecialCollectionAttribute::setCollectionType( const QByteArray &type ) 00070 { 00071 d->mType = type; 00072 } 00073 00074 QByteArray SpecialCollectionAttribute::collectionType() const 00075 { 00076 return d->mType; 00077 } 00078 00079 // Register the attribute when the library is loaded. 00080 namespace { 00081 00082 bool dummySpecialCollectionAttribute() 00083 { 00084 using namespace Akonadi; 00085 AttributeFactory::registerAttribute<SpecialCollectionAttribute>(); 00086 return true; 00087 } 00088 00089 const bool registeredSpecialCollectionAttribute = dummySpecialCollectionAttribute(); 00090 00091 }