• Skip to content
  • Skip to link menu
KDE 4.8 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

akonadi

cachepolicy.cpp
00001 /*
00002     Copyright (c) 2008 Volker Krause <vkrause@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
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 }
00137 
00138 QDebug operator<<( QDebug d, const CachePolicy& c )
00139 {
00140     return d << "CachePolicy: " << endl
00141             << "   inherit:" << c.inheritFromParent() << endl
00142             << "   interval:" << c.intervalCheckTime() << endl
00143             << "   timeout:" << c.cacheTimeout() << endl
00144             << "   sync on demand:" << c.syncOnDemand() << endl
00145             << "   local parts:" << c.localParts();
00146 }

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal