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

0001 /*
0002     SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "attribute.h"
0010 #include <QByteArray>
0011 
0012 #include <memory>
0013 
0014 namespace Akonadi
0015 {
0016 class CollectionIdentificationAttributePrivate;
0017 
0018 /**
0019  * @short Attribute that stores additional information on a collection that can be used for searching.
0020  *
0021  * Additional indexed properties that can be used for searching.
0022  *
0023  * @author Christian Mollekopf <mollekopf@kolabsys.com>
0024  * @since 4.15
0025  */
0026 class AKONADICORE_EXPORT CollectionIdentificationAttribute : public Akonadi::Attribute
0027 {
0028 public:
0029     explicit CollectionIdentificationAttribute(const QByteArray &identifier = QByteArray(),
0030                                                const QByteArray &folderNamespace = QByteArray(),
0031                                                const QByteArray &name = QByteArray(),
0032                                                const QByteArray &organizationUnit = QByteArray(),
0033                                                const QByteArray &mail = QByteArray());
0034     ~CollectionIdentificationAttribute() override;
0035 
0036     /**
0037      * Sets an identifier for the collection.
0038      */
0039     void setIdentifier(const QByteArray &identifier);
0040     [[nodiscard]] QByteArray identifier() const;
0041 
0042     void setMail(const QByteArray &);
0043     [[nodiscard]] QByteArray mail() const;
0044 
0045     void setOu(const QByteArray &);
0046     [[nodiscard]] QByteArray ou() const;
0047 
0048     void setName(const QByteArray &);
0049     [[nodiscard]] QByteArray name() const;
0050 
0051     /**
0052      * Sets a namespace the collection is in.
0053      *
0054      * Initially used are:
0055      * * "person" for a collection shared by a person.
0056      * * "shared" for a collection shared by a person.
0057      */
0058     void setCollectionNamespace(const QByteArray &ns);
0059     [[nodiscard]] QByteArray collectionNamespace() const;
0060     [[nodiscard]] QByteArray type() const override;
0061     Attribute *clone() const override;
0062     [[nodiscard]] QByteArray serialized() const override;
0063     void deserialize(const QByteArray &data) override;
0064 
0065 private:
0066     /// @cond PRIVATE
0067     const std::unique_ptr<CollectionIdentificationAttributePrivate> d;
0068     /// @endcond
0069 };
0070 
0071 } // namespace Akonadi