Akonadi::ChangeRecorder Class

class Akonadi::ChangeRecorder

Records and replays change notification. More...

Header: #include <Akonadi/ChangeRecorder>
CMake: find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore)
Inherits: Akonadi::Monitor

Public Functions

ChangeRecorder(QObject *parent = nullptr)
virtual ~ChangeRecorder() override
void changeProcessed()
QString dumpNotificationListToString() const
bool isEmpty() const
void setChangeRecordingEnabled(bool enable)
void setConfig(QSettings *settings)

Public Slots

void replayNext()

Signals

Detailed Description

This class is responsible for recording change notifications while an agent is not online and replaying the notifications when the agent is online again. Therefore the agent doesn't have to care about online/offline mode in its synchronization algorithm.

Unlike Akonadi::Monitor this class only emits one change signal at a time. To receive the next one you need to explicitly call replayNext(). If a signal is emitted that has no receivers, it's automatically skipped, which means you only need to connect to signals you are actually interested in.

Author: Volker Krause <vkrause@kde.org>

Member Function Documentation

[explicit] ChangeRecorder::ChangeRecorder(QObject *parent = nullptr)

Creates a new change recorder.

[override virtual noexcept] ChangeRecorder::~ChangeRecorder()

Destroys the change recorder. All not yet processed changes are written back to the config file.

void ChangeRecorder::changeProcessed()

Removes the previously emitted change from the records.

[signal] void ChangeRecorder::changesAdded()

Emitted when new changes are recorded.

QString ChangeRecorder::dumpNotificationListToString() const

Debugging: dump current list of notifications, as saved on disk.

bool ChangeRecorder::isEmpty() const

Returns whether there are recorded changes.

[signal] void ChangeRecorder::nothingToReplay()

Emitted when replayNext() was called, but there was no valid change to replay. This can happen when all pending changes have been filtered out, for example. You only need to connect to this signal if you rely on one signal being emitted as a result of calling replayNext().

[slot] void ChangeRecorder::replayNext()

Replay the next change notification and erase the previous one from the record.

void ChangeRecorder::setChangeRecordingEnabled(bool enable)

Enables change recording. If change recording is disabled, this class behaves exactly like Akonadi::Monitor. Change recording is enabled by default. enable \ false to disable change recording. \ true by default

void ChangeRecorder::setConfig(QSettings *settings)

Sets the QSettings object used for persistent recorded changes.