Bug 327577 - Duplicate and corrupt tree view items after copy/paste of folder
Summary: Duplicate and corrupt tree view items after copy/paste of folder
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.11.3
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Steyn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-13 20:14 UTC by Joris Steyn
Modified: 2013-11-13 20:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joris Steyn 2013-11-13 20:14:40 UTC
When pasting a folder in the tree view, a UMLPackage is pasted instead of a folder. The contents are added to the tree view twice where only one of the two can be dragged into a diagram. Saving this results in a bad XMI file; the original folder contents can not be loaded.


Reproducible: Always

Steps to Reproduce:
1. Add a folder (tree view popup menu "New -> Folder")
2. Add an object to the new folder (for example class)
3. Copy the folder
4. Paste the folder
Actual Results:  
Several errors can be observed:
* pasted folder has no stereotype, so becomes a regular package (no folder icon)
* contents are added twice; in the new folder and in the view's root
* items in the new folder have wrong ID

Expected Results:  
Umbrello should create an exact duplicate of the folder and all its contents. New IDs should be assigned to all new objects.
Comment 1 Joris Steyn 2013-11-13 20:36:21 UTC
Git commit f65315dade54e4ba2f85c1c415112ff18ddcd9d2 by Joris Steyn.
Committed on 13/10/2013 at 17:42.
Pushed by jorissteyn into branch 'master'.

Fix broken icon on pasted folder

The stereotype of an object should be taken into account when determining the
baseType. Otherwise, a pasted folder will be a UMLPackage instead of UMLFolder.

M  +6    -3    umbrello/clipboard/umldragdata.cpp
M  +0    -8    umbrello/umllistviewitem.cpp

http://commits.kde.org/umbrello/f65315dade54e4ba2f85c1c415112ff18ddcd9d2
Comment 2 Joris Steyn 2013-11-13 20:36:22 UTC
Git commit e264e22cbf563505b69989f58018b816a93ad3e3 by Joris Steyn.
Committed on 13/11/2013 at 20:14.
Pushed by jorissteyn into branch 'master'.

Fix copy/paste of folders

Copying folders in the tree view now works as described. Nested folders and
pasting to other instances of Umbrello work fine as well.

Ideally, when copying a folder, the XMI clip only contains the UML:Package node
and all child items are contained and loaded from Namespace.ownedElements. But,
loadFromXMI() does not support that. This fix makes a paste operation ignore
ownedElements completely and uses the "flat" list of all children to create the
objects.

M  +3    -4    umbrello/clipboard/umlclipboard.cpp
M  +49   -1    umbrello/clipboard/umldragdata.cpp

http://commits.kde.org/umbrello/e264e22cbf563505b69989f58018b816a93ad3e3