File indexing completed on 2024-11-10 04:40:27

0001 /*
0002     SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonadicore_export.h"
0010 
0011 #include "attribute.h"
0012 #include "collection.h"
0013 
0014 #include <memory>
0015 
0016 namespace Akonadi
0017 {
0018 class CollectionRightsAttributePrivate;
0019 
0020 /**
0021  * @internal
0022  *
0023  * @short Attribute that stores the rights of a collection.
0024  *
0025  * Every collection can have rights set which describes whether
0026  * the collection is readable or writable. That information is stored
0027  * in this custom attribute.
0028  *
0029  * @note You shouldn't use this class directly but the convenience methods
0030  * Collection::rights() and Collection::setRights() instead.
0031  *
0032  * @author Tobias Koenig <tokoe@kde.org>
0033  */
0034 class AKONADICORE_EXPORT CollectionRightsAttribute : public Attribute
0035 {
0036 public:
0037     /**
0038      * Creates a new collection rights attribute.
0039      */
0040     explicit CollectionRightsAttribute();
0041 
0042     /**
0043      * Destroys the collection rights attribute.
0044      */
0045     ~CollectionRightsAttribute() override;
0046 
0047     /**
0048      * Sets the @p rights of the collection.
0049      */
0050     void setRights(Collection::Rights rights);
0051 
0052     /**
0053      * Returns the rights of the collection.
0054      */
0055     Collection::Rights rights() const;
0056 
0057     QByteArray type() const override;
0058 
0059     CollectionRightsAttribute *clone() const override;
0060 
0061     QByteArray serialized() const override;
0062 
0063     void deserialize(const QByteArray &data) override;
0064 
0065 private:
0066     /// @cond PRIVATE
0067     const std::unique_ptr<CollectionRightsAttributePrivate> d;
0068     /// @endcond
0069 };
0070 
0071 } // namespace Akonadi