[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Fri Apr 16 15:52:12 UTC 2004
CVS commit by okellogg:
loadFromXMI(): Return false if loaded texts are empty.
Remove commented-out code.
M +7 -54 floatingtext.cpp 1.39
--- kdesdk/umbrello/umbrello/floatingtext.cpp #1.38:1.39
@@ -607,58 +607,11 @@ bool FloatingText::loadFromXMI( QDomElem
m_PostText = qElement.attribute( "posttext", "" );
m_Text = qElement.attribute( "text", "" );
-
-/*
- int id = UMLWidget::getID();
- if (id == -1)
- return true;
-
- if ( playsAssocRole() ) {
- m_pAssoc = m_pView->findAssocWidget( id );
- if (m_pAssoc == NULL) {
- kdDebug() << "FloatingText::loadFromXMI: "
- << "cannot find master assoc widget " << id << endl;
- return false;
- }
- Uml::Changeability_Type changeType;
- // CHECK: Can we get rid of the following synchronization.
- switch (m_Role) {
- case tr_MultiA:
- m_Text = m_pAssoc->getMultiA();
- break;
- case tr_MultiB:
- m_Text = m_pAssoc->getMultiB();
- break;
- case tr_Name:
- m_Text = m_pAssoc->getName();
- break;
- case tr_RoleAName:
- m_Text = m_pAssoc->getRoleNameA();
- break;
- case tr_RoleBName:
- m_Text = m_pAssoc->getRoleNameB();
- break;
- case tr_ChangeA:
- changeType = m_pAssoc->getChangeabilityA();
- m_Text = UMLAssociation::ChangeabilityToString( changeType );
-
- break;
- case tr_ChangeB:
- changeType = m_pAssoc->getChangeabilityB();
- m_Text = UMLAssociation::ChangeabilityToString( changeType );
- break;
- default:
- break;
- }
- } else if (playsMessageRole()) {
- m_pMessage = dynamic_cast<MessageWidget*>( m_pView->findWidget(id) );
- if (m_pMessage == NULL) {
- kdDebug() << "FloatingText::loadFromXMI: "
- << "cannot find master message widget " << id << endl;
- return false;
- }
- }
-*/
-
- return true;
+ // If all texts are empty then this is a useless widget.
+ // In that case we return false.
+ // CAVEAT: The caller should not interpret the false return value
+ // as an indication of failure since previous umbrello versions
+ // saved lots of these empty FloatingTexts.
+ bool isDummy = (m_Text == "" && m_PreText == "" && m_PostText == "");
+ return !isDummy;
}
More information about the umbrello-devel
mailing list