File indexing completed on 2024-11-24 04:44:20

0001 /*
0002     SPDX-FileCopyrightText: 2009 Bertjan Broeksema <broeksema@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Attribute>
0010 #include <KMbox/MBoxEntry>
0011 
0012 #include <QSet>
0013 
0014 /**
0015  * This attribute stores a list of offsets in the mbox file of mails which are
0016  * deleted but not yet actually removed from the file yet.
0017  */
0018 class DeletedItemsAttribute : public Akonadi::Attribute
0019 {
0020 public:
0021     DeletedItemsAttribute();
0022 
0023     DeletedItemsAttribute(const DeletedItemsAttribute &other);
0024 
0025     ~DeletedItemsAttribute() override;
0026 
0027     void addDeletedItemOffset(quint64);
0028 
0029     DeletedItemsAttribute *clone() const override;
0030 
0031     [[nodiscard]] QSet<quint64> deletedItemOffsets() const;
0032     [[nodiscard]] KMBox::MBoxEntry::List deletedItemEntries() const;
0033 
0034     void deserialize(const QByteArray &data) override;
0035 
0036     /**
0037      * Returns the number of offsets stored in this attribute.
0038      */
0039     [[nodiscard]] int offsetCount() const;
0040 
0041     [[nodiscard]] QByteArray serialized() const override;
0042 
0043     [[nodiscard]] QByteArray type() const override;
0044 
0045     [[nodiscard]] bool operator==(const DeletedItemsAttribute &other) const;
0046 
0047 private:
0048     QSet<quint64> mDeletedItemOffsets;
0049 };