akonadi
cachepolicy.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "cachepolicy.h"
00021 #include "collection.h"
00022
00023 using namespace Akonadi;
00024
00028 class CachePolicy::Private : public QSharedData
00029 {
00030 public:
00031 Private() :
00032 QSharedData(),
00033 inherit( true ),
00034 timeout( -1 ),
00035 interval( -1 ),
00036 syncOnDemand( false )
00037 {}
00038
00039 Private( const Private &other ) :
00040 QSharedData( other )
00041 {
00042 inherit = other.inherit;
00043 localParts = other.localParts;
00044 timeout = other.timeout;
00045 interval = other.interval;
00046 syncOnDemand = other.syncOnDemand;
00047 }
00048
00049 bool inherit;
00050 QStringList localParts;
00051 int timeout;
00052 int interval;
00053 bool syncOnDemand;
00054 };
00055
00056
00057 CachePolicy::CachePolicy() :
00058 d( new Private )
00059 {
00060 }
00061
00062 CachePolicy::CachePolicy(const CachePolicy & other) :
00063 d( other.d )
00064 {
00065 }
00066
00067 CachePolicy::~ CachePolicy()
00068 {
00069 }
00070
00071 CachePolicy & CachePolicy::operator =(const CachePolicy & other)
00072 {
00073 d = other.d;
00074 return *this;
00075 }
00076
00077 bool Akonadi::CachePolicy::operator ==(const CachePolicy & other) const
00078 {
00079 if ( !d->inherit && !other.d->inherit ) {
00080 return d->localParts == other.d->localParts
00081 && d->timeout == other.d->timeout
00082 && d->interval == other.d->interval
00083 && d->syncOnDemand == other.d->syncOnDemand;
00084 }
00085 return d->inherit == other.d->inherit;
00086 }
00087
00088 bool CachePolicy::inheritFromParent() const
00089 {
00090 return d->inherit;
00091 }
00092
00093 void CachePolicy::setInheritFromParent(bool inherit)
00094 {
00095 d->inherit = inherit;
00096 }
00097
00098 QStringList CachePolicy::localParts() const
00099 {
00100 return d->localParts;
00101 }
00102
00103 void CachePolicy::setLocalParts(const QStringList & parts)
00104 {
00105 d->localParts = parts;
00106 }
00107
00108 int CachePolicy::cacheTimeout() const
00109 {
00110 return d->timeout;
00111 }
00112
00113 void CachePolicy::setCacheTimeout(int timeout)
00114 {
00115 d->timeout = timeout;
00116 }
00117
00118 int CachePolicy::intervalCheckTime() const
00119 {
00120 return d->interval;
00121 }
00122
00123 void CachePolicy::setIntervalCheckTime(int time)
00124 {
00125 d->interval = time;
00126 }
00127
00128 bool CachePolicy::syncOnDemand() const
00129 {
00130 return d->syncOnDemand;
00131 }
00132
00133 void CachePolicy::setSyncOnDemand(bool enable)
00134 {
00135 d->syncOnDemand = enable;
00136 }