itemfetchscope.h

00001 /*
00002     Copyright (c) 2008 Kevin Krammer <kevin.krammer@gmx.at>
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 #ifndef ITEMFETCHSCOPE_H
00021 #define ITEMFETCHSCOPE_H
00022 
00023 #include "akonadi_export.h"
00024 
00025 #include <QtCore/QSharedDataPointer>
00026 
00027 class QStringList;
00028 template <typename T> class QSet;
00029 
00030 namespace Akonadi {
00031 
00032 class ItemFetchScopePrivate;
00033 
00067 class AKONADI_EXPORT ItemFetchScope
00068 {
00069   public:
00074     enum AncestorRetrieval {
00075       None, 
00076       Parent, 
00077       All 
00078     };
00079 
00086     ItemFetchScope();
00087 
00091     ItemFetchScope( const ItemFetchScope &other );
00092 
00096     ~ItemFetchScope();
00097 
00101     ItemFetchScope &operator=( const ItemFetchScope &other );
00102 
00108     QSet<QByteArray> payloadParts() const;
00109 
00117     void fetchPayloadPart( const QByteArray &part, bool fetch = true );
00118 
00124     bool fullPayload() const;
00125 
00132     void fetchFullPayload( bool fetch = true );
00133 
00141     QSet<QByteArray> attributes() const;
00142 
00149     void fetchAttribute( const QByteArray &type, bool fetch = true );
00150 
00156     template <typename T> inline void fetchAttribute( bool fetch = true )
00157     {
00158       T dummy;
00159       fetchAttribute( dummy.type(), fetch );
00160     }
00161 
00167     bool allAttributes() const;
00168 
00175     void fetchAllAttributes( bool fetch = true );
00176 
00183     bool cacheOnly() const;
00184 
00192     void setCacheOnly( bool cacheOnly );
00193 
00201     void setAncestorRetrieval( AncestorRetrieval ancestorDepth );
00202 
00209     AncestorRetrieval ancestorRetrieval() const;
00210 
00214     bool isEmpty() const;
00215 
00216   private:
00217     //@cond PRIVATE
00218     QSharedDataPointer<ItemFetchScopePrivate> d;
00219     //@endcond
00220 };
00221 
00222 }
00223 
00224 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys