Commit c4de1a6c authored by Joris Steyn's avatar Joris Steyn Committed by Ralf Habacker
Browse files

The problem with copy-pasting in the tree view is fixed.

BUG: 291749
FIXED-IN:4.11.3
parent 5dd307fa
......@@ -383,22 +383,27 @@ UMLObject* treeViewGetCurrentObject()
/**
* Return the UMLPackage if the current item
* in the tree view is a package.
* in the tree view is a package. Return the
* closest package in the tree view or NULL otherwise
*
* @return the package or NULL
*/
UMLPackage* treeViewGetPackageFromCurrent()
{
UMLListView *listView = UMLApp::app()->listView();
UMLListViewItem *parentItem = (UMLListViewItem*)listView->currentItem();
if (parentItem) {
while (parentItem) {
UMLListViewItem::ListViewType lvt = parentItem->type();
if (Model_Utils::typeIsContainer(lvt) ||
lvt == UMLListViewItem::lvt_Class ||
lvt == UMLListViewItem::lvt_Interface) {
if (Model_Utils::typeIsContainer(lvt)) {
UMLObject *o = parentItem->umlObject();
return static_cast<UMLPackage*>(o);
}
// selected item is not a container, try to find the
// container higher up in the tree view
parentItem = static_cast<UMLListViewItem*>(parentItem->parent());
}
return NULL;
}
......
......@@ -1068,6 +1068,7 @@ bool UMLObject::loadFromXMI(QDomElement & element)
m_BaseType != ot_ForeignKeyConstraint) {
if (m_bInPaste) {
m_pUMLPackage = Model_Utils::treeViewGetPackageFromCurrent();
this->setID(UniqueID::gen());
}
if (m_pUMLPackage) {
m_pUMLPackage->addObject(this);
......
......@@ -231,7 +231,9 @@ void UMLView::dragEnterEvent(QDragEnterEvent *e)
bAccept = false;
break;
case Uml::DiagramType::EntityRelationship:
if (ot != UMLObject::ot_Entity)
if (umlScene()->widgetOnDiagram(id) ||
(ot != UMLObject::ot_Entity &&
ot != UMLObject::ot_Category))
bAccept = false;
break;
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment