akonadi
recentcontactscollections.cpp
00001 /* 00002 This file is part of Akonadi Contact. 00003 00004 Copyright (c) 2009 Tobias Koenig <tokoe@kde.org> 00005 00006 This library is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU Library General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00014 License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to the 00018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 02110-1301, USA. 00020 */ 00021 00022 #include "recentcontactscollections_p.h" 00023 00024 #include "recentcontactscollectionssettings.h" 00025 00026 #include <KGlobal> 00027 00028 #include "akonadi/agentinstance.h" 00029 00030 using namespace Akonadi; 00031 00032 class Akonadi::RecentContactsCollectionsPrivate 00033 { 00034 public: 00035 RecentContactsCollectionsPrivate(); 00036 ~RecentContactsCollectionsPrivate(); 00037 00038 RecentContactsCollections *mInstance; 00039 }; 00040 00041 typedef RecentContactsCollectionsSettings Settings; 00042 00043 K_GLOBAL_STATIC( RecentContactsCollectionsPrivate, sInstance ) 00044 00045 static const QByteArray sRecentContactsType = "recent-contacts"; 00046 00047 RecentContactsCollectionsPrivate::RecentContactsCollectionsPrivate() 00048 : mInstance( new RecentContactsCollections( this ) ) 00049 { 00050 } 00051 00052 RecentContactsCollectionsPrivate::~RecentContactsCollectionsPrivate() 00053 { 00054 delete mInstance; 00055 } 00056 00057 RecentContactsCollections::RecentContactsCollections( RecentContactsCollectionsPrivate *dd ) 00058 : SpecialCollections( Settings::self() ), 00059 d( dd ) 00060 { 00061 } 00062 00063 RecentContactsCollections *RecentContactsCollections::self() 00064 { 00065 return sInstance->mInstance; 00066 } 00067 00068 bool RecentContactsCollections::hasCollection( const AgentInstance &instance ) const 00069 { 00070 return SpecialCollections::hasCollection( sRecentContactsType, instance ); 00071 } 00072 00073 Collection RecentContactsCollections::collection( const AgentInstance &instance ) const 00074 { 00075 return SpecialCollections::collection( sRecentContactsType, instance ); 00076 } 00077 00078 bool RecentContactsCollections::registerCollection( const Collection &collection ) 00079 { 00080 return SpecialCollections::registerCollection( sRecentContactsType, collection ); 00081 } 00082 00083 bool RecentContactsCollections::hasDefaultCollection() const 00084 { 00085 return SpecialCollections::hasDefaultCollection( sRecentContactsType ); 00086 } 00087 00088 Collection RecentContactsCollections::defaultCollection() const 00089 { 00090 return SpecialCollections::defaultCollection( sRecentContactsType ); 00091 } 00092 00093 #include "recentcontactscollections_p.moc"