[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/digikam
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2011-02-03 8:12:53
Message-ID: 20110203081253.9AE663E1F5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1218608 by cgilles:

backport commit #1218563 from GoSC2010 branch
BUGS: 264745


 M  +14 -8     metadatahub.cpp  


--- trunk/extragear/graphics/digikam/digikam/metadatahub.cpp #1218607:1218608
@@ -611,7 +611,8 @@
         // To fix this constraint (not needed currently), an oldKeywords parameter \
is needed  
         // create list of keywords to be added and to be removed
-        QStringList oldTagsPathList, newTagsPathList, oldKeywords, newKeywords;
+        QStringList tagsPathList, oldKeywords, newKeywords;
+        metadata.getImageTagsPath(tagsPathList);
 
         for (QMap<int, TagStatus>::iterator it = d->tags.begin(); it != \
d->tags.end(); ++it)  {
@@ -621,15 +622,20 @@
                 // This works for single and multiple selection.
                 // In both situations, tags which had originally been loaded
                 // have explicitly been removed with setTag.
+                QString tagName = TagsCache::instance()->tagName(it.key());
+                QString tagPath = TagsCache::instance()->tagPath(it.key(), \
TagsCache::NoLeadingSlash);  if (it.value().hasTag)
                 {
-                    newTagsPathList.append(TagsCache::instance()->tagPath(it.key(), \
                TagsCache::NoLeadingSlash));
-                    newKeywords.append(TagsCache::instance()->tagName(it.key()));
+                    if (!tagsPathList.contains(tagPath))
+                    {
+                        tagsPathList << tagPath;
                 }
+                    newKeywords << tagName;
+                }
                 else
                 {
-                    oldTagsPathList.append(TagsCache::instance()->tagPath(it.key(), \
                TagsCache::NoLeadingSlash));
-                    oldKeywords.append(TagsCache::instance()->tagName(it.key()));
+                    tagsPathList.removeAll(tagPath);
+                    oldKeywords << tagName;
                 }
             }
         }
@@ -638,14 +644,14 @@
         // synchronize metadata, else contents is not coherent.
 
         // We set Iptc keywords using tags name.
-        dirty |= metadata.setIptcKeywords(metadata.getIptcKeywords(), newKeywords);
+        dirty |= metadata.setIptcKeywords(oldKeywords, newKeywords);
 
         // We add Xmp keywords using tags name.
-        dirty |= metadata.removeXmpKeywords(metadata.getXmpKeywords());
+        dirty |= metadata.removeXmpKeywords(oldKeywords);
         dirty |= metadata.setXmpKeywords(newKeywords);
 
         // We set Tags Path list in digiKam Xmp private namespace using tags path.
-        dirty |= metadata.setImageTagsPath(newTagsPathList);
+        dirty |= metadata.setImageTagsPath(tagsPathList);
     }
 
     return dirty;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic