Source Code (Use browser search to find items of interest.)
Class Index
kword'KWCommandHistory (./koffice/kword/kword_undo.h:91)
class KWCommandHistory : public QObject
{
Q_OBJECT
public:
KWCommandHistory();
void addCommand( KWCommand *_command );
void undo();
void redo();
QString getUndoName();
QString getRedoName();
protected:
QList<KWCommand> history;
int current;
signals:
void undoRedoChanged( QString, QString );
};
kword'KWCommandHistory::KWCommandHistory() (./koffice/kword/kword_undo.cc:180)
KWCommandHistory::KWCommandHistory()
: current( -1 )
{
history.setAutoDelete( true );
}
/*================================================================*/
kword'KWCommandHistory::addCommand() (./koffice/kword/kword_undo.cc:187)
void KWCommandHistory::addCommand( KWCommand *_command )
{
if ( current < static_cast<int>( history.count() ) )
{
QList<KWCommand> _commands;
_commands.setAutoDelete( false );
for ( int i = 0; i < current; i++ )
{
_commands.insert( i, history.at( 0 ) );
history.take( 0 );
}
_commands.append( _command );
history.clear();
history = _commands;
history.setAutoDelete( true );
}
else
history.append( _command );
if ( history.count() > MAX_UNDO_REDO )
history.removeFirst();
else
current++;
emit undoRedoChanged( getUndoName(), getRedoName() );
}
/*================================================================*/
kword'KWCommandHistory::undo() (./koffice/kword/kword_undo.cc:217)
void KWCommandHistory::undo()
{
if ( current > 0 )
{
history.at( current - 1 )->unexecute();
current--;
emit undoRedoChanged( getUndoName(), getRedoName() );
}
}
/*================================================================*/
kword'KWCommandHistory::redo() (./koffice/kword/kword_undo.cc:229)
void KWCommandHistory::redo()
{
if ( current < static_cast<int>( history.count() ) && current > -1 )
{
history.at( current )->execute();
current++;
emit undoRedoChanged( getUndoName(), getRedoName() );
}
}
/*================================================================*/
kword'KWCommandHistory::getUndoName() (./koffice/kword/kword_undo.cc:240)
QString KWCommandHistory::getUndoName()
{
if ( current > 0 )
return history.at( current - 1 )->getName();
else
return QString();
}
/*================================================================*/
kword'KWCommandHistory::getRedoName() (./koffice/kword/kword_undo.cc:249)
QString KWCommandHistory::getRedoName()
{
if ( current < static_cast<int>( history.count() ) && current > -1 )
return history.at( current )->getName();
else
return QString();
}