deleteditemsattribute.h 1.86 KB
Newer Older
1
/*
2
    Copyright (c) 2009 Bertjan Broeksema <broeksema@kde.org>
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

    This library is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published by
    the Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    This library is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
    License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to the
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
*/

20 21 22
#ifndef DELETEDITEMSATTRIBUTE_H
#define DELETEDITEMSATTRIBUTE_H

23
#include <akonadi/attribute.h>
24 25
#include <kmbox/mboxentry.h>

26 27 28
#include <QtCore/QSet>

/**
Laurent Montel's avatar
Laurent Montel committed
29
 * This attribute stores a list of offsets in the mbox file of mails which are
30
 * deleted but not yet actually removed from the file yet.
31 32 33 34 35 36
 */
class DeletedItemsAttribute : public Akonadi::Attribute
{
  public:
    DeletedItemsAttribute();

37
    DeletedItemsAttribute( const DeletedItemsAttribute &other );
38 39 40

    ~DeletedItemsAttribute();

41
    void addDeletedItemOffset( quint64 );
42

Laurent Montel's avatar
Laurent Montel committed
43
    virtual DeletedItemsAttribute *clone() const;
44

45
    QSet<quint64> deletedItemOffsets() const;
46
    KMBox::MBoxEntry::List deletedItemEntries() const;
47

48
    virtual void deserialize( const QByteArray &data );
49

50 51 52 53 54
    /**
     * Returns the number of offsets stored in this attribute.
     */
    int offsetCount() const;

55 56 57 58
    virtual QByteArray serialized() const;

    virtual QByteArray type() const;

Laurent Montel's avatar
Laurent Montel committed
59 60
    bool operator ==(const DeletedItemsAttribute &other) const;
private:
61
    QSet<quint64> mDeletedItemOffsets;
62 63
};

64 65
#endif