File indexing completed on 2025-03-09 04:03:41
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2006 Thomas Zander <zander@kde.org> 0003 * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "KoShapeLockCommand.h" 0009 #include "KoShape.h" 0010 0011 #include <klocalizedstring.h> 0012 0013 KoShapeLockCommand::KoShapeLockCommand(const QList<KoShape*> &shapes, const QList<bool> &oldLock, const QList<bool> &newLock, KUndo2Command *parent) 0014 : KUndo2Command(parent) 0015 , m_shapes(shapes) 0016 , m_oldLock(oldLock) 0017 , m_newLock(newLock) 0018 { 0019 Q_ASSERT(m_shapes.count() == m_oldLock.count()); 0020 Q_ASSERT(m_shapes.count() == m_newLock.count()); 0021 0022 setText(kundo2_i18n("Lock shapes")); 0023 } 0024 0025 KoShapeLockCommand::~KoShapeLockCommand() 0026 { 0027 } 0028 0029 void KoShapeLockCommand::redo() 0030 { 0031 KUndo2Command::redo(); 0032 for (int i = 0; i < m_shapes.count(); ++i) { 0033 m_shapes[i]->setGeometryProtected(m_newLock[i]); 0034 } 0035 } 0036 0037 void KoShapeLockCommand::undo() 0038 { 0039 KUndo2Command::undo(); 0040 for (int i = 0; i < m_shapes.count(); ++i) { 0041 m_shapes[i]->setGeometryProtected(m_oldLock[i]); 0042 } 0043 }