SetDocumentVersionsCommand.h header

#include <ew/core/SetDocumentVersionsCommand.h>

Namespace ew::core

SetDocumentVersionsCommand class

class ew::core::SetDocumentVersionsCommand

Command that replaces a document's whole list of saved version snapshots – used when the writer takes a new snapshot, deletes one, or restores one (which first snapshots the current draft). Undo restores the previous list and redo re-applies the new one. The document body is edited separately (the editor owns text undo), so this command manages only the snapshot list.

Members

ew::core::SetDocumentVersionsCommand::SetDocumentVersionsCommand(Document &document, std::vector< DocumentVersion > versions)

Creates a command that sets document's version snapshots to versions when applied.

ew::core::SetDocumentVersionsCommand::~SetDocumentVersionsCommand() override

Destroys the command.

void ew::core::SetDocumentVersionsCommand::apply() override

Records the document's current version list and applies the new one.

void ew::core::SetDocumentVersionsCommand::undo() override

Restores the previous version list.

QString ew::core::SetDocumentVersionsCommand::description() const override

Returns a short description for the undo/redo UI.