KFormDesigner::CommandGroup Class Reference

#include <commands.h>

Inheritance diagram for KFormDesigner::CommandGroup:
KFormDesigner::Command

Public Member Functions

 CommandGroup (const TQString &name, WidgetPropertySet *propSet)
 
void addCommand (KCommand *command, bool allowExecute)
 
virtual void execute ()
 
virtual void unexecute ()
 
virtual TQString name () const
 
const TQPtrList< KCommand > & commands () const
 
void resetAllowExecuteFlags ()
 
virtual void debug ()
 

Protected Attributes

SubCommands * m_subCommands
 
TQPtrDict< char > m_commandsShouldntBeExecuted
 
WidgetPropertySet * m_propSet
 

Detailed Description

A Command Group is a command that holds several subcommands. It will appear as one to the user and in the command history, but it can use the implementation of multiple commands internally. It extends KMacroCommand by providing the list of commands executed. Selected subcommands can be marked as nonexecutable by adding them using addCommand(KCommand *command, bool allowExecute) special method.

Definition at line 321 of file commands.h.

Constructor & Destructor Documentation

◆ CommandGroup()

CommandGroup::CommandGroup ( const TQString &  name,
WidgetPropertySet *  propSet 
)

Definition at line 1531 of file commands.cpp.

◆ ~CommandGroup()

CommandGroup::~CommandGroup ( )
virtual

Definition at line 1538 of file commands.cpp.

Member Function Documentation

◆ addCommand()

void CommandGroup::addCommand ( KCommand *  command,
bool  allowExecute 
)

Like KmacroCommand::addCommand(KCommand*) but if allowExecute is false, command will not be executed as a subcommand when CommandGroup::execute() is called.

This is useful e.g. in KexiFormView::insertAutoFields(), where a number of subcommands of InsertWidgetCommand type and subcommands is groupped using CommandGroup but some of these subcommands are executed before executing CommandGroup::execute().

If allowExecute is true, this method behaves exactly like KmacroCommand::addCommand(KCommand*).

Note that unexecute() doesn't check allowExecute flag: all subcommands will be unexecuted (in reverse order to the one in which they were added).

Definition at line 1548 of file commands.cpp.

◆ commands()

const TQPtrList< KCommand > & CommandGroup::commands ( ) const
Returns
a list of all subcommands of this group. Note that if a given subcommand is a group itself, it will not be expanded to subcommands on this list.

Definition at line 1543 of file commands.cpp.

◆ debug()

void CommandGroup::debug ( )
virtual

Implements KFormDesigner::Command.

Definition at line 1586 of file commands.cpp.

◆ execute()

void CommandGroup::execute ( )
virtual

Executes all subcommands added to this group in the same order as they were added. Subcommands added with addCommand(KCommand *command, bool allowExecute) where allowExecute == false, will not be executed.

Definition at line 1558 of file commands.cpp.

◆ name()

TQString CommandGroup::name ( ) const
virtual

Definition at line 1575 of file commands.cpp.

◆ resetAllowExecuteFlags()

void CommandGroup::resetAllowExecuteFlags ( )

Resets all 'allowExecute' flags that was set in addCommand(). Call this after calling CommandGroup::execute() to ensure that in the future, when REDO is be executed, all subcommands will be executed.

Definition at line 1580 of file commands.cpp.

◆ unexecute()

void CommandGroup::unexecute ( )
virtual

Unexecutes all subcommands added to this group, (in reversed order).

Definition at line 1568 of file commands.cpp.

Member Data Documentation

◆ m_commandsShouldntBeExecuted

TQPtrDict<char> KFormDesigner::CommandGroup::m_commandsShouldntBeExecuted
protected

Used to store pointers to subcommands that shouldn't be executed on CommandGroup::execute()

Definition at line 374 of file commands.h.

◆ m_propSet

WidgetPropertySet* KFormDesigner::CommandGroup::m_propSet
protected

Definition at line 375 of file commands.h.

◆ m_subCommands

SubCommands* KFormDesigner::CommandGroup::m_subCommands
protected

Definition at line 371 of file commands.h.


The documentation for this class was generated from the following files: