1/*
2 * akonadi_serializer_kalarm.h - Akonadi resource serializer for KAlarm
3 * Copyright © 2009-2014 by David Jarvie <djarvie@kde.org>
4 *
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Library General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 * License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#ifndef AKONADI_SERIALIZER_KALARM_H
22#define AKONADI_SERIALIZER_KALARM_H
23
24#include "kaeventformatter.h"
25
26#include <akonadi/itemserializerplugin.h>
27#include <akonadi/differencesalgorithminterface.h>
28#include <akonadi/gidextractorinterface.h>
29#include <kcalcore/icalformat.h>
30
31#include <QtCore/QObject>
32
33namespace Akonadi
34{
35 class Item;
36 class AbstractDifferencesReporter;
37}
38
39class SerializerPluginKAlarm : public QObject,
40 public Akonadi::ItemSerializerPlugin,
41 public Akonadi::DifferencesAlgorithmInterface,
42 public Akonadi::GidExtractorInterface
43{
44 Q_OBJECT
45 Q_INTERFACES(Akonadi::ItemSerializerPlugin)
46 Q_INTERFACES(Akonadi::DifferencesAlgorithmInterface)
47 Q_INTERFACES(Akonadi::GidExtractorInterface)
48
49 public:
50 bool deserialize(Akonadi::Item& item, const QByteArray& label, QIODevice& data, int version);
51 void serialize(const Akonadi::Item& item, const QByteArray& label, QIODevice& data, int& version);
52 void compare(Akonadi::AbstractDifferencesReporter*, const Akonadi::Item& left, const Akonadi::Item& right);
53 QString extractGid(const Akonadi::Item& item) const;
54
55 private:
56 void reportDifference(Akonadi::AbstractDifferencesReporter*, KAEventFormatter::Parameter);
57
58 KCalCore::ICalFormat mFormat;
59 KAEventFormatter mValueL;
60 KAEventFormatter mValueR;
61 QString mRegistered;
62};
63
64#endif // AKONADI_SERIALIZER_KALARM_H
65
66// vim: et sw=4:
67