Akonadi::History

Search for usage in LXR

#include <history.h>

Inheritance diagram for Akonadi::History:

Public Types

enum  ResultCode { ResultCodeSuccess = 0 , ResultCodeError }
 
- Public Types inherited from QObject
typedef  QObjectList
 

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 () override
 
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)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
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_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 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
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, 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 *context, Functor functor, 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)
 
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, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- 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, &QAction::triggered, myIncidenceChanger->history(), &Akonadi::IncidenceChanger::undo);
connect(redoAction, &QAction::triggered, myIncidenceChanger->history(), &Akonadi::IncidenceChanger::redo);
void triggered(bool checked)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
Author
Sérgio Martins iamse.nosp@m.rgio.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Since
4.11

Definition at line 47 of file history.h.

Member Enumeration Documentation

◆ ResultCode

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 57 of file history.h.

Constructor & Destructor Documentation

◆ ~History()

History::~History ( )
overridedefault

Destroys the History instance.

Member Function Documentation

◆ changed

void Akonadi::History::changed ( )
signal

The redo/undo stacks have changed.

◆ clear

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 119 of file history.cpp.

◆ lastErrorString()

QString History::lastErrorString ( ) const
nodiscard

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 134 of file history.cpp.

◆ nextRedoDescription()

QString History::nextRedoDescription ( ) const
nodiscard

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 87 of file history.cpp.

◆ nextUndoDescription()

QString History::nextUndoDescription ( ) const
nodiscard

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 78 of file history.cpp.

◆ recordCreation()

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 32 of file history.cpp.

◆ recordDeletion()

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 57 of file history.cpp.

◆ recordDeletions()

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 65 of file history.cpp.

◆ recordModification()

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 43 of file history.cpp.

◆ redo

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 101 of file history.cpp.

◆ redoAvailable()

bool History::redoAvailable ( ) const
nodiscard

Returns true if there are changes that can be redone.

Definition at line 144 of file history.cpp.

◆ redone

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()

◆ undo

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 96 of file history.cpp.

◆ undoAll()

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 106 of file history.cpp.

◆ undoAvailable()

bool History::undoAvailable ( ) const
nodiscard

Returns true if there are changes that can be undone.

Definition at line 139 of file history.cpp.

◆ undone

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-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.