Implement KDBX 4.1 group tags

This commit is contained in:
Janek Bevendorff 2021-11-10 00:06:03 +01:00
parent cd9ef58e98
commit e5822974ac
5 changed files with 23 additions and 0 deletions

Binary file not shown.

View File

@ -125,6 +125,11 @@ QString Group::notes() const
return m_data.notes;
}
QString Group::tags() const
{
return m_data.tags;
}
int Group::iconNumber() const
{
return m_data.iconNumber;
@ -319,6 +324,11 @@ void Group::setNotes(const QString& notes)
set(m_data.notes, notes);
}
void Group::setTags(const QString& tags)
{
set(m_data.tags, tags);
}
void Group::setIcon(int iconNumber)
{
if (iconNumber >= 0 && (m_data.iconNumber != iconNumber || !m_data.customIcon.isNull())) {
@ -1228,6 +1238,9 @@ bool Group::GroupData::equals(const Group::GroupData& other, CompareItemOptions
if (::compare(notes, other.notes, options) != 0) {
return false;
}
if (::compare(tags, other.tags, options) != 0) {
return false;
}
if (::compare(iconNumber, other.iconNumber) != 0) {
return false;
}

View File

@ -69,6 +69,7 @@ public:
Group::TriState autoTypeEnabled;
Group::TriState searchingEnabled;
Group::MergeMode mergeMode;
QString tags;
QUuid previousParentGroupUuid;
bool operator==(const GroupData& other) const;
@ -83,6 +84,7 @@ public:
const QString uuidToHex() const;
QString name() const;
QString notes() const;
QString tags() const;
int iconNumber() const;
const QUuid& iconUuid() const;
const TimeInfo& timeInfo() const;
@ -122,6 +124,7 @@ public:
void setUuid(const QUuid& uuid);
void setName(const QString& name);
void setNotes(const QString& notes);
void setTags(const QString& tags);
void setIcon(int iconNumber);
void setIcon(const QUuid& uuid);
void setTimeInfo(const TimeInfo& timeInfo);

View File

@ -502,6 +502,10 @@ Group* KdbxXmlReader::parseGroup()
group->setNotes(readString());
continue;
}
if (m_xml.name() == "Tags") {
group->setTags(readString());
continue;
}
if (m_xml.name() == "IconID") {
int iconId = readNumber();
if (iconId < 0) {

View File

@ -259,6 +259,9 @@ void KdbxXmlWriter::writeGroup(const Group* group)
writeUuid("UUID", group->uuid());
writeString("Name", group->name());
writeString("Notes", group->notes());
if (!group->tags().isEmpty()) {
writeString("Tags", group->tags());
}
writeNumber("IconID", group->iconNumber());
if (!group->iconUuid().isNull()) {