diff --git a/src/App/Document.cpp b/src/App/Document.cpp index cba2e757be..86b9ef79ca 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1516,10 +1516,10 @@ DocumentObject* Document::_copyObject(DocumentObject* obj, std::mapgetNameInDocument(); if (!keepdigitsatend) { - size_t lastpos = objname.length()-1; - while (objname[lastpos] >= 48 && objname[lastpos] <= 57) - lastpos--; - objname = objname.substr(0, lastpos+1); + size_t lastpos = objname.length()-1; + while (objname[lastpos] >= 48 && objname[lastpos] <= 57) + lastpos--; + objname = objname.substr(0, lastpos+1); } DocumentObject* copy = addObject(obj->getTypeId().getName(),objname.c_str()); if (!copy) return 0; diff --git a/src/App/PropertyFile.cpp b/src/App/PropertyFile.cpp index 52278ea991..9340232728 100644 --- a/src/App/PropertyFile.cpp +++ b/src/App/PropertyFile.cpp @@ -346,10 +346,10 @@ void PropertyFileIncluded::RestoreDocFile(Base::Reader &reader) Property *PropertyFileIncluded::Copy(void) const { - PropertyFileIncluded *p= new PropertyFileIncluded(); + PropertyFileIncluded *prop = new PropertyFileIncluded(); // remember the base name - p->_BaseFileName = _BaseFileName; + prop->_BaseFileName = _BaseFileName; if (!_cValue.empty()) { Base::FileInfo file(_cValue); @@ -361,11 +361,11 @@ Property *PropertyFileIncluded::Copy(void) const bool done = file.renameFile(NewName.filePath().c_str()); assert(done); // remember the new name for the Undo - Base::Console().Log("Copy this=%p Before=%s After=%s\n",p,p->_cValue.c_str(),NewName.filePath().c_str()); - p->_cValue = NewName.filePath().c_str(); + Base::Console().Log("Copy this=%p Before=%s After=%s\n",prop,prop->_cValue.c_str(),NewName.filePath().c_str()); + prop->_cValue = NewName.filePath().c_str(); } - return p; + return prop; } void PropertyFileIncluded::Paste(const Property &from) @@ -376,6 +376,9 @@ void PropertyFileIncluded::Paste(const Property &from) file.deleteFile(); const PropertyFileIncluded &fileInc = dynamic_cast(from); + // set the base name + _BaseFileName = fileInc._BaseFileName; + if (!fileInc._cValue.empty()) { // move the saved files back in place Base::FileInfo NewFile(fileInc._cValue); diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 6d3b01a34f..5586fff6f0 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -894,9 +894,9 @@ bool StdCmdPaste::isActive(void) return getMainWindow()->canInsertFromMimeData(mime); } -DEF_STD_CMD_A(StdCmdDDuplicateSelection); +DEF_STD_CMD_A(StdCmdDuplicateSelection); -StdCmdDDuplicateSelection::StdCmdDDuplicateSelection() +StdCmdDuplicateSelection::StdCmdDuplicateSelection() :Command("Std_DuplicateSelection") { sAppModule = "Edit"; @@ -907,7 +907,7 @@ StdCmdDDuplicateSelection::StdCmdDDuplicateSelection() sStatusTip = QT_TR_NOOP("Put duplicates of the selected objects to the active document"); } -void StdCmdDDuplicateSelection::activated(int iMsg) +void StdCmdDuplicateSelection::activated(int iMsg) { App::Document* act = App::GetApplication().getActiveDocument(); if (!act) @@ -964,7 +964,7 @@ void StdCmdDDuplicateSelection::activated(int iMsg) } } -bool StdCmdDDuplicateSelection::isActive(void) +bool StdCmdDuplicateSelection::isActive(void) { return Gui::Selection().hasSelection(); } @@ -1275,7 +1275,7 @@ void CreateDocCommands(void) rcCmdMgr.addCommand(new StdCmdCut()); rcCmdMgr.addCommand(new StdCmdCopy()); rcCmdMgr.addCommand(new StdCmdPaste()); - rcCmdMgr.addCommand(new StdCmdDDuplicateSelection()); + rcCmdMgr.addCommand(new StdCmdDuplicateSelection()); rcCmdMgr.addCommand(new StdCmdSelectAll()); rcCmdMgr.addCommand(new StdCmdDelete()); rcCmdMgr.addCommand(new StdCmdRefresh());