typo found by Andrey Cherepanov
[kdepim.git] / akonadi / resources / mbox / deleteditemsattribute.cpp
blobd5cc84a90b3107fdefc248f9a1356f611f26d107
1 /*
2 Copyright (c) 2009 Bertjan Broeksema <b.broeksema@kdemail.net>
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
20 #include "deleteditemsattribute.h"
22 DeletedItemsAttribute::DeletedItemsAttribute()
26 DeletedItemsAttribute::DeletedItemsAttribute(const DeletedItemsAttribute &other)
27 : Akonadi::Attribute()
29 if (&other == this)
30 return;
32 mDeletedItemOffsets = other.mDeletedItemOffsets;
35 DeletedItemsAttribute::~DeletedItemsAttribute()
39 Akonadi::Attribute *DeletedItemsAttribute::clone() const
41 return new DeletedItemsAttribute(*this);
44 QSet<int> DeletedItemsAttribute::deletedItemOffsets() const
46 return mDeletedItemOffsets;
49 void DeletedItemsAttribute::deserialize(const QByteArray &data)
51 QList<QByteArray> offsets = data.split(',');
52 mDeletedItemOffsets.clear();
54 foreach(const QByteArray& offset, offsets) {
55 mDeletedItemOffsets.insert(offset.toInt());
59 QByteArray DeletedItemsAttribute::serialized() const
61 QByteArray serialized;
63 foreach(int offset, mDeletedItemOffsets) {
64 serialized += QByteArray::number(offset);
65 serialized += ',';
68 serialized.chop(1); // Remove the last ','
70 return serialized;
73 QByteArray DeletedItemsAttribute::type() const
75 return "deleted mbox items";