Bug 312606

Summary: tag is duplicated when assigned to another file
Product: nepomuk Reporter: Aurelien Gateau <agateau>
Component: generalAssignee: Nepomuk Bugs Coordination <nepomuk-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: francesco.cecconi, hrvoje.senjan, nepomuk-bugs, sven.burmeister
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 4.10

Description Aurelien Gateau 2013-01-04 15:07:50 UTC
[running KDE/4.10 branch rebuild yesterday (January 3rd)]

Running through the tests listed here: http://community.kde.org/Getinvolved/Quality/Beta/4.10/DolphinInformation, I did this:

- create two files, t1 and t2
- select t1, open the tag edit dialog
- create a new tag named "test"
- select t2, open the tag edit dialog
- tick the checkbox for the "test" tag
- open the tag edit dialog again: there are now two entries named "test"
Comment 1 S. Burmeister 2013-01-05 08:26:55 UTC
Seems to work with 4.10 RC2.
Comment 2 Francesco Cecconi 2013-01-05 08:41:14 UTC
This is fixed in 4.10 rc2.
Comment 3 Hrvoje Senjan 2013-01-05 12:36:48 UTC
That(In reply to comment #0)
> - create two files, t1 and t2
> - select t1, open the tag edit dialog
> - create a new tag named "test"
> - select t2, open the tag edit dialog
> - tick the checkbox for the "test" tag
> - open the tag edit dialog again: there are now two entries named "test"

That used to be the case few days ago, but i can't no longer reproduce the issue with current master (nepomuk-core/widgets, kde-baseapps, etc)
Comment 4 Hrvoje Senjan 2013-01-05 12:40:23 UTC
(In reply to comment #3)
> That(In reply to comment #0)
> > - create two files, t1 and t2
> > - select t1, open the tag edit dialog
> > - create a new tag named "test"
> > - select t2, open the tag edit dialog
> > - tick the checkbox for the "test" tag
> > - open the tag edit dialog again: there are now two entries named "test"
> 
> That used to be the case few days ago, but i can't no longer reproduce the
> issue with current master (nepomuk-core/widgets, kde-baseapps, etc)

Actually, i have one tag duplicated from the time that happened. If i add that tag to file, the tag is *again* duplicated.
Comment 5 Vishesh Handa 2013-01-25 11:16:47 UTC
Git commit 575a0f3443816231a57a96613b415b5f4f515157 by Vishesh Handa.
Committed on 25/01/2013 at 12:00.
Pushed by vhanda into branch 'KDE/4.10'.

KEditTagsDialog: Use the uri not the label as the unique identifier

The EditTags dialog used the Resource::genericLabel() as the unique
identifier when accessing tags. It would save this genericLabel in the
Qt::UserRole of the QListWidgetItem. This caused the following problems -

* When removing a tag, the tag would be identified via Tag(genericLabel),
  this will NOT always give the correct tag back. Mainly cause
  Tag(QString) operates on the nao:identifier not the genericLabel.
  Quite often the genericLabel and the nao:identifier are the same, so
  this wouldn't always be a problem.

  By using Tag(genericLabel) we try to delete a tag with nao:identifier
  genericLabel, which didn't actually exist.

* When saving tags, it would create each tag with the Tag(genericLabel),
  this would normally be fine, unless there exists a tag whose
  nao:identifier and genericLabel are not the same. In that case the tag
  would be duplicated, and since the user only sees the genericLabel, it
  would result in 2 identical tags being shown.

* When saving the tags, it would try and re-create each tag which was
  being returned. This resulted in a lot of unnecessary Tag::setLabel
  calls which cause unnecessary writes, and slow down the entire
  process. This can get especially slow when marking a file with a large
  number of tags. We now only set the label of the tags which do not
  already exist.
Related: bug 313635

M  +13   -8    ui/kedittagsdialog.cpp

http://commits.kde.org/nepomuk-widgets/575a0f3443816231a57a96613b415b5f4f515157