akonadi
collection.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AKONADI_COLLECTION_H
00021 #define AKONADI_COLLECTION_H
00022
00023 #include "akonadi_export.h"
00024
00025 #include <akonadi/entity.h>
00026
00027 #include <QtCore/QMetaType>
00028 #include <QtCore/QSharedDataPointer>
00029
00030 class KUrl;
00031
00032 namespace Akonadi {
00033
00034 class CachePolicy;
00035 class CollectionPrivate;
00036 class CollectionStatistics;
00037
00075 class AKONADI_EXPORT Collection : public Entity
00076 {
00077 public:
00081 typedef QList<Collection> List;
00082
00086 enum Right {
00087 ReadOnly = 0x0,
00088 CanChangeItem = 0x1,
00089 CanCreateItem = 0x2,
00090 CanDeleteItem = 0x4,
00091 CanChangeCollection = 0x8,
00092 CanCreateCollection = 0x10,
00093 CanDeleteCollection = 0x20,
00094 CanLinkItem = 0x40,
00095 CanUnlinkItem = 0x80,
00096 AllRights = (CanChangeItem | CanCreateItem | CanDeleteItem |
00097 CanChangeCollection | CanCreateCollection | CanDeleteCollection)
00098 };
00099 Q_DECLARE_FLAGS(Rights, Right)
00100
00101
00104 Collection();
00105
00111 explicit Collection( Id id );
00112
00116 ~Collection();
00117
00121 Collection( const Collection &other );
00122
00126 static Collection fromUrl( const KUrl &url );
00127
00131 QString name() const;
00132
00138 void setName( const QString &name );
00139
00143 Rights rights() const;
00144
00148 void setRights( Rights rights );
00149
00155 QStringList contentMimeTypes() const;
00156
00160 void setContentMimeTypes( const QStringList &types );
00161
00166 KDE_DEPRECATED Id parent() const;
00167
00172 KDE_DEPRECATED void setParent( Id parent );
00173
00178 KDE_DEPRECATED void setParent( const Collection &collection );
00179
00185 KDE_DEPRECATED QString parentRemoteId() const;
00186
00191 KDE_DEPRECATED void setParentRemoteId( const QString &identifier );
00192
00196 static Collection root();
00197
00201 static QString mimeType();
00202
00206 QString resource() const;
00207
00211 void setResource( const QString &identifier );
00212
00216 CachePolicy cachePolicy() const;
00217
00221 void setCachePolicy( const CachePolicy &policy );
00222
00226 CollectionStatistics statistics() const;
00227
00231 void setStatistics( const CollectionStatistics &statistics );
00232
00236 KUrl url() const;
00237
00238 private:
00239 AKONADI_DECLARE_PRIVATE( Collection )
00240 friend class CollectionFetchJob;
00241 friend class CollectionModifyJob;
00242 };
00243
00244 }
00245
00246 AKONADI_EXPORT uint qHash( const Akonadi::Collection &collection );
00250 AKONADI_EXPORT QDebug operator<<( QDebug d, const Akonadi::Collection &collection );
00251
00252 Q_DECLARE_METATYPE(Akonadi::Collection)
00253 Q_DECLARE_METATYPE(Akonadi::Collection::List)
00254 Q_DECLARE_OPERATORS_FOR_FLAGS( Akonadi::Collection::Rights )
00255
00256 #endif