File indexing completed on 2025-01-05 04:58:18

0001 /*
0002   SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 // THIS file should not exist and is only a copy of
0008 // kdepim-runtime/resources/shared/singlefileresource
0009 
0010 // Any improvements should be done at kdepim-runtime and
0011 // than afterwards copy the new version
0012 
0013 #pragma once
0014 
0015 #include "pimcommonakonadi_export.h"
0016 
0017 #include <Akonadi/Attribute>
0018 
0019 #include <KIMAP/Acl>
0020 
0021 #include <QMap>
0022 
0023 #include <memory>
0024 namespace PimCommon
0025 {
0026 class ImapAclAttributePrivate;
0027 /**
0028  * @brief The ImapAclAttribute class
0029  */
0030 class PIMCOMMONAKONADI_EXPORT ImapAclAttribute : public Akonadi::Attribute
0031 {
0032 public:
0033     ImapAclAttribute();
0034     ImapAclAttribute(const QMap<QByteArray, KIMAP::Acl::Rights> &rights, const QMap<QByteArray, KIMAP::Acl::Rights> &oldRights);
0035     ~ImapAclAttribute() override;
0036     void setRights(const QMap<QByteArray, KIMAP::Acl::Rights> &rights);
0037     QMap<QByteArray, KIMAP::Acl::Rights> rights() const;
0038     QMap<QByteArray, KIMAP::Acl::Rights> oldRights() const;
0039     void setMyRights(KIMAP::Acl::Rights rights);
0040     KIMAP::Acl::Rights myRights() const;
0041     QByteArray type() const override;
0042     ImapAclAttribute *clone() const override;
0043     QByteArray serialized() const override;
0044     void deserialize(const QByteArray &data) override;
0045 
0046     bool operator==(const ImapAclAttribute &other) const;
0047 
0048 private:
0049     std::unique_ptr<ImapAclAttributePrivate> const d;
0050     QMap<QByteArray, KIMAP::Acl::Rights> mRights;
0051     QMap<QByteArray, KIMAP::Acl::Rights> mOldRights;
0052     KIMAP::Acl::Rights mMyRights;
0053 };
0054 }