SetCategoryKeyListCommand.h header

#include <ew/core/SetCategoryKeyListCommand.h>

Namespace ew::core

SetCategoryKeyListCommand class

class ew::core::SetCategoryKeyListCommand

Command that replaces one of a category's key lists, as one undoable step.

One command for both lists rather than two near-identical ones: the snapshot, the apply and the undo are the same three lines whichever list is meant, and the only thing that genuinely differs is what the undo history calls it. Two copies would be two places for that logic to drift.

Like ew::core::entity::SetEntityOwnFieldsCommand it takes the WHOLE list, because every edit to it – ticking a property, unticking one, select-all – is a replacement of the whole.

It never touches a VALUE. Both lists decide what is SHOWN: an entity's stored value for a key that is excluded, or not opted into, stays exactly where it is and reappears the moment the key comes back. That is what makes either list safe to change by accident.

Members

ew::core::taxonomy::SetCategoryKeyListCommand::SetCategoryKeyListCommand(Taxonomy &taxonomy, ew::core::foundation::CategoryId categoryId, CategoryKeyList list, std::vector< QString > keys)

Creates a command that gives the category categoryId in taxonomy exactly keys for the list list when applied.

ew::core::taxonomy::SetCategoryKeyListCommand::~SetCategoryKeyListCommand() override

Destroys the command.

void ew::core::taxonomy::SetCategoryKeyListCommand::apply() override

Records the category's current list and applies the new one.

void ew::core::taxonomy::SetCategoryKeyListCommand::undo() override

Restores the previous list, in its original order.

QString ew::core::taxonomy::SetCategoryKeyListCommand::description() const override

Returns a short description for the undo/redo UI, naming which list changed.

Enumerations

enum class CategoryKeyList { Inherited, Excluded }

Which of a category's two key lists an edit is about.

They are separate settings because the two boundaries mean opposite things: across an ENTITY boundary nothing carries and the category names what it takes; across a CATEGORY boundary everything carries and it names what it drops.