1/*
2 Copyright (c) 2007 Volker Krause <vkrause@kde.org>
3
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.
8
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.
13
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.
18*/
19
20#ifndef AKONADI_CHANGERECORDER_P_H
21#define AKONADI_CHANGERECORDER_P_H
22
23#include "akonadiprivate_export.h"
24#include "changerecorder.h"
25#include "monitor_p.h"
26
27namespace Akonadi {
28
29class ChangeRecorder;
30class ChangeNotificationDependenciesFactory;
31
32class AKONADI_TESTS_EXPORT ChangeRecorderPrivate : public Akonadi::MonitorPrivate
33{
34public:
35 ChangeRecorderPrivate(ChangeNotificationDependenciesFactory *dependenciesFactory_, ChangeRecorder *parent);
36
37 Q_DECLARE_PUBLIC(ChangeRecorder)
38 QSettings *settings;
39 bool enableChangeRecording;
40
41 virtual int pipelineSize() const;
42 virtual void notificationsEnqueued(int count);
43 virtual void notificationsErased();
44
45 virtual void slotNotify(const NotificationMessageV3::List &msgs);
46
47 QString notificationsFileName() const;
48
49 void loadNotifications();
50 QQueue<NotificationMessageV3> loadFrom(QIODevice *device);
51 QString dumpNotificationListToString() const;
52 void addToStream(QDataStream &stream, const NotificationMessageV3 &msg);
53 void saveNotifications();
54 void saveTo(QIODevice *device);
55private:
56 void dequeueNotification();
57 void notificationsLoaded();
58 void writeStartOffset();
59
60 int m_lastKnownNotificationsCount; // just for invariant checking
61 int m_startOffset; // number of saved notifications to skip
62 bool m_needFullSave;
63};
64
65} // namespace Akonadi
66
67#endif
68