• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • Akonadi
  • History
Public Types | Public Slots | Signals | Public Member Functions | List of all members
Akonadi::History Class Reference

#include <history.h>

Inherits QObject.

Public Types

enum  ResultCode { ResultCodeSuccess = 0, ResultCodeError }
 

Public Slots

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

Signals

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

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=0)
 
bool undoAvailable () const
 

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.nosp@m.rgio.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Since
4.11

Definition at line 58 of file history.h.

Member Enumeration Documentation

enum Akonadi::History::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 67 of file history.h.

Constructor & Destructor Documentation

History::~History ( )

Destroys the History instance.

Definition at line 37 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 148 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 163 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 117 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 109 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 47 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 82 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 92 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 62 of file history.cpp.

void History::redo ( QWidget *  parent = 0)
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 130 of file history.cpp.

bool History::redoAvailable ( ) const

Returns true if there are changes that can be redone.

Definition at line 173 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 = 0)
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 125 of file history.cpp.

void History::undoAll ( QWidget *  parent = 0)

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

bool History::undoAvailable ( ) const

Returns true if there are changes that can be undone.

Definition at line 168 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:
  • history.h
  • history.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:29 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal