00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "itemfetchscope.h"
00021
00022 #include "itemfetchscope_p.h"
00023
00024 #include <QtCore/QStringList>
00025
00026 using namespace Akonadi;
00027
00028 ItemFetchScope::ItemFetchScope()
00029 {
00030 d = new ItemFetchScopePrivate();
00031 }
00032
00033 ItemFetchScope::ItemFetchScope( const ItemFetchScope &other )
00034 : d( other.d )
00035 {
00036 }
00037
00038 ItemFetchScope::~ItemFetchScope()
00039 {
00040 }
00041
00042 ItemFetchScope &ItemFetchScope::operator=( const ItemFetchScope &other )
00043 {
00044 if ( &other != this )
00045 d = other.d;
00046
00047 return *this;
00048 }
00049
00050 QSet< QByteArray > ItemFetchScope::payloadParts() const
00051 {
00052 return d->mPayloadParts;
00053 }
00054
00055 void ItemFetchScope::fetchPayloadPart(const QByteArray & part, bool fetch)
00056 {
00057 if ( fetch )
00058 d->mPayloadParts.insert( part );
00059 else
00060 d->mPayloadParts.remove( part );
00061 }
00062
00063 bool ItemFetchScope::fullPayload() const
00064 {
00065 return d->mFullPayload;
00066 }
00067
00068 void ItemFetchScope::fetchFullPayload(bool fetch)
00069 {
00070 d->mFullPayload = fetch;
00071 }
00072
00073 QSet< QByteArray > ItemFetchScope::attributes() const
00074 {
00075 return d->mAttributes;
00076 }
00077
00078 void ItemFetchScope::fetchAttribute(const QByteArray & type, bool fetch)
00079 {
00080 if ( fetch )
00081 d->mAttributes.insert( type );
00082 else
00083 d->mAttributes.remove( type );
00084 }
00085
00086 bool ItemFetchScope::allAttributes() const
00087 {
00088 return d->mAllAttributes;
00089 }
00090
00091 void ItemFetchScope::fetchAllAttributes(bool fetch)
00092 {
00093 d->mAllAttributes = fetch;
00094 }
00095
00096 bool ItemFetchScope::isEmpty() const
00097 {
00098 return d->mPayloadParts.isEmpty() && d->mAttributes.isEmpty() && !d->mFullPayload && !d->mAllAttributes;
00099 }
00100
00101 bool ItemFetchScope::cacheOnly() const
00102 {
00103 return d->mCacheOnly;
00104 }
00105
00106 void ItemFetchScope::setCacheOnly(bool cacheOnly)
00107 {
00108 d->mCacheOnly = cacheOnly;
00109 }
00110
00111 ItemFetchScope::AncestorRetrieval ItemFetchScope::ancestorRetrieval() const
00112 {
00113 return d->mAncestorDepth;
00114 }
00115
00116 void ItemFetchScope::setAncestorRetrieval( AncestorRetrieval depth )
00117 {
00118 d->mAncestorDepth = depth;
00119 }
00120
00121 void ItemFetchScope::setFetchModificationTime( bool retrieveMtime )
00122 {
00123 d->mFetchMtime = retrieveMtime;
00124 }
00125
00126 bool ItemFetchScope::fetchModificationTime() const
00127 {
00128 return d->mFetchMtime;
00129 }
00130