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

akonadi

  • akonadi
cachepolicy.cpp
1/*
2 Copyright (c) 2008 Volker Krause <vkrause@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#include "cachepolicy.h"
21#include "collection.h"
22
23using namespace Akonadi;
24
28class CachePolicy::Private : public QSharedData
29{
30public:
31 Private()
32 : QSharedData()
33 , inherit(true)
34 , timeout(-1)
35 , interval(-1)
36 , syncOnDemand(false)
37 {}
38
39 Private(const Private &other)
40 : QSharedData(other)
41 {
42 inherit = other.inherit;
43 localParts = other.localParts;
44 timeout = other.timeout;
45 interval = other.interval;
46 syncOnDemand = other.syncOnDemand;
47 }
48
49 bool inherit;
50 QStringList localParts;
51 int timeout;
52 int interval;
53 bool syncOnDemand;
54};
55
56CachePolicy::CachePolicy()
57{
58 static QSharedDataPointer<Private> sharedPrivate(new Private);
59 d = sharedPrivate;
60}
61
62CachePolicy::CachePolicy(const CachePolicy &other)
63 : d(other.d)
64{
65}
66
67CachePolicy::~ CachePolicy()
68{
69}
70
71CachePolicy &CachePolicy::operator =(const CachePolicy &other)
72{
73 d = other.d;
74 return *this;
75}
76
77bool Akonadi::CachePolicy::operator ==(const CachePolicy &other) const
78{
79 if (!d->inherit && !other.d->inherit) {
80 return d->localParts == other.d->localParts
81 && d->timeout == other.d->timeout
82 && d->interval == other.d->interval
83 && d->syncOnDemand == other.d->syncOnDemand;
84 }
85 return d->inherit == other.d->inherit;
86}
87
88bool CachePolicy::inheritFromParent() const
89{
90 return d->inherit;
91}
92
93void CachePolicy::setInheritFromParent(bool inherit)
94{
95 d->inherit = inherit;
96}
97
98QStringList CachePolicy::localParts() const
99{
100 return d->localParts;
101}
102
103void CachePolicy::setLocalParts(const QStringList &parts)
104{
105 d->localParts = parts;
106}
107
108int CachePolicy::cacheTimeout() const
109{
110 return d->timeout;
111}
112
113void CachePolicy::setCacheTimeout(int timeout)
114{
115 d->timeout = timeout;
116}
117
118int CachePolicy::intervalCheckTime() const
119{
120 return d->interval;
121}
122
123void CachePolicy::setIntervalCheckTime(int time)
124{
125 d->interval = time;
126}
127
128bool CachePolicy::syncOnDemand() const
129{
130 return d->syncOnDemand;
131}
132
133void CachePolicy::setSyncOnDemand(bool enable)
134{
135 d->syncOnDemand = enable;
136}
137
138QDebug operator<<(QDebug d, const CachePolicy &c)
139{
140 return d << "CachePolicy: " << endl
141 << " inherit:" << c.inheritFromParent() << endl
142 << " interval:" << c.intervalCheckTime() << endl
143 << " timeout:" << c.cacheTimeout() << endl
144 << " sync on demand:" << c.syncOnDemand() << endl
145 << " local parts:" << c.localParts();
146}
Akonadi::CachePolicy
Represents the caching policy for a collection.
Definition cachepolicy.h:72
Akonadi::CachePolicy::operator==
bool operator==(const CachePolicy &other) const
Definition cachepolicy.cpp:77
Akonadi::CachePolicy::cacheTimeout
int cacheTimeout() const
Returns the cache timeout for non-permanently cached parts in minutes; -1 means indefinitely.
Definition cachepolicy.cpp:108
Akonadi::CachePolicy::inheritFromParent
bool inheritFromParent() const
Returns whether it inherits cache policy from the parent collection.
Definition cachepolicy.cpp:88
Akonadi::CachePolicy::intervalCheckTime
int intervalCheckTime() const
Returns the interval check time in minutes, -1 for never.
Definition cachepolicy.cpp:118
Akonadi::CachePolicy::setLocalParts
void setLocalParts(const QStringList &parts)
Specifies the parts to permanently cache locally.
Definition cachepolicy.cpp:103
Akonadi::CachePolicy::operator=
CachePolicy & operator=(const CachePolicy &other)
Definition cachepolicy.cpp:71
Akonadi::CachePolicy::localParts
QStringList localParts() const
Returns the parts to permanently cache locally.
Definition cachepolicy.cpp:98
Akonadi::CachePolicy::syncOnDemand
bool syncOnDemand() const
Returns whether the collection will be synced automatically when necessary, i.e.
Definition cachepolicy.cpp:128
Akonadi::CachePolicy::setIntervalCheckTime
void setIntervalCheckTime(int time)
Sets interval check time.
Definition cachepolicy.cpp:123
Akonadi::CachePolicy::setCacheTimeout
void setCacheTimeout(int timeout)
Sets cache timeout for non-permanently cached parts.
Definition cachepolicy.cpp:113
Akonadi::CachePolicy::setInheritFromParent
void setInheritFromParent(bool inherit)
Sets whether the cache policy should be inherited from the parent collection.
Definition cachepolicy.cpp:93
Akonadi::CachePolicy::setSyncOnDemand
void setSyncOnDemand(bool enable)
Sets whether the collection shall be synced automatically when necessary, i.e.
Definition cachepolicy.cpp:133
Akonadi::CachePolicy::CachePolicy
CachePolicy()
Creates an empty cache policy.
Definition cachepolicy.cpp:56
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