class KCommandHistory

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

Definition#include <kcommand.h>
InheritsQObject (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Signals

Protected Methods

Protected Slots


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.

 KCommandHistory ()

KCommandHistory

Creates a command history, to store commands. This constructor doesn't create actions, so you need to call undo and redo yourself.

 KCommandHistory (KActionCollection *actionCollection, bool withMenus = true)

KCommandHistory

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.

 ~KCommandHistory ()

~KCommandHistory

[virtual]

Destructs the command history object.

void  clear ()

clear

Erases all the undo/redo history. Use this when reloading the data, for instance, since this invalidates all the commands.

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

addCommand

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("The name"), parameters); m_historyCommand.addCommand( cmd );

int  undoLimit ()

undoLimit

[const]

Returns: the maximum number of items in the undo history

void  setUndoLimit (int limit)

setUndoLimit

Sets the maximum number of items in the undo history.

int  redoLimit ()

redoLimit

[const]

Returns: the maximum number of items in the redo history

void  setRedoLimit (int limit)

setRedoLimit

Sets the maximum number of items in the redo history.

void  updateActions ()

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.

void  undo ()

undo

[virtual slot]

Undoes the last action. Call this if you don't use the builtin KActions.

void  redo ()

redo

[virtual slot]

Redoes the last undone action. Call this if you don't use the builtin KActions.

void  documentSaved ()

documentSaved

[virtual slot]

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.

void  slotUndoAboutToShow ()

slotUndoAboutToShow

[protected slots slot]

void  slotUndoActivated ( int )

slotUndoActivated

[protected slots slot]

void  slotRedoAboutToShow ()

slotRedoAboutToShow

[protected slots slot]

void  slotRedoActivated ( int )

slotRedoActivated

[protected slots slot]

void  commandExecuted ()

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.

void  documentRestored ()

documentRestored

[signal]

Emitted everytime we reach the index where you saved the document for the last time. See documentSaved

void  virtual_hook ( int id, void* data )

virtual_hook

[protected virtual]


Generated by: dfaure on faure on Tue Apr 16 08:49:25 2002, using kdoc 2.0a53.