9#include "akonadicore_export.h"
14#include <QSharedDataPointer>
21class CollectionPrivate;
22class CollectionStatistics;
64 Q_PROPERTY(
Id id READ
id WRITE setId)
65 Q_PROPERTY(
QString remoteIdd READ remoteId WRITE setRemoteId)
66 Q_PROPERTY(
bool isValid READ isValid)
67 Q_PROPERTY(
QString remoteRevision READ remoteRevision WRITE setRemoteRevision)
68 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled)
69 Q_PROPERTY(
bool isVirtual READ isVirtual WRITE setVirtual)
70 Q_PROPERTY(
QString name READ name WRITE setName)
71 Q_PROPERTY(
QString displayName READ displayName)
72 Q_PROPERTY(
Rights rights READ rights WRITE setRights)
73 Q_PROPERTY(
QStringList contentMimeTypes READ contentMimeTypes WRITE setContentMimeTypes)
74 Q_PROPERTY(
QString resource READ resource WRITE setResource)
94 CanChangeCollection = 0x8,
95 CanCreateCollection = 0x10,
96 CanDeleteCollection = 0x20,
99 AllRights = (CanChangeItem | CanCreateItem | CanDeleteItem | CanChangeCollection | CanCreateCollection
100 | CanDeleteCollection)
102 Q_DECLARE_FLAGS(Rights, Right)
140 void setId(
Id identifier);
145 [[nodiscard]]
Id id()
const;
150 void setRemoteId(
const QString &
id);
155 [[nodiscard]]
QString remoteId()
const;
166 void setRemoteRevision(
const QString &revision);
174 [[nodiscard]]
QString remoteRevision()
const;
179 [[nodiscard]]
bool isValid()
const;
185 [[nodiscard]]
bool operator==(
const Collection &other)
const;
191 [[nodiscard]]
bool operator!=(
const Collection &other)
const;
205 [[nodiscard]]
bool operator<(
const Collection &other)
const;
213 [[nodiscard]]
Collection parentCollection()
const;
232 void setParentCollection(
const Collection &parent);
255 bool hasAttribute(
const QByteArray &name)
const;
269 void clearAttributes();
293 inline T *attribute(CreateOption option = DontCreate);
299 inline const T *attribute()
const;
305 inline void removeAttribute();
311 inline bool hasAttribute()
const;
316 [[nodiscard]]
QString name()
const;
325 [[nodiscard]]
QString displayName()
const;
332 void setName(
const QString &name);
337 [[nodiscard]] Rights rights()
const;
342 void setRights(Rights rights);
349 [[nodiscard]]
QStringList contentMimeTypes()
const;
354 void setContentMimeTypes(
const QStringList &types);
364 [[nodiscard]]
static QString mimeType();
371 [[nodiscard]]
static QString virtualMimeType();
376 [[nodiscard]]
QString resource()
const;
381 void setResource(
const QString &identifier);
418 [[nodiscard]]
QUrl url(UrlType type = UrlShort)
const;
425 [[nodiscard]]
bool isVirtual()
const;
433 void setVirtual(
bool isVirtual);
454 void setEnabled(
bool enabled);
461 [[nodiscard]]
bool enabled()
const;
496 void setLocalListPreference(ListPurpose purpose, ListPreference preference);
503 [[nodiscard]] ListPreference localListPreference(ListPurpose purpose)
const;
512 [[nodiscard]]
bool shouldList(ListPurpose purpose)
const;
524 void setShouldList(ListPurpose purpose,
bool shouldList);
541 friend class ProtocolHelper;
543 void markAttributeModified(
const QByteArray &type);
547 friend class CollectionPrivate;
551AKONADICORE_EXPORT
size_t qHash(
const Akonadi::Collection &collection,
size_t seed = 0) noexcept;
557 markAttributeModified(type);
558 if (hasAttribute(type)) {
559 if (T *attr =
dynamic_cast<T *
>(attribute(type))) {
562 qWarning() <<
"Found attribute of unknown type" << type <<
". Did you forget to call AttributeFactory::registerAttribute()?";
563 }
else if (option == AddIfMissing) {
576 if (hasAttribute(type)) {
577 if (
const T *attr =
dynamic_cast<const T *
>(attribute(type))) {
580 qWarning() <<
"Found attribute of unknown type" << type <<
". Did you forget to call AttributeFactory::registerAttribute()?";
589 removeAttribute(T().type());
595 return hasAttribute(T().type());
Provides interface for custom attributes for Entity.
Represents the caching policy for a collection.
Job that creates a new collection in the Akonadi storage.
Job that fetches collections from the Akonadi storage.
Job that modifies a collection in the Akonadi storage.
Provides statistics information of a Collection.
Represents a collection of PIM items.
~Collection()
Destroys the collection.
qint64 Id
Describes the unique id type.
UrlType
Describes the type of url which is returned in url().
ListPurpose
Describes the purpose of the listing.
@ ListSync
Listing for synchronization.
@ ListDisplay
Listing for display to the user.
Collection(Collection &&other) noexcept
Move constructor.
const T * attribute() const
Returns the attribute of the requested type or 0 if it is not available.
CreateOption
Describes the options that can be passed to access attributes.
@ AddIfMissing
Creates the attribute if it is missing.
Right
Describes rights of a collection.
bool hasAttribute() const
Returns whether the collection has an attribute of the requested type.
void removeAttribute()
Removes and deletes the attribute of the requested type.
ListPreference
Describes the list preference value.
@ ListDisabled
Disable collection for specified purpose.
@ ListEnabled
Enable collection for specified purpose.
Helper integration between Akonadi and Qt.