[KPhotoAlbum] Keywords with id=0?

Robert Krawitz rlk at alum.mit.edu
Mon Dec 16 00:02:06 GMT 2019


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


-- 
Robert Krawitz                                     <rlk at alum.mit.edu>

***  MIT Engineers   A Proud Tradition   http://mitathletics.com  ***
Member of the League for Programming Freedom  --  http://ProgFree.org
Project lead for Gutenprint   --    http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton



More information about the Kphotoalbum mailing list