akonadi
collectionfetchscope.cpp
00001 /* 00002 Copyright (c) 2008 Kevin Krammer <kevin.krammer@gmx.at> 00003 Copyright (c) 2009 Volker Krause <vkrause@kde.org> 00004 00005 This library is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU Library General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or (at your 00008 option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, but WITHOUT 00011 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to the 00017 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 02110-1301, USA. 00019 */ 00020 00021 #include "collectionfetchscope.h" 00022 00023 #include <QString> 00024 #include <QStringList> 00025 00026 namespace Akonadi { 00027 00028 class CollectionFetchScopePrivate : public QSharedData 00029 { 00030 public: 00031 CollectionFetchScopePrivate() : 00032 ancestorDepth( CollectionFetchScope::None ), 00033 unsubscribed( false ), 00034 statistics( false ) 00035 { 00036 } 00037 00038 CollectionFetchScopePrivate( const CollectionFetchScopePrivate &other ) 00039 : QSharedData( other ) 00040 { 00041 resource = other.resource; 00042 contentMimeTypes = other.contentMimeTypes; 00043 ancestorDepth = other.ancestorDepth; 00044 unsubscribed = other.unsubscribed; 00045 statistics = other.statistics; 00046 } 00047 00048 public: 00049 QString resource; 00050 QStringList contentMimeTypes; 00051 CollectionFetchScope::AncestorRetrieval ancestorDepth; 00052 bool unsubscribed; 00053 bool statistics; 00054 }; 00055 00056 CollectionFetchScope::CollectionFetchScope() 00057 { 00058 d = new CollectionFetchScopePrivate(); 00059 } 00060 00061 CollectionFetchScope::CollectionFetchScope( const CollectionFetchScope &other ) 00062 : d( other.d ) 00063 { 00064 } 00065 00066 CollectionFetchScope::~CollectionFetchScope() 00067 { 00068 } 00069 00070 CollectionFetchScope &CollectionFetchScope::operator=( const CollectionFetchScope &other ) 00071 { 00072 if ( &other != this ) 00073 d = other.d; 00074 00075 return *this; 00076 } 00077 00078 bool CollectionFetchScope::isEmpty () const 00079 { 00080 return d->resource.isEmpty() && d->contentMimeTypes.isEmpty() && !d->statistics && !d->unsubscribed && d->ancestorDepth == None; 00081 } 00082 00083 bool CollectionFetchScope::includeUnubscribed () const 00084 { 00085 return d->unsubscribed; 00086 } 00087 00088 void CollectionFetchScope::setIncludeUnsubscribed (bool include) 00089 { 00090 d->unsubscribed = include; 00091 } 00092 00093 bool CollectionFetchScope::includeStatistics () const 00094 { 00095 return d->statistics; 00096 } 00097 00098 void CollectionFetchScope::setIncludeStatistics (bool include) 00099 { 00100 d->statistics = include; 00101 } 00102 00103 QString CollectionFetchScope::resource () const 00104 { 00105 return d->resource; 00106 } 00107 00108 void CollectionFetchScope::setResource (const QString & resource) 00109 { 00110 d->resource = resource; 00111 } 00112 00113 QStringList CollectionFetchScope::contentMimeTypes () const 00114 { 00115 return d->contentMimeTypes; 00116 } 00117 00118 void CollectionFetchScope::setContentMimeTypes (const QStringList & mimeTypes) 00119 { 00120 d->contentMimeTypes = mimeTypes; 00121 } 00122 00123 CollectionFetchScope::AncestorRetrieval CollectionFetchScope::ancestorRetrieval() const 00124 { 00125 return d->ancestorDepth; 00126 } 00127 00128 void CollectionFetchScope::setAncestorRetrieval( AncestorRetrieval ancestorDepth ) 00129 { 00130 d->ancestorDepth = ancestorDepth; 00131 } 00132 00133 }