Bug 96221 - adding attribute in list view says Malformed argument
Summary: adding attribute in list view says Malformed argument
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-03 16:40 UTC by Jonathan Riddell
Modified: 2005-01-07 17:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Riddell 2005-01-03 16:40:09 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Add a new attribute by right clicking a class in the tree view and choosing New->Attribute, then just press enter to confirm the name an error dialogue comes up with Malformed Argument and cancels the new attribute.
Comment 1 Oliver Kellogg 2005-01-03 17:18:27 UTC
Good point. Since recently, attributes require UML syntax:
attrb_name : attrib_type
If we don't require the type, what should the type default to?
(It used to be "int", but not all languages have a type "int".)
Comment 2 Jonathan Riddell 2005-01-06 01:16:15 UTC
Either it should default to an int and have code generators substitute that for something sensible if they don't have ints.  Or default to some sort of 'undefined'.
Comment 3 Oliver Kellogg 2005-01-07 17:27:04 UTC
CVS commit by okellogg: 

Umbrello::parseAttribute(): Allow missing type in input string (type defaults to "int")
BUG:96221


  M +1 -1      ChangeLog   1.56
  M +8 -8      umbrello/model_utils.cpp   1.17
  M +2 -1      umbrello/umllistview.cpp   1.141
  M +2 -1      umbrello/umllistviewitem.cpp   1.69


--- kdesdk/umbrello/ChangeLog  #1.55:1.56
@@ -23,5 +23,5 @@
 91433 91434 91494 91869 91922 92116 92123 92222 92300 92301
 92781 92995 93122 93219 93297 93501 93595 93696 94173 94728
-94795 94883 95082 95252 95722 95924 95951 96216
+94795 94883 95082 95252 95722 95924 95951 96216 96221
 
 Version 1.3

--- kdesdk/umbrello/umbrello/model_utils.cpp  #1.16:1.17
@@ -242,8 +242,7 @@ Parse_Status parseAttribute(QString a, N
 
         QStringList nameAndType = QStringList::split( QRegExp("\\s*:\\s*"), a);
-        if (nameAndType.count() != 2)
-                return PS_Malformed_Arg;
-
-        UMLObject *pType = owningScope->findTemplate(nameAndType[1]);
+        UMLObject *pType = NULL;
+        if (nameAndType.count() == 2) {
+                pType = owningScope->findTemplate(nameAndType[1]);
         if (pType == NULL) {
                 pType = pDoc->findUMLObject(nameAndType[1], Uml::ot_UMLObject, owningScope);
@@ -251,4 +250,5 @@ Parse_Status parseAttribute(QString a, N
                         return PS_Unknown_ArgType;
         }
+        }
         nmTpPair = NameAndType(nameAndType[0], pType);
         return PS_OK;

--- kdesdk/umbrello/umbrello/umllistview.cpp  #1.140:1.141
@@ -2193,4 +2193,5 @@ bool UMLListView::createChildUMLObject( 
                 newObject = m_doc->createAttribute( owningClass, nt.first );
                 UMLAttribute *att = static_cast<UMLAttribute*>(newObject);
+                if (nt.second)
                 att->setType(nt.second);
                 text = att->toString(Uml::st_SigNoScope);

--- kdesdk/umbrello/umbrello/umllistviewitem.cpp  #1.68:1.69
@@ -424,4 +424,5 @@ void UMLListViewItem::okRename( int col 
                                 m_pObject->setName(nt.first);
                                 UMLAttribute *pAtt = static_cast<UMLAttribute*>(m_pObject);
+                                if (nt.second)
                                 pAtt->setType(nt.second);
                                 m_Label = pAtt->toString(Uml::st_SigNoScope);