.TH "KCommandHistory" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KCommandHistory \- The command history stores a (user) configurable amount of Commands.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kcommand.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
.SS "Public Slots"

.in +1c
.ti -1c
.RI "virtual void \fBundo\fP ()"
.br
.ti -1c
.RI "virtual void \fBredo\fP ()"
.br
.ti -1c
.RI "virtual void \fBdocumentSaved\fP ()"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBcommandExecuted\fP ()"
.br
.ti -1c
.RI "void \fBdocumentRestored\fP ()"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKCommandHistory\fP ()"
.br
.ti -1c
.RI "\fBKCommandHistory\fP (\fBKActionCollection\fP *actionCollection, bool withMenus=true)"
.br
.ti -1c
.RI "virtual \fB~KCommandHistory\fP ()"
.br
.ti -1c
.RI "void \fBclear\fP ()"
.br
.ti -1c
.RI "void \fBaddCommand\fP (\fBKCommand\fP *command, bool execute=true)"
.br
.ti -1c
.RI "int \fBundoLimit\fP () const "
.br
.ti -1c
.RI "void \fBsetUndoLimit\fP (int limit)"
.br
.ti -1c
.RI "int \fBredoLimit\fP () const "
.br
.ti -1c
.RI "void \fBsetRedoLimit\fP (int limit)"
.br
.ti -1c
.RI "void \fBupdateActions\fP ()"
.br
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "void \fBslotUndoAboutToShow\fP ()"
.br
.ti -1c
.RI "void \fBslotUndoActivated\fP (int)"
.br
.ti -1c
.RI "void \fBslotRedoAboutToShow\fP ()"
.br
.ti -1c
.RI "void \fBslotRedoActivated\fP (int)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SH "Detailed Description"
.PP 
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. 
.PP
Definition at line 156 of file kcommand.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KCommandHistory::KCommandHistory ()"
.PP
Creates a command history, to store commands. 
.PP
This constructor doesn't create actions, so you need to call \fBundo\fP and \fBredo\fP yourself. 
.PP
Definition at line 72 of file kcommand.cpp.
.PP
References clear(), and QPtrList::setAutoDelete().
.SS "KCommandHistory::KCommandHistory (\fBKActionCollection\fP * actionCollection, bool withMenus = \fCtrue\fP)"
.PP
Creates a command history, to store commands. 
.PP
This also creates an undo and a redo action, in the \fCactionCollection\fP, using the standard names ('edit_undo' and 'edit_redo'). 
.PP
\fBParameters:\fP
.RS 4
\fIwithMenus\fP if true, the actions will display a menu when plugged into a toolbar. 
.br
\fIactionCollection\fP the parent collection 
.RE
.PP

.PP
Definition at line 80 of file kcommand.cpp.
.PP
References clear(), QObject::connect(), KStdAction::redo(), redo(), QPtrList::setAutoDelete(), KStdAction::undo(), and undo().
.SS "KCommandHistory::~\fBKCommandHistory\fP ()\fC [virtual]\fP"
.PP
Destructs the command history object. 
.PP
Definition at line 113 of file kcommand.cpp.
.SH "Member Function Documentation"
.PP 
.SS "void KCommandHistory::clear ()"
.PP
Erases all the undo/redo history. 
.PP
Use this when reloading the data, for instance, since this invalidates all the commands. 
.PP
Definition at line 117 of file kcommand.cpp.
.PP
References KAction::setEnabled(), and KAction::setText().
.PP
Referenced by KCommandHistory().
.SS "void KCommandHistory::addCommand (\fBKCommand\fP * command, bool execute = \fCtrue\fP)"
.PP
Adds a command to the history. 
.PP
Call this for each \fCcommand\fP you create. Unless you set \fCexecute\fP 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 ); 
.PP
Definition at line 130 of file kcommand.cpp.
.PP
References QPtrList::append(), QPtrList::clear(), commandExecuted(), QPtrList::count(), endl(), QPtrList::findRef(), QPtrList::insert(), KAction::isEnabled(), kdDebug(), QPtrList::removeLast(), KAction::setEnabled(), and KAction::setText().
.SS "int KCommandHistory::undoLimit () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
the maximum number of items in the undo history 
.RE
.PP

.PP
Definition at line 200 of file kcommand.h.
.SS "void KCommandHistory::setUndoLimit (int limit)"
.PP
Sets the maximum number of items in the undo history. 
.PP
Definition at line 264 of file kcommand.cpp.
.SS "int KCommandHistory::redoLimit () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
the maximum number of items in the redo history 
.RE
.PP

.PP
Definition at line 208 of file kcommand.h.
.SS "void KCommandHistory::setRedoLimit (int limit)"
.PP
Sets the maximum number of items in the redo history. 
.PP
Definition at line 272 of file kcommand.cpp.
.SS "void KCommandHistory::updateActions ()"
.PP
Enable or disable the undo and redo actions. 
.PP
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. 
.PP
Definition at line 354 of file kcommand.cpp.
.PP
References QPtrList::findRef(), QPtrList::next(), and KAction::setEnabled().
.SS "void KCommandHistory::undo ()\fC [virtual, slot]\fP"
.PP
Undoes the last action. 
.PP
Call this if you don't use the builtin KActions. 
.PP
Definition at line 181 of file kcommand.cpp.
.PP
References commandExecuted(), QPtrList::current(), documentRestored(), QPtrList::findRef(), QPtrList::prev(), KAction::setEnabled(), and KAction::setText().
.PP
Referenced by KCommandHistory().
.SS "void KCommandHistory::redo ()\fC [virtual, slot]\fP"
.PP
Redoes the last undone action. 
.PP
Call this if you don't use the builtin KActions. 
.PP
Definition at line 215 of file kcommand.cpp.
.PP
References commandExecuted(), QPtrList::current(), documentRestored(), QPtrList::findRef(), QPtrList::first(), KAction::isEnabled(), QPtrList::next(), KAction::setEnabled(), and KAction::setText().
.PP
Referenced by KCommandHistory().
.SS "void KCommandHistory::documentSaved ()\fC [virtual, slot]\fP"
.PP
Remembers when you saved the document. 
.PP
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. 
.PP
Definition at line 254 of file kcommand.cpp.
.PP
References QPtrList::findRef().
.SS "void KCommandHistory::commandExecuted ()\fC [signal]\fP"
.PP
Emitted every time a command is executed (whether by addCommand, undo or redo). 
.PP
You can use this to update the GUI, for instance. 
.PP
Referenced by addCommand(), redo(), and undo().
.SS "void KCommandHistory::documentRestored ()\fC [signal]\fP"
.PP
Emitted every time we reach the index where you saved the document for the last time. 
.PP
See documentSaved 
.PP
Referenced by redo(), and undo().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
