Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeRenameCommand.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2008 Thorsten Zachmann <zachmann@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
8
9#include <QString>
10#include <klocalizedstring.h>
11#include "KoShape.h"
12
13class Q_DECL_HIDDEN KoShapeRenameCommand::Private
14{
15public:
16 Private(KoShape *shape, const QString &newName)
17 : shape(shape)
18 , newName(newName)
19 , oldName(shape->name())
20 {}
21
23 QString newName;
24 QString oldName;
25};
26
28 : KUndo2Command(kundo2_i18n("Rename Shape"), parent)
29, d(new Private(shape, newName))
30{
31}
32
37
39{
41 d->shape->setName(d->newName);
42}
43
45{
47 d->shape->setName(d->oldName);
48}
virtual void undo()
virtual void redo()
void undo() override
revert the actions done in redo
Private(KoShape *shape, const QString &newName)
KoShapeRenameCommand(KoShape *shape, const QString &newName, KUndo2Command *parent=0)
void redo() override
redo the command
KUndo2MagicString kundo2_i18n(const char *text)