Bug 136061 - JJ: xml scheme: mixup of attribute names: *color and *colour
Summary: JJ: xml scheme: mixup of attribute names: *color and *colour
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-20 23:44 UTC by Bastian Fenske
Modified: 2006-12-27 10:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Mixup spelling in xml scheme proposed patch (2.17 KB, patch)
2006-12-23 18:56 UTC, Michael Palomas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bastian Fenske 2006-10-20 23:44:15 UTC
Version:           1.5.3 (using KDE 3.5.5, Debian Package 4:3.5.5a-1 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.17-2-486

Would't it not be clearer to either use *color or *colour as attribute names of the diagram and widget elemens in the xml scheme?

BE:
classwidget/usesdiagramfillcolour
classwidget/usesdiagramusefillcolour
classwidget/fillcolour
interfacewidget/usesdiagramfillcolour
interfacewidget/usesdiagramusefillcolour
interfacewidget/fillcolour

AE:
diagram/fillcolor
diagram/usefillcolor
diagram/linecolor
classwidget/usefillcolor
classwidget/linecolor
interfacewidget/usefillcolor
interfacewidget/linecolor
Comment 1 Oliver Kellogg 2006-11-20 21:11:25 UTC
Easy enough for Junior Job. Caveat: Need to continue to support
loading files containing the "ou" spelling for backward compatibility.
Comment 2 Michael Palomas 2006-12-23 18:56:34 UTC
Created attachment 19019 [details]
Mixup spelling in xml scheme proposed patch

Hello,

here is my proposed patch for this bug (KDE 3.5 svn branch). Changed *colour to
*color in UMLWidget::saveToXMI , and in loadFromXMI first try to retrieve old
british  spelling to keep backward compatibility, then try with the american
one .

Tested on very simple project file (2 classes with colors changed) which used
the old mixup scheme, loaded correctly, then saved again, .xmi is then
consistent with only *color as expected.

I hope i did not miss more *colour attributes in other source files.

Cheers,

Michael
Comment 3 Oliver Kellogg 2006-12-27 10:08:20 UTC
SVN commit 616890 by okellogg:

Apply attachment 19019 [details] from Michael Palomas:
> Changed *colour to *color in UMLWidget::saveToXMI, and in loadFromXMI first
> try to retrieve old british  spelling to keep backward compatibility, then
> try with the american one.

BUG:136061


 M  +1 -0      ChangeLog  
 M  +13 -4     umbrello/umlwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #616889:616890
@@ -15,6 +15,7 @@
 * Association line nodes don't drag along with multiply-selected classes (57878)
 * Disappearing parameters when editing class properties (114477)
 * Umbrello saves too much copies at xmi (135606)
+* XML scheme: mixup of attribute names: *color and *colour (136061)
 * Artifacts of a component diagram are wrongly placed in Deployment View folder (137564)
 * Incorrect export to SQL (138139)
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidget.cpp #616889:616890
@@ -949,12 +949,13 @@
     qElement.setAttribute( "y", getY() );
     qElement.setAttribute( "width", getWidth() );
     qElement.setAttribute( "height", getHeight() );
-    qElement.setAttribute( "usesdiagramfillcolour", m_bUsesDiagramFillColour );
-    qElement.setAttribute( "usesdiagramusefillcolour", m_bUsesDiagramUseFillColour );
+    // for consistency the following attributes now use american spelling for "color"
+    qElement.setAttribute( "usesdiagramfillcolor", m_bUsesDiagramFillColour );
+    qElement.setAttribute( "usesdiagramusefillcolor", m_bUsesDiagramUseFillColour );
     if (m_bUsesDiagramFillColour) {
-        qElement.setAttribute( "fillcolour", "none" );
+        qElement.setAttribute( "fillcolor", "none" );
     } else {
-        qElement.setAttribute( "fillcolour", m_FillColour.name() );
+        qElement.setAttribute( "fillcolor", m_FillColour.name() );
     }
     qElement.setAttribute("isinstance", m_bIsInstance);
     if (!m_instanceName.isEmpty())
@@ -972,9 +973,17 @@
     QString y = qElement.attribute( "y", "0" );
     QString h = qElement.attribute( "height", "0" );
     QString w = qElement.attribute( "width", "0" );
+    /*
+      For the next three *color attributes, there was a mixup of american and english spelling for "color".
+      So first we need to keep backward compatibility and try to retrieve the *colour attribute.
+      Next we overwrite this value if we find a *color, otherwise the former *colour is kept.
+    */
     QString fillColour = qElement.attribute( "fillcolour", "none" );
+    fillColour = qElement.attribute( "fillcolor", fillColour );
     QString usesDiagramFillColour = qElement.attribute( "usesdiagramfillcolour", "1" );
+    usesDiagramFillColour = qElement.attribute( "usesdiagramfillcolor", usesDiagramFillColour );
     QString usesDiagramUseFillColour = qElement.attribute( "usesdiagramusefillcolour", "1" );
+    usesDiagramUseFillColour = qElement.attribute( "usesdiagramusefillcolor", usesDiagramUseFillColour );
 
     m_nId = STR2ID(id);