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

akonadi

  • sources
  • kde-4.14
  • kdepimlibs
  • 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 
23 using namespace Akonadi;
24 
28 class CachePolicy::Private : public QSharedData
29 {
30 public:
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 
56 CachePolicy::CachePolicy()
57 {
58  static QSharedDataPointer<Private> sharedPrivate(new Private);
59  d = sharedPrivate;
60 }
61 
62 CachePolicy::CachePolicy(const CachePolicy &other)
63  : d(other.d)
64 {
65 }
66 
67 CachePolicy::~ CachePolicy()
68 {
69 }
70 
71 CachePolicy &CachePolicy::operator =(const CachePolicy &other)
72 {
73  d = other.d;
74  return *this;
75 }
76 
77 bool 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 
88 bool CachePolicy::inheritFromParent() const
89 {
90  return d->inherit;
91 }
92 
93 void CachePolicy::setInheritFromParent(bool inherit)
94 {
95  d->inherit = inherit;
96 }
97 
98 QStringList CachePolicy::localParts() const
99 {
100  return d->localParts;
101 }
102 
103 void CachePolicy::setLocalParts(const QStringList &parts)
104 {
105  d->localParts = parts;
106 }
107 
108 int CachePolicy::cacheTimeout() const
109 {
110  return d->timeout;
111 }
112 
113 void CachePolicy::setCacheTimeout(int timeout)
114 {
115  d->timeout = timeout;
116 }
117 
118 int CachePolicy::intervalCheckTime() const
119 {
120  return d->interval;
121 }
122 
123 void CachePolicy::setIntervalCheckTime(int time)
124 {
125  d->interval = time;
126 }
127 
128 bool CachePolicy::syncOnDemand() const
129 {
130  return d->syncOnDemand;
131 }
132 
133 void CachePolicy::setSyncOnDemand(bool enable)
134 {
135  d->syncOnDemand = enable;
136 }
137 
138 QDebug 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::intervalCheckTime
int intervalCheckTime() const
Returns the interval check time in minutes, -1 for never.
Definition: cachepolicy.cpp:118
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::CachePolicy::inheritFromParent
bool inheritFromParent() const
Returns whether it inherits cache policy from the parent collection.
Definition: cachepolicy.cpp:88
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::operator==
bool operator==(const CachePolicy &other) const
Definition: cachepolicy.cpp:77
QSharedData
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
Represents the caching policy for a collection.
Definition: cachepolicy.h:71
QStringList
Akonadi::CachePolicy::setLocalParts
void setLocalParts(const QStringList &parts)
Specifies the parts to permanently cache locally.
Definition: cachepolicy.cpp:103
QDebug
Akonadi::CachePolicy::~CachePolicy
~CachePolicy()
Destroys the cache policy.
Definition: cachepolicy.cpp:67
Akonadi::CachePolicy::localParts
QStringList localParts() const
Returns the parts to permanently cache locally.
Definition: cachepolicy.cpp:98
Akonadi::CachePolicy::setInheritFromParent
void setInheritFromParent(bool inherit)
Sets whether the cache policy should be inherited from the parent collection.
Definition: cachepolicy.cpp:93
QSharedDataPointer< Private >
Akonadi::CachePolicy::operator=
CachePolicy & operator=(const CachePolicy &other)
Definition: cachepolicy.cpp:71
Akonadi::CachePolicy::syncOnDemand
bool syncOnDemand() const
Returns whether the collection will be synced automatically when necessary, i.e.
Definition: cachepolicy.cpp:128
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:02 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
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

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