Akonadi::History

#include <history.h>

Inheritance diagram for Akonadi::History:

Public Types

enum  ResultCode { ResultCodeSuccess = 0, ResultCodeError }
 

Signals

void changed ()
 
void redone (Akonadi::History::ResultCode resultCode)
 
void undone (Akonadi::History::ResultCode resultCode)
 

Public Slots

bool clear ()
 
void redo (QWidget *parent=nullptr)
 
void undo (QWidget *parent=nullptr)
 

Public Member Functions

 ~History ()
 
QString lastErrorString () const
 
QString nextRedoDescription () const
 
QString nextUndoDescription () const
 
void recordCreation (const Akonadi::Item &item, const QString &description, const uint atomicOperationId=0)
 
void recordDeletion (const Akonadi::Item &item, const QString &description, const uint atomicOperationId=0)
 
void recordDeletions (const Akonadi::Item::List &items, const QString &description, const uint atomicOperationId=0)
 
void recordModification (const Akonadi::Item &oldItem, const Akonadi::Item &newItem, const QString &description, const uint atomicOperationId=0)
 
bool redoAvailable () const
 
void undoAll (QWidget *parent=nullptr)
 
bool undoAvailable () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

History class for implementing undo/redo of calendar operations.

Whenever you use IncidenceChanger to create, delete or modify incidences, this class is used to record those changes onto a stack, so they can be undone or redone.

If needed, groupware invitations will be sent to attendees and organizers when undoing or redoing changes.

This class can't be instantiated directly, use it through IncidenceChanger:

Akonadi::IncidenceChanger *myIncidenceChanger = new Akonadi::IncidenceChanger();
connect( undoAction, SIGNAL(triggered()), myIncidenceChanger->history(), SLOT(undo()) );
connect( redoAction, SIGNAL(triggered()), myIncidenceChanger->history(), SLOT(redo()) );
Author
Sérgio Martins iamse[email protected]rgio[email protected]@gmai[email protected]l.co[email protected]m
Since
4.11

Definition at line 44 of file history.h.

Member Enumeration Documentation

This enum describes the possible result codes (success/error values) for an undo or redo operation.

See also
undone()
redone()
Enumerator
ResultCodeSuccess 

Success.

ResultCodeError 

An error occurred. Call lastErrorString() for the error message. This isn't very verbose because IncidenceChanger hasn't been refactored yet.

Definition at line 54 of file history.h.

Constructor & Destructor Documentation

History::~History ( )

Destroys the History instance.

Definition at line 21 of file history.cpp.

Member Function Documentation

void Akonadi::History::changed ( )
signal

The redo/undo stacks have changed.

bool History::clear ( )
slot

Clears the undo and redo stacks.

Won't do anything if there's a undo/redo job currently running.

Returns
true if the stacks were cleared, false if there was a job running

Definition at line 130 of file history.cpp.

QString History::lastErrorString ( ) const

Returns the last error message.

Call this immediately after catching the undone()/redone() signal with an ResultCode != ResultCodeSuccess.

The message is translated.

Definition at line 145 of file history.cpp.

QString History::nextRedoDescription ( ) const

Returns the description of the next redo.

This is the description that was passed when calling recordCreation(), recordDeletion() or recordModification().

See also
nextUndoDescription()

Definition at line 98 of file history.cpp.

QString History::nextUndoDescription ( ) const

Returns the description of the next undo.

This is the description that was passed when calling recordCreation(), recordDeletion() or recordModification().

See also
nextRedoDescription()

Definition at line 89 of file history.cpp.

void History::recordCreation ( const Akonadi::Item &  item,
const QString description,
const uint  atomicOperationId = 0 
)

Pushes an incidence creation onto the undo stack.

The creation can be undone calling undo().

Parameters
itemthe item that was created. Must be valid and have a Incidence::Ptr payload
descriptiontext that can be used in the undo/redo menu item to describe the operation If empty, a default one will be provided.
atomicOperationIdif not 0, specifies which group of changes this change belongs to. When a change is undone/redone, all other changes which are in the same group are also undone/redone

Definition at line 36 of file history.cpp.

void History::recordDeletion ( const Akonadi::Item &  item,
const QString description,
const uint  atomicOperationId = 0 
)

Pushes an incidence deletion onto the undo stack.

The deletion can be undone calling undo().

Parameters
itemThe item to delete. Must be valid, doesn't need to contain a payload.
descriptiontext that can be used in the undo/redo menu item to describe the operation If empty, a default one will be provided.
atomicOperationIdif not 0, specifies which group of changes this change belongs to. When a change is undone/redone, all other changes which are in the same group are also undone/redone

Definition at line 66 of file history.cpp.

void History::recordDeletions ( const Akonadi::Item::List &  items,
const QString description,
const uint  atomicOperationId = 0 
)

Pushes a list of incidence deletions onto the undo stack.

The deletions can be undone calling undo() once.

Parameters
itemsThe list of items to delete. All items must be valid.
descriptiontext that can be used in the undo/redo menu item to describe the operation If empty, a default one will be provided.
atomicOperationIdIf != 0, specifies which group of changes thischange belongs to. Will be useful for atomic undoing/redoing, not implemented yet.

Definition at line 74 of file history.cpp.

void History::recordModification ( const Akonadi::Item &  oldItem,
const Akonadi::Item &  newItem,
const QString description,
const uint  atomicOperationId = 0 
)

Pushes an incidence modification onto the undo stack.

The modification can be undone calling undo().

Parameters
oldItemitem containing the payload before the change. Must be valid and contain an Incidence::Ptr payload.
newItemitem containing the new payload. Must be valid and contain an Incidence::Ptr payload.
descriptiontext that can be used in the undo/redo menu item to describe the operation If empty, a default one will be provided.
atomicOperationIdif not 0, specifies which group of changes this change belongs to. When a change is undone/redone, all other changes which are in the same group are also undone/redone

Definition at line 49 of file history.cpp.

void History::redo ( QWidget parent = nullptr)
slot

Reverts the change that's on top of the redo stack.

Can't be called if there's an undo/redo operation running, asserts. Can be called if the stack is empty, in this case, nothing happens. This function is async, catch signal redone() to know when the operation finishes.

Parameters
parentwill be passed to dialogs created by IncidenceChanger, for example those asking if you want to send invitations.
See also
undo()
redone()

Definition at line 112 of file history.cpp.

bool History::redoAvailable ( ) const

Returns true if there are changes that can be redone.

Definition at line 155 of file history.cpp.

void Akonadi::History::redone ( Akonadi::History::ResultCode  resultCode)
signal

This signal is emitted when an redo operation finishes.

Parameters
resultCodeHistory::ResultCodeSuccess on success.
See also
lastErrorString()
void History::undo ( QWidget parent = nullptr)
slot

Reverts the change that's on top of the undo stack.

Can't be called if there's an undo/redo operation running, asserts. Can be called if the stack is empty, in this case, nothing happens. This function is async, catch signal undone() to know when the operation finishes.

Parameters
parentwill be passed to dialogs created by IncidenceChanger, for example those asking if you want to send invitations.
See also
redo()
undone()

Definition at line 107 of file history.cpp.

void History::undoAll ( QWidget parent = nullptr)

Reverts every change in the undo stack.

Parameters
parentwill be passed to dialogs created by IncidenceChanger, for example those asking if you want to send invitations.

Definition at line 117 of file history.cpp.

bool History::undoAvailable ( ) const

Returns true if there are changes that can be undone.

Definition at line 150 of file history.cpp.

void Akonadi::History::undone ( Akonadi::History::ResultCode  resultCode)
signal

This signal is emitted when an undo operation finishes.

Parameters
resultCodeHistory::ResultCodeSuccess on success.
See also
lastErrorString()

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Nov 29 2020 23:11:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.