[KPhotoAlbum] Keywords with id=0?

Johannes Zarl-Zierl johannes at zarl-zierl.at
Sun Dec 22 00:26:48 GMT 2019


Hi,

I've now implemented a cleanup procedure in KPhotoAlbum itself, so that people 
unaware of the contrib/kpa-merge script don't lose tag data.

Before anyone asks: I'll also add a user-visible notification later on...

Cheers,
  Johannes


Am Montag, 16. Dezember 2019, 01:02:06 CET schrieb Robert Krawitz:
> On Mon, 16 Dec 2019 01:00:23 +0100, Johannes Zarl-Zierl wrote:
> > LGTM
> 
> Pushed (I separately pushed changes to contrib/kpa-merge to clean this
> up where it exists).
> 
> > Am Montag, 16. Dezember 2019, 00:42:01 CET schrieb Robert Krawitz:
> >> So this is where we are now:
> >> 
> >> diff --git a/XMLDB/XMLCategory.cpp b/XMLDB/XMLCategory.cpp
> >> index 712cc689..1ddc00f3 100644
> >> --- a/XMLDB/XMLCategory.cpp
> >> +++ b/XMLDB/XMLCategory.cpp
> >> @@ -20,6 +20,7 @@
> >> 
> >>  #include <DB/ImageDB.h>
> >>  #include <DB/MemberMap.h>
> >>  #include <Utilities/List.h>
> >> 
> >> +#include "Logging.h"
> >> 
> >>  XMLDB::XMLCategory::XMLCategory(const QString &name, const QString
> >>  &icon,
> >> 
> >> ViewType type, int thumbnailSize, bool show, bool positionable)
> >> 
> >>      : m_name(name)
> >> 
> >> @@ -130,7 +131,8 @@ void XMLDB::XMLCategory::renameItem(const QString
> >> &oldValue, const QString &newV m_idMap.remove(oldValue);
> >> 
> >>      addItem(newValue);
> >> 
> >> -    setIdMapping(newValue, id);
> >> +    if ( id > 0)
> >> +        setIdMapping(newValue, id);
> >> 
> >>      emit itemRenamed(oldValue, newValue);
> >>  
> >>  }
> >> 
> >> @@ -179,8 +181,12 @@ void XMLDB::XMLCategory::initIdMap()
> >> 
> >>  void XMLDB::XMLCategory::setIdMapping(const QString &name, int id)
> >>  {
> >> 
> >> -    m_nameMap.insert(id, name);
> >> -    m_idMap.insert(name, id);
> >> +    if (id <= 0) {
> >> +        qCWarning(XMLDBLog, "XMLDB::XMLCategory::setIdMapping attempting
> >> to set id for %s to invalid value %d", qPrintable(name), id); +    }
> >> else { +        m_nameMap.insert(id, name);
> >> +        m_idMap.insert(name, id);
> >> +    }
> >> 
> >>  }
> >>  
> >>  QString XMLDB::XMLCategory::nameForId(int id) const






More information about the Kphotoalbum mailing list