Bug 340724 - Label position problem of copy and pasted messages
Summary: Label position problem of copy and pasted messages
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.14.2 (KDE Applications 4.14.2)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-07 10:01 UTC by Ralf Habacker
Modified: 2014-11-26 12:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.14.95 (KDE 14.11.95)
Sentry Crash Report:


Attachments
Screenshot showing duplicated message (2.78 KB, image/png)
2014-11-10 07:23 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2014-11-07 10:01:38 UTC
Copy and paste of a synchronous message in a sequence diagram somehow creates a somehow shared label copy.  

Reproducible: Always

Steps to Reproduce:
1. open umbrello
2. create a sequence diagram
3. add an object
4. add a synchronous messages from the object to the object (self message) using the name 'test'
5. copy and paste this message and move it down
6. move the first message to another vertical location



Actual Results:  
After releasing the mouse the label of the second message will be moved to the first message label.
Moving the second message will restore the second label position.


Expected Results:  
The label position of the second message should not be related to the first message movement.
Comment 1 Ralf Habacker 2014-11-07 10:07:44 UTC
Inspecting the xmi file from a save of the test case shows that the labels shares the same localid and the message widgets shares the same textid:

         <messagewidget  localid="ZzIE2ALK1HXe" textid="Znxj2kPJx0Tp" xmi.id="GCdCuRAwmemS" >
              <floatingtext  localid="pDedHxRayiFV" xmi.id="Znxj2kPJx0Tp"/>
         </messagewidget>
         <messagewidget  localid="9gqCuDbbnSxI"  textid="Znxj2kPJx0Tp" xmi.id="GCdCuRAwmemS" >
            <floatingtext localid="pDedHxRayiFV"  xmi.id="Znxj2kPJx0Tp" />
         </messagewidget>
Comment 2 Ralf Habacker 2014-11-07 11:58:38 UTC
(In reply to Ralf Habacker from comment #1)
> Inspecting the xmi file from a save of the test case shows that the labels
> shares the same localid

The problem is that in 
bool UMLDragData::decodeClip4(const QMimeData* mimeData, UMLObjectList& objects,
                          UMLWidgetList& widgets,
                          AssociationWidgetList& associations, Uml::DiagramType::Enum &dType)

only top level widgets are be patched to get a new localid 

            // Generate a new unique 'local ID' so a second widget for the same
            // UMLObject can be distinguished from the first widget
            widget->setLocalID(
                doc->assignNewID(widget->localID())
            );

but in 
bool MessageWidget::loadFromXMI(QDomElement& qElement)
... 
        QString tag = element.tagName();
        if (tag == QLatin1String("floatingtext") || tag == QLatin1String("UML::FloatingTextWidget")) {
            m_pFText = new FloatingTextWidget(m_scene, tr, operationText(m_scene), m_textId);
            m_scene->addFloatingTextWidget(m_pFText);
            if(! m_pFText->loadFromXMI(element)) {

the related FloatingTextWidget fetches localid from the xml fragement

bool UMLWidget::loadFromXMI(QDomElement & qElement)
{
...
    QString localid = qElement.attribute(QLatin1String("localid"), QLatin1String("0"));
    if (localid != QLatin1String("0")) {
        m_nLocalID = Uml::ID::fromString(localid);
    }
Comment 3 Ralf Habacker 2014-11-10 07:23:35 UTC
Created attachment 89517 [details]
Screenshot showing duplicated message
Comment 4 Ralf Habacker 2014-11-10 07:25:49 UTC
Further test shows that copying a message selects also the related object and pasting inserts the message AND the related object into the diagram (see screenshot). This issue seems to be related to Bug 340728.
Comment 5 Ralf Habacker 2014-11-10 10:29:30 UTC
(In reply to Ralf Habacker from comment #4)
> Further test shows that copying a message selects also the related object
> and pasting inserts the message AND the related object into the diagram.

This behavior is required for pasting sequence diagram fragments into new diagrams not already having the related objects, but not for pasting into the current diagram.
Comment 6 Ralf Habacker 2014-11-13 17:49:08 UTC
Changed title according to the fact that synchronous and asynchronous messages are affected.
Comment 7 Ralf Habacker 2014-11-13 17:58:04 UTC
Git commit cd5dc9faad024ff5036b921ea7f6c5f9491de85b by Ralf Habacker.
Committed on 13/11/2014 at 17:46.
Pushed by habacker into branch 'Applications/14.12'.

Fix bug 'Label position problem of copy and pasted messages'.

The floating text widget assigned to a message pasted on sequence diagrams
did not get a unique local id.
FIXED-IN:4.14.95

M  +8    -3    umbrello/clipboard/umldragdata.cpp

http://commits.kde.org/umbrello/cd5dc9faad024ff5036b921ea7f6c5f9491de85b
Comment 8 Ralf Habacker 2014-11-13 19:54:26 UTC
reverted to 4.14.95. umbrello.kde.org version filter require this