Bug 313635 - Duplicate tags in a file and cannot be deleted
Summary: Duplicate tags in a file and cannot be deleted
Status: RESOLVED FIXED
Alias: None
Product: nepomuk
Classification: Unmaintained
Component: general (show other bugs)
Version: 4.9.98 RC3
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Nepomuk Bugs Coordination
URL: http://www.youtube.com/watch?v=Nhj6rQ...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-21 16:10 UTC by Aristide
Modified: 2013-02-14 21:41 UTC (History)
4 users (show)

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 Aristide 2013-01-21 16:10:38 UTC
When I tag files in Dolphin for Nepomuk with same « tag » (Please see videos for many details) tags are duplicate and cannot be deleted.

You can see video for more details. 

Reproducible: Always

Steps to Reproduce:
1. Right click on file and Property (Or Add Tags on side pannel)
2. Type tag name (for example « photo »).
3. Validate
4. Chose other file
5. Select add tags, and check photo
6. Ok
7. Open again dialog and you can see duplicate of Videos. And this tag cannot be removed.
Comment 1 Vishesh Handa 2013-01-22 11:19:45 UTC
Wow. Thanks for the extremely detailed bug report.

I have a fairly decent idea as to why this might be occurring. Could you perhaps try the same using the Dolphin sidebar instead of the going via the file the properties and Information.

With 4.10, the code paths for Properties -> Information and the Dolphin sidebar widget are completely different.
Comment 2 Hrvoje Senjan 2013-01-22 11:30:38 UTC
Check also bug #312606
Also i can't reproduce this with master, but as i wrote in mentioned bug report, the issue did happened at some point, but is gone for me
Comment 3 Aristide 2013-01-23 00:05:27 UTC
Same problem. But delete $HOME/.kde4/share/apps/apps/nepomuk fix this problem. For information, this file has don't be deleted since KDE 4.8
Comment 4 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 312606

M  +13   -8    ui/kedittagsdialog.cpp

http://commits.kde.org/nepomuk-widgets/575a0f3443816231a57a96613b415b5f4f515157
Comment 5 Vishesh Handa 2013-02-14 21:41:51 UTC
Git commit 0e08394206b29a839e0ba1f09211c857c8abbbe5 by Vishesh Handa.
Committed on 25/01/2013 at 12:16.
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.

Cherry-picked from nepomuk-core 575a0f3443816231a57a96613b415b5f4f515157

This is being cherry-picked cause the Dolhin still uses the
KFileMetadataWidget when you select File -> Properties -> Information.
It uses the KFileMetadataWidget cause that is KIO code, not Dolphin.

M  +13   -8    nepomuk/ui/kedittagsdialog.cpp

http://commits.kde.org/kdelibs/0e08394206b29a839e0ba1f09211c857c8abbbe5