[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Thu Jun 17 23:16:06 UTC 2004
CVS commit by okellogg:
Fix bug 83546 (Null string in <listitem> in xmi file causes infinite loop)
M +10 -3 umllistview.cpp 1.102
M +16 -1 umllistviewitem.cpp 1.44
--- kdesdk/umbrello/umbrello/umllistview.cpp #1.101:1.102
@@ -896,4 +896,5 @@ bool UMLListView::acceptDrag(QDropEvent*
accept = (dstType == Uml::lvt_Logical_Folder ||
dstType == Uml::lvt_Logical_View ||
+ dstType == Uml::lvt_Class ||
dstType == Uml::lvt_Package);
break;
@@ -1012,4 +1013,5 @@ void UMLListView::slotDropped(QDropEvent
if (itemType == Uml::lvt_Logical_Folder ||
itemType == Uml::lvt_Logical_View ||
+ itemType == Uml::lvt_Class ||
itemType == Uml::lvt_Package) {
newItem = move->deepCopy(newParent);
@@ -2196,4 +2198,10 @@ bool UMLListView::loadChildrenFromXMI( U
// Pull a new ID now.
nID = m_doc->getUniqueID();
+ } else if (type != "801" && type != "802" &&
+ type != "821" && type != "827") {
+ kdError() << "UMLListView::loadChildrenFromXMI: item of type "
+ << type << " has no ID, skipping." << endl;
+ domElement = node.toElement();
+ continue;
}
@@ -2305,7 +2313,6 @@ bool UMLListView::loadChildrenFromXMI( U
break;
default:
- if (nID != -1) {
item = new UMLListViewItem( parent, label, lvType, nID );
- }
+ break;
}//end switch
--- kdesdk/umbrello/umbrello/umllistviewitem.cpp #1.43:1.44
@@ -478,4 +478,12 @@ void UMLListViewItem::saveToXMI( QDomDoc
<< m_Label << " because stereotype/template loading "
<< "does not yet generate the appropriate signals" << endl;
+ } else if (m_pObject->getID() == -1) {
+ if (m_Label.isEmpty()) {
+ kdDebug() << "UMLListViewItem::saveToXMI(): Skipping empty item"
+ << endl;
+ return;
+ }
+ kdDebug() << "UMLListViewItem::saveToXMI(): saving local label "
+ << m_Label << " because umlobject ID is not set" << endl;
itemElement.setAttribute( "label", m_Label );
}
@@ -492,6 +500,13 @@ bool UMLListViewItem::loadFromXMI(QDomEl
QString id = qElement.attribute( "id", "-1" );
QString type = qElement.attribute( "type", "-1" );
- setText( qElement.attribute( "label", "" ) );
+ QString label = qElement.attribute( "label", "" );
QString open = qElement.attribute( "open", "1" );
+ if (!label.isEmpty())
+ setText( label );
+ else if (id == "-1") {
+ kdError() << "UMLListViewItem::loadFromXMI: Item of type "
+ << type << " has neither ID nor label" << endl;
+ return false;
+ }
m_nChildren = qElement.childNodes().count();
More information about the umbrello-devel
mailing list