• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
  • contact
recentcontactscollections.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #include "recentcontactscollections_p.h"
23 
24 #include "recentcontactscollectionssettings.h"
25 
26 #include <KGlobal>
27 
28 #include "akonadi/agentinstance.h"
29 #include "akonadi/servermanager.h"
30 
31 using namespace Akonadi;
32 
33 class Akonadi::RecentContactsCollectionsPrivate
34 {
35  public:
36  RecentContactsCollectionsPrivate();
37  ~RecentContactsCollectionsPrivate();
38 
39  RecentContactsCollections *mInstance;
40 };
41 
42 typedef RecentContactsCollectionsSettings Settings;
43 
44 K_GLOBAL_STATIC( RecentContactsCollectionsPrivate, sInstance )
45 
46 static const QByteArray sRecentContactsType = "recent-contacts";
47 
48 RecentContactsCollectionsPrivate::RecentContactsCollectionsPrivate()
49  : mInstance( new RecentContactsCollections( this ) )
50 {
51 }
52 
53 RecentContactsCollectionsPrivate::~RecentContactsCollectionsPrivate()
54 {
55  delete mInstance;
56 }
57 
58 static KCoreConfigSkeleton *getConfig( const QString &filename)
59 {
60  Settings::instance( ServerManager::addNamespace( filename ) );
61  return Settings::self();
62 }
63 
64 RecentContactsCollections::RecentContactsCollections( RecentContactsCollectionsPrivate *dd )
65  : SpecialCollections( getConfig(QLatin1String("recentcontactscollectionsrc")) ),
66  d( dd )
67 {
68  Q_UNUSED(d); // d isn't used yet
69 }
70 
71 RecentContactsCollections *RecentContactsCollections::self()
72 {
73  return sInstance->mInstance;
74 }
75 
76 bool RecentContactsCollections::hasCollection( const AgentInstance &instance ) const
77 {
78  return SpecialCollections::hasCollection( sRecentContactsType, instance );
79 }
80 
81 Collection RecentContactsCollections::collection( const AgentInstance &instance ) const
82 {
83  return SpecialCollections::collection( sRecentContactsType, instance );
84 }
85 
86 bool RecentContactsCollections::registerCollection( const Collection &collection )
87 {
88  return SpecialCollections::registerCollection( sRecentContactsType, collection );
89 }
90 
91 bool RecentContactsCollections::hasDefaultCollection() const
92 {
93  return SpecialCollections::hasDefaultCollection( sRecentContactsType );
94 }
95 
96 Collection RecentContactsCollections::defaultCollection() const
97 {
98  return SpecialCollections::defaultCollection( sRecentContactsType );
99 }
100 
101 #include "moc_recentcontactscollections_p.cpp"
Akonadi::RecentContactsCollections::collection
Akonadi::Collection collection(const AgentInstance &instance) const
Returns the recent contacts collection in the given agent instance, or an invalid collection if such ...
Definition: recentcontactscollections.cpp:81
Akonadi::SpecialCollections::registerCollection
bool registerCollection(const QByteArray &type, const Akonadi::Collection &collection)
Registers the given collection as a special collection with the given type.
Definition: specialcollections.cpp:244
Akonadi::SpecialCollections
An interface to special collections.
Definition: specialcollections.h:65
Akonadi::SpecialCollections::hasCollection
bool hasCollection(const QByteArray &type, const AgentInstance &instance) const
Returns whether the given agent instance has a special collection of the given type.
Definition: specialcollections.cpp:194
Akonadi::RecentContactsCollections
Definition: recentcontactscollections_p.h:39
Akonadi::RecentContactsCollections::registerCollection
bool registerCollection(const Akonadi::Collection &collection)
Registers the given collection as a recent contacts collection.
Definition: recentcontactscollections.cpp:86
Akonadi::SpecialCollections::hasDefaultCollection
bool hasDefaultCollection(const QByteArray &type) const
Returns whether the default resource has a special collection of the given type.
Definition: specialcollections.cpp:272
Akonadi::Collection
Represents a collection of PIM items.
Definition: collection.h:75
Akonadi::RecentContactsCollections::hasCollection
bool hasCollection(const AgentInstance &instance) const
Returns whether the given agent instance has a recent contacts collection.
Definition: recentcontactscollections.cpp:76
Akonadi::RecentContactsCollections::hasDefaultCollection
bool hasDefaultCollection() const
Returns whether the default resource has a recent contacts collection.
Definition: recentcontactscollections.cpp:91
Akonadi::SpecialCollections::defaultCollection
Akonadi::Collection defaultCollection(const QByteArray &type) const
Returns the special collection of given type in the default resource, or an invalid collection if suc...
Definition: specialcollections.cpp:277
Akonadi::RecentContactsCollections::self
static RecentContactsCollections * self()
Returns the global RecentContactsCollections instance.
Definition: recentcontactscollections.cpp:71
Akonadi::SpecialCollections::collection
Akonadi::Collection collection(const QByteArray &type, const AgentInstance &instance) const
Returns the special collection of the given type in the given agent instance, or an invalid collectio...
Definition: specialcollections.cpp:199
Akonadi::RecentContactsCollections::defaultCollection
Akonadi::Collection defaultCollection() const
Returns the recent contacts collection in the default resource, or an invalid collection if such a co...
Definition: recentcontactscollections.cpp:96
Akonadi::AgentInstance
A representation of an agent instance.
Definition: agentinstance.h:62
Akonadi::ServerManager::addNamespace
static QString addNamespace(const QString &string)
Adds the multi-instance namespace to string if required (with '_' as separator).
Definition: servermanager.cpp:324
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal