• 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
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  d( new Private )
58 {
59 }
60 
61 CachePolicy::CachePolicy(const CachePolicy & other) :
62  d( other.d )
63 {
64 }
65 
66 CachePolicy::~ CachePolicy()
67 {
68 }
69 
70 CachePolicy & CachePolicy::operator =(const CachePolicy & other)
71 {
72  d = other.d;
73  return *this;
74 }
75 
76 bool Akonadi::CachePolicy::operator ==(const CachePolicy & other) const
77 {
78  if ( !d->inherit && !other.d->inherit ) {
79  return d->localParts == other.d->localParts
80  && d->timeout == other.d->timeout
81  && d->interval == other.d->interval
82  && d->syncOnDemand == other.d->syncOnDemand;
83  }
84  return d->inherit == other.d->inherit;
85 }
86 
87 bool CachePolicy::inheritFromParent() const
88 {
89  return d->inherit;
90 }
91 
92 void CachePolicy::setInheritFromParent(bool inherit)
93 {
94  d->inherit = inherit;
95 }
96 
97 QStringList CachePolicy::localParts() const
98 {
99  return d->localParts;
100 }
101 
102 void CachePolicy::setLocalParts(const QStringList & parts)
103 {
104  d->localParts = parts;
105 }
106 
107 int CachePolicy::cacheTimeout() const
108 {
109  return d->timeout;
110 }
111 
112 void CachePolicy::setCacheTimeout(int timeout)
113 {
114  d->timeout = timeout;
115 }
116 
117 int CachePolicy::intervalCheckTime() const
118 {
119  return d->interval;
120 }
121 
122 void CachePolicy::setIntervalCheckTime(int time)
123 {
124  d->interval = time;
125 }
126 
127 bool CachePolicy::syncOnDemand() const
128 {
129  return d->syncOnDemand;
130 }
131 
132 void CachePolicy::setSyncOnDemand(bool enable)
133 {
134  d->syncOnDemand = enable;
135 }
136 
137 QDebug operator<<( QDebug d, const CachePolicy& c )
138 {
139  return d << "CachePolicy: " << endl
140  << " inherit:" << c.inheritFromParent() << endl
141  << " interval:" << c.intervalCheckTime() << endl
142  << " timeout:" << c.cacheTimeout() << endl
143  << " sync on demand:" << c.syncOnDemand() << endl
144  << " local parts:" << c.localParts();
145 }
Akonadi::CachePolicy::intervalCheckTime
int intervalCheckTime() const
Returns the interval check time in minutes, -1 for never.
Definition: cachepolicy.cpp:117
Akonadi::CachePolicy::setSyncOnDemand
void setSyncOnDemand(bool enable)
Sets whether the collection shall be synced automatically when necessary, i.e.
Definition: cachepolicy.cpp:132
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:87
Akonadi::CachePolicy::setIntervalCheckTime
void setIntervalCheckTime(int time)
Sets interval check time.
Definition: cachepolicy.cpp:122
Akonadi::CachePolicy::setCacheTimeout
void setCacheTimeout(int timeout)
Sets cache timeout for non-permanently cached parts.
Definition: cachepolicy.cpp:112
Akonadi::CachePolicy::operator==
bool operator==(const CachePolicy &other) const
Definition: cachepolicy.cpp:76
Akonadi::CachePolicy::cacheTimeout
int cacheTimeout() const
Returns the cache timeout for non-permanently cached parts in minutes; -1 means indefinitely.
Definition: cachepolicy.cpp:107
Akonadi::CachePolicy
Represents the caching policy for a collection.
Definition: cachepolicy.h:71
Akonadi::CachePolicy::setLocalParts
void setLocalParts(const QStringList &parts)
Specifies the parts to permanently cache locally.
Definition: cachepolicy.cpp:102
Akonadi::CachePolicy::~CachePolicy
~CachePolicy()
Destroys the cache policy.
Definition: cachepolicy.cpp:66
Akonadi::CachePolicy::localParts
QStringList localParts() const
Returns the parts to permanently cache locally.
Definition: cachepolicy.cpp:97
Akonadi::CachePolicy::setInheritFromParent
void setInheritFromParent(bool inherit)
Sets whether the cache policy should be inherited from the parent collection.
Definition: cachepolicy.cpp:92
Akonadi::CachePolicy::operator=
CachePolicy & operator=(const CachePolicy &other)
Definition: cachepolicy.cpp:70
Akonadi::CachePolicy::syncOnDemand
bool syncOnDemand() const
Returns whether the collection will be synced automatically when necessary, i.e.
Definition: cachepolicy.cpp:127
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:26 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