• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
KCommandHistory Class Reference

#include <kcommand.h>

Inherits TQObject.

Public Slots

virtual void undo ()
 
virtual void redo ()
 
virtual void documentSaved ()
 

Signals

void commandExecuted ()
 
void commandExecuted (KCommand *command)
 
void documentRestored ()
 

Public Member Functions

 KCommandHistory ()
 
 KCommandHistory (TDEActionCollection *actionCollection, bool withMenus=true)
 
virtual ~KCommandHistory ()
 
void clear ()
 
void addCommand (KCommand *command, bool execute=true)
 
int undoLimit () const
 
void setUndoLimit (int limit)
 
int redoLimit () const
 
void setRedoLimit (int limit)
 
void updateActions ()
 

Protected Slots

void slotUndoAboutToShow ()
 
void slotUndoActivated (int)
 
void slotRedoAboutToShow ()
 
void slotRedoActivated (int)
 

Protected Member Functions

virtual void virtual_hook (int id, void *data)
 

Detailed Description

The command history stores a (user) configurable amount of Commands.

It keeps track of its size and deletes commands if it gets too large. The user can set a maximum undo and a maximum redo limit (e.g. max. 50 undo / 30 redo commands). The KCommandHistory keeps track of the "borders" and deletes commands, if appropriate. It also activates/deactivates the undo/redo actions in the menu and changes the text according to the name of the command.

Definition at line 156 of file kcommand.h.

Constructor & Destructor Documentation

◆ KCommandHistory() [1/2]

KCommandHistory::KCommandHistory ( )

Creates a command history, to store commands.

This constructor doesn't create actions, so you need to call undo and redo yourself.

Definition at line 72 of file kcommand.cpp.

◆ KCommandHistory() [2/2]

KCommandHistory::KCommandHistory ( TDEActionCollection *  actionCollection,
bool  withMenus = true 
)

Creates a command history, to store commands.

This also creates an undo and a redo action, in the actionCollection, using the standard names ("edit_undo" and "edit_redo").

Parameters
withMenusif true, the actions will display a menu when plugged into a toolbar.
actionCollectionthe parent collection

Definition at line 80 of file kcommand.cpp.

◆ ~KCommandHistory()

KCommandHistory::~KCommandHistory ( )
virtual

Destructs the command history object.

Definition at line 113 of file kcommand.cpp.

Member Function Documentation

◆ addCommand()

void KCommandHistory::addCommand ( KCommand *  command,
bool  execute = true 
)

Adds a command to the history.

Call this for each command you create. Unless you set execute to false, this will also execute the command. This means, most of the application's code will look like MyCommand * cmd = new MyCommand(i18n("Capitalized Name"), parameters); m_historyCommand.addCommand( cmd );

Definition at line 130 of file kcommand.cpp.

◆ clear()

void KCommandHistory::clear ( )

Erases all the undo/redo history.

Use this when reloading the data, for instance, since this invalidates all the commands.

Definition at line 117 of file kcommand.cpp.

◆ commandExecuted [1/2]

void KCommandHistory::commandExecuted ( )
signal

Emitted every time a command is executed (whether by addCommand, undo or redo).

You can use this to update the GUI, for instance.

KDE4 TODO: remove

◆ commandExecuted [2/2]

void KCommandHistory::commandExecuted ( KCommand *  command)
signal

Emitted every time a command is executed (whether by addCommand, undo or redo).

You can use this to update the GUI, for instance.

Parameters
commandwas executed
Since
3.5

◆ documentRestored

void KCommandHistory::documentRestored ( )
signal

Emitted every time we reach the index where you saved the document for the last time.

See documentSaved

◆ documentSaved

void KCommandHistory::documentSaved ( )
virtualslot

Remembers when you saved the document.

Call this right after saving the document. As soon as the history reaches the current index again (via some undo/redo operations) it will emit documentRestored If you implemented undo/redo properly the document is the same you saved before.

Definition at line 258 of file kcommand.cpp.

◆ redo

void KCommandHistory::redo ( )
virtualslot

Redoes the last undone action.

Call this if you don't use the builtin TDEActions.

Definition at line 217 of file kcommand.cpp.

◆ redoLimit()

int KCommandHistory::redoLimit ( ) const
inline
Returns
the maximum number of items in the redo history

Definition at line 208 of file kcommand.h.

◆ setRedoLimit()

void KCommandHistory::setRedoLimit ( int  limit)

Sets the maximum number of items in the redo history.

Definition at line 276 of file kcommand.cpp.

◆ setUndoLimit()

void KCommandHistory::setUndoLimit ( int  limit)

Sets the maximum number of items in the undo history.

Definition at line 268 of file kcommand.cpp.

◆ slotRedoAboutToShow

void KCommandHistory::slotRedoAboutToShow ( )
protectedslot

Definition at line 334 of file kcommand.cpp.

◆ slotRedoActivated

void KCommandHistory::slotRedoActivated ( int  pos)
protectedslot

Definition at line 351 of file kcommand.cpp.

◆ slotUndoAboutToShow

void KCommandHistory::slotUndoAboutToShow ( )
protectedslot

Definition at line 315 of file kcommand.cpp.

◆ slotUndoActivated

void KCommandHistory::slotUndoActivated ( int  pos)
protectedslot

Definition at line 327 of file kcommand.cpp.

◆ undo

void KCommandHistory::undo ( )
virtualslot

Undoes the last action.

Call this if you don't use the builtin TDEActions.

Definition at line 182 of file kcommand.cpp.

◆ undoLimit()

int KCommandHistory::undoLimit ( ) const
inline
Returns
the maximum number of items in the undo history

Definition at line 200 of file kcommand.h.

◆ updateActions()

void KCommandHistory::updateActions ( )

Enable or disable the undo and redo actions.

This isn't usually necessary, but this method can be useful if you disable all actions (to go to a "readonly" state), and then want to come back to a readwrite mode.

Definition at line 358 of file kcommand.cpp.

◆ virtual_hook()

void KCommandHistory::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 376 of file kcommand.cpp.


The documentation for this class was generated from the following files:
  • kcommand.h
  • kcommand.cpp

tdeui

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

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.