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

akonadi

  • 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
31using namespace Akonadi;
32
33class Akonadi::RecentContactsCollectionsPrivate
34{
35 public:
36 RecentContactsCollectionsPrivate();
37 ~RecentContactsCollectionsPrivate();
38
39 RecentContactsCollections *mInstance;
40};
41
42typedef RecentContactsCollectionsSettings Settings;
43
44K_GLOBAL_STATIC( RecentContactsCollectionsPrivate, sInstance )
45
46static const QByteArray sRecentContactsType = "recent-contacts";
47
48RecentContactsCollectionsPrivate::RecentContactsCollectionsPrivate()
49 : mInstance( new RecentContactsCollections( this ) )
50{
51}
52
53RecentContactsCollectionsPrivate::~RecentContactsCollectionsPrivate()
54{
55 delete mInstance;
56}
57
58static KCoreConfigSkeleton *getConfig( const QString &filename)
59{
60 Settings::instance( ServerManager::addNamespace( filename ) );
61 return Settings::self();
62}
63
64RecentContactsCollections::RecentContactsCollections( RecentContactsCollectionsPrivate *dd )
65 : SpecialCollections( getConfig(QLatin1String("recentcontactscollectionsrc")) ),
66 d( dd )
67{
68 Q_UNUSED(d); // d isn't used yet
69}
70
71RecentContactsCollections *RecentContactsCollections::self()
72{
73 return sInstance->mInstance;
74}
75
76bool RecentContactsCollections::hasCollection( const AgentInstance &instance ) const
77{
78 return SpecialCollections::hasCollection( sRecentContactsType, instance );
79}
80
81Collection RecentContactsCollections::collection( const AgentInstance &instance ) const
82{
83 return SpecialCollections::collection( sRecentContactsType, instance );
84}
85
86bool RecentContactsCollections::registerCollection( const Collection &collection )
87{
88 return SpecialCollections::registerCollection( sRecentContactsType, collection );
89}
90
91bool RecentContactsCollections::hasDefaultCollection() const
92{
93 return SpecialCollections::hasDefaultCollection( sRecentContactsType );
94}
95
96Collection RecentContactsCollections::defaultCollection() const
97{
98 return SpecialCollections::defaultCollection( sRecentContactsType );
99}
100
101#include "moc_recentcontactscollections_p.cpp"
Akonadi::AgentInstance
A representation of an agent instance.
Definition agentinstance.h:63
Akonadi::Collection
Represents a collection of PIM items.
Definition collection.h:76
Akonadi::RecentContactsCollections
Definition recentcontactscollections_p.h:40
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::RecentContactsCollections::hasDefaultCollection
bool hasDefaultCollection() const
Returns whether the default resource has a recent contacts collection.
Definition recentcontactscollections.cpp:91
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::self
static RecentContactsCollections * self()
Returns the global RecentContactsCollections instance.
Definition recentcontactscollections.cpp:71
Akonadi::RecentContactsCollections::registerCollection
bool registerCollection(const Akonadi::Collection &collection)
Registers the given collection as a recent contacts collection.
Definition recentcontactscollections.cpp:86
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::ServerManager::addNamespace
static QString addNamespace(const QString &string)
Adds the multi-instance namespace to string if required (with '_' as separator).
Definition servermanager.cpp:337
Akonadi::SpecialCollections
An interface to special collections.
Definition specialcollections.h:66
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::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::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::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::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
FreeBusyManager::Singleton.
Definition actionstatemanager_p.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 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
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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