1 // actionblocksattributes.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 07/12/2010 Added this text. :-)
15 #include "actionblocksattributes.h"
18 #include "rs_dialogfactory.h"
20 ActionBlocksAttributes::ActionBlocksAttributes(
21 RS_EntityContainer & container, GraphicView & graphicView):
22 ActionInterface("Edit Block Attributes", container, graphicView)
26 ActionBlocksAttributes::~ActionBlocksAttributes()
30 void ActionBlocksAttributes::trigger()
32 RS_DEBUG->print("editing block attributes");
34 if (graphic && RS_DIALOGFACTORY)
36 RS_Block * block = graphic->getActiveBlock();
37 RS_BlockList * blockList = graphic->getBlockList();
39 if (blockList && block)
41 QString oldName = block->getName();
42 RS_BlockData d = RS_DIALOGFACTORY->requestBlockAttributesDialog(blockList);
46 QString newName = d.name;
47 blockList->rename(block, newName);
49 // update the name of all inserts:
50 graphic->renameInserts(oldName, newName);
51 graphic->addBlockNotification();
59 void ActionBlocksAttributes::init(int status)
61 ActionInterface::init(status);